DEAUTH_LEAVING or Reason3 or fucking CRDA

Before you start reading a warning, this blog entry is rant. End of warning.

You might get frustrated by somewhat irregular behavior of your WiFi adapters (especially if you travel a lot to different regions), with errors like these:

    kernel: [ 1549.345884] alfa0: deauthenticating from XX:XX:XX:XX:XX:XX by local choice (Reason: 3=DEAUTH_LEAVING)

    kernel: [ 3330.004070] wlan0: deauthenticated from XX:XX:XX:XX:XX:XX (Reason: 3=DEAUTH_LEAVING)

And then you start investigating and banging your head on the table what’s the fucking reason for your beloved WiFi adapter to behave and de-auth out of your so much needed AP.

Well you can thank the regulations and restrictions set for different countries. As per https://wireless.wiki.kernel.org:

“Every card sold was certified to work in a particular regulatory environment (that being set of channels, maximum allowed power, other special flags etc). On Intel cards these restrictions are enforced by firmware, Atheros’s equipment has regdomain code in EEPROM which is read on startup by the driver and then (if it’s not “world” regdomain) CRDA is contacted to get a set of regulatory requirements. ”

And if you like to know the reasons head over to the Regulatory considerations . It all boils down to the:

“… it’s one of the major key components to getting proper vendor support on drivers due to fear uncertainty and doubt that Linux drivers cannot follow the requirements for radio spectrum use …”

So, how can you solve this issue? Unfortunately there is no silver bullet, but case by case scenario. Meaning there is another thing you need to remember while traveling and/or changing WiFi AP’s or clients.

First find out what region was set for your AP that you would like to use. Most likely it’s in US or EU region. To check the full list of regions you can take a look in the file /usr/share/zoneinfo/zone.tab but in case you do not have it, you can check it here.

Now, the important part in this command is to find the channels you can’t operate, and those are ones marked with NO-IR. The “NO-IR” means that the device is not allowed to actively transmit radiation on that channel. There are some cards that can change this by modifying EEPROM (hint: madwifi but this is on your own risk).

    # iw list
    ....        
            Frequencies:
                * 2412 MHz [1] (20.0 dBm)
                * 2417 MHz [2] (20.0 dBm)
                * 2422 MHz [3] (20.0 dBm)
                * 2427 MHz [4] (20.0 dBm)
                * 2432 MHz [5] (20.0 dBm)
                * 2437 MHz [6] (20.0 dBm)
                * 2442 MHz [7] (20.0 dBm)
                * 2447 MHz [8] (20.0 dBm)
                * 2452 MHz [9] (20.0 dBm)
                * 2457 MHz [10] (20.0 dBm)
                * 2462 MHz [11] (20.0 dBm)
                * 2467 MHz [12] (20.0 dBm) (no IR)
                * 2472 MHz [13] (20.0 dBm) (no IR)
                * 2484 MHz [14] (20.0 dBm) (no IR)

Next thing is to check your /etc/default/crda file and see what you have set there, usually its not set:

    # cat /etc/default/crda
    # Set REGDOMAIN to a ISO/IEC 3166-1 alpha2 country code so that iw(8) may set
    # the initial regulatory domain setting for IEEE 802.11 devices which operate
    # on this system.
    #
    # Governments assert the right to regulate usage of radio spectrum within
    # their respective territories so make sure you select a ISO/IEC 3166-1 alpha2
    # country code suitable for your location or you may infringe on local
    # legislature. See `/usr/share/zoneinfo/zone.tab' for a table of timezone
    # descriptions containing ISO/IEC 3166-1 alpha2 country codes.

    REGDOMAIN=

So to set everything to proper values (example is US), do the following:

    # sed -i 's/^REG.*=$/&US/' /etc/default/crda
    # iw reg set US
    # iw reg get
    country US: DFS-FCC
        (2402 - 2472 @ 40), (N/A, 30), (N/A)
        (5170 - 5250 @ 80), (N/A, 17), (N/A)
        (5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS
        (5735 - 5835 @ 80), (N/A, 30), (N/A)
        (57240 - 63720 @ 2160), (N/A, 40), (N/A)

I really hope that your search engine fu brought you here before you started freaking out why shit isn’t working and that these quick and simple guidelines helped. Stay cool.

Just my 2c.

 
3
Kudos
 
3
Kudos

Now read this

Ettus Research USRP B200/B210 simple case

Hi there. If you are into SDR and out looking for signals, you have probably heard about Ettus Research products. In case you have bought B200 or B210 product you know that these will be delivered without any case/box. Since this product... Continue →