Very old CoreWLAN bug?

With the deprecation of the airport binary in macOS 14.4 I am re-writing my own network tool to directly use CoreWLAN. In doing this and testing and comparing to previous results from the Apple airport binary under various versions of macOS I believe CoreWLAN has a 'bug' which as a result was exhibited in the Apple airport binary and equally my own code. As detailed below.

This applies to the release version of macOS 14.4 (23E214)

macOS Sonoma 14.3.1 and previous versions of macOS going back many, many years have included an official Apple binary at the following location.

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport

Whilst this is now officially deprecated in macOS 14.4 it is obvious that this tool will have itself been utilising the official Apple framework CoreWLAN.

As part of the process of re-writing my own tool which formerly used the above Apple binary, I have re-written my tool to directly utilise CoreWLAN myself via the Objc interface.

In doing this I have been able to in my own tool reproduce an incorrect behaviour formerly exhibited by the airport binary and still exhibited with my own tool directly utilising CoreWLAN. It therefore appears the issue is in CoreWLAN and not the now deprecated airport binary.

Using the airport binary in macOS 14.3.1 (the last working version) I get a result like the following.

                            SSID BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
                  vodafone20645C                   -89  6       Y  -- RSN(PSK/AES/AES) 
                  vodafone20645C                   -89  60      Y  -- RSN(PSK/AES/AES) 

You can see the column for CC which stands for country code is empty and hence shows ‘--‘. This field should indicate the country the WiFi access point is configured to support. (This affects the available choices of WiFi channels, transmitter strength and other aspects in order to render the access point LEGAL to use in various countries.)

Using my own code under the same version of macOS written to directly call CoreWLAN and obtain the same information I get the same results i.e. CoreWLAN does not return any country code information. My code under both macOS 14.3.1 and 14.4 returns the same results i.e. no country code.

As a comparison here is the output from the airport binary included in macOS 12.7.4 (21H1123)

                            SSID BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
                  vodafone20645C                   -89  6       Y  -- RSN(PSK/AES/AES) 
                  vodafone20645C                   -89  60      Y  -- RSN(PSK/AES/AES) 

As you can see it is identical confirming this bug has existed for a long time.

To show this however DID NOT USE TO EXIST here is the result from a much older macOS X Yosemite 10.10.5 (14F2511)

                            SSID BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
                       VM2833142 cc:58:30:07:32:48 -88  108     Y  NL WPA2(PSK/AES/AES) 
                         EE WiFi 62:e5:32:e3:ab:35 -61  11      Y  GB NONE
                         EV home 78:85:f4:42:02:58 -57  11      Y  CN WPA2(PSK/AES/AES) 
                        SKYGW3RD 3c:45:7a:fe:6b:0a -63  11      Y  -- WPA2(PSK/AES/AES) 
                       BT-6FCW7K c4:e5:32:e3:ab:34 -61  11      Y  GB WPA2(PSK/AES/AES)

As you can see in this case it is listing access points that are set to respectively, Netherlands, Great Britain, China, ‘Unknown’, and Great Britain. (As an aside and not part of this bug I am reporting, CoreWLAN has not reported the BSSID aka MAC address for some time either.)

Note: The countryCode field is still defined in CoreWLAN as retrieving it does not generate an error unlike picking a non-existent field name.

See also - https://developer.apple.com/documentation/corewlan/cwinterface/countrycode()

Replies

On older macOS versions i.e. prior to 14.4 the same code utilising CoreWLAN would produce

{( <CwNetwork: 0x600001249140> [ssid=EE WiFi-X, bssid=<redacted>, security=WPA2 Personal, rssi=-50, channel=<CWChannel: 0x60001240160> [channelNumber=40(5GHz), channelWidth={80MHz}], ibss=0] )}

This is what the same code and the new crippled CoreWLAN in macOS 14.4 return.

{( <CWNetwork: 0x6000009ac4b0> [ssid=(null), bssid=(null), security=WPA2 Personal, rssi=-53, channel=<CWChannel: 0x6000009a2570> [channelNumber=6(2GHz), channelWidth={20MHz}], ibss=0], <CWNetwork: 0x6000009ac530> [ssid=(null), bssid=(null), security=WPA2/WPA3 Personal, rssi=-73, channel=<CWChannel: 0x6000009a25a0> [channelNumber=11(2GHz), channelWidth={20MHz}], ibss=0] )}

As you can see all the ssid values are not being returned. :(

SOLVED

It turns out that as of macOS 14.4 not only is the airport binary deprecated so it no longer functions and instead returns and error message, but CoreWLAN has been changed so that to retrieve SSID names your application needs Location Services permission enabling for it in Privacy & Security in System Preferences.

As far as I can see this later change is not documented here at

https://developer.apple.com/documentation/corewlan

CoreWLAN has been changed so that to retrieve SSID names your application needs Location Services permission

Correct.

This change rolled out with macOS 14 and we’ve been discussing it here.

As far as I can see this later change is not documented here at

Indeed. There was a docs bug filed (FB12569894) but it’s not been fixed yet )-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"