aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c56
1 files changed, 38 insertions, 18 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index caf97f5a2937..c08924aeac00 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1277,7 +1277,6 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local,
1277 1277
1278 /* enable WMM or activate new settings */ 1278 /* enable WMM or activate new settings */
1279 sdata->vif.bss_conf.qos = true; 1279 sdata->vif.bss_conf.qos = true;
1280 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_QOS);
1281} 1280}
1282 1281
1283static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata, 1282static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
@@ -1455,8 +1454,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1455 changed |= BSS_CHANGED_ASSOC; 1454 changed |= BSS_CHANGED_ASSOC;
1456 sdata->vif.bss_conf.assoc = false; 1455 sdata->vif.bss_conf.assoc = false;
1457 1456
1458 ieee80211_set_wmm_default(sdata);
1459
1460 /* channel(_type) changes are handled by ieee80211_hw_config */ 1457 /* channel(_type) changes are handled by ieee80211_hw_config */
1461 WARN_ON(!ieee80211_set_channel_type(local, sdata, NL80211_CHAN_NO_HT)); 1458 WARN_ON(!ieee80211_set_channel_type(local, sdata, NL80211_CHAN_NO_HT));
1462 1459
@@ -1484,10 +1481,16 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1484 changed |= BSS_CHANGED_ARP_FILTER; 1481 changed |= BSS_CHANGED_ARP_FILTER;
1485 } 1482 }
1486 1483
1484 sdata->vif.bss_conf.qos = false;
1485 changed |= BSS_CHANGED_QOS;
1486
1487 /* The BSSID (not really interesting) and HT changed */ 1487 /* The BSSID (not really interesting) and HT changed */
1488 changed |= BSS_CHANGED_BSSID | BSS_CHANGED_HT; 1488 changed |= BSS_CHANGED_BSSID | BSS_CHANGED_HT;
1489 ieee80211_bss_info_change_notify(sdata, changed); 1489 ieee80211_bss_info_change_notify(sdata, changed);
1490 1490
1491 /* disassociated - set to defaults now */
1492 ieee80211_set_wmm_default(sdata, false);
1493
1491 del_timer_sync(&sdata->u.mgd.conn_mon_timer); 1494 del_timer_sync(&sdata->u.mgd.conn_mon_timer);
1492 del_timer_sync(&sdata->u.mgd.bcn_mon_timer); 1495 del_timer_sync(&sdata->u.mgd.bcn_mon_timer);
1493 del_timer_sync(&sdata->u.mgd.timer); 1496 del_timer_sync(&sdata->u.mgd.timer);
@@ -1822,7 +1825,7 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
1822 1825
1823 memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN); 1826 memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN);
1824 1827
1825 if (memcmp(bssid, mgmt->bssid, ETH_ALEN)) 1828 if (compare_ether_addr(bssid, mgmt->bssid))
1826 return RX_MGMT_NONE; 1829 return RX_MGMT_NONE;
1827 1830
1828 auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg); 1831 auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
@@ -1903,7 +1906,7 @@ ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
1903 return RX_MGMT_NONE; 1906 return RX_MGMT_NONE;
1904 1907
1905 if (!ifmgd->associated || 1908 if (!ifmgd->associated ||
1906 memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN)) 1909 compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
1907 return RX_MGMT_NONE; 1910 return RX_MGMT_NONE;
1908 1911
1909 bssid = ifmgd->associated->bssid; 1912 bssid = ifmgd->associated->bssid;
@@ -1936,7 +1939,7 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
1936 return RX_MGMT_NONE; 1939 return RX_MGMT_NONE;
1937 1940
1938 if (!ifmgd->associated || 1941 if (!ifmgd->associated ||
1939 memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN)) 1942 compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
1940 return RX_MGMT_NONE; 1943 return RX_MGMT_NONE;
1941 1944
1942 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); 1945 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
@@ -2155,7 +2158,8 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
2155 ieee80211_sta_wmm_params(local, sdata, elems.wmm_param, 2158 ieee80211_sta_wmm_params(local, sdata, elems.wmm_param,
2156 elems.wmm_param_len); 2159 elems.wmm_param_len);
2157 else 2160 else
2158 ieee80211_set_wmm_default(sdata); 2161 ieee80211_set_wmm_default(sdata, false);
2162 changed |= BSS_CHANGED_QOS;
2159 2163
2160 if (elems.ht_info_elem && elems.wmm_param && 2164 if (elems.ht_info_elem && elems.wmm_param &&
2161 (sdata->local->hw.queues >= 4) && 2165 (sdata->local->hw.queues >= 4) &&
@@ -2203,7 +2207,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2203 2207
2204 if (!assoc_data) 2208 if (!assoc_data)
2205 return RX_MGMT_NONE; 2209 return RX_MGMT_NONE;
2206 if (memcmp(assoc_data->bss->bssid, mgmt->bssid, ETH_ALEN)) 2210 if (compare_ether_addr(assoc_data->bss->bssid, mgmt->bssid))
2207 return RX_MGMT_NONE; 2211 return RX_MGMT_NONE;
2208 2212
2209 /* 2213 /*
@@ -2291,8 +2295,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
2291 bool need_ps = false; 2295 bool need_ps = false;
2292 2296
2293 if (sdata->u.mgd.associated && 2297 if (sdata->u.mgd.associated &&
2294 memcmp(mgmt->bssid, sdata->u.mgd.associated->bssid, 2298 compare_ether_addr(mgmt->bssid, sdata->u.mgd.associated->bssid)
2295 ETH_ALEN) == 0) { 2299 == 0) {
2296 bss = (void *)sdata->u.mgd.associated->priv; 2300 bss = (void *)sdata->u.mgd.associated->priv;
2297 /* not previously set so we may need to recalc */ 2301 /* not previously set so we may need to recalc */
2298 need_ps = !bss->dtim_period; 2302 need_ps = !bss->dtim_period;
@@ -2347,7 +2351,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
2347 2351
2348 ASSERT_MGD_MTX(ifmgd); 2352 ASSERT_MGD_MTX(ifmgd);
2349 2353
2350 if (memcmp(mgmt->da, sdata->vif.addr, ETH_ALEN)) 2354 if (compare_ether_addr(mgmt->da, sdata->vif.addr))
2351 return; /* ignore ProbeResp to foreign address */ 2355 return; /* ignore ProbeResp to foreign address */
2352 2356
2353 baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; 2357 baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
@@ -2360,11 +2364,12 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
2360 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false); 2364 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false);
2361 2365
2362 if (ifmgd->associated && 2366 if (ifmgd->associated &&
2363 memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN) == 0) 2367 compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid) == 0)
2364 ieee80211_reset_ap_probe(sdata); 2368 ieee80211_reset_ap_probe(sdata);
2365 2369
2366 if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies && 2370 if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies &&
2367 memcmp(mgmt->bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN) == 0) { 2371 compare_ether_addr(mgmt->bssid, ifmgd->auth_data->bss->bssid)
2372 == 0) {
2368 /* got probe response, continue with auth */ 2373 /* got probe response, continue with auth */
2369 printk(KERN_DEBUG "%s: direct probe responded\n", sdata->name); 2374 printk(KERN_DEBUG "%s: direct probe responded\n", sdata->name);
2370 ifmgd->auth_data->tries = 0; 2375 ifmgd->auth_data->tries = 0;
@@ -2421,7 +2426,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
2421 return; 2426 return;
2422 2427
2423 if (ifmgd->assoc_data && !ifmgd->assoc_data->have_beacon && 2428 if (ifmgd->assoc_data && !ifmgd->assoc_data->have_beacon &&
2424 memcmp(mgmt->bssid, ifmgd->assoc_data->bss->bssid, ETH_ALEN) == 0) { 2429 compare_ether_addr(mgmt->bssid, ifmgd->assoc_data->bss->bssid)
2430 == 0) {
2425 ieee802_11_parse_elems(mgmt->u.beacon.variable, 2431 ieee802_11_parse_elems(mgmt->u.beacon.variable,
2426 len - baselen, &elems); 2432 len - baselen, &elems);
2427 2433
@@ -2436,7 +2442,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
2436 } 2442 }
2437 2443
2438 if (!ifmgd->associated || 2444 if (!ifmgd->associated ||
2439 memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN)) 2445 compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
2440 return; 2446 return;
2441 bssid = ifmgd->associated->bssid; 2447 bssid = ifmgd->associated->bssid;
2442 2448
@@ -3299,7 +3305,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
3299 bool match; 3305 bool match;
3300 3306
3301 /* keep sta info, bssid if matching */ 3307 /* keep sta info, bssid if matching */
3302 match = memcmp(ifmgd->bssid, req->bss->bssid, ETH_ALEN) == 0; 3308 match = compare_ether_addr(ifmgd->bssid, req->bss->bssid) == 0;
3303 ieee80211_destroy_auth_data(sdata, match); 3309 ieee80211_destroy_auth_data(sdata, match);
3304 } 3310 }
3305 3311
@@ -3421,7 +3427,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
3421 goto err_clear; 3427 goto err_clear;
3422 } 3428 }
3423 } else 3429 } else
3424 WARN_ON_ONCE(memcmp(ifmgd->bssid, req->bss->bssid, ETH_ALEN)); 3430 WARN_ON_ONCE(compare_ether_addr(ifmgd->bssid, req->bss->bssid));
3425 3431
3426 if (!bss->dtim_period && 3432 if (!bss->dtim_period &&
3427 sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) { 3433 sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) {
@@ -3440,6 +3446,20 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
3440 } 3446 }
3441 run_again(ifmgd, assoc_data->timeout); 3447 run_again(ifmgd, assoc_data->timeout);
3442 3448
3449 if (bss->corrupt_data) {
3450 char *corrupt_type = "data";
3451 if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_BEACON) {
3452 if (bss->corrupt_data &
3453 IEEE80211_BSS_CORRUPT_PROBE_RESP)
3454 corrupt_type = "beacon and probe response";
3455 else
3456 corrupt_type = "beacon";
3457 } else if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP)
3458 corrupt_type = "probe response";
3459 printk(KERN_DEBUG "%s: associating with AP with corrupt %s\n",
3460 sdata->name, corrupt_type);
3461 }
3462
3443 err = 0; 3463 err = 0;
3444 goto out; 3464 goto out;
3445 err_clear: 3465 err_clear:
@@ -3471,7 +3491,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
3471 sdata->name, req->bssid, req->reason_code); 3491 sdata->name, req->bssid, req->reason_code);
3472 3492
3473 if (ifmgd->associated && 3493 if (ifmgd->associated &&
3474 memcmp(ifmgd->associated->bssid, req->bssid, ETH_ALEN) == 0) 3494 compare_ether_addr(ifmgd->associated->bssid, req->bssid) == 0)
3475 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, 3495 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
3476 req->reason_code, true, frame_buf); 3496 req->reason_code, true, frame_buf);
3477 else 3497 else