diff options
author | Johannes Berg <johannes.berg@intel.com> | 2014-08-12 15:01:28 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-08-26 05:16:02 -0400 |
commit | 5bc8c1f2b070bab82ed738f98ecfac725e33c57f (patch) | |
tree | cc5d73214736192a08d1478da050459a360bf3fd | |
parent | 0e227084aee36b3ba27b4fc9cd9e425be6ce2ab8 (diff) |
cfg80211: allow passing frame type to cfg80211_inform_bss()
When using the cfg80211_inform_bss[_width]() functions drivers
cannot currently indicate whether the data was received in a
beacon or probe response. Fix that by passing a new enum that
indicates such (or unknown).
For good measure, use it in ath6kl.
Acked-by: Kalle Valo <kvalo@qca.qualcomm.com> [ath6kl]
Acked-by: Arend van Spriel <arend@broadcom.com> [brcmfmac]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/cfg80211.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/wmi.c | 43 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/wmi.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 18 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cfg.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/scan.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/scan.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/rndis_wlan.c | 14 | ||||
-rw-r--r-- | drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 1 | ||||
-rw-r--r-- | drivers/staging/wlan-ng/cfg80211.c | 1 | ||||
-rw-r--r-- | include/net/cfg80211.h | 20 | ||||
-rw-r--r-- | net/wireless/scan.c | 15 |
13 files changed, 77 insertions, 58 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index e535807c3d89..ba60e37213eb 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c | |||
@@ -717,6 +717,7 @@ ath6kl_add_bss_if_needed(struct ath6kl_vif *vif, | |||
717 | memcpy(ie + 2, vif->ssid, vif->ssid_len); | 717 | memcpy(ie + 2, vif->ssid, vif->ssid_len); |
718 | memcpy(ie + 2 + vif->ssid_len, beacon_ie, beacon_ie_len); | 718 | memcpy(ie + 2 + vif->ssid_len, beacon_ie, beacon_ie_len); |
719 | bss = cfg80211_inform_bss(ar->wiphy, chan, | 719 | bss = cfg80211_inform_bss(ar->wiphy, chan, |
720 | CFG80211_BSS_FTYPE_UNKNOWN, | ||
720 | bssid, 0, cap_val, 100, | 721 | bssid, 0, cap_val, 100, |
721 | ie, 2 + vif->ssid_len + beacon_ie_len, | 722 | ie, 2 + vif->ssid_len + beacon_ie_len, |
722 | 0, GFP_KERNEL); | 723 | 0, GFP_KERNEL); |
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index 77fcca1f5bd6..b921005ad7ee 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c | |||
@@ -1092,7 +1092,6 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len, | |||
1092 | u8 *buf; | 1092 | u8 *buf; |
1093 | struct ieee80211_channel *channel; | 1093 | struct ieee80211_channel *channel; |
1094 | struct ath6kl *ar = wmi->parent_dev; | 1094 | struct ath6kl *ar = wmi->parent_dev; |
1095 | struct ieee80211_mgmt *mgmt; | ||
1096 | struct cfg80211_bss *bss; | 1095 | struct cfg80211_bss *bss; |
1097 | 1096 | ||
1098 | if (len <= sizeof(struct wmi_bss_info_hdr2)) | 1097 | if (len <= sizeof(struct wmi_bss_info_hdr2)) |
@@ -1138,39 +1137,15 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len, | |||
1138 | } | 1137 | } |
1139 | } | 1138 | } |
1140 | 1139 | ||
1141 | /* | 1140 | bss = cfg80211_inform_bss(ar->wiphy, channel, |
1142 | * In theory, use of cfg80211_inform_bss() would be more natural here | 1141 | bih->frame_type == BEACON_FTYPE ? |
1143 | * since we do not have the full frame. However, at least for now, | 1142 | CFG80211_BSS_FTYPE_BEACON : |
1144 | * cfg80211 can only distinguish Beacon and Probe Response frames from | 1143 | CFG80211_BSS_FTYPE_PRESP, |
1145 | * each other when using cfg80211_inform_bss_frame(), so let's build a | 1144 | bih->bssid, get_unaligned_le64((__le64 *)buf), |
1146 | * fake IEEE 802.11 header to be able to take benefit of this. | 1145 | get_unaligned_le16(((__le16 *)buf) + 5), |
1147 | */ | 1146 | get_unaligned_le16(((__le16 *)buf) + 4), |
1148 | mgmt = kmalloc(24 + len, GFP_ATOMIC); | 1147 | buf + 8 + 2 + 2, len - 8 - 2 - 2, |
1149 | if (mgmt == NULL) | 1148 | (bih->snr - 95) * 100, GFP_ATOMIC); |
1150 | return -EINVAL; | ||
1151 | |||
1152 | if (bih->frame_type == BEACON_FTYPE) { | ||
1153 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | ||
1154 | IEEE80211_STYPE_BEACON); | ||
1155 | memset(mgmt->da, 0xff, ETH_ALEN); | ||
1156 | } else { | ||
1157 | struct net_device *dev = vif->ndev; | ||
1158 | |||
1159 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | ||
1160 | IEEE80211_STYPE_PROBE_RESP); | ||
1161 | memcpy(mgmt->da, dev->dev_addr, ETH_ALEN); | ||
1162 | } | ||
1163 | mgmt->duration = cpu_to_le16(0); | ||
1164 | memcpy(mgmt->sa, bih->bssid, ETH_ALEN); | ||
1165 | memcpy(mgmt->bssid, bih->bssid, ETH_ALEN); | ||
1166 | mgmt->seq_ctrl = cpu_to_le16(0); | ||
1167 | |||
1168 | memcpy(&mgmt->u.beacon, buf, len); | ||
1169 | |||
1170 | bss = cfg80211_inform_bss_frame(ar->wiphy, channel, mgmt, | ||
1171 | 24 + len, (bih->snr - 95) * 100, | ||
1172 | GFP_ATOMIC); | ||
1173 | kfree(mgmt); | ||
1174 | if (bss == NULL) | 1149 | if (bss == NULL) |
1175 | return -ENOMEM; | 1150 | return -ENOMEM; |
1176 | cfg80211_put_bss(ar->wiphy, bss); | 1151 | cfg80211_put_bss(ar->wiphy, bss); |
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c index 335bc38325db..960b66fc1430 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c | |||
@@ -346,7 +346,7 @@ static void wmi_evt_rx_mgmt(struct wil6210_priv *wil, int id, void *d, int len) | |||
346 | rx_mgmt_frame->bssid); | 346 | rx_mgmt_frame->bssid); |
347 | cfg80211_put_bss(wiphy, bss); | 347 | cfg80211_put_bss(wiphy, bss); |
348 | } else { | 348 | } else { |
349 | wil_err(wil, "cfg80211_inform_bss() failed\n"); | 349 | wil_err(wil, "cfg80211_inform_bss_frame() failed\n"); |
350 | } | 350 | } |
351 | } else { | 351 | } else { |
352 | cfg80211_rx_mgmt(wil->wdev, freq, signal, | 352 | cfg80211_rx_mgmt(wil->wdev, freq, signal, |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 02fe706fc9ec..12a60ca1462a 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -2394,9 +2394,13 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg, | |||
2394 | brcmf_dbg(CONN, "Beacon interval: %d\n", notify_interval); | 2394 | brcmf_dbg(CONN, "Beacon interval: %d\n", notify_interval); |
2395 | brcmf_dbg(CONN, "Signal: %d\n", notify_signal); | 2395 | brcmf_dbg(CONN, "Signal: %d\n", notify_signal); |
2396 | 2396 | ||
2397 | bss = cfg80211_inform_bss(wiphy, notify_channel, (const u8 *)bi->BSSID, | 2397 | bss = cfg80211_inform_bss(wiphy, notify_channel, |
2398 | 0, notify_capability, notify_interval, notify_ie, | 2398 | CFG80211_BSS_FTYPE_UNKNOWN, |
2399 | notify_ielen, notify_signal, GFP_KERNEL); | 2399 | (const u8 *)bi->BSSID, |
2400 | 0, notify_capability, | ||
2401 | notify_interval, notify_ie, | ||
2402 | notify_ielen, notify_signal, | ||
2403 | GFP_KERNEL); | ||
2400 | 2404 | ||
2401 | if (!bss) | 2405 | if (!bss) |
2402 | return -ENOMEM; | 2406 | return -ENOMEM; |
@@ -2498,9 +2502,11 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_info *cfg, | |||
2498 | brcmf_dbg(CONN, "beacon interval: %d\n", notify_interval); | 2502 | brcmf_dbg(CONN, "beacon interval: %d\n", notify_interval); |
2499 | brcmf_dbg(CONN, "signal: %d\n", notify_signal); | 2503 | brcmf_dbg(CONN, "signal: %d\n", notify_signal); |
2500 | 2504 | ||
2501 | bss = cfg80211_inform_bss(wiphy, notify_channel, bssid, | 2505 | bss = cfg80211_inform_bss(wiphy, notify_channel, |
2502 | 0, notify_capability, notify_interval, | 2506 | CFG80211_BSS_FTYPE_UNKNOWN, bssid, 0, |
2503 | notify_ie, notify_ielen, notify_signal, GFP_KERNEL); | 2507 | notify_capability, notify_interval, |
2508 | notify_ie, notify_ielen, notify_signal, | ||
2509 | GFP_KERNEL); | ||
2504 | 2510 | ||
2505 | if (!bss) { | 2511 | if (!bss) { |
2506 | err = -ENOMEM; | 2512 | err = -ENOMEM; |
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 47a998d8f99e..22884ba7d6cc 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c | |||
@@ -653,6 +653,7 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy, | |||
653 | if (channel && | 653 | if (channel && |
654 | !(channel->flags & IEEE80211_CHAN_DISABLED)) { | 654 | !(channel->flags & IEEE80211_CHAN_DISABLED)) { |
655 | bss = cfg80211_inform_bss(wiphy, channel, | 655 | bss = cfg80211_inform_bss(wiphy, channel, |
656 | CFG80211_BSS_FTYPE_UNKNOWN, | ||
656 | bssid, get_unaligned_le64(tsfdesc), | 657 | bssid, get_unaligned_le64(tsfdesc), |
657 | capa, intvl, ie, ielen, | 658 | capa, intvl, ie, ielen, |
658 | LBS_SCAN_RSSI_TO_MBM(rssi), | 659 | LBS_SCAN_RSSI_TO_MBM(rssi), |
@@ -1754,6 +1755,7 @@ static void lbs_join_post(struct lbs_private *priv, | |||
1754 | 1755 | ||
1755 | bss = cfg80211_inform_bss(priv->wdev->wiphy, | 1756 | bss = cfg80211_inform_bss(priv->wdev->wiphy, |
1756 | params->chandef.chan, | 1757 | params->chandef.chan, |
1758 | CFG80211_BSS_FTYPE_UNKNOWN, | ||
1757 | bssid, | 1759 | bssid, |
1758 | 0, | 1760 | 0, |
1759 | capability, | 1761 | capability, |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index e2e6bf13c2d8..15f994f3b4ce 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -1557,6 +1557,7 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv) | |||
1557 | band)); | 1557 | band)); |
1558 | 1558 | ||
1559 | bss = cfg80211_inform_bss(priv->wdev->wiphy, chan, | 1559 | bss = cfg80211_inform_bss(priv->wdev->wiphy, chan, |
1560 | CFG80211_BSS_FTYPE_UNKNOWN, | ||
1560 | bss_info.bssid, 0, WLAN_CAPABILITY_IBSS, | 1561 | bss_info.bssid, 0, WLAN_CAPABILITY_IBSS, |
1561 | 0, ie_buf, ie_len, 0, GFP_KERNEL); | 1562 | 0, ie_buf, ie_len, 0, GFP_KERNEL); |
1562 | cfg80211_put_bss(priv->wdev->wiphy, bss); | 1563 | cfg80211_put_bss(priv->wdev->wiphy, bss); |
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index dee717a19ddb..195ef0ca343f 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -1719,7 +1719,8 @@ mwifiex_parse_single_response_buf(struct mwifiex_private *priv, u8 **bss_info, | |||
1719 | 1719 | ||
1720 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { | 1720 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { |
1721 | bss = cfg80211_inform_bss(priv->wdev->wiphy, | 1721 | bss = cfg80211_inform_bss(priv->wdev->wiphy, |
1722 | chan, bssid, timestamp, | 1722 | chan, CFG80211_BSS_FTYPE_UNKNOWN, |
1723 | bssid, timestamp, | ||
1723 | cap_info_bitmap, beacon_period, | 1724 | cap_info_bitmap, beacon_period, |
1724 | ie_buf, ie_len, rssi, GFP_KERNEL); | 1725 | ie_buf, ie_len, rssi, GFP_KERNEL); |
1725 | bss_priv = (struct mwifiex_bss_priv *)bss->priv; | 1726 | bss_priv = (struct mwifiex_bss_priv *)bss->priv; |
diff --git a/drivers/net/wireless/orinoco/scan.c b/drivers/net/wireless/orinoco/scan.c index e175b9b8561b..2c66166add70 100644 --- a/drivers/net/wireless/orinoco/scan.c +++ b/drivers/net/wireless/orinoco/scan.c | |||
@@ -123,9 +123,10 @@ static void orinoco_add_hostscan_result(struct orinoco_private *priv, | |||
123 | beacon_interval = le16_to_cpu(bss->a.beacon_interv); | 123 | beacon_interval = le16_to_cpu(bss->a.beacon_interv); |
124 | signal = SIGNAL_TO_MBM(le16_to_cpu(bss->a.level)); | 124 | signal = SIGNAL_TO_MBM(le16_to_cpu(bss->a.level)); |
125 | 125 | ||
126 | cbss = cfg80211_inform_bss(wiphy, channel, bss->a.bssid, timestamp, | 126 | cbss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, |
127 | capability, beacon_interval, ie_buf, ie_len, | 127 | bss->a.bssid, timestamp, capability, |
128 | signal, GFP_KERNEL); | 128 | beacon_interval, ie_buf, ie_len, signal, |
129 | GFP_KERNEL); | ||
129 | cfg80211_put_bss(wiphy, cbss); | 130 | cfg80211_put_bss(wiphy, cbss); |
130 | } | 131 | } |
131 | 132 | ||
@@ -156,9 +157,10 @@ void orinoco_add_extscan_result(struct orinoco_private *priv, | |||
156 | ie = bss->data; | 157 | ie = bss->data; |
157 | signal = SIGNAL_TO_MBM(bss->level); | 158 | signal = SIGNAL_TO_MBM(bss->level); |
158 | 159 | ||
159 | cbss = cfg80211_inform_bss(wiphy, channel, bss->bssid, timestamp, | 160 | cbss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, |
160 | capability, beacon_interval, ie, ie_len, | 161 | bss->bssid, timestamp, capability, |
161 | signal, GFP_KERNEL); | 162 | beacon_interval, ie, ie_len, signal, |
163 | GFP_KERNEL); | ||
162 | cfg80211_put_bss(wiphy, cbss); | 164 | cfg80211_put_bss(wiphy, cbss); |
163 | } | 165 | } |
164 | 166 | ||
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index d2a9a08210be..1a4facd1fbf3 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -2022,9 +2022,10 @@ static bool rndis_bss_info_update(struct usbnet *usbdev, | |||
2022 | capability = le16_to_cpu(fixed->capabilities); | 2022 | capability = le16_to_cpu(fixed->capabilities); |
2023 | beacon_interval = le16_to_cpu(fixed->beacon_interval); | 2023 | beacon_interval = le16_to_cpu(fixed->beacon_interval); |
2024 | 2024 | ||
2025 | bss = cfg80211_inform_bss(priv->wdev.wiphy, channel, bssid->mac, | 2025 | bss = cfg80211_inform_bss(priv->wdev.wiphy, channel, |
2026 | timestamp, capability, beacon_interval, ie, ie_len, signal, | 2026 | CFG80211_BSS_FTYPE_UNKNOWN, bssid->mac, |
2027 | GFP_KERNEL); | 2027 | timestamp, capability, beacon_interval, |
2028 | ie, ie_len, signal, GFP_KERNEL); | ||
2028 | cfg80211_put_bss(priv->wdev.wiphy, bss); | 2029 | cfg80211_put_bss(priv->wdev.wiphy, bss); |
2029 | 2030 | ||
2030 | return (bss != NULL); | 2031 | return (bss != NULL); |
@@ -2711,9 +2712,10 @@ static void rndis_wlan_craft_connected_bss(struct usbnet *usbdev, u8 *bssid, | |||
2711 | bssid, (u32)timestamp, capability, beacon_period, ie_len, | 2712 | bssid, (u32)timestamp, capability, beacon_period, ie_len, |
2712 | ssid.essid, signal); | 2713 | ssid.essid, signal); |
2713 | 2714 | ||
2714 | bss = cfg80211_inform_bss(priv->wdev.wiphy, channel, bssid, | 2715 | bss = cfg80211_inform_bss(priv->wdev.wiphy, channel, |
2715 | timestamp, capability, beacon_period, ie_buf, ie_len, | 2716 | CFG80211_BSS_FTYPE_UNKNOWN, bssid, |
2716 | signal, GFP_KERNEL); | 2717 | timestamp, capability, beacon_period, |
2718 | ie_buf, ie_len, signal, GFP_KERNEL); | ||
2717 | cfg80211_put_bss(priv->wdev.wiphy, bss); | 2719 | cfg80211_put_bss(priv->wdev.wiphy, bss); |
2718 | } | 2720 | } |
2719 | 2721 | ||
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index 2d6d7d1a5b7d..8b0ccb5c5fc4 100644 --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | |||
@@ -279,6 +279,7 @@ static int rtw_cfg80211_inform_bss(struct rtw_adapter *padapter, | |||
279 | } | 279 | } |
280 | 280 | ||
281 | bss = cfg80211_inform_bss(wiphy, notify_channel, | 281 | bss = cfg80211_inform_bss(wiphy, notify_channel, |
282 | CFG80211_BSS_FTYPE_UNKNOWN, | ||
282 | pnetwork->network.MacAddress, | 283 | pnetwork->network.MacAddress, |
283 | pnetwork->network.tsf, | 284 | pnetwork->network.tsf, |
284 | pnetwork->network.capability, | 285 | pnetwork->network.capability, |
diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c index 3727f6d25cf1..8942dcb44180 100644 --- a/drivers/staging/wlan-ng/cfg80211.c +++ b/drivers/staging/wlan-ng/cfg80211.c | |||
@@ -422,6 +422,7 @@ static int prism2_scan(struct wiphy *wiphy, | |||
422 | IEEE80211_BAND_2GHZ); | 422 | IEEE80211_BAND_2GHZ); |
423 | bss = cfg80211_inform_bss(wiphy, | 423 | bss = cfg80211_inform_bss(wiphy, |
424 | ieee80211_get_channel(wiphy, freq), | 424 | ieee80211_get_channel(wiphy, freq), |
425 | CFG80211_BSS_FTYPE_UNKNOWN, | ||
425 | (const u8 *) &(msg2.bssid.data.data), | 426 | (const u8 *) &(msg2.bssid.data.data), |
426 | msg2.timestamp.data, msg2.capinfo.data, | 427 | msg2.timestamp.data, msg2.capinfo.data, |
427 | msg2.beaconperiod.data, | 428 | msg2.beaconperiod.data, |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 77b85a89abca..ab21299c8f4d 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -3767,11 +3767,25 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, | |||
3767 | } | 3767 | } |
3768 | 3768 | ||
3769 | /** | 3769 | /** |
3770 | * cfg80211_inform_bss - inform cfg80211 of a new BSS | 3770 | * enum cfg80211_bss_frame_type - frame type that the BSS data came from |
3771 | * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is | ||
3772 | * from a beacon or probe response | ||
3773 | * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon | ||
3774 | * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response | ||
3775 | */ | ||
3776 | enum cfg80211_bss_frame_type { | ||
3777 | CFG80211_BSS_FTYPE_UNKNOWN, | ||
3778 | CFG80211_BSS_FTYPE_BEACON, | ||
3779 | CFG80211_BSS_FTYPE_PRESP, | ||
3780 | }; | ||
3781 | |||
3782 | /** | ||
3783 | * cfg80211_inform_bss_width - inform cfg80211 of a new BSS | ||
3771 | * | 3784 | * |
3772 | * @wiphy: the wiphy reporting the BSS | 3785 | * @wiphy: the wiphy reporting the BSS |
3773 | * @rx_channel: The channel the frame was received on | 3786 | * @rx_channel: The channel the frame was received on |
3774 | * @scan_width: width of the control channel | 3787 | * @scan_width: width of the control channel |
3788 | * @ftype: frame type (if known) | ||
3775 | * @bssid: the BSSID of the BSS | 3789 | * @bssid: the BSSID of the BSS |
3776 | * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) | 3790 | * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) |
3777 | * @capability: the capability field sent by the peer | 3791 | * @capability: the capability field sent by the peer |
@@ -3791,6 +3805,7 @@ struct cfg80211_bss * __must_check | |||
3791 | cfg80211_inform_bss_width(struct wiphy *wiphy, | 3805 | cfg80211_inform_bss_width(struct wiphy *wiphy, |
3792 | struct ieee80211_channel *rx_channel, | 3806 | struct ieee80211_channel *rx_channel, |
3793 | enum nl80211_bss_scan_width scan_width, | 3807 | enum nl80211_bss_scan_width scan_width, |
3808 | enum cfg80211_bss_frame_type ftype, | ||
3794 | const u8 *bssid, u64 tsf, u16 capability, | 3809 | const u8 *bssid, u64 tsf, u16 capability, |
3795 | u16 beacon_interval, const u8 *ie, size_t ielen, | 3810 | u16 beacon_interval, const u8 *ie, size_t ielen, |
3796 | s32 signal, gfp_t gfp); | 3811 | s32 signal, gfp_t gfp); |
@@ -3798,12 +3813,13 @@ cfg80211_inform_bss_width(struct wiphy *wiphy, | |||
3798 | static inline struct cfg80211_bss * __must_check | 3813 | static inline struct cfg80211_bss * __must_check |
3799 | cfg80211_inform_bss(struct wiphy *wiphy, | 3814 | cfg80211_inform_bss(struct wiphy *wiphy, |
3800 | struct ieee80211_channel *rx_channel, | 3815 | struct ieee80211_channel *rx_channel, |
3816 | enum cfg80211_bss_frame_type ftype, | ||
3801 | const u8 *bssid, u64 tsf, u16 capability, | 3817 | const u8 *bssid, u64 tsf, u16 capability, |
3802 | u16 beacon_interval, const u8 *ie, size_t ielen, | 3818 | u16 beacon_interval, const u8 *ie, size_t ielen, |
3803 | s32 signal, gfp_t gfp) | 3819 | s32 signal, gfp_t gfp) |
3804 | { | 3820 | { |
3805 | return cfg80211_inform_bss_width(wiphy, rx_channel, | 3821 | return cfg80211_inform_bss_width(wiphy, rx_channel, |
3806 | NL80211_BSS_CHAN_WIDTH_20, | 3822 | NL80211_BSS_CHAN_WIDTH_20, ftype, |
3807 | bssid, tsf, capability, | 3823 | bssid, tsf, capability, |
3808 | beacon_interval, ie, ielen, signal, | 3824 | beacon_interval, ie, ielen, signal, |
3809 | gfp); | 3825 | gfp); |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index ad1a1a2808d3..620a4b40d466 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -884,6 +884,7 @@ struct cfg80211_bss* | |||
884 | cfg80211_inform_bss_width(struct wiphy *wiphy, | 884 | cfg80211_inform_bss_width(struct wiphy *wiphy, |
885 | struct ieee80211_channel *rx_channel, | 885 | struct ieee80211_channel *rx_channel, |
886 | enum nl80211_bss_scan_width scan_width, | 886 | enum nl80211_bss_scan_width scan_width, |
887 | enum cfg80211_bss_frame_type ftype, | ||
887 | const u8 *bssid, u64 tsf, u16 capability, | 888 | const u8 *bssid, u64 tsf, u16 capability, |
888 | u16 beacon_interval, const u8 *ie, size_t ielen, | 889 | u16 beacon_interval, const u8 *ie, size_t ielen, |
889 | s32 signal, gfp_t gfp) | 890 | s32 signal, gfp_t gfp) |
@@ -911,7 +912,7 @@ cfg80211_inform_bss_width(struct wiphy *wiphy, | |||
911 | tmp.pub.beacon_interval = beacon_interval; | 912 | tmp.pub.beacon_interval = beacon_interval; |
912 | tmp.pub.capability = capability; | 913 | tmp.pub.capability = capability; |
913 | /* | 914 | /* |
914 | * Since we do not know here whether the IEs are from a Beacon or Probe | 915 | * If we do not know here whether the IEs are from a Beacon or Probe |
915 | * Response frame, we need to pick one of the options and only use it | 916 | * Response frame, we need to pick one of the options and only use it |
916 | * with the driver that does not provide the full Beacon/Probe Response | 917 | * with the driver that does not provide the full Beacon/Probe Response |
917 | * frame. Use Beacon frame pointer to avoid indicating that this should | 918 | * frame. Use Beacon frame pointer to avoid indicating that this should |
@@ -926,7 +927,17 @@ cfg80211_inform_bss_width(struct wiphy *wiphy, | |||
926 | ies->from_beacon = false; | 927 | ies->from_beacon = false; |
927 | memcpy(ies->data, ie, ielen); | 928 | memcpy(ies->data, ie, ielen); |
928 | 929 | ||
929 | rcu_assign_pointer(tmp.pub.beacon_ies, ies); | 930 | switch (ftype) { |
931 | case CFG80211_BSS_FTYPE_BEACON: | ||
932 | ies->from_beacon = true; | ||
933 | /* fall through to assign */ | ||
934 | case CFG80211_BSS_FTYPE_UNKNOWN: | ||
935 | rcu_assign_pointer(tmp.pub.beacon_ies, ies); | ||
936 | break; | ||
937 | case CFG80211_BSS_FTYPE_PRESP: | ||
938 | rcu_assign_pointer(tmp.pub.proberesp_ies, ies); | ||
939 | break; | ||
940 | } | ||
930 | rcu_assign_pointer(tmp.pub.ies, ies); | 941 | rcu_assign_pointer(tmp.pub.ies, ies); |
931 | 942 | ||
932 | signal_valid = abs(rx_channel->center_freq - channel->center_freq) <= | 943 | signal_valid = abs(rx_channel->center_freq - channel->center_freq) <= |