diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-04-01 05:58:36 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-04-22 16:54:39 -0400 |
commit | de95a54b1aebe5592cae971ca5e5d9ec6a381a17 (patch) | |
tree | 55a622d1e61e73cd6426c5e0643ac9fd117a9fe8 /net/mac80211/util.c | |
parent | 18a8365992a8041aa178ae9ad5f0d951d0457230 (diff) |
mac80211: pass all probe request IEs to driver
Instead of just passing the cfg80211-requested IEs, pass
the locally generated ones as well.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r-- | net/mac80211/util.c | 79 |
1 files changed, 48 insertions, 31 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 05caf34f31da..72b091317a7c 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -831,16 +831,57 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, | |||
831 | ieee80211_tx_skb(sdata, skb, encrypt); | 831 | ieee80211_tx_skb(sdata, skb, encrypt); |
832 | } | 832 | } |
833 | 833 | ||
834 | int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, | ||
835 | const u8 *ie, size_t ie_len) | ||
836 | { | ||
837 | struct ieee80211_supported_band *sband; | ||
838 | u8 *pos, *supp_rates_len, *esupp_rates_len = NULL; | ||
839 | int i; | ||
840 | |||
841 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
842 | |||
843 | pos = buffer; | ||
844 | |||
845 | *pos++ = WLAN_EID_SUPP_RATES; | ||
846 | supp_rates_len = pos; | ||
847 | *pos++ = 0; | ||
848 | |||
849 | for (i = 0; i < sband->n_bitrates; i++) { | ||
850 | struct ieee80211_rate *rate = &sband->bitrates[i]; | ||
851 | |||
852 | if (esupp_rates_len) { | ||
853 | *esupp_rates_len += 1; | ||
854 | } else if (*supp_rates_len == 8) { | ||
855 | *pos++ = WLAN_EID_EXT_SUPP_RATES; | ||
856 | esupp_rates_len = pos; | ||
857 | *pos++ = 1; | ||
858 | } else | ||
859 | *supp_rates_len += 1; | ||
860 | |||
861 | *pos++ = rate->bitrate / 5; | ||
862 | } | ||
863 | |||
864 | /* | ||
865 | * If adding more here, adjust code in main.c | ||
866 | * that calculates local->scan_ies_len. | ||
867 | */ | ||
868 | |||
869 | if (ie) { | ||
870 | memcpy(pos, ie, ie_len); | ||
871 | pos += ie_len; | ||
872 | } | ||
873 | |||
874 | return pos - buffer; | ||
875 | } | ||
876 | |||
834 | void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | 877 | void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, |
835 | u8 *ssid, size_t ssid_len, | 878 | const u8 *ssid, size_t ssid_len, |
836 | u8 *ie, size_t ie_len) | 879 | const u8 *ie, size_t ie_len) |
837 | { | 880 | { |
838 | struct ieee80211_local *local = sdata->local; | 881 | struct ieee80211_local *local = sdata->local; |
839 | struct ieee80211_supported_band *sband; | ||
840 | struct sk_buff *skb; | 882 | struct sk_buff *skb; |
841 | struct ieee80211_mgmt *mgmt; | 883 | struct ieee80211_mgmt *mgmt; |
842 | u8 *pos, *supp_rates, *esupp_rates = NULL; | 884 | u8 *pos; |
843 | int i; | ||
844 | 885 | ||
845 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) + 200 + | 886 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) + 200 + |
846 | ie_len); | 887 | ie_len); |
@@ -867,33 +908,9 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | |||
867 | *pos++ = WLAN_EID_SSID; | 908 | *pos++ = WLAN_EID_SSID; |
868 | *pos++ = ssid_len; | 909 | *pos++ = ssid_len; |
869 | memcpy(pos, ssid, ssid_len); | 910 | memcpy(pos, ssid, ssid_len); |
911 | pos += ssid_len; | ||
870 | 912 | ||
871 | supp_rates = skb_put(skb, 2); | 913 | skb_put(skb, ieee80211_build_preq_ies(local, pos, ie, ie_len)); |
872 | supp_rates[0] = WLAN_EID_SUPP_RATES; | ||
873 | supp_rates[1] = 0; | ||
874 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
875 | |||
876 | for (i = 0; i < sband->n_bitrates; i++) { | ||
877 | struct ieee80211_rate *rate = &sband->bitrates[i]; | ||
878 | if (esupp_rates) { | ||
879 | pos = skb_put(skb, 1); | ||
880 | esupp_rates[1]++; | ||
881 | } else if (supp_rates[1] == 8) { | ||
882 | esupp_rates = skb_put(skb, 3); | ||
883 | esupp_rates[0] = WLAN_EID_EXT_SUPP_RATES; | ||
884 | esupp_rates[1] = 1; | ||
885 | pos = &esupp_rates[2]; | ||
886 | } else { | ||
887 | pos = skb_put(skb, 1); | ||
888 | supp_rates[1]++; | ||
889 | } | ||
890 | *pos = rate->bitrate / 5; | ||
891 | } | ||
892 | |||
893 | /* if adding more here, adjust max_scan_ie_len */ | ||
894 | |||
895 | if (ie) | ||
896 | memcpy(skb_put(skb, ie_len), ie, ie_len); | ||
897 | 914 | ||
898 | ieee80211_tx_skb(sdata, skb, 0); | 915 | ieee80211_tx_skb(sdata, skb, 0); |
899 | } | 916 | } |