Problematic WiFi on Mac Book Pro (Retina 2013 Model), Due to 802.11d Protocol
UPDATE: There is an option to control the country code in the Airport Utility. However if you do not have a another machine that can connect to your wireless network, you will need to binary patch your laptops network driver as previously explained in this post. To update the country code, complete the following steps: Start the airport utility, double click the airport you want to modify. A new window with the name of the airport will pop up. Click on the airport tab. Click on the wireless tab. Click the Wireless Network Options button. From the pull down menu “country” choose the country you wish it to broadcast channels for.
For an extended weekend my girlfriend and I went to my parents place in Bodø. Northern Norway. As usual we connected all the devices we use to the local accesspoint, Apple Airport Express, almost everything worked fine, like android cellphone and ebookreaders.
Then I tried to connect my Mac Book Pro. I found the Wi-Fi ssid in the list of networks. Selected it and typed in the password. Then the Wi-Fi manager immediately thought there were no access points in the neighbourhood, previosly it said it was four, and would not connect me. It would not let me disconnect or turn on or off the WiFi. In the system settings it said the WiFi was off, even though it was still on.
I checked the system log and found the following message.
May 2 00:07:17 Eiriks-MacBook-Pro kernel[0]: en0: 802.11d country code set to ‘KP’.
After painfully searching for answers on the Internet with my cellphone, aparently there is a protocol called 802.11d that transmits beacons about what regulatory channels the WiFi adapters are allowed to use. When this is misconfigured on the access point, as it probably is, on the default AirPort Express configuration. Where it thinks the thing is in North Korea, were there is no channels it is allowed to broadcast on. Adapter dies.
After this has happened, to be able to connect to another wireless network, I had to remove the access-point of my parents from the list of saved networks and then reboot, as the Mac Book Pro tries to connect and the 802.11d beacon is sent to the adapter, forcing the driver to send on no radio channels. It seems like there is no way around rebooting to solve this.
I can imagine a lot of support problems about people not being able to connect to their wireless network at home, and complaining about their Internet Service Provider or router equipment due to this problem. But, when they get to the Wi-Fi cafe, shop or repair shop the problem does not reappear. A lot of Googling about this particular problem seemed to verify that hypothesis. People solving the problem with getting new access points, even though the access point is perfectly fine.
After all, all I want to do, is disable the 802.11d beacon function. This is impossible to do in any settings on the Mac OS X. Alas, there was a Russian forum [1] with a lot of Cyrillic text about, bare with me, to binary patch the driver thinking the country code is always X2. The writer of this patch has had problems with wrong 802.11d beacons being sent, so the adapter would not go into 5GHz mode, even though the channels were perfectly working. This patch worked great for me to.
So apparently, what I would have to do is change/binary patch the network driver with the string 0x81 0x78 0x30 0x6B 0x10 0x00 0x00 0x0F 0x85 to 0x81 0x78 0x30 0x6B 0x10 0x00 0x00 x90 0xE0. This forces the driver to use country code «X2» whatever beacon is being sent, so it will never change. Finally a solution that could work for me. You could either change this with a hex-editing utility or copy and paste the following very handy one-liner in the terminal application:
sudo perl -pi -e ‘s|\x81\x78\x30\x6B\x10\x00\x00\x0F\x85|\x81\x78\x30\x6B\x10\x00\x00\x90\xE9 |’/System/Library/Extensions/IO80211Family.kext/Contents/PlugIns/AirPortBrcm4360.kext/Contents/MacOS/AirPortBrcm4360 && sudo touch /System/Library/Extensions/
Then reboot the machine, and you should be able to connect to all Wi-Fi networks without this problem.
In case you tried it and it were not successful, here are the original files
Footnotes
[1] http://www.hub.ru/wiki/802.11d
Comments