Comment 33 for bug 543836

Thomas Betker (thomas-betker) wrote :

I can confirm that the problem with the rt2870sta driver and WPA still exists in Ubuntu 10.04.2 LTS, and that it goes away when linux-backports-modules-wireless-lucid-generic is installed.

I am using the rt2870sta driver for my D-Link DWL-G122 rev. E1 (chipset RT3070, USB 07d1:3c0f), with NetworkManager and wpa_supplicant. The rt2800usb driver is blacklisted (it doesn't work for me), and the USB ID of my WLAN adapter is configured in the rt2870sta driver by writing it to /sys/bus/usb/drivers/rt2870/new_id; see "Variante B" in http://forum.ubuntuusers.de/topic/linksys-wusb100-wireless-stick/#post-2264339 (German). [Note: When the backported drivers are installed, these tricks are no longer necessary, i.e., rt2870sta is loaded and works out of the box. Very nice.]

The driver correctly detects my Access Point (and other APs), but fails to connect. Running 'iwevent', I noticed that the Association Request IEs are corrupt:

12:01:36.189784 wlan0 Association Request IEs:000E45617379426F782D373934453232010882848B961224486C0100000FAC020100000FAC040100000FAC020000

Breaking this up (two-byte header per information element - one byte for the identifier, one for the length), it reads:

000E 45617379426F782D373934453232
0108 82848B961224486C
____ 0100000FAC020100000FAC040100000FAC020000

At the position ____, there are two bytes (h'3014) missing. I assume that the Association Request is ignored by the AP for this reason. I have checked the source code of the original rt2870sta driver, and I think the bug is in linux-source-2.6.32/drivers/staging/rt2860/sta/assoc.c, MlmeAssocReqAction():

    if (pAd->StaCfg.WpaSupplicantUP == 1)
    {
        MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp,
                            // <<< missing RSNIe and RSNIE_Len here! >>>
                            pAd->StaCfg.RSNIE_Len, pAd->StaCfg.RSN_IE,
                            END_OF_ARGS);
    }
    else
    {
        MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp,
                            1, &RSNIe,
                            1, &pAd->StaCfg.RSNIE_Len,
                            pAd->StaCfg.RSNIE_Len, pAd->StaCfg.RSN_IE,
                            END_OF_ARGS);
    }

In my case, the wpa_supplicant is up and does not set the WPA2 IE; the driver uses its own StaCfg.RSN_IE, but without the two-byte header. In later versions of the rt2870 driver, this bug was fixed by checking if wpa_supplicant has actually provided the IE; e.g.:

    if ((pAd->StaCfg.WpaSupplicantUP ==
         WPA_SUPPLICANT_ENABLE)
        && (pAd->StaCfg.bRSN_IE_FromWpaSupplicant ==
            TRUE)) {
            MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp,
                              pAd->StaCfg.RSNIE_Len,
                              pAd->StaCfg.RSN_IE,
                              END_OF_ARGS);
    } else {
            MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp,
                              1, &RSNIe,
                              1, &pAd->StaCfg.RSNIE_Len,
                              pAd->StaCfg.RSNIE_Len,
                              pAd->StaCfg.RSN_IE,
                              END_OF_ARGS);
    }

Anyway, when the backported driver is installed, the IEs shown by 'iwevent' are correct, and the driver connects to my AP immediately.