diff --git a/examples/all-clusters-app/mbed/mbed_app.json b/examples/all-clusters-app/mbed/mbed_app.json index 6271cbc091cf58..be14989fe20fb1 100644 --- a/examples/all-clusters-app/mbed/mbed_app.json +++ b/examples/all-clusters-app/mbed/mbed_app.json @@ -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" ] } }, diff --git a/examples/lighting-app/mbed/mbed_app.json b/examples/lighting-app/mbed/mbed_app.json index ae32541fccad62..aaad97efcdf73f 100644 --- a/examples/lighting-app/mbed/mbed_app.json +++ b/examples/lighting-app/mbed/mbed_app.json @@ -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", diff --git a/examples/lock-app/mbed/mbed_app.json b/examples/lock-app/mbed/mbed_app.json index 27ec18a15a4763..45a384f057cf72 100644 --- a/examples/lock-app/mbed/mbed_app.json +++ b/examples/lock-app/mbed/mbed_app.json @@ -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", diff --git a/examples/shell/mbed/mbed_app.json b/examples/shell/mbed/mbed_app.json index 1a6b662db9abcf..c7281d23ee5fc2 100644 --- a/examples/shell/mbed/mbed_app.json +++ b/examples/shell/mbed/mbed_app.json @@ -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" ] } }, diff --git a/src/platform/mbed/ConnectivityManagerImpl.cpp b/src/platform/mbed/ConnectivityManagerImpl.cpp index dcb2055c392742..5c584d07d07c4a 100644 --- a/src/platform/mbed/ConnectivityManagerImpl.cpp +++ b/src/platform/mbed/ConnectivityManagerImpl.cpp @@ -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 {