aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2012-12-10 09:19:13 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-01-03 07:01:33 -0500
commitd45c41722a3eca639ced2c4c93665ced229b1da9 (patch)
treee1fed264ee3b9f03e12ed012f76a8de97a4a3eef
parentcc3983d8ab174ca43d5817f16c489b3cce3a795a (diff)
mac82011: use frame control to differentiate probe resp/beacon
The probe response/beacon management frame RX code passes a bool parameter to differentiate beacons and probe responses. This is useless since we have the frame and can thus use its frame control field. Moreover it is buggy since there is one call to ieee80211_rx_bss_info with a beacon frame that is indicated as a probe response, which is also fixed by using the frame control field, so do that. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/mac80211/ibss.c50
-rw-r--r--net/mac80211/ieee80211_i.h3
-rw-r--r--net/mac80211/mlme.c13
-rw-r--r--net/mac80211/scan.c9
4 files changed, 27 insertions, 48 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 854de974dc9a..272274931982 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -425,11 +425,9 @@ static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata,
425} 425}
426 426
427static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, 427static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
428 struct ieee80211_mgmt *mgmt, 428 struct ieee80211_mgmt *mgmt, size_t len,
429 size_t len,
430 struct ieee80211_rx_status *rx_status, 429 struct ieee80211_rx_status *rx_status,
431 struct ieee802_11_elems *elems, 430 struct ieee802_11_elems *elems)
432 bool beacon)
433{ 431{
434 struct ieee80211_local *local = sdata->local; 432 struct ieee80211_local *local = sdata->local;
435 int freq; 433 int freq;
@@ -530,7 +528,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
530 } 528 }
531 529
532 bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems, 530 bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems,
533 channel, beacon); 531 channel);
534 if (!bss) 532 if (!bss)
535 return; 533 return;
536 534
@@ -877,14 +875,21 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
877 ieee80211_tx_skb(sdata, skb); 875 ieee80211_tx_skb(sdata, skb);
878} 876}
879 877
880static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, 878static
881 struct ieee80211_mgmt *mgmt, 879void ieee80211_rx_mgmt_probe_beacon(struct ieee80211_sub_if_data *sdata,
882 size_t len, 880 struct ieee80211_mgmt *mgmt, size_t len,
883 struct ieee80211_rx_status *rx_status) 881 struct ieee80211_rx_status *rx_status)
884{ 882{
885 size_t baselen; 883 size_t baselen;
886 struct ieee802_11_elems elems; 884 struct ieee802_11_elems elems;
887 885
886 BUILD_BUG_ON(offsetof(typeof(mgmt->u.probe_resp), variable) !=
887 offsetof(typeof(mgmt->u.beacon), variable));
888
889 /*
890 * either beacon or probe_resp but the variable field is at the
891 * same offset
892 */
888 baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; 893 baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
889 if (baselen > len) 894 if (baselen > len)
890 return; 895 return;
@@ -892,25 +897,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
892 ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen, 897 ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen,
893 &elems); 898 &elems);
894 899
895 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false); 900 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems);
896}
897
898static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
899 struct ieee80211_mgmt *mgmt,
900 size_t len,
901 struct ieee80211_rx_status *rx_status)
902{
903 size_t baselen;
904 struct ieee802_11_elems elems;
905
906 /* Process beacon from the current BSS */
907 baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt;
908 if (baselen > len)
909 return;
910
911 ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems);
912
913 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, true);
914} 901}
915 902
916void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 903void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
@@ -934,12 +921,9 @@ void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
934 ieee80211_rx_mgmt_probe_req(sdata, skb); 921 ieee80211_rx_mgmt_probe_req(sdata, skb);
935 break; 922 break;
936 case IEEE80211_STYPE_PROBE_RESP: 923 case IEEE80211_STYPE_PROBE_RESP:
937 ieee80211_rx_mgmt_probe_resp(sdata, mgmt, skb->len,
938 rx_status);
939 break;
940 case IEEE80211_STYPE_BEACON: 924 case IEEE80211_STYPE_BEACON:
941 ieee80211_rx_mgmt_beacon(sdata, mgmt, skb->len, 925 ieee80211_rx_mgmt_probe_beacon(sdata, mgmt, skb->len,
942 rx_status); 926 rx_status);
943 break; 927 break;
944 case IEEE80211_STYPE_AUTH: 928 case IEEE80211_STYPE_AUTH:
945 ieee80211_rx_mgmt_auth_ibss(sdata, mgmt, skb->len); 929 ieee80211_rx_mgmt_auth_ibss(sdata, mgmt, skb->len);
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 8563b9a5cac3..fa6d43e6197f 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1346,8 +1346,7 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
1346 struct ieee80211_mgmt *mgmt, 1346 struct ieee80211_mgmt *mgmt,
1347 size_t len, 1347 size_t len,
1348 struct ieee802_11_elems *elems, 1348 struct ieee802_11_elems *elems,
1349 struct ieee80211_channel *channel, 1349 struct ieee80211_channel *channel);
1350 bool beacon);
1351void ieee80211_rx_bss_put(struct ieee80211_local *local, 1350void ieee80211_rx_bss_put(struct ieee80211_local *local,
1352 struct ieee80211_bss *bss); 1351 struct ieee80211_bss *bss);
1353 1352
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 3cf85d8629a7..7d253a022173 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2369,8 +2369,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2369static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, 2369static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
2370 struct ieee80211_mgmt *mgmt, size_t len, 2370 struct ieee80211_mgmt *mgmt, size_t len,
2371 struct ieee80211_rx_status *rx_status, 2371 struct ieee80211_rx_status *rx_status,
2372 struct ieee802_11_elems *elems, 2372 struct ieee802_11_elems *elems)
2373 bool beacon)
2374{ 2373{
2375 struct ieee80211_local *local = sdata->local; 2374 struct ieee80211_local *local = sdata->local;
2376 int freq; 2375 int freq;
@@ -2404,7 +2403,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
2404 return; 2403 return;
2405 2404
2406 bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems, 2405 bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems,
2407 channel, beacon); 2406 channel);
2408 if (bss) 2407 if (bss)
2409 ieee80211_rx_bss_put(local, bss); 2408 ieee80211_rx_bss_put(local, bss);
2410 2409
@@ -2447,7 +2446,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
2447 ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen, 2446 ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen,
2448 &elems); 2447 &elems);
2449 2448
2450 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false); 2449 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems);
2451 2450
2452 if (ifmgd->associated && 2451 if (ifmgd->associated &&
2453 ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid)) 2452 ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid))
@@ -2528,8 +2527,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
2528 ieee802_11_parse_elems(mgmt->u.beacon.variable, 2527 ieee802_11_parse_elems(mgmt->u.beacon.variable,
2529 len - baselen, &elems); 2528 len - baselen, &elems);
2530 2529
2531 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, 2530 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems);
2532 false);
2533 ifmgd->assoc_data->have_beacon = true; 2531 ifmgd->assoc_data->have_beacon = true;
2534 ifmgd->assoc_data->sent_assoc = false; 2532 ifmgd->assoc_data->sent_assoc = false;
2535 /* continue assoc process */ 2533 /* continue assoc process */
@@ -2682,8 +2680,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
2682 ifmgd->beacon_crc = ncrc; 2680 ifmgd->beacon_crc = ncrc;
2683 ifmgd->beacon_crc_valid = true; 2681 ifmgd->beacon_crc_valid = true;
2684 2682
2685 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, 2683 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems);
2686 true);
2687 2684
2688 if (ieee80211_sta_wmm_params(local, sdata, elems.wmm_param, 2685 if (ieee80211_sta_wmm_params(local, sdata, elems.wmm_param,
2689 elems.wmm_param_len)) 2686 elems.wmm_param_len))
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index d59fc6818b1c..06cbe26892a8 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -65,12 +65,11 @@ static bool is_uapsd_supported(struct ieee802_11_elems *elems)
65struct ieee80211_bss * 65struct ieee80211_bss *
66ieee80211_bss_info_update(struct ieee80211_local *local, 66ieee80211_bss_info_update(struct ieee80211_local *local,
67 struct ieee80211_rx_status *rx_status, 67 struct ieee80211_rx_status *rx_status,
68 struct ieee80211_mgmt *mgmt, 68 struct ieee80211_mgmt *mgmt, size_t len,
69 size_t len,
70 struct ieee802_11_elems *elems, 69 struct ieee802_11_elems *elems,
71 struct ieee80211_channel *channel, 70 struct ieee80211_channel *channel)
72 bool beacon)
73{ 71{
72 bool beacon = ieee80211_is_beacon(mgmt->frame_control);
74 struct cfg80211_bss *cbss; 73 struct cfg80211_bss *cbss;
75 struct ieee80211_bss *bss; 74 struct ieee80211_bss *bss;
76 int clen, srlen; 75 int clen, srlen;
@@ -203,7 +202,7 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)
203 202
204 bss = ieee80211_bss_info_update(local, rx_status, 203 bss = ieee80211_bss_info_update(local, rx_status,
205 mgmt, skb->len, &elems, 204 mgmt, skb->len, &elems,
206 channel, beacon); 205 channel);
207 if (bss) 206 if (bss)
208 ieee80211_rx_bss_put(local, bss); 207 ieee80211_rx_bss_put(local, bss);
209} 208}