nl80211: Fix re-enabling of 802.11b rates
authorJouni Malinen <j@w1.fi>
Sat, 29 Oct 2011 19:12:26 +0000 (22:12 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 29 Oct 2011 19:12:26 +0000 (22:12 +0300)
nl80211_disable_11b_rates() function was supposed to use the 'disabled'
parameter to figure out whether to disable or re-enable 802.11b rates.
In addition, the driver deinit path was now ending up re-disabling the
enabled rates at the end of the deinit operations when the interface
type was forced back to station. Both of these issues are now fixed
and the 2.4 GHz band TX rate index is cleared properly when
wpa_supplicant is stopped.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/drivers/driver_nl80211.c

index 49dd7a4..be12c13 100644 (file)
@@ -2496,8 +2496,10 @@ static void wpa_driver_nl80211_deinit(void *priv)
                os_free(drv->if_indices);
 #endif /* HOSTAPD */
 
-       if (drv->disable_11b_rates)
+       if (drv->disable_11b_rates) {
+               drv->disable_11b_rates = 0;
                nl80211_disable_11b_rates(drv, drv->ifindex, 0);
+       }
 
        netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, 0,
                               IF_OPER_UP);
@@ -6997,8 +6999,10 @@ static int nl80211_disable_11b_rates(struct wpa_driver_nl80211_data *drv,
        band = nla_nest_start(msg, NL80211_BAND_2GHZ);
        if (!band)
                goto nla_put_failure;
-       NLA_PUT(msg, NL80211_TXRATE_LEGACY, 8,
-               "\x0c\x12\x18\x24\x30\x48\x60\x6c");
+       if (disabled) {
+               NLA_PUT(msg, NL80211_TXRATE_LEGACY, 8,
+                       "\x0c\x12\x18\x24\x30\x48\x60\x6c");
+       }
        nla_nest_end(msg, band);
 
        nla_nest_end(msg, bands);