]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[MAC80211]: STA reassociation improvements
authorDaniel Drake <dsd@gentoo.org>
Fri, 27 Jul 2007 13:43:23 +0000 (15:43 +0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:47:37 +0000 (16:47 -0700)
My cheapy D-Link AP behaves strangely w.r.t reassociations.

The following sequence of commands causes me to lose association and to be
unable to regain it:

ifconfig eth8 down
ifconfig eth8 up
iwconfig eth8 essid <x>

This is because mac80211 tries to reassociate, rather than just associate.
My AP replies with an association response (not a reassociation response...)
denying the association with code 12: "Association denied due to reason
outside the scope of this standard"

mac80211 tries this reassociation another 4 times or so before finally giving
up.

I see 2 problems here:
 1. bringing the interface down and up again should be resetting interface state
    i.e. after the interface is brought down, it should have no memory of if or
         where it was previously associated
 2. after the first reassociation fails, mac80211 should fall back to
    standard association for the next attempt

Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: Jiri Benc <jbenc@suse.cz>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/ieee80211.c
net/mac80211/ieee80211_sta.c

index 566bdca32b8629b7e41fa3b351b7c8830bbc1a4d..f811a260ee9c2ced6f343922e6796f7bbb73f32f 100644 (file)
@@ -375,6 +375,18 @@ static void ieee80211_start_hard_monitor(struct ieee80211_local *local)
        }
 }
 
+static void ieee80211_if_open(struct net_device *dev)
+{
+       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+       switch (sdata->type) {
+       case IEEE80211_IF_TYPE_STA:
+       case IEEE80211_IF_TYPE_IBSS:
+               sdata->u.sta.prev_bssid_set = 0;
+               break;
+       }
+}
+
 static int ieee80211_open(struct net_device *dev)
 {
        struct ieee80211_sub_if_data *sdata, *nsdata;
@@ -408,6 +420,7 @@ static int ieee80211_open(struct net_device *dev)
                local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP;
                return 0;
        }
+       ieee80211_if_open(dev);
        ieee80211_start_soft_monitor(local);
 
        conf.if_id = dev->ifindex;
index 9aee1abae1279dedba8b74f8b4b692c40ad5340c..8e6548974a9f53d0d79fe1bcef434d911952b00e 100644 (file)
@@ -1187,8 +1187,10 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
        if (status_code != WLAN_STATUS_SUCCESS) {
                printk(KERN_DEBUG "%s: AP denied association (code=%d)\n",
                       dev->name, status_code);
-               if (status_code == WLAN_STATUS_REASSOC_NO_ASSOC)
-                       ifsta->prev_bssid_set = 0;
+               /* if this was a reassociation, ensure we try a "full"
+                * association next time. This works around some broken APs
+                * which do not correctly reject reassociation requests. */
+               ifsta->prev_bssid_set = 0;
                return;
        }