Skip to content

Commit

Permalink
Fix setting node IP address (#12266)
Browse files Browse the repository at this point in the history
Fix recvmsg function - enable LWIP option in mbed
  • Loading branch information
ATmobica authored and pull[bot] committed Mar 9, 2022
1 parent 2112a41 commit 1430654
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
3 changes: 2 additions & 1 deletion examples/all-clusters-app/mbed/mbed_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"MXCRYPTO_DISABLED",
"NL_ASSERT_LOG=NL_ASSERT_LOG_DEFAULT",
"NL_ASSERT_EXPECT_FLAGS=NL_ASSERT_FLAG_LOG",
"WHD_PRINT_DISABLE"
"WHD_PRINT_DISABLE",
"MBED_CONF_LWIP_NETBUF_RECVINFO_ENABLED"
]
}
},
Expand Down
3 changes: 2 additions & 1 deletion examples/lighting-app/mbed/mbed_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"MXCRYPTO_DISABLED",
"NL_ASSERT_LOG=NL_ASSERT_LOG_DEFAULT",
"NL_ASSERT_EXPECT_FLAGS=NL_ASSERT_FLAG_LOG",
"WHD_PRINT_DISABLE"
"WHD_PRINT_DISABLE",
"MBED_CONF_LWIP_NETBUF_RECVINFO_ENABLED"
],
"target.components_add": ["capsense"],
"lighting-state-led": "P9_6",
Expand Down
3 changes: 2 additions & 1 deletion examples/lock-app/mbed/mbed_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"MXCRYPTO_DISABLED",
"NL_ASSERT_LOG=NL_ASSERT_LOG_DEFAULT",
"NL_ASSERT_EXPECT_FLAGS=NL_ASSERT_FLAG_LOG",
"WHD_PRINT_DISABLE"
"WHD_PRINT_DISABLE",
"MBED_CONF_LWIP_NETBUF_RECVINFO_ENABLED"
],
"target.components_add": ["capsense"],
"lock-state-led": "P9_6",
Expand Down
3 changes: 2 additions & 1 deletion examples/shell/mbed/mbed_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"MXCRYPTO_DISABLED",
"NL_ASSERT_LOG=NL_ASSERT_LOG_DEFAULT",
"NL_ASSERT_EXPECT_FLAGS=NL_ASSERT_FLAG_LOG",
"WHD_PRINT_DISABLE"
"WHD_PRINT_DISABLE",
"MBED_CONF_LWIP_NETBUF_RECVINFO_ENABLED"
]
}
},
Expand Down
29 changes: 29 additions & 0 deletions src/platform/mbed/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,35 @@ CHIP_ERROR ConnectivityManagerImpl::OnStationConnected()
ReturnErrorOnFailure(PlatformMgr().PostEvent(&event));
ChipLogProgress(DeviceLayer, "New Ip4 address set: %s", address.get_ip_address());
}

error = mWifiInterface->get_ipv6_link_local_address(&address);
if (error)
{
if (mIp6Address != IPAddress::Any)
{
// Unnexpected change, forward to the application
mIp6Address = IPAddress::Any;
ChipDeviceEvent event;
event.Type = DeviceEventType::kInternetConnectivityChange;
event.InternetConnectivityChange.IPv4 = kConnectivity_NoChange;
event.InternetConnectivityChange.IPv6 = kConnectivity_Lost;
ReturnErrorOnFailure(PlatformMgr().PostEvent(&event));
ChipLogError(DeviceLayer, "Unnexpected loss of Ip6 address");
}
}
else
{
if (IPAddress::FromString(address.get_ip_address(), addr) && addr != mIp6Address)
{
mIp6Address = addr;
ChipDeviceEvent event;
event.Type = DeviceEventType::kInternetConnectivityChange;
event.InternetConnectivityChange.IPv4 = kConnectivity_NoChange;
event.InternetConnectivityChange.IPv6 = kConnectivity_Established;
ReturnErrorOnFailure(PlatformMgr().PostEvent(&event));
ChipLogProgress(DeviceLayer, "New Ip6 address set %s", address.get_ip_address());
}
}
}
else
{
Expand Down

0 comments on commit 1430654

Please sign in to comment.