Skip to content

Commit e319be1

Browse files
committed
Wifi (macOS): print <unknown ssid> when we can't get SSID
SSID is not available after Sonoma. According to the doc: SSID information is not available unless Location Services is enabled and the user has authorized the calling app to use location services.
1 parent ab8448e commit e319be1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/detection/wifi/wifi_apple.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "wifi.h"
22

33
#import <CoreWLAN/CoreWLAN.h>
4+
#import <CoreLocation/CLLocationManager.h>
45

56
const char* ffDetectWifi(FFlist* result)
67
{
@@ -31,7 +32,12 @@
3132
if(!inf.serviceActive)
3233
continue;
3334

34-
ffStrbufAppendS(&item->conn.ssid, inf.ssid.UTF8String);
35+
[CLLocationManager.new requestAlwaysAuthorization];
36+
if (inf.ssid)
37+
ffStrbufAppendS(&item->conn.ssid, inf.ssid.UTF8String);
38+
else
39+
ffStrbufSetStatic(&item->conn.ssid, "<unknown ssid>"); // https://developer.apple.com/forums/thread/732431
40+
3541
ffStrbufAppendS(&item->conn.macAddress, inf.hardwareAddress.UTF8String);
3642
switch(inf.activePHYMode)
3743
{
@@ -116,6 +122,9 @@
116122
case 15 /*kCWSecurityOWETransition*/:
117123
ffStrbufAppendS(&item->conn.security, "OWE Transition");
118124
break;
125+
case kCWSecurityUnknown:
126+
// Ignore
127+
break;
119128
default:
120129
ffStrbufAppendF(&item->conn.security, "Unknown (%ld)", inf.security);
121130
break;

0 commit comments

Comments
 (0)