Skip to content

Commit ac2266c

Browse files
committed
Wifi (FreeBSD): early break if the interface is not associated
1 parent 0dc40a2 commit ac2266c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/detection/wifi/wifi_bsd.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@ const char* ffDetectWifi(FFlist* result)
3737
item->conn.channel = 0;
3838
item->conn.frequency = 0;
3939

40+
ffParsePropLines(ifconfig.chars, "status: ", &item->conn.status);
41+
if (!ffStrbufEqualS(&item->conn.status, "associated"))
42+
continue;
43+
4044
ffParsePropLines(ifconfig.chars, "ssid ", &item->conn.ssid);
4145
if (item->conn.ssid.length)
4246
{
47+
// This doesn't work for quoted SSID values
4348
uint32_t idx = ffStrbufFirstIndexS(&item->conn.ssid, " bssid ");
4449
if (idx < item->conn.ssid.length)
4550
{
@@ -69,8 +74,6 @@ const char* ffDetectWifi(FFlist* result)
6974
ffStrbufPrependS(&item->conn.protocol, "802.");
7075
}
7176
}
72-
73-
ffParsePropLines(ifconfig.chars, "status: ", &item->conn.status);
7477
}
7578
}
7679

0 commit comments

Comments
 (0)