Skip to content

Commit 2235665

Browse files
TE-N-ElvenWangpull[bot]
authored andcommitted
Ignore the network interface update event if wifi name not init (#19439)
The WiFi name is configured when WiFi init successfuly. Sometime, the WiFi interface is not up in some Linux platform and instead the platform use ethernet like eth0. In this condition, eth0 will have the IP update event and this update listerner will be called. On this condition, the GetWiFiIfName() will report a nullptr and cause a Segmentation fault. This patch will ignore the event and prevent the Segmentation fault. Signed-off-by: Haoran Wang <[email protected]>
1 parent 641fd18 commit 2235665

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/platform/Linux/PlatformManagerImpl.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ void PlatformManagerImpl::WiFIIPChangeListener()
117117
continue;
118118
}
119119

120+
if (ConnectivityManagerImpl::GetWiFiIfName() == nullptr)
121+
{
122+
ChipLogDetail(DeviceLayer, "No wifi interface name. Ignoring IP update event.");
123+
continue;
124+
}
125+
120126
if (strcmp(name, ConnectivityManagerImpl::GetWiFiIfName()) != 0)
121127
{
122128
continue;

0 commit comments

Comments
 (0)