diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2012-12-10 09:19:13 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-01-03 07:01:33 -0500 |
commit | d45c41722a3eca639ced2c4c93665ced229b1da9 (patch) | |
tree | e1fed264ee3b9f03e12ed012f76a8de97a4a3eef /net/mac80211/ibss.c | |
parent | cc3983d8ab174ca43d5817f16c489b3cce3a795a (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>
Diffstat (limited to 'net/mac80211/ibss.c')
-rw-r--r-- | net/mac80211/ibss.c | 50 |
1 files changed, 17 insertions, 33 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 | ||
427 | static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | 427 | static 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 | ||
880 | static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, | 878 | static |
881 | struct ieee80211_mgmt *mgmt, | 879 | void 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 | |||
898 | static 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 | ||
916 | void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | 903 | void 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); |