History

Merge tag 'mac80211-next-for-davem-2016-10-28' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next

Johannes Berg says: ==================== Among various cleanups and improvements, we have the following: * client FILS authentication support in mac80211 (Jouni) * AP/VLAN multicast improvements (Michael Braun) * config/advertising support for differing beacon intervals on multiple virtual interfaces (Purushottam Kushwaha, myself) * deprecate the old WDS mode for cfg80211-based drivers, the mode is hardly usable since it doesn't support any "modern" features like WPA encryption (2003), HT (2009) or VHT (2014), I'm not even sure WEP (introduced in 1997) could be done. ====================

David S. Miller committed 10 years ago

Commit 32ab0a32 parents 9769905 514877145 files · +1383 −421Browse files

Unified · Split

45 files
  1. Documentation/networking/mac80211_hwsim/README +1 −1
  2. drivers/net/wireless/Kconfig +13 −0
  3. drivers/net/wireless/ath/ath10k/mac.c +1 −0
  4. drivers/net/wireless/ath/ath9k/init.c +6 −0
  5. drivers/net/wireless/broadcom/b43/main.c +2 −0
  6. drivers/net/wireless/broadcom/b43legacy/main.c +2 −0
  7. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +12 −10
  8. drivers/net/wireless/mac80211_hwsim.c +40 −39
  9. drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +4 −2
  10. drivers/net/wireless/ti/wlcore/main.c +1 −0
  11. include/linux/ieee80211.h +26 −0
  12. include/net/cfg80211.h +117 −33
  13. include/net/ieee80211_radiotap.h +2 −2
  14. include/net/mac80211.h +15 −4
  15. include/uapi/linux/nl80211.h +64 −5
  16. net/mac80211/Makefile +1 −0
  17. net/mac80211/aes_cmac.c +4 −4
  18. net/mac80211/aes_cmac.h +4 −0
  19. net/mac80211/agg-rx.c +2 −6
  20. net/mac80211/cfg.c +9 −26
  21. net/mac80211/debugfs.c +1 −0
  22. net/mac80211/debugfs_netdev.c +11 −0
  23. net/mac80211/debugfs_sta.c +7 −2
  24. net/mac80211/fils_aead.c +342 −0
  25. net/mac80211/fils_aead.h +19 −0
  26. net/mac80211/ieee80211_i.h +25 −1
  27. net/mac80211/iface.c +16 −0
  28. net/mac80211/main.c +5 −0
  29. net/mac80211/mlme.c +51 −9
  30. net/mac80211/rx.c +7 −4
  31. net/mac80211/sta_info.c +10 −13
  32. net/mac80211/sta_info.h +2 −2
  33. net/mac80211/tx.c +40 −15
  34. net/mac80211/util.c +37 −24
  35. net/mac80211/wme.c +16 −7
  36. net/mac80211/wpa.c +1 −1
  37. net/wireless/core.c +29 −4
  38. net/wireless/core.h +2 −2
  39. net/wireless/mesh.c +2 −0
  40. net/wireless/mlme.c +3 −3
  41. net/wireless/nl80211.c +273 −172
  42. net/wireless/rdev-ops.h +24 −0
  43. net/wireless/sme.c +1 −1
  44. net/wireless/trace.h +37 −0
  45. net/wireless/util.c +96 −29
Documentation/networking/mac80211_hwsim/README+1−1
@@ -60,7 +60,7 @@ modprobe mac80211_hwsim · 59 unmodified lines
60hostapd hostapd.conf60hostapd hostapd.conf
61 61
62# Run wpa_supplicant (station) for wlan162# Run wpa_supplicant (station) for wlan1
63wpa_supplicant -Dwext -iwlan1 -c wpa_supplicant.conf63wpa_supplicant -Dnl80211 -iwlan1 -c wpa_supplicant.conf
64 64
65 65
66More test cases are available in hostap.git:66More test cases are available in hostap.git:
drivers/net/wireless/Kconfig+13−0
@@ -17,6 +17,19 @@ menuconfig WLAN · 16 unmodified lines
17 17
18if WLAN18if WLAN
19 19
20config WIRELESS_WDS
21 bool "mac80211-based legacy WDS support" if EXPERT
22 help
23 This option enables the deprecated WDS support, the newer
24 mac80211-based 4-addr AP/client support supersedes it with
25 a much better feature set (HT, VHT, ...)
26
27 We plan to remove this option and code, so if you find
28 that you have to enable it, please let us know on the
29 linux-wireless@vger.kernel.org mailing list, so we can
30 help you migrate to 4-addr AP/client (or, if it's really
31 necessary, give up on our plan of removing it).
32
20source "drivers/net/wireless/admtek/Kconfig"33source "drivers/net/wireless/admtek/Kconfig"
21source "drivers/net/wireless/ath/Kconfig"34source "drivers/net/wireless/ath/Kconfig"
22source "drivers/net/wireless/atmel/Kconfig"35source "drivers/net/wireless/atmel/Kconfig"
drivers/net/wireless/ath/ath10k/mac.c+1−0
@@ -7881,6 +7881,7 @@ int ath10k_mac_register(struct ath10k *ar) · 7880 unmodified lines
7881 ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF);7881 ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF);
7882 ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA);7882 ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA);
7883 ieee80211_hw_set(ar->hw, QUEUE_CONTROL);7883 ieee80211_hw_set(ar->hw, QUEUE_CONTROL);
7884 ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG);
7884 7885
7885 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags))7886 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags))
7886 ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL);7887 ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL);
drivers/net/wireless/ath/ath9k/init.c+6−0
@@ -734,9 +734,11 @@ static const struct ieee80211_iface_limit if_limits[] = { · 733 unmodified lines
734 BIT(NL80211_IFTYPE_P2P_GO) },734 BIT(NL80211_IFTYPE_P2P_GO) },
735};735};
736 736
737#ifdef CONFIG_WIRELESS_WDS
737static const struct ieee80211_iface_limit wds_limits[] = {738static const struct ieee80211_iface_limit wds_limits[] = {
738 { .max = 2048, .types = BIT(NL80211_IFTYPE_WDS) },739 { .max = 2048, .types = BIT(NL80211_IFTYPE_WDS) },
739};740};
741#endif
740 742
741#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT743#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
742 744
@@ -774,6 +776,7 @@ static const struct ieee80211_iface_combination if_comb[] = { · 31 unmodified lines
774 BIT(NL80211_CHAN_WIDTH_40),776 BIT(NL80211_CHAN_WIDTH_40),
775#endif777#endif
776 },778 },
779#ifdef CONFIG_WIRELESS_WDS
777 {780 {
778 .limits = wds_limits,781 .limits = wds_limits,
779 .n_limits = ARRAY_SIZE(wds_limits),782 .n_limits = ARRAY_SIZE(wds_limits),
@@ -781,6 +784,7 @@ static const struct ieee80211_iface_combination if_comb[] = { · 1 unmodified line
781 .num_different_channels = 1,784 .num_different_channels = 1,
782 .beacon_int_infra_match = true,785 .beacon_int_infra_match = true,
783 },786 },
787#endif
784};788};
785 789
786#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT790#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
@@ -851,7 +855,9 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) · 64 unmodified lines
851 BIT(NL80211_IFTYPE_STATION) |855 BIT(NL80211_IFTYPE_STATION) |
852 BIT(NL80211_IFTYPE_ADHOC) |856 BIT(NL80211_IFTYPE_ADHOC) |
853 BIT(NL80211_IFTYPE_MESH_POINT) |857 BIT(NL80211_IFTYPE_MESH_POINT) |
858#ifdef CONFIG_WIRELESS_WDS
854 BIT(NL80211_IFTYPE_WDS) |859 BIT(NL80211_IFTYPE_WDS) |
860#endif
855 BIT(NL80211_IFTYPE_OCB);861 BIT(NL80211_IFTYPE_OCB);
856 862
857 if (ath9k_is_chanctx_enabled())863 if (ath9k_is_chanctx_enabled())
drivers/net/wireless/broadcom/b43/main.c+2−0
@@ -5591,7 +5591,9 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev) · 5590 unmodified lines
5591 BIT(NL80211_IFTYPE_AP) |5591 BIT(NL80211_IFTYPE_AP) |
5592 BIT(NL80211_IFTYPE_MESH_POINT) |5592 BIT(NL80211_IFTYPE_MESH_POINT) |
5593 BIT(NL80211_IFTYPE_STATION) |5593 BIT(NL80211_IFTYPE_STATION) |
5594#ifdef CONFIG_WIRELESS_WDS
5594 BIT(NL80211_IFTYPE_WDS) |5595 BIT(NL80211_IFTYPE_WDS) |
5596#endif
5595 BIT(NL80211_IFTYPE_ADHOC);5597 BIT(NL80211_IFTYPE_ADHOC);
5596 5598
5597 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;5599 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
drivers/net/wireless/broadcom/b43legacy/main.c+2−0
@@ -3838,7 +3838,9 @@ static int b43legacy_wireless_init(struct ssb_device *dev) · 3837 unmodified lines
3838 hw->wiphy->interface_modes =3838 hw->wiphy->interface_modes =
3839 BIT(NL80211_IFTYPE_AP) |3839 BIT(NL80211_IFTYPE_AP) |
3840 BIT(NL80211_IFTYPE_STATION) |3840 BIT(NL80211_IFTYPE_STATION) |
3841#ifdef CONFIG_WIRELESS_WDS
3841 BIT(NL80211_IFTYPE_WDS) |3842 BIT(NL80211_IFTYPE_WDS) |
3843#endif
3842 BIT(NL80211_IFTYPE_ADHOC);3844 BIT(NL80211_IFTYPE_ADHOC);
3843 hw->queues = 1; /* FIXME: hardware has more queues */3845 hw->queues = 1; /* FIXME: hardware has more queues */
3844 hw->max_rates = 2;3846 hw->max_rates = 2;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c+12−10
@@ -414,23 +414,24 @@ static int brcmf_vif_change_validate(struct brcmf_cfg80211_info *cfg, · 413 unmodified lines
414 struct brcmf_cfg80211_vif *vif,414 struct brcmf_cfg80211_vif *vif,
415 enum nl80211_iftype new_type)415 enum nl80211_iftype new_type)
416{416{
417 int iftype_num[NUM_NL80211_IFTYPES];
418 struct brcmf_cfg80211_vif *pos;417 struct brcmf_cfg80211_vif *pos;
419 bool check_combos = false;418 bool check_combos = false;
420 int ret = 0;419 int ret = 0;
420 struct iface_combination_params params = {
421 .num_different_channels = 1,
422 };
421 423
422 memset(&iftype_num[0], 0, sizeof(iftype_num));
423 list_for_each_entry(pos, &cfg->vif_list, list)424 list_for_each_entry(pos, &cfg->vif_list, list)
424 if (pos == vif) {425 if (pos == vif) {
425 iftype_num[new_type]++;426 params.iftype_num[new_type]++;
426 } else {427 } else {
427 /* concurrent interfaces so need check combinations */428 /* concurrent interfaces so need check combinations */
428 check_combos = true;429 check_combos = true;
429 iftype_num[pos->wdev.iftype]++;430 params.iftype_num[pos->wdev.iftype]++;
430 }431 }
431 432
432 if (check_combos)433 if (check_combos)
433 ret = cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);434 ret = cfg80211_check_combinations(cfg->wiphy, &params);
434 435
435 return ret;436 return ret;
436}437}
@@ -438,15 +439,16 @@ static int brcmf_vif_change_validate(struct brcmf_cfg80211_info *cfg, · 1 unmodified line
438static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,439static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,
439 enum nl80211_iftype new_type)440 enum nl80211_iftype new_type)
440{441{
441 int iftype_num[NUM_NL80211_IFTYPES];
442 struct brcmf_cfg80211_vif *pos;442 struct brcmf_cfg80211_vif *pos;
443 struct iface_combination_params params = {
444 .num_different_channels = 1,
445 };
443 446
444 memset(&iftype_num[0], 0, sizeof(iftype_num));
445 list_for_each_entry(pos, &cfg->vif_list, list)447 list_for_each_entry(pos, &cfg->vif_list, list)
446 iftype_num[pos->wdev.iftype]++;448 params.iftype_num[pos->wdev.iftype]++;
447 449
448 iftype_num[new_type]++;450 params.iftype_num[new_type]++;
449 return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);451 return cfg80211_check_combinations(cfg->wiphy, &params);
450}452}
451 453
452static void convert_key_from_CPU(struct brcmf_wsec_key *key,454static void convert_key_from_CPU(struct brcmf_wsec_key *key,
drivers/net/wireless/mac80211_hwsim.c+40−39
@@ -2249,35 +2249,51 @@ static void mac80211_hwsim_get_et_stats(struct ieee80211_hw *hw, · 2248 unmodified lines
2249 WARN_ON(i != MAC80211_HWSIM_SSTATS_LEN);2249 WARN_ON(i != MAC80211_HWSIM_SSTATS_LEN);
2250}2250}
2251 2251
2252#define HWSIM_COMMON_OPS \
2253 .tx = mac80211_hwsim_tx, \
2254 .start = mac80211_hwsim_start, \
2255 .stop = mac80211_hwsim_stop, \
2256 .add_interface = mac80211_hwsim_add_interface, \
2257 .change_interface = mac80211_hwsim_change_interface, \
2258 .remove_interface = mac80211_hwsim_remove_interface, \
2259 .config = mac80211_hwsim_config, \
2260 .configure_filter = mac80211_hwsim_configure_filter, \
2261 .bss_info_changed = mac80211_hwsim_bss_info_changed, \
2262 .sta_add = mac80211_hwsim_sta_add, \
2263 .sta_remove = mac80211_hwsim_sta_remove, \
2264 .sta_notify = mac80211_hwsim_sta_notify, \
2265 .set_tim = mac80211_hwsim_set_tim, \
2266 .conf_tx = mac80211_hwsim_conf_tx, \
2267 .get_survey = mac80211_hwsim_get_survey, \
2268 CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd) \
2269 .ampdu_action = mac80211_hwsim_ampdu_action, \
2270 .flush = mac80211_hwsim_flush, \
2271 .get_tsf = mac80211_hwsim_get_tsf, \
2272 .set_tsf = mac80211_hwsim_set_tsf, \
2273 .get_et_sset_count = mac80211_hwsim_get_et_sset_count, \
2274 .get_et_stats = mac80211_hwsim_get_et_stats, \
2275 .get_et_strings = mac80211_hwsim_get_et_strings,
2276
2252static const struct ieee80211_ops mac80211_hwsim_ops = {2277static const struct ieee80211_ops mac80211_hwsim_ops = {
2253 .tx = mac80211_hwsim_tx,2278 HWSIM_COMMON_OPS
2254 .start = mac80211_hwsim_start,
2255 .stop = mac80211_hwsim_stop,
2256 .add_interface = mac80211_hwsim_add_interface,
2257 .change_interface = mac80211_hwsim_change_interface,
2258 .remove_interface = mac80211_hwsim_remove_interface,
2259 .config = mac80211_hwsim_config,
2260 .configure_filter = mac80211_hwsim_configure_filter,
2261 .bss_info_changed = mac80211_hwsim_bss_info_changed,
2262 .sta_add = mac80211_hwsim_sta_add,
2263 .sta_remove = mac80211_hwsim_sta_remove,
2264 .sta_notify = mac80211_hwsim_sta_notify,
2265 .set_tim = mac80211_hwsim_set_tim,
2266 .conf_tx = mac80211_hwsim_conf_tx,
2267 .get_survey = mac80211_hwsim_get_survey,
2268 CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd)
2269 .ampdu_action = mac80211_hwsim_ampdu_action,
2270 .sw_scan_start = mac80211_hwsim_sw_scan,2279 .sw_scan_start = mac80211_hwsim_sw_scan,
2271 .sw_scan_complete = mac80211_hwsim_sw_scan_complete,2280 .sw_scan_complete = mac80211_hwsim_sw_scan_complete,
2272 .flush = mac80211_hwsim_flush,
2273 .get_tsf = mac80211_hwsim_get_tsf,
2274 .set_tsf = mac80211_hwsim_set_tsf,
2275 .get_et_sset_count = mac80211_hwsim_get_et_sset_count,
2276 .get_et_stats = mac80211_hwsim_get_et_stats,
2277 .get_et_strings = mac80211_hwsim_get_et_strings,
2278};2281};
2279 2282
2280static struct ieee80211_ops mac80211_hwsim_mchan_ops;2283static const struct ieee80211_ops mac80211_hwsim_mchan_ops = {
2284 HWSIM_COMMON_OPS
2285 .hw_scan = mac80211_hwsim_hw_scan,
2286 .cancel_hw_scan = mac80211_hwsim_cancel_hw_scan,
2287 .sw_scan_start = NULL,
2288 .sw_scan_complete = NULL,
2289 .remain_on_channel = mac80211_hwsim_roc,
2290 .cancel_remain_on_channel = mac80211_hwsim_croc,
2291 .add_chanctx = mac80211_hwsim_add_chanctx,
2292 .remove_chanctx = mac80211_hwsim_remove_chanctx,
2293 .change_chanctx = mac80211_hwsim_change_chanctx,
2294 .assign_vif_chanctx = mac80211_hwsim_assign_vif_chanctx,
2295 .unassign_vif_chanctx = mac80211_hwsim_unassign_vif_chanctx,
2296};
2281 2297
2282struct hwsim_new_radio_params {2298struct hwsim_new_radio_params {
2283 unsigned int channels;2299 unsigned int channels;
@@ -3362,21 +3378,6 @@ static int __init init_mac80211_hwsim(void) · 1078 unmodified lines
3362 if (channels < 1)3378 if (channels < 1)
3363 return -EINVAL;3379 return -EINVAL;
3364 3380
3365 mac80211_hwsim_mchan_ops = mac80211_hwsim_ops;
3366 mac80211_hwsim_mchan_ops.hw_scan = mac80211_hwsim_hw_scan;
3367 mac80211_hwsim_mchan_ops.cancel_hw_scan = mac80211_hwsim_cancel_hw_scan;
3368 mac80211_hwsim_mchan_ops.sw_scan_start = NULL;
3369 mac80211_hwsim_mchan_ops.sw_scan_complete = NULL;
3370 mac80211_hwsim_mchan_ops.remain_on_channel = mac80211_hwsim_roc;
3371 mac80211_hwsim_mchan_ops.cancel_remain_on_channel = mac80211_hwsim_croc;
3372 mac80211_hwsim_mchan_ops.add_chanctx = mac80211_hwsim_add_chanctx;
3373 mac80211_hwsim_mchan_ops.remove_chanctx = mac80211_hwsim_remove_chanctx;
3374 mac80211_hwsim_mchan_ops.change_chanctx = mac80211_hwsim_change_chanctx;
3375 mac80211_hwsim_mchan_ops.assign_vif_chanctx =
3376 mac80211_hwsim_assign_vif_chanctx;
3377 mac80211_hwsim_mchan_ops.unassign_vif_chanctx =
3378 mac80211_hwsim_unassign_vif_chanctx;
3379
3380 spin_lock_init(&hwsim_radio_lock);3381 spin_lock_init(&hwsim_radio_lock);
3381 3382
3382 err = register_pernet_device(&hwsim_net_ops);3383 err = register_pernet_device(&hwsim_net_ops);
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c+4−2
@@ -1362,11 +1362,13 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) · 1361 unmodified lines
1362 if (rt2x00dev->bcn->limit > 0)1362 if (rt2x00dev->bcn->limit > 0)
1363 rt2x00dev->hw->wiphy->interface_modes |=1363 rt2x00dev->hw->wiphy->interface_modes |=
1364 BIT(NL80211_IFTYPE_ADHOC) |1364 BIT(NL80211_IFTYPE_ADHOC) |
1365 BIT(NL80211_IFTYPE_AP) |
1366#ifdef CONFIG_MAC80211_MESH1365#ifdef CONFIG_MAC80211_MESH
1367 BIT(NL80211_IFTYPE_MESH_POINT) |1366 BIT(NL80211_IFTYPE_MESH_POINT) |
1368#endif1367#endif
1369 BIT(NL80211_IFTYPE_WDS);1368#ifdef CONFIG_WIRELESS_WDS
1369 BIT(NL80211_IFTYPE_WDS) |
1370#endif
1371 BIT(NL80211_IFTYPE_AP);
1370 1372
1371 rt2x00dev->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;1373 rt2x00dev->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
1372 1374
drivers/net/wireless/ti/wlcore/main.c+1−0
@@ -6086,6 +6086,7 @@ static int wl1271_init_ieee80211(struct wl1271 *wl) · 6085 unmodified lines
6086 ieee80211_hw_set(wl->hw, SUPPORTS_DYNAMIC_PS);6086 ieee80211_hw_set(wl->hw, SUPPORTS_DYNAMIC_PS);
6087 ieee80211_hw_set(wl->hw, SIGNAL_DBM);6087 ieee80211_hw_set(wl->hw, SIGNAL_DBM);
6088 ieee80211_hw_set(wl->hw, SUPPORTS_PS);6088 ieee80211_hw_set(wl->hw, SUPPORTS_PS);
6089 ieee80211_hw_set(wl->hw, SUPPORTS_TX_FRAG);
6089 6090
6090 wl->hw->wiphy->cipher_suites = cipher_suites;6091 wl->hw->wiphy->cipher_suites = cipher_suites;
6091 wl->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);6092 wl->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
include/linux/ieee80211.h+26−0
@@ -1576,6 +1576,9 @@ struct ieee80211_vht_operation { · 1575 unmodified lines
1576#define WLAN_AUTH_SHARED_KEY 11576#define WLAN_AUTH_SHARED_KEY 1
1577#define WLAN_AUTH_FT 21577#define WLAN_AUTH_FT 2
1578#define WLAN_AUTH_SAE 31578#define WLAN_AUTH_SAE 3
1579#define WLAN_AUTH_FILS_SK 4
1580#define WLAN_AUTH_FILS_SK_PFS 5
1581#define WLAN_AUTH_FILS_PK 6
1579#define WLAN_AUTH_LEAP 1281582#define WLAN_AUTH_LEAP 128
1580 1583
1581#define WLAN_AUTH_CHALLENGE_LEN 1281584#define WLAN_AUTH_CHALLENGE_LEN 128
@@ -1960,6 +1963,26 @@ enum ieee80211_eid { · 378 unmodified lines
1960 1963
1961 WLAN_EID_VENDOR_SPECIFIC = 221,1964 WLAN_EID_VENDOR_SPECIFIC = 221,
1962 WLAN_EID_QOS_PARAMETER = 222,1965 WLAN_EID_QOS_PARAMETER = 222,
1966 WLAN_EID_CAG_NUMBER = 237,
1967 WLAN_EID_AP_CSN = 239,
1968 WLAN_EID_FILS_INDICATION = 240,
1969 WLAN_EID_DILS = 241,
1970 WLAN_EID_FRAGMENT = 242,
1971 WLAN_EID_EXTENSION = 255
1972};
1973
1974/* Element ID Extensions for Element ID 255 */
1975enum ieee80211_eid_ext {
1976 WLAN_EID_EXT_ASSOC_DELAY_INFO = 1,
1977 WLAN_EID_EXT_FILS_REQ_PARAMS = 2,
1978 WLAN_EID_EXT_FILS_KEY_CONFIRM = 3,
1979 WLAN_EID_EXT_FILS_SESSION = 4,
1980 WLAN_EID_EXT_FILS_HLP_CONTAINER = 5,
1981 WLAN_EID_EXT_FILS_IP_ADDR_ASSIGN = 6,
1982 WLAN_EID_EXT_KEY_DELIVERY = 7,
1983 WLAN_EID_EXT_FILS_WRAPPED_DATA = 8,
1984 WLAN_EID_EXT_FILS_PUBLIC_KEY = 12,
1985 WLAN_EID_EXT_FILS_NONCE = 13,
1963};1986};
1964 1987
1965/* Action category code */1988/* Action category code */
@@ -2073,6 +2096,9 @@ enum ieee80211_key_len { · 107 unmodified lines
2073#define IEEE80211_GCMP_MIC_LEN 162096#define IEEE80211_GCMP_MIC_LEN 16
2074#define IEEE80211_GCMP_PN_LEN 62097#define IEEE80211_GCMP_PN_LEN 6
2075 2098
2099#define FILS_NONCE_LEN 16
2100#define FILS_MAX_KEK_LEN 64
2101
2076/* Public action codes */2102/* Public action codes */
2077enum ieee80211_pub_actioncode {2103enum ieee80211_pub_actioncode {
2078 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4,2104 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4,
include/net/cfg80211.h+117−33
@@ -771,6 +771,30 @@ struct cfg80211_csa_settings { · 770 unmodified lines
771 u8 count;771 u8 count;
772};772};
773 773
774/**
775 * struct iface_combination_params - input parameters for interface combinations
776 *
777 * Used to pass interface combination parameters
778 *
779 * @num_different_channels: the number of different channels we want
780 * to use for verification
781 * @radar_detect: a bitmap where each bit corresponds to a channel
782 * width where radar detection is needed, as in the definition of
783 * &struct ieee80211_iface_combination.@radar_detect_widths
784 * @iftype_num: array with the number of interfaces of each interface
785 * type. The index is the interface type as specified in &enum
786 * nl80211_iftype.
787 * @new_beacon_int: set this to the beacon interval of a new interface
788 * that's not operating yet, if such is to be checked as part of
789 * the verification
790 */
791struct iface_combination_params {
792 int num_different_channels;
793 u8 radar_detect;
794 int iftype_num[NUM_NL80211_IFTYPES];
795 u32 new_beacon_int;
796};
797
774/**798/**
775 * enum station_parameters_apply_mask - station parameter values to apply799 * enum station_parameters_apply_mask - station parameter values to apply
776 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)800 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
@@ -1761,9 +1785,11 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); · 984 unmodified lines
1761 * @key_len: length of WEP key for shared key authentication1785 * @key_len: length of WEP key for shared key authentication
1762 * @key_idx: index of WEP key for shared key authentication1786 * @key_idx: index of WEP key for shared key authentication
1763 * @key: WEP key for shared key authentication1787 * @key: WEP key for shared key authentication
1764 * @sae_data: Non-IE data to use with SAE or %NULL. This starts with1788 * @auth_data: Fields and elements in Authentication frames. This contains
1765 * Authentication transaction sequence number field.1789 * the authentication frame body (non-IE and IE data), excluding the
1766 * @sae_data_len: Length of sae_data buffer in octets1790 * Authentication algorithm number, i.e., starting at the Authentication
1791 * transaction sequence number field.
1792 * @auth_data_len: Length of auth_data buffer in octets
1767 */1793 */
1768struct cfg80211_auth_request {1794struct cfg80211_auth_request {
1769 struct cfg80211_bss *bss;1795 struct cfg80211_bss *bss;
@@ -1772,8 +1798,8 @@ struct cfg80211_auth_request { · 2 unmodified lines
1772 enum nl80211_auth_type auth_type;1798 enum nl80211_auth_type auth_type;
1773 const u8 *key;1799 const u8 *key;
1774 u8 key_len, key_idx;1800 u8 key_len, key_idx;
1775 const u8 *sae_data;1801 const u8 *auth_data;
1776 size_t sae_data_len;1802 size_t auth_data_len;
1777};1803};
1778 1804
1779/**1805/**
@@ -1814,6 +1840,12 @@ enum cfg80211_assoc_req_flags { · 34 unmodified lines
1814 * @ht_capa_mask: The bits of ht_capa which are to be used.1840 * @ht_capa_mask: The bits of ht_capa which are to be used.
1815 * @vht_capa: VHT capability override1841 * @vht_capa: VHT capability override
1816 * @vht_capa_mask: VHT capability mask indicating which fields to use1842 * @vht_capa_mask: VHT capability mask indicating which fields to use
1843 * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
1844 * %NULL if FILS is not used.
1845 * @fils_kek_len: Length of fils_kek in octets
1846 * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
1847 * Request/Response frame or %NULL if FILS is not used. This field starts
1848 * with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
1817 */1849 */
1818struct cfg80211_assoc_request {1850struct cfg80211_assoc_request {
1819 struct cfg80211_bss *bss;1851 struct cfg80211_bss *bss;
@@ -1825,6 +1857,9 @@ struct cfg80211_assoc_request { · 5 unmodified lines
1825 struct ieee80211_ht_cap ht_capa;1857 struct ieee80211_ht_cap ht_capa;
1826 struct ieee80211_ht_cap ht_capa_mask;1858 struct ieee80211_ht_cap ht_capa_mask;
1827 struct ieee80211_vht_cap vht_capa, vht_capa_mask;1859 struct ieee80211_vht_cap vht_capa, vht_capa_mask;
1860 const u8 *fils_kek;
1861 size_t fils_kek_len;
1862 const u8 *fils_nonces;
1828};1863};
1829 1864
1830/**1865/**
@@ -2015,6 +2050,18 @@ struct cfg80211_connect_params { · 184 unmodified lines
2015 const u8 *prev_bssid;2050 const u8 *prev_bssid;
2016};2051};
2017 2052
2053/**
2054 * enum cfg80211_connect_params_changed - Connection parameters being updated
2055 *
2056 * This enum provides information of all connect parameters that
2057 * have to be updated as part of update_connect_params() call.
2058 *
2059 * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
2060 */
2061enum cfg80211_connect_params_changed {
2062 UPDATE_ASSOC_IES = BIT(0),
2063};
2064
2018/**2065/**
2019 * enum wiphy_params_flags - set_wiphy_params bitfield values2066 * enum wiphy_params_flags - set_wiphy_params bitfield values
2020 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed2067 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
@@ -2536,9 +2583,18 @@ struct cfg80211_nan_func { · 515 unmodified lines
2536 * cases, the result of roaming is indicated with a call to2583 * cases, the result of roaming is indicated with a call to
2537 * cfg80211_roamed() or cfg80211_roamed_bss().2584 * cfg80211_roamed() or cfg80211_roamed_bss().
2538 * (invoked with the wireless_dev mutex held)2585 * (invoked with the wireless_dev mutex held)
2539 * @disconnect: Disconnect from the BSS/ESS. Once done, call2586 * @update_connect_params: Update the connect parameters while connected to a
2540 * cfg80211_disconnected().2587 * BSS. The updated parameters can be used by driver/firmware for
2588 * subsequent BSS selection (roaming) decisions and to form the
2589 * Authentication/(Re)Association Request frames. This call does not
2590 * request an immediate disassociation or reassociation with the current
2591 * BSS, i.e., this impacts only subsequent (re)associations. The bits in
2592 * changed are defined in &enum cfg80211_connect_params_changed.
2541 * (invoked with the wireless_dev mutex held)2593 * (invoked with the wireless_dev mutex held)
2594 * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
2595 * connection is in progress. Once done, call cfg80211_disconnected() in
2596 * case connection was already established (invoked with the
2597 * wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
2542 *2598 *
2543 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call2599 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
2544 * cfg80211_ibss_joined(), also call that function when changing BSSID due2600 * cfg80211_ibss_joined(), also call that function when changing BSSID due
@@ -2706,6 +2762,8 @@ struct cfg80211_nan_func { · 161 unmodified lines
2706 * @nan_change_conf: changes NAN configuration. The changed parameters must2762 * @nan_change_conf: changes NAN configuration. The changed parameters must
2707 * be specified in @changes (using &enum cfg80211_nan_conf_changes);2763 * be specified in @changes (using &enum cfg80211_nan_conf_changes);
2708 * All other parameters must be ignored.2764 * All other parameters must be ignored.
2765 *
2766 * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
2709 */2767 */
2710struct cfg80211_ops {2768struct cfg80211_ops {
2711 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);2769 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -2820,6 +2878,10 @@ struct cfg80211_ops { · 108 unmodified lines
2820 2878
2821 int (*connect)(struct wiphy *wiphy, struct net_device *dev,2879 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
2822 struct cfg80211_connect_params *sme);2880 struct cfg80211_connect_params *sme);
2881 int (*update_connect_params)(struct wiphy *wiphy,
2882 struct net_device *dev,
2883 struct cfg80211_connect_params *sme,
2884 u32 changed);
2823 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,2885 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
2824 u16 reason_code);2886 u16 reason_code);
2825 2887
@@ -2982,6 +3044,10 @@ struct cfg80211_ops { · 156 unmodified lines
2982 struct wireless_dev *wdev,3044 struct wireless_dev *wdev,
2983 struct cfg80211_nan_conf *conf,3045 struct cfg80211_nan_conf *conf,
2984 u32 changes);3046 u32 changes);
3047
3048 int (*set_multicast_to_unicast)(struct wiphy *wiphy,
3049 struct net_device *dev,
3050 const bool enabled);
2985};3051};
2986 3052
2987/*3053/*
@@ -3080,6 +3146,12 @@ struct ieee80211_iface_limit { · 92 unmodified lines
3080 * only in special cases.3146 * only in special cases.
3081 * @radar_detect_widths: bitmap of channel widths supported for radar detection3147 * @radar_detect_widths: bitmap of channel widths supported for radar detection
3082 * @radar_detect_regions: bitmap of regions supported for radar detection3148 * @radar_detect_regions: bitmap of regions supported for radar detection
3149 * @beacon_int_min_gcd: This interface combination supports different
3150 * beacon intervals.
3151 * = 0 - all beacon intervals for different interface must be same.
3152 * > 0 - any beacon interval for the interface part of this combination AND
3153 * *GCD* of all beacon intervals from beaconing interfaces of this
3154 * combination must be greater or equal to this value.
3083 *3155 *
3084 * With this structure the driver can describe which interface3156 * With this structure the driver can describe which interface
3085 * combinations it supports concurrently.3157 * combinations it supports concurrently.
@@ -3138,6 +3210,7 @@ struct ieee80211_iface_combination { · 52 unmodified lines
3138 bool beacon_int_infra_match;3210 bool beacon_int_infra_match;
3139 u8 radar_detect_widths;3211 u8 radar_detect_widths;
3140 u8 radar_detect_regions;3212 u8 radar_detect_regions;
3213 u32 beacon_int_min_gcd;
3141};3214};
3142 3215
3143struct ieee80211_txrx_stypes {3216struct ieee80211_txrx_stypes {
@@ -3745,8 +3818,8 @@ struct cfg80211_cached_keys; · 601 unmodified lines
3745 * @beacon_interval: beacon interval used on this device for transmitting3818 * @beacon_interval: beacon interval used on this device for transmitting
3746 * beacons, 0 when not valid3819 * beacons, 0 when not valid
3747 * @address: The address for this device, valid only if @netdev is %NULL3820 * @address: The address for this device, valid only if @netdev is %NULL
3748 * @p2p_started: true if this is a P2P Device that has been started3821 * @is_running: true if this is a non-netdev device that has been started, e.g.
3749 * @nan_started: true if this is a NAN interface that has been started3822 * the P2P Device.
3750 * @cac_started: true if DFS channel availability check has been started3823 * @cac_started: true if DFS channel availability check has been started
3751 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.3824 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
3752 * @cac_time_ms: CAC time in ms3825 * @cac_time_ms: CAC time in ms
@@ -3778,7 +3851,7 @@ struct wireless_dev { · 25 unmodified lines
3778 3851
3779 struct mutex mtx;3852 struct mutex mtx;
3780 3853
3781 bool use_4addr, p2p_started, nan_started;3854 bool use_4addr, is_running;
3782 3855
3783 u8 address[ETH_ALEN] __aligned(sizeof(u16));3856 u8 address[ETH_ALEN] __aligned(sizeof(u16));
3784 3857
@@ -3835,6 +3908,13 @@ static inline u8 *wdev_address(struct wireless_dev *wdev) · 50 unmodified lines
3835 return wdev->address;3908 return wdev->address;
3836}3909}
3837 3910
3911static inline bool wdev_running(struct wireless_dev *wdev)
3912{
3913 if (wdev->netdev)
3914 return netif_running(wdev->netdev);
3915 return wdev->is_running;
3916}
3917
3838/**3918/**
3839 * wdev_priv - return wiphy priv from wireless_dev3919 * wdev_priv - return wiphy priv from wireless_dev
3840 *3920 *
@@ -4139,6 +4219,27 @@ static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) · 298 unmodified lines
4139 return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);4219 return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
4140}4220}
4141 4221
4222/**
4223 * cfg80211_find_ext_ie - find information element with EID Extension in data
4224 *
4225 * @ext_eid: element ID Extension
4226 * @ies: data consisting of IEs
4227 * @len: length of data
4228 *
4229 * Return: %NULL if the extended element ID could not be found or if
4230 * the element is invalid (claims to be longer than the given
4231 * data), or a pointer to the first byte of the requested
4232 * element, that is the byte containing the element ID.
4233 *
4234 * Note: There are no checks on the element length other than
4235 * having to fit into the given data.
4236 */
4237static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
4238{
4239 return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
4240 &ext_eid, 1, 2);
4241}
4242
4142/**4243/**
4143 * cfg80211_find_vendor_ie - find vendor specific information element in data4244 * cfg80211_find_vendor_ie - find vendor specific information element in data
4144 *4245 *
@@ -4539,7 +4640,8 @@ void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); · 394 unmodified lines
4539 * moves to cfg80211 in this call4640 * moves to cfg80211 in this call
4540 * @buf: authentication frame (header + body)4641 * @buf: authentication frame (header + body)
4541 * @len: length of the frame data4642 * @len: length of the frame data
4542 * @uapsd_queues: bitmap of ACs configured to uapsd. -1 if n/a.4643 * @uapsd_queues: bitmap of queues configured for uapsd. Same format
4644 * as the AC bitmap in the QoS info field
4543 *4645 *
4544 * After being asked to associate via cfg80211_ops::assoc() the driver must4646 * After being asked to associate via cfg80211_ops::assoc() the driver must
4545 * call either this function or cfg80211_auth_timeout().4647 * call either this function or cfg80211_auth_timeout().
@@ -5575,36 +5677,20 @@ unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); · 1029 unmodified lines
5575 * cfg80211_check_combinations - check interface combinations5677 * cfg80211_check_combinations - check interface combinations
5576 *5678 *
5577 * @wiphy: the wiphy5679 * @wiphy: the wiphy
5578 * @num_different_channels: the number of different channels we want5680 * @params: the interface combinations parameter
5579 * to use for verification
5580 * @radar_detect: a bitmap where each bit corresponds to a channel
5581 * width where radar detection is needed, as in the definition of
5582 * &struct ieee80211_iface_combination.@radar_detect_widths
5583 * @iftype_num: array with the numbers of interfaces of each interface
5584 * type. The index is the interface type as specified in &enum
5585 * nl80211_iftype.
5586 *5681 *
5587 * This function can be called by the driver to check whether a5682 * This function can be called by the driver to check whether a
5588 * combination of interfaces and their types are allowed according to5683 * combination of interfaces and their types are allowed according to
5589 * the interface combinations.5684 * the interface combinations.
5590 */5685 */
5591int cfg80211_check_combinations(struct wiphy *wiphy,5686int cfg80211_check_combinations(struct wiphy *wiphy,
5592 const int num_different_channels,5687 struct iface_combination_params *params);
5593 const u8 radar_detect,
5594 const int iftype_num[NUM_NL80211_IFTYPES]);
5595 5688
5596/**5689/**
5597 * cfg80211_iter_combinations - iterate over matching combinations5690 * cfg80211_iter_combinations - iterate over matching combinations
5598 *5691 *
5599 * @wiphy: the wiphy5692 * @wiphy: the wiphy
5600 * @num_different_channels: the number of different channels we want5693 * @params: the interface combinations parameter
5601 * to use for verification
5602 * @radar_detect: a bitmap where each bit corresponds to a channel
5603 * width where radar detection is needed, as in the definition of
5604 * &struct ieee80211_iface_combination.@radar_detect_widths
5605 * @iftype_num: array with the numbers of interfaces of each interface
5606 * type. The index is the interface type as specified in &enum
5607 * nl80211_iftype.
5608 * @iter: function to call for each matching combination5694 * @iter: function to call for each matching combination
5609 * @data: pointer to pass to iter function5695 * @data: pointer to pass to iter function
5610 *5696 *
@@ -5613,9 +5699,7 @@ int cfg80211_check_combinations(struct wiphy *wiphy, · 2 unmodified lines
5613 * purposes.5699 * purposes.
5614 */5700 */
5615int cfg80211_iter_combinations(struct wiphy *wiphy,5701int cfg80211_iter_combinations(struct wiphy *wiphy,
5616 const int num_different_channels,5702 struct iface_combination_params *params,
5617 const u8 radar_detect,
5618 const int iftype_num[NUM_NL80211_IFTYPES],
5619 void (*iter)(const struct ieee80211_iface_combination *c,5703 void (*iter)(const struct ieee80211_iface_combination *c,
5620 void *data),5704 void *data),
5621 void *data);5705 void *data);
include/net/ieee80211_radiotap.h+2−2
@@ -333,9 +333,9 @@ enum ieee80211_radiotap_type { · 332 unmodified lines
333#define IEEE80211_RADIOTAP_TIMESTAMP_UNIT_NS 0x0003333#define IEEE80211_RADIOTAP_TIMESTAMP_UNIT_NS 0x0003
334#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_MASK 0x00F0334#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_MASK 0x00F0
335#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_BEGIN_MDPU 0x0000335#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_BEGIN_MDPU 0x0000
336#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_EO_MPDU 0x0010336#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_PLCP_SIG_ACQ 0x0010
337#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_EO_PPDU 0x0020337#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_EO_PPDU 0x0020
338#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_PLCP_SIG_ACQ 0x0030338#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_EO_MPDU 0x0030
339#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_UNKNOWN 0x00F0339#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_UNKNOWN 0x00F0
340 340
341#define IEEE80211_RADIOTAP_TIMESTAMP_FLAG_64BIT 0x00341#define IEEE80211_RADIOTAP_TIMESTAMP_FLAG_64BIT 0x00
include/net/mac80211.h+15−4
@@ -1438,7 +1438,7 @@ enum ieee80211_vif_flags { · 1437 unmodified lines
1438struct ieee80211_vif {1438struct ieee80211_vif {
1439 enum nl80211_iftype type;1439 enum nl80211_iftype type;
1440 struct ieee80211_bss_conf bss_conf;1440 struct ieee80211_bss_conf bss_conf;
1441 u8 addr[ETH_ALEN];1441 u8 addr[ETH_ALEN] __aligned(2);
1442 bool p2p;1442 bool p2p;
1443 bool csa_active;1443 bool csa_active;
1444 bool mu_mimo_owner;1444 bool mu_mimo_owner;
@@ -1745,7 +1745,8 @@ struct ieee80211_sta_rates { · 300 unmodified lines
1745 * @drv_priv: data area for driver use, will always be aligned to1745 * @drv_priv: data area for driver use, will always be aligned to
1746 * sizeof(void *), size is determined in hw information.1746 * sizeof(void *), size is determined in hw information.
1747 * @uapsd_queues: bitmap of queues configured for uapsd. Only valid1747 * @uapsd_queues: bitmap of queues configured for uapsd. Only valid
1748 * if wme is supported.1748 * if wme is supported. The bits order is like in
1749 * IEEE80211_WMM_IE_STA_QOSINFO_AC_*.
1749 * @max_sp: max Service Period. Only valid if wme is supported.1750 * @max_sp: max Service Period. Only valid if wme is supported.
1750 * @bandwidth: current bandwidth the station can receive with1751 * @bandwidth: current bandwidth the station can receive with
1751 * @rx_nss: in HT/VHT, the maximum number of spatial streams the1752 * @rx_nss: in HT/VHT, the maximum number of spatial streams the
@@ -2025,6 +2026,10 @@ struct ieee80211_txq { · 273 unmodified lines
2025 * drivers, mac80211 packet loss mechanism will not be triggered and driver2026 * drivers, mac80211 packet loss mechanism will not be triggered and driver
2026 * is completely depending on firmware event for station kickout.2027 * is completely depending on firmware event for station kickout.
2027 *2028 *
2029 * @IEEE80211_HW_SUPPORTS_TX_FRAG: Hardware does fragmentation by itself.
2030 * The stack will not do fragmentation.
2031 * The callback for @set_frag_threshold should be set as well.
2032 *
2028 * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays2033 * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
2029 */2034 */
2030enum ieee80211_hw_flags {2035enum ieee80211_hw_flags {
@@ -2066,6 +2071,7 @@ enum ieee80211_hw_flags { · 35 unmodified lines
2066 IEEE80211_HW_TX_AMSDU,2071 IEEE80211_HW_TX_AMSDU,
2067 IEEE80211_HW_TX_FRAG_LIST,2072 IEEE80211_HW_TX_FRAG_LIST,
2068 IEEE80211_HW_REPORTS_LOW_ACK,2073 IEEE80211_HW_REPORTS_LOW_ACK,
2074 IEEE80211_HW_SUPPORTS_TX_FRAG,
2069 2075
2070 /* keep last, obviously */2076 /* keep last, obviously */
2071 NUM_IEEE80211_HW_FLAGS2077 NUM_IEEE80211_HW_FLAGS
@@ -3093,8 +3099,9 @@ enum ieee80211_reconfig_type { · 1021 unmodified lines
3093 * The callback must be atomic.3099 * The callback must be atomic.
3094 *3100 *
3095 * @set_frag_threshold: Configuration of fragmentation threshold. Assign this3101 * @set_frag_threshold: Configuration of fragmentation threshold. Assign this
3096 * if the device does fragmentation by itself; if this callback is3102 * if the device does fragmentation by itself. Note that to prevent the
3097 * implemented then the stack will not do fragmentation.3103 * stack from doing fragmentation IEEE80211_HW_SUPPORTS_TX_FRAG
3104 * should be set as well.
3098 * The callback can sleep.3105 * The callback can sleep.
3099 *3106 *
3100 * @set_rts_threshold: Configuration of RTS threshold (if device needs it)3107 * @set_rts_threshold: Configuration of RTS threshold (if device needs it)
@@ -4087,6 +4094,10 @@ void ieee80211_sta_pspoll(struct ieee80211_sta *sta); · 986 unmodified lines
4087 * This must be used in conjunction with ieee80211_sta_ps_transition()4094 * This must be used in conjunction with ieee80211_sta_ps_transition()
4088 * and possibly ieee80211_sta_pspoll(); calls to all three must be4095 * and possibly ieee80211_sta_pspoll(); calls to all three must be
4089 * serialized.4096 * serialized.
4097 * %IEEE80211_NUM_TIDS can be passed as the tid if the tid is unknown.
4098 * In this case, mac80211 will not check that this tid maps to an AC
4099 * that is trigger enabled and assume that the caller did the proper
4100 * checks.
4090 */4101 */
4091void ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, u8 tid);4102void ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, u8 tid);
4092 4103
include/uapi/linux/nl80211.h+64−5
@@ -600,6 +600,20 @@ · 599 unmodified lines
600 *600 *
601 * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface.601 * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface.
602 *602 *
603 * @NL80211_CMD_SET_MULTICAST_TO_UNICAST: Configure if this AP should perform
604 * multicast to unicast conversion. When enabled, all multicast packets
605 * with ethertype ARP, IPv4 or IPv6 (possibly within an 802.1Q header)
606 * will be sent out to each station once with the destination (multicast)
607 * MAC address replaced by the station's MAC address. Note that this may
608 * break certain expectations of the receiver, e.g. the ability to drop
609 * unicast IP packets encapsulated in multicast L2 frames, or the ability
610 * to not send destination unreachable messages in such cases.
611 * This can only be toggled per BSS. Configure this on an interface of
612 * type %NL80211_IFTYPE_AP. It applies to all its VLAN interfaces
613 * (%NL80211_IFTYPE_AP_VLAN), except for those in 4addr (WDS) mode.
614 * If %NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED is not present with this
615 * command, the feature is disabled.
616 *
603 * @NL80211_CMD_JOIN_MESH: Join a mesh. The mesh ID must be given, and initial617 * @NL80211_CMD_JOIN_MESH: Join a mesh. The mesh ID must be given, and initial
604 * mesh config parameters may be given.618 * mesh config parameters may be given.
605 * @NL80211_CMD_LEAVE_MESH: Leave the mesh network -- no special arguments, the619 * @NL80211_CMD_LEAVE_MESH: Leave the mesh network -- no special arguments, the
@@ -874,6 +888,12 @@ · 268 unmodified lines
874 * This will contain a %NL80211_ATTR_NAN_MATCH nested attribute and888 * This will contain a %NL80211_ATTR_NAN_MATCH nested attribute and
875 * %NL80211_ATTR_COOKIE.889 * %NL80211_ATTR_COOKIE.
876 *890 *
891 * @NL80211_CMD_UPDATE_CONNECT_PARAMS: Update one or more connect parameters
892 * for subsequent roaming cases if the driver or firmware uses internal
893 * BSS selection. This command can be issued only while connected and it
894 * does not result in a change for the current association. Currently,
895 * only the %NL80211_ATTR_IE data is used and updated with this command.
896 *
877 * @NL80211_CMD_MAX: highest used command number897 * @NL80211_CMD_MAX: highest used command number
878 * @__NL80211_CMD_AFTER_LAST: internal use898 * @__NL80211_CMD_AFTER_LAST: internal use
879 */899 */
@@ -1069,6 +1089,10 @@ enum nl80211_commands { · 189 unmodified lines
1069 NL80211_CMD_CHANGE_NAN_CONFIG,1089 NL80211_CMD_CHANGE_NAN_CONFIG,
1070 NL80211_CMD_NAN_MATCH,1090 NL80211_CMD_NAN_MATCH,
1071 1091
1092 NL80211_CMD_SET_MULTICAST_TO_UNICAST,
1093
1094 NL80211_CMD_UPDATE_CONNECT_PARAMS,
1095
1072 /* add new commands above here */1096 /* add new commands above here */
1073 1097
1074 /* used to define NL80211_CMD_MAX below */1098 /* used to define NL80211_CMD_MAX below */
@@ -1638,8 +1662,16 @@ enum nl80211_commands { · 563 unmodified lines
1638 * the connection request from a station. nl80211_connect_failed_reason1662 * the connection request from a station. nl80211_connect_failed_reason
1639 * enum has different reasons of connection failure.1663 * enum has different reasons of connection failure.
1640 *1664 *
1641 * @NL80211_ATTR_SAE_DATA: SAE elements in Authentication frames. This starts1665 * @NL80211_ATTR_AUTH_DATA: Fields and elements in Authentication frames.
1642 * with the Authentication transaction sequence number field.1666 * This contains the authentication frame body (non-IE and IE data),
1667 * excluding the Authentication algorithm number, i.e., starting at the
1668 * Authentication transaction sequence number field. It is used with
1669 * authentication algorithms that need special fields to be added into
1670 * the frames (SAE and FILS). Currently, only the SAE cases use the
1671 * initial two fields (Authentication transaction sequence number and
1672 * Status code). However, those fields are included in the attribute data
1673 * for all authentication algorithms to keep the attribute definition
1674 * consistent.
1643 *1675 *
1644 * @NL80211_ATTR_VHT_CAPABILITY: VHT Capability information element (from1676 * @NL80211_ATTR_VHT_CAPABILITY: VHT Capability information element (from
1645 * association request when used with NL80211_CMD_NEW_STATION)1677 * association request when used with NL80211_CMD_NEW_STATION)
@@ -1936,6 +1968,14 @@ enum nl80211_commands { · 290 unmodified lines
1936 * attribute.1968 * attribute.
1937 * @NL80211_ATTR_NAN_MATCH: used to report a match. This is a nested attribute.1969 * @NL80211_ATTR_NAN_MATCH: used to report a match. This is a nested attribute.
1938 * See &enum nl80211_nan_match_attributes.1970 * See &enum nl80211_nan_match_attributes.
1971 * @NL80211_ATTR_FILS_KEK: KEK for FILS (Re)Association Request/Response frame
1972 * protection.
1973 * @NL80211_ATTR_FILS_NONCES: Nonces (part of AAD) for FILS (Re)Association
1974 * Request/Response frame protection. This attribute contains the 16 octet
1975 * STA Nonce followed by 16 octets of AP Nonce.
1976 *
1977 * @NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED: Indicates whether or not multicast
1978 * packets should be send out as unicast to all stations (flag attribute).
1939 *1979 *
1940 * @NUM_NL80211_ATTR: total number of nl80211_attrs available1980 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
1941 * @NL80211_ATTR_MAX: highest attribute number currently defined1981 * @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2195,7 +2235,7 @@ enum nl80211_attrs { · 253 unmodified lines
2195 2235
2196 NL80211_ATTR_CONN_FAILED_REASON,2236 NL80211_ATTR_CONN_FAILED_REASON,
2197 2237
2198 NL80211_ATTR_SAE_DATA,2238 NL80211_ATTR_AUTH_DATA,
2199 2239
2200 NL80211_ATTR_VHT_CAPABILITY,2240 NL80211_ATTR_VHT_CAPABILITY,
2201 2241
@@ -2336,6 +2376,11 @@ enum nl80211_attrs { · 134 unmodified lines
2336 NL80211_ATTR_NAN_FUNC,2376 NL80211_ATTR_NAN_FUNC,
2337 NL80211_ATTR_NAN_MATCH,2377 NL80211_ATTR_NAN_MATCH,
2338 2378
2379 NL80211_ATTR_FILS_KEK,
2380 NL80211_ATTR_FILS_NONCES,
2381
2382 NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED,
2383
2339 /* add attributes here, update the policy in nl80211.c */2384 /* add attributes here, update the policy in nl80211.c */
2340 2385
2341 __NL80211_ATTR_AFTER_LAST,2386 __NL80211_ATTR_AFTER_LAST,
@@ -2347,6 +2392,7 @@ enum nl80211_attrs { · 5 unmodified lines
2347#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION2392#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
2348#define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG2393#define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG
2349#define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER2394#define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
2395#define NL80211_ATTR_SAE_DATA NL80211_ATTR_AUTH_DATA
2350 2396
2351/*2397/*
2352 * Allow user space programs to use #ifdef on new attributes by defining them2398 * Allow user space programs to use #ifdef on new attributes by defining them
@@ -3660,6 +3706,9 @@ enum nl80211_bss_status { · 1307 unmodified lines
3660 * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r)3706 * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r)
3661 * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP)3707 * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP)
3662 * @NL80211_AUTHTYPE_SAE: Simultaneous authentication of equals3708 * @NL80211_AUTHTYPE_SAE: Simultaneous authentication of equals
3709 * @NL80211_AUTHTYPE_FILS_SK: Fast Initial Link Setup shared key
3710 * @NL80211_AUTHTYPE_FILS_SK_PFS: Fast Initial Link Setup shared key with PFS
3711 * @NL80211_AUTHTYPE_FILS_PK: Fast Initial Link Setup public key
3663 * @__NL80211_AUTHTYPE_NUM: internal3712 * @__NL80211_AUTHTYPE_NUM: internal
3664 * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm3713 * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm
3665 * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by3714 * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by
@@ -3672,6 +3721,9 @@ enum nl80211_auth_type { · 6 unmodified lines
3672 NL80211_AUTHTYPE_FT,3721 NL80211_AUTHTYPE_FT,
3673 NL80211_AUTHTYPE_NETWORK_EAP,3722 NL80211_AUTHTYPE_NETWORK_EAP,
3674 NL80211_AUTHTYPE_SAE,3723 NL80211_AUTHTYPE_SAE,
3724 NL80211_AUTHTYPE_FILS_SK,
3725 NL80211_AUTHTYPE_FILS_SK_PFS,
3726 NL80211_AUTHTYPE_FILS_PK,
3675 3727
3676 /* keep last */3728 /* keep last */
3677 __NL80211_AUTHTYPE_NUM,3729 __NL80211_AUTHTYPE_NUM,
@@ -4280,6 +4332,9 @@ enum nl80211_iface_limit_attrs { · 602 unmodified lines
4280 * of supported channel widths for radar detection.4332 * of supported channel widths for radar detection.
4281 * @NL80211_IFACE_COMB_RADAR_DETECT_REGIONS: u32 attribute containing the bitmap4333 * @NL80211_IFACE_COMB_RADAR_DETECT_REGIONS: u32 attribute containing the bitmap
4282 * of supported regulatory regions for radar detection.4334 * of supported regulatory regions for radar detection.
4335 * @NL80211_IFACE_COMB_BI_MIN_GCD: u32 attribute specifying the minimum GCD of
4336 * different beacon intervals supported by all the interface combinations
4337 * in this group (if not present, all beacon intervals be identical).
4283 * @NUM_NL80211_IFACE_COMB: number of attributes4338 * @NUM_NL80211_IFACE_COMB: number of attributes
4284 * @MAX_NL80211_IFACE_COMB: highest attribute number4339 * @MAX_NL80211_IFACE_COMB: highest attribute number
4285 *4340 *
@@ -4287,8 +4342,8 @@ enum nl80211_iface_limit_attrs { · 1 unmodified line
4287 * limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 24342 * limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 2
4288 * => allows an AP and a STA that must match BIs4343 * => allows an AP and a STA that must match BIs
4289 *4344 *
4290 * numbers = [ #{AP, P2P-GO} <= 8 ], channels = 1, max = 84345 * numbers = [ #{AP, P2P-GO} <= 8 ], BI min gcd, channels = 1, max = 8,
4291 * => allows 8 of AP/GO4346 * => allows 8 of AP/GO that can have BI gcd >= min gcd
4292 *4347 *
4293 * numbers = [ #{STA} <= 2 ], channels = 2, max = 24348 * numbers = [ #{STA} <= 2 ], channels = 2, max = 2
4294 * => allows two STAs on different channels4349 * => allows two STAs on different channels
@@ -4314,6 +4369,7 @@ enum nl80211_if_combination_attrs { · 19 unmodified lines
4314 NL80211_IFACE_COMB_NUM_CHANNELS,4369 NL80211_IFACE_COMB_NUM_CHANNELS,
4315 NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,4370 NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,
4316 NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,4371 NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,
4372 NL80211_IFACE_COMB_BI_MIN_GCD,
4317 4373
4318 /* keep last */4374 /* keep last */
4319 NUM_NL80211_IFACE_COMB,4375 NUM_NL80211_IFACE_COMB,
@@ -4634,6 +4690,8 @@ enum nl80211_feature_flags { · 314 unmodified lines
4634 * configuration (AP/mesh) with HT rates.4690 * configuration (AP/mesh) with HT rates.
4635 * @NL80211_EXT_FEATURE_BEACON_RATE_VHT: Driver supports beacon rate4691 * @NL80211_EXT_FEATURE_BEACON_RATE_VHT: Driver supports beacon rate
4636 * configuration (AP/mesh) with VHT rates.4692 * configuration (AP/mesh) with VHT rates.
4693 * @NL80211_EXT_FEATURE_FILS_STA: This driver supports Fast Initial Link Setup
4694 * with user space SME (NL80211_CMD_AUTHENTICATE) in station mode.
4637 *4695 *
4638 * @NUM_NL80211_EXT_FEATURES: number of extended features.4696 * @NUM_NL80211_EXT_FEATURES: number of extended features.
4639 * @MAX_NL80211_EXT_FEATURES: highest extended feature index.4697 * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -4648,6 +4706,7 @@ enum nl80211_ext_feature_index { · 8 unmodified lines
4648 NL80211_EXT_FEATURE_BEACON_RATE_LEGACY,4706 NL80211_EXT_FEATURE_BEACON_RATE_LEGACY,
4649 NL80211_EXT_FEATURE_BEACON_RATE_HT,4707 NL80211_EXT_FEATURE_BEACON_RATE_HT,
4650 NL80211_EXT_FEATURE_BEACON_RATE_VHT,4708 NL80211_EXT_FEATURE_BEACON_RATE_VHT,
4709 NL80211_EXT_FEATURE_FILS_STA,
4651 4710
4652 /* add new features before the definition below */4711 /* add new features before the definition below */
4653 NUM_NL80211_EXT_FEATURES,4712 NUM_NL80211_EXT_FEATURES,
net/mac80211/Makefile+1−0
@@ -19,6 +19,7 @@ mac80211-y := \ · 18 unmodified lines
19 aes_gcm.o \19 aes_gcm.o \
20 aes_cmac.o \20 aes_cmac.o \
21 aes_gmac.o \21 aes_gmac.o \
22 fils_aead.o \
22 cfg.o \23 cfg.o \
23 ethtool.o \24 ethtool.o \
24 rx.o \25 rx.o \
net/mac80211/aes_cmac.c+4−4
@@ -23,7 +23,7 @@ · 22 unmodified lines
23#define AAD_LEN 2023#define AAD_LEN 20
24 24
25 25
26static void gf_mulx(u8 *pad)26void gf_mulx(u8 *pad)
27{27{
28 int i, carry;28 int i, carry;
29 29
@@ -35,9 +35,9 @@ static void gf_mulx(u8 *pad) · 5 unmodified lines
35 pad[AES_BLOCK_SIZE - 1] ^= 0x87;35 pad[AES_BLOCK_SIZE - 1] ^= 0x87;
36}36}
37 37
38static void aes_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,38void aes_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
39 const u8 *addr[], const size_t *len, u8 *mac,39 const u8 *addr[], const size_t *len, u8 *mac,
40 size_t mac_len)40 size_t mac_len)
41{41{
42 u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE];42 u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE];
43 const u8 *pos, *end;43 const u8 *pos, *end;
net/mac80211/aes_cmac.h+4−0
@@ -11,6 +11,10 @@ · 10 unmodified lines
11 11
12#include <linux/crypto.h>12#include <linux/crypto.h>
13 13
14void gf_mulx(u8 *pad);
15void aes_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
16 const u8 *addr[], const size_t *len, u8 *mac,
17 size_t mac_len);
14struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],18struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],
15 size_t key_len);19 size_t key_len);
16void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad,20void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad,
net/mac80211/agg-rx.c+2−6
@@ -315,11 +315,7 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta, · 314 unmodified lines
315 mutex_lock(&sta->ampdu_mlme.mtx);315 mutex_lock(&sta->ampdu_mlme.mtx);
316 316
317 if (test_bit(tid, sta->ampdu_mlme.agg_session_valid)) {317 if (test_bit(tid, sta->ampdu_mlme.agg_session_valid)) {
318 tid_agg_rx = rcu_dereference_protected(318 if (sta->ampdu_mlme.tid_rx_token[tid] == dialog_token) {
319 sta->ampdu_mlme.tid_rx[tid],
320 lockdep_is_held(&sta->ampdu_mlme.mtx));
321
322 if (tid_agg_rx->dialog_token == dialog_token) {
323 ht_dbg_ratelimited(sta->sdata,319 ht_dbg_ratelimited(sta->sdata,
324 "updated AddBA Req from %pM on tid %u\n",320 "updated AddBA Req from %pM on tid %u\n",
325 sta->sta.addr, tid);321 sta->sta.addr, tid);
@@ -396,7 +392,6 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta, · 70 unmodified lines
396 }392 }
397 393
398 /* update data */394 /* update data */
399 tid_agg_rx->dialog_token = dialog_token;
400 tid_agg_rx->ssn = start_seq_num;395 tid_agg_rx->ssn = start_seq_num;
401 tid_agg_rx->head_seq_num = start_seq_num;396 tid_agg_rx->head_seq_num = start_seq_num;
402 tid_agg_rx->buf_size = buf_size;397 tid_agg_rx->buf_size = buf_size;
@@ -418,6 +413,7 @@ end: · 15 unmodified lines
418 if (status == WLAN_STATUS_SUCCESS) {413 if (status == WLAN_STATUS_SUCCESS) {
419 __set_bit(tid, sta->ampdu_mlme.agg_session_valid);414 __set_bit(tid, sta->ampdu_mlme.agg_session_valid);
420 __clear_bit(tid, sta->ampdu_mlme.unexpected_agg);415 __clear_bit(tid, sta->ampdu_mlme.unexpected_agg);
416 sta->ampdu_mlme.tid_rx_token[tid] = dialog_token;
421 }417 }
422 mutex_unlock(&sta->ampdu_mlme.mtx);418 mutex_unlock(&sta->ampdu_mlme.mtx);
423 419
net/mac80211/cfg.c+9−26
@@ -357,10 +357,7 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 356 unmodified lines
357 mutex_lock(&local->sta_mtx);357 mutex_lock(&local->sta_mtx);
358 358
359 if (mac_addr) {359 if (mac_addr) {
360 if (ieee80211_vif_is_mesh(&sdata->vif))360 sta = sta_info_get_bss(sdata, mac_addr);
361 sta = sta_info_get(sdata, mac_addr);
362 else
363 sta = sta_info_get_bss(sdata, mac_addr);
364 /*361 /*
365 * The ASSOC test makes sure the driver is ready to362 * The ASSOC test makes sure the driver is ready to
366 * receive the key. When wpa_supplicant has roamed363 * receive the key. When wpa_supplicant has roamed
@@ -867,6 +864,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, · 500 unmodified lines
867 }864 }
868 sdata->needed_rx_chains = sdata->local->rx_chains;865 sdata->needed_rx_chains = sdata->local->rx_chains;
869 866
867 sdata->vif.bss_conf.beacon_int = params->beacon_interval;
868
870 mutex_lock(&local->mtx);869 mutex_lock(&local->mtx);
871 err = ieee80211_vif_use_channel(sdata, &params->chandef,870 err = ieee80211_vif_use_channel(sdata, &params->chandef,
872 IEEE80211_CHANCTX_SHARED);871 IEEE80211_CHANCTX_SHARED);
@@ -897,7 +896,6 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, · 24 unmodified lines
897 vlan->vif.type);896 vlan->vif.type);
898 }897 }
899 898
900 sdata->vif.bss_conf.beacon_int = params->beacon_interval;
901 sdata->vif.bss_conf.dtim_period = params->dtim_period;899 sdata->vif.bss_conf.dtim_period = params->dtim_period;
902 sdata->vif.bss_conf.enable_beacon = true;900 sdata->vif.bss_conf.enable_beacon = true;
903 sdata->vif.bss_conf.allow_p2p_go_ps = sdata->vif.p2p;901 sdata->vif.bss_conf.allow_p2p_go_ps = sdata->vif.p2p;
@@ -1523,9 +1521,6 @@ static int ieee80211_change_station(struct wiphy *wiphy, · 619 unmodified lines
1523 goto out_err;1521 goto out_err;
1524 1522
1525 if (params->vlan && params->vlan != sta->sdata->dev) {1523 if (params->vlan && params->vlan != sta->sdata->dev) {
1526 bool prev_4addr = false;
1527 bool new_4addr = false;
1528
1529 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);1524 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
1530 1525
1531 if (params->vlan->ieee80211_ptr->use_4addr) {1526 if (params->vlan->ieee80211_ptr->use_4addr) {
@@ -1535,26 +1530,21 @@ static int ieee80211_change_station(struct wiphy *wiphy, · 3 unmodified lines
1535 }1530 }
1536 1531
1537 rcu_assign_pointer(vlansdata->u.vlan.sta, sta);1532 rcu_assign_pointer(vlansdata->u.vlan.sta, sta);
1538 new_4addr = true;
1539 __ieee80211_check_fast_rx_iface(vlansdata);1533 __ieee80211_check_fast_rx_iface(vlansdata);
1540 }1534 }
1541 1535
1542 if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&1536 if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
1543 sta->sdata->u.vlan.sta) {1537 sta->sdata->u.vlan.sta)
1544 RCU_INIT_POINTER(sta->sdata->u.vlan.sta, NULL);1538 RCU_INIT_POINTER(sta->sdata->u.vlan.sta, NULL);
1545 prev_4addr = true;1539
1546 }1540 if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
1541 ieee80211_vif_dec_num_mcast(sta->sdata);
1547 1542
1548 sta->sdata = vlansdata;1543 sta->sdata = vlansdata;
1549 ieee80211_check_fast_xmit(sta);1544 ieee80211_check_fast_xmit(sta);
1550 1545
1551 if (sta->sta_state == IEEE80211_STA_AUTHORIZED &&1546 if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
1552 prev_4addr != new_4addr) {1547 ieee80211_vif_inc_num_mcast(sta->sdata);
1553 if (new_4addr)
1554 atomic_dec(&sta->sdata->bss->num_mcast_sta);
1555 else
1556 atomic_inc(&sta->sdata->bss->num_mcast_sta);
1557 }
1558 1548
1559 ieee80211_send_layer2_update(sta);1549 ieee80211_send_layer2_update(sta);
1560 }1550 }
@@ -2480,13 +2470,6 @@ int __ieee80211_request_smps_ap(struct ieee80211_sub_if_data *sdata, · 919 unmodified lines
2480 smps_mode == IEEE80211_SMPS_AUTOMATIC)2470 smps_mode == IEEE80211_SMPS_AUTOMATIC)
2481 return 0;2471 return 0;
2482 2472
2483 /* If no associated stations, there's no need to do anything */
2484 if (!atomic_read(&sdata->u.ap.num_mcast_sta)) {
2485 sdata->smps_mode = smps_mode;
2486 ieee80211_queue_work(&sdata->local->hw, &sdata->recalc_smps);
2487 return 0;
2488 }
2489
2490 ht_dbg(sdata,2473 ht_dbg(sdata,
2491 "SMPS %d requested in AP mode, sending Action frame to %d stations\n",2474 "SMPS %d requested in AP mode, sending Action frame to %d stations\n",
2492 smps_mode, atomic_read(&sdata->u.ap.num_mcast_sta));2475 smps_mode, atomic_read(&sdata->u.ap.num_mcast_sta));
net/mac80211/debugfs.c+1−0
@@ -210,6 +210,7 @@ static const char *hw_flag_names[] = { · 209 unmodified lines
210 FLAG(TX_AMSDU),210 FLAG(TX_AMSDU),
211 FLAG(TX_FRAG_LIST),211 FLAG(TX_FRAG_LIST),
212 FLAG(REPORTS_LOW_ACK),212 FLAG(REPORTS_LOW_ACK),
213 FLAG(SUPPORTS_TX_FRAG),
213#undef FLAG214#undef FLAG
214};215};
215 216
net/mac80211/debugfs_netdev.c+11−0
@@ -477,6 +477,7 @@ IEEE80211_IF_FILE_RW(tdls_wider_bw); · 476 unmodified lines
477IEEE80211_IF_FILE(num_mcast_sta, u.ap.num_mcast_sta, ATOMIC);477IEEE80211_IF_FILE(num_mcast_sta, u.ap.num_mcast_sta, ATOMIC);
478IEEE80211_IF_FILE(num_sta_ps, u.ap.ps.num_sta_ps, ATOMIC);478IEEE80211_IF_FILE(num_sta_ps, u.ap.ps.num_sta_ps, ATOMIC);
479IEEE80211_IF_FILE(dtim_count, u.ap.ps.dtim_count, DEC);479IEEE80211_IF_FILE(dtim_count, u.ap.ps.dtim_count, DEC);
480IEEE80211_IF_FILE(num_mcast_sta_vlan, u.vlan.num_mcast_sta, ATOMIC);
480 481
481static ssize_t ieee80211_if_fmt_num_buffered_multicast(482static ssize_t ieee80211_if_fmt_num_buffered_multicast(
482 const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)483 const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
@@ -684,6 +685,13 @@ static void add_ap_files(struct ieee80211_sub_if_data *sdata) · 201 unmodified lines
684 DEBUGFS_ADD_MODE(tkip_mic_test, 0200);685 DEBUGFS_ADD_MODE(tkip_mic_test, 0200);
685}686}
686 687
688static void add_vlan_files(struct ieee80211_sub_if_data *sdata)
689{
690 /* add num_mcast_sta_vlan using name num_mcast_sta */
691 debugfs_create_file("num_mcast_sta", 0400, sdata->vif.debugfs_dir,
692 sdata, &num_mcast_sta_vlan_ops);
693}
694
687static void add_ibss_files(struct ieee80211_sub_if_data *sdata)695static void add_ibss_files(struct ieee80211_sub_if_data *sdata)
688{696{
689 DEBUGFS_ADD_MODE(tsf, 0600);697 DEBUGFS_ADD_MODE(tsf, 0600);
@@ -787,6 +795,9 @@ static void add_files(struct ieee80211_sub_if_data *sdata) · 97 unmodified lines
787 case NL80211_IFTYPE_AP:795 case NL80211_IFTYPE_AP:
788 add_ap_files(sdata);796 add_ap_files(sdata);
789 break;797 break;
798 case NL80211_IFTYPE_AP_VLAN:
799 add_vlan_files(sdata);
800 break;
790 case NL80211_IFTYPE_WDS:801 case NL80211_IFTYPE_WDS:
791 add_wds_files(sdata);802 add_wds_files(sdata);
792 break;803 break;
net/mac80211/debugfs_sta.c+7−2
@@ -199,13 +199,18 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, · 198 unmodified lines
199 "TID\t\tRX\tDTKN\tSSN\t\tTX\tDTKN\tpending\n");199 "TID\t\tRX\tDTKN\tSSN\t\tTX\tDTKN\tpending\n");
200 200
201 for (i = 0; i < IEEE80211_NUM_TIDS; i++) {201 for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
202 bool tid_rx_valid;
203
202 tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[i]);204 tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[i]);
203 tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[i]);205 tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[i]);
206 tid_rx_valid = test_bit(i, sta->ampdu_mlme.agg_session_valid);
204 207
205 p += scnprintf(p, sizeof(buf) + buf - p, "%02d", i);208 p += scnprintf(p, sizeof(buf) + buf - p, "%02d", i);
206 p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x", !!tid_rx);209 p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x",
210 tid_rx_valid);
207 p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x",211 p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x",
208 tid_rx ? tid_rx->dialog_token : 0);212 tid_rx_valid ?
213 sta->ampdu_mlme.tid_rx_token[i] : 0);
209 p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.3x",214 p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.3x",
210 tid_rx ? tid_rx->ssn : 0);215 tid_rx ? tid_rx->ssn : 0);
211 216
net/mac80211/fils_aead.c+342−0
@@ -0,0 +1,342 @@
1/*
2 * FILS AEAD for (Re)Association Request/Response frames
3 * Copyright 2016, Qualcomm Atheros, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#include <crypto/aes.h>
11#include <crypto/algapi.h>
12#include <crypto/skcipher.h>
13
14#include "ieee80211_i.h"
15#include "aes_cmac.h"
16#include "fils_aead.h"
17
18static int aes_s2v(struct crypto_cipher *tfm,
19 size_t num_elem, const u8 *addr[], size_t len[], u8 *v)
20{
21 u8 d[AES_BLOCK_SIZE], tmp[AES_BLOCK_SIZE];
22 size_t i;
23 const u8 *data[2];
24 size_t data_len[2], data_elems;
25
26 /* D = AES-CMAC(K, <zero>) */
27 memset(tmp, 0, AES_BLOCK_SIZE);
28 data[0] = tmp;
29 data_len[0] = AES_BLOCK_SIZE;
30 aes_cmac_vector(tfm, 1, data, data_len, d, AES_BLOCK_SIZE);
31
32 for (i = 0; i < num_elem - 1; i++) {
33 /* D = dbl(D) xor AES_CMAC(K, Si) */
34 gf_mulx(d); /* dbl */
35 aes_cmac_vector(tfm, 1, &addr[i], &len[i], tmp,
36 AES_BLOCK_SIZE);
37 crypto_xor(d, tmp, AES_BLOCK_SIZE);
38 }
39
40 if (len[i] >= AES_BLOCK_SIZE) {
41 /* len(Sn) >= 128 */
42 size_t j;
43 const u8 *pos;
44
45 /* T = Sn xorend D */
46
47 /* Use a temporary buffer to perform xorend on Sn (addr[i]) to
48 * avoid modifying the const input argument.
49 */
50 data[0] = addr[i];
51 data_len[0] = len[i] - AES_BLOCK_SIZE;
52 pos = addr[i] + data_len[0];
53 for (j = 0; j < AES_BLOCK_SIZE; j++)
54 tmp[j] = pos[j] ^ d[j];
55 data[1] = tmp;
56 data_len[1] = AES_BLOCK_SIZE;
57 data_elems = 2;
58 } else {
59 /* len(Sn) < 128 */
60 /* T = dbl(D) xor pad(Sn) */
61 gf_mulx(d); /* dbl */
62 memset(tmp, 0, AES_BLOCK_SIZE);
63 memcpy(tmp, addr[i], len[i]);
64 tmp[len[i]] = 0x80;
65 crypto_xor(d, tmp, AES_BLOCK_SIZE);
66 data[0] = d;
67 data_len[0] = sizeof(d);
68 data_elems = 1;
69 }
70 /* V = AES-CMAC(K, T) */
71 aes_cmac_vector(tfm, data_elems, data, data_len, v, AES_BLOCK_SIZE);
72
73 return 0;
74}
75
76/* Note: addr[] and len[] needs to have one extra slot at the end. */
77static int aes_siv_encrypt(const u8 *key, size_t key_len,
78 const u8 *plain, size_t plain_len,
79 size_t num_elem, const u8 *addr[],
80 size_t len[], u8 *out)
81{
82 u8 v[AES_BLOCK_SIZE];
83 struct crypto_cipher *tfm;
84 struct crypto_skcipher *tfm2;
85 struct skcipher_request *req;
86 int res;
87 struct scatterlist src[1], dst[1];
88 u8 *tmp;
89
90 key_len /= 2; /* S2V key || CTR key */
91
92 addr[num_elem] = plain;
93 len[num_elem] = plain_len;
94 num_elem++;
95
96 /* S2V */
97
98 tfm = crypto_alloc_cipher("aes", 0, 0);
99 if (IS_ERR(tfm))
100 return PTR_ERR(tfm);
101 /* K1 for S2V */
102 res = crypto_cipher_setkey(tfm, key, key_len);
103 if (!res)
104 res = aes_s2v(tfm, num_elem, addr, len, v);
105 crypto_free_cipher(tfm);
106 if (res)
107 return res;
108
109 /* Use a temporary buffer of the plaintext to handle need for
110 * overwriting this during AES-CTR.
111 */
112 tmp = kmemdup(plain, plain_len, GFP_KERNEL);
113 if (!tmp)
114 return -ENOMEM;
115
116 /* IV for CTR before encrypted data */
117 memcpy(out, v, AES_BLOCK_SIZE);
118
119 /* Synthetic IV to be used as the initial counter in CTR:
120 * Q = V bitand (1^64 || 0^1 || 1^31 || 0^1 || 1^31)
121 */
122 v[8] &= 0x7f;
123 v[12] &= 0x7f;
124
125 /* CTR */
126
127 tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, 0);
128 if (IS_ERR(tfm2)) {
129 kfree(tmp);
130 return PTR_ERR(tfm2);
131 }
132 /* K2 for CTR */
133 res = crypto_skcipher_setkey(tfm2, key + key_len, key_len);
134 if (res)
135 goto fail;
136
137 req = skcipher_request_alloc(tfm2, GFP_KERNEL);
138 if (!req) {
139 res = -ENOMEM;
140 goto fail;
141 }
142
143 sg_init_one(src, tmp, plain_len);
144 sg_init_one(dst, out + AES_BLOCK_SIZE, plain_len);
145 skcipher_request_set_crypt(req, src, dst, plain_len, v);
146 res = crypto_skcipher_encrypt(req);
147 skcipher_request_free(req);
148fail:
149 kfree(tmp);
150 crypto_free_skcipher(tfm2);
151 return res;
152}
153
154/* Note: addr[] and len[] needs to have one extra slot at the end. */
155static int aes_siv_decrypt(const u8 *key, size_t key_len,
156 const u8 *iv_crypt, size_t iv_c_len,
157 size_t num_elem, const u8 *addr[], size_t len[],
158 u8 *out)
159{
160 struct crypto_cipher *tfm;
161 struct crypto_skcipher *tfm2;
162 struct skcipher_request *req;
163 struct scatterlist src[1], dst[1];
164 size_t crypt_len;
165 int res;
166 u8 frame_iv[AES_BLOCK_SIZE], iv[AES_BLOCK_SIZE];
167 u8 check[AES_BLOCK_SIZE];
168
169 crypt_len = iv_c_len - AES_BLOCK_SIZE;
170 key_len /= 2; /* S2V key || CTR key */
171 addr[num_elem] = out;
172 len[num_elem] = crypt_len;
173 num_elem++;
174
175 memcpy(iv, iv_crypt, AES_BLOCK_SIZE);
176 memcpy(frame_iv, iv_crypt, AES_BLOCK_SIZE);
177
178 /* Synthetic IV to be used as the initial counter in CTR:
179 * Q = V bitand (1^64 || 0^1 || 1^31 || 0^1 || 1^31)
180 */
181 iv[8] &= 0x7f;
182 iv[12] &= 0x7f;
183
184 /* CTR */
185
186 tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, 0);
187 if (IS_ERR(tfm2))
188 return PTR_ERR(tfm2);
189 /* K2 for CTR */
190 res = crypto_skcipher_setkey(tfm2, key + key_len, key_len);
191 if (res) {
192 crypto_free_skcipher(tfm2);
193 return res;
194 }
195
196 req = skcipher_request_alloc(tfm2, GFP_KERNEL);
197 if (!req) {
198 crypto_free_skcipher(tfm2);
199 return -ENOMEM;
200 }
201
202 sg_init_one(src, iv_crypt + AES_BLOCK_SIZE, crypt_len);
203 sg_init_one(dst, out, crypt_len);
204 skcipher_request_set_crypt(req, src, dst, crypt_len, iv);
205 res = crypto_skcipher_decrypt(req);
206 skcipher_request_free(req);
207 crypto_free_skcipher(tfm2);
208 if (res)
209 return res;
210
211 /* S2V */
212
213 tfm = crypto_alloc_cipher("aes", 0, 0);
214 if (IS_ERR(tfm))
215 return PTR_ERR(tfm);
216 /* K1 for S2V */
217 res = crypto_cipher_setkey(tfm, key, key_len);
218 if (!res)
219 res = aes_s2v(tfm, num_elem, addr, len, check);
220 crypto_free_cipher(tfm);
221 if (res)
222 return res;
223 if (memcmp(check, frame_iv, AES_BLOCK_SIZE) != 0)
224 return -EINVAL;
225 return 0;
226}
227
228int fils_encrypt_assoc_req(struct sk_buff *skb,
229 struct ieee80211_mgd_assoc_data *assoc_data)
230{
231 struct ieee80211_mgmt *mgmt = (void *)skb->data;
232 u8 *capab, *ies, *encr;
233 const u8 *addr[5 + 1], *session;
234 size_t len[5 + 1];
235 size_t crypt_len;
236
237 if (ieee80211_is_reassoc_req(mgmt->frame_control)) {
238 capab = (u8 *)&mgmt->u.reassoc_req.capab_info;
239 ies = mgmt->u.reassoc_req.variable;
240 } else {
241 capab = (u8 *)&mgmt->u.assoc_req.capab_info;
242 ies = mgmt->u.assoc_req.variable;
243 }
244
245 session = cfg80211_find_ext_ie(WLAN_EID_EXT_FILS_SESSION,
246 ies, skb->data + skb->len - ies);
247 if (!session || session[1] != 1 + 8)
248 return -EINVAL;
249 /* encrypt after FILS Session element */
250 encr = (u8 *)session + 2 + 1 + 8;
251
252 /* AES-SIV AAD vectors */
253
254 /* The STA's MAC address */
255 addr[0] = mgmt->sa;
256 len[0] = ETH_ALEN;
257 /* The AP's BSSID */
258 addr[1] = mgmt->da;
259 len[1] = ETH_ALEN;
260 /* The STA's nonce */
261 addr[2] = assoc_data->fils_nonces;
262 len[2] = FILS_NONCE_LEN;
263 /* The AP's nonce */
264 addr[3] = &assoc_data->fils_nonces[FILS_NONCE_LEN];
265 len[3] = FILS_NONCE_LEN;
266 /* The (Re)Association Request frame from the Capability Information
267 * field to the FILS Session element (both inclusive).
268 */
269 addr[4] = capab;
270 len[4] = encr - capab;
271
272 crypt_len = skb->data + skb->len - encr;
273 skb_put(skb, AES_BLOCK_SIZE);
274 return aes_siv_encrypt(assoc_data->fils_kek, assoc_data->fils_kek_len,
275 encr, crypt_len, 1, addr, len, encr);
276}
277
278int fils_decrypt_assoc_resp(struct ieee80211_sub_if_data *sdata,
279 u8 *frame, size_t *frame_len,
280 struct ieee80211_mgd_assoc_data *assoc_data)
281{
282 struct ieee80211_mgmt *mgmt = (void *)frame;
283 u8 *capab, *ies, *encr;
284 const u8 *addr[5 + 1], *session;
285 size_t len[5 + 1];
286 int res;
287 size_t crypt_len;
288
289 if (*frame_len < 24 + 6)
290 return -EINVAL;
291
292 capab = (u8 *)&mgmt->u.assoc_resp.capab_info;
293 ies = mgmt->u.assoc_resp.variable;
294 session = cfg80211_find_ext_ie(WLAN_EID_EXT_FILS_SESSION,
295 ies, frame + *frame_len - ies);
296 if (!session || session[1] != 1 + 8) {
297 mlme_dbg(sdata,
298 "No (valid) FILS Session element in (Re)Association Response frame from %pM",
299 mgmt->sa);
300 return -EINVAL;
301 }
302 /* decrypt after FILS Session element */
303 encr = (u8 *)session + 2 + 1 + 8;
304
305 /* AES-SIV AAD vectors */
306
307 /* The AP's BSSID */
308 addr[0] = mgmt->sa;
309 len[0] = ETH_ALEN;
310 /* The STA's MAC address */
311 addr[1] = mgmt->da;
312 len[1] = ETH_ALEN;
313 /* The AP's nonce */
314 addr[2] = &assoc_data->fils_nonces[FILS_NONCE_LEN];
315 len[2] = FILS_NONCE_LEN;
316 /* The STA's nonce */
317 addr[3] = assoc_data->fils_nonces;
318 len[3] = FILS_NONCE_LEN;
319 /* The (Re)Association Response frame from the Capability Information
320 * field to the FILS Session element (both inclusive).
321 */
322 addr[4] = capab;
323 len[4] = encr - capab;
324
325 crypt_len = frame + *frame_len - encr;
326 if (crypt_len < AES_BLOCK_SIZE) {
327 mlme_dbg(sdata,
328 "Not enough room for AES-SIV data after FILS Session element in (Re)Association Response frame from %pM",
329 mgmt->sa);
330 return -EINVAL;
331 }
332 res = aes_siv_decrypt(assoc_data->fils_kek, assoc_data->fils_kek_len,
333 encr, crypt_len, 5, addr, len, encr);
334 if (res != 0) {
335 mlme_dbg(sdata,
336 "AES-SIV decryption of (Re)Association Response frame from %pM failed",
337 mgmt->sa);
338 return res;
339 }
340 *frame_len -= AES_BLOCK_SIZE;
341 return 0;
342}
net/mac80211/fils_aead.h+19−0
@@ -0,0 +1,19 @@
1/*
2 * FILS AEAD for (Re)Association Request/Response frames
3 * Copyright 2016, Qualcomm Atheros, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef FILS_AEAD_H
11#define FILS_AEAD_H
12
13int fils_encrypt_assoc_req(struct sk_buff *skb,
14 struct ieee80211_mgd_assoc_data *assoc_data);
15int fils_decrypt_assoc_resp(struct ieee80211_sub_if_data *sdata,
16 u8 *frame, size_t *frame_len,
17 struct ieee80211_mgd_assoc_data *assoc_data);
18
19#endif /* FILS_AEAD_H */
net/mac80211/ieee80211_i.h+25−1
@@ -84,6 +84,8 @@ struct ieee80211_local; · 83 unmodified lines
84#define IEEE80211_DEFAULT_MAX_SP_LEN \84#define IEEE80211_DEFAULT_MAX_SP_LEN \
85 IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL85 IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
86 86
87extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS];
88
87#define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */)89#define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */)
88 90
89#define IEEE80211_MAX_NAN_INSTANCE_ID 25591#define IEEE80211_MAX_NAN_INSTANCE_ID 255
@@ -307,6 +309,7 @@ struct ieee80211_if_vlan { · 217 unmodified lines
307 309
308 /* used for all tx if the VLAN is configured to 4-addr mode */310 /* used for all tx if the VLAN is configured to 4-addr mode */
309 struct sta_info __rcu *sta;311 struct sta_info __rcu *sta;
312 atomic_t num_mcast_sta; /* number of stations receiving multicast */
310};313};
311 314
312struct mesh_stats {315struct mesh_stats {
@@ -398,6 +401,10 @@ struct ieee80211_mgd_assoc_data { · 85 unmodified lines
398 401
399 struct ieee80211_vht_cap ap_vht_cap;402 struct ieee80211_vht_cap ap_vht_cap;
400 403
404 u8 fils_nonces[2 * FILS_NONCE_LEN];
405 u8 fils_kek[FILS_MAX_KEK_LEN];
406 size_t fils_kek_len;
407
401 size_t ie_len;408 size_t ie_len;
402 u8 ie[];409 u8 ie[];
403};410};
@@ -442,7 +449,7 @@ struct ieee80211_if_managed { · 38 unmodified lines
442 struct ieee80211_mgd_auth_data *auth_data;449 struct ieee80211_mgd_auth_data *auth_data;
443 struct ieee80211_mgd_assoc_data *assoc_data;450 struct ieee80211_mgd_assoc_data *assoc_data;
444 451
445 u8 bssid[ETH_ALEN];452 u8 bssid[ETH_ALEN] __aligned(2);
446 453
447 u16 aid;454 u16 aid;
448 455
@@ -1527,6 +1534,23 @@ ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status) · 1078 unmodified lines
1527 return false;1534 return false;
1528}1535}
1529 1536
1537void ieee80211_vif_inc_num_mcast(struct ieee80211_sub_if_data *sdata);
1538void ieee80211_vif_dec_num_mcast(struct ieee80211_sub_if_data *sdata);
1539
1540/* This function returns the number of multicast stations connected to this
1541 * interface. It returns -1 if that number is not tracked, that is for netdevs
1542 * not in AP or AP_VLAN mode or when using 4addr.
1543 */
1544static inline int
1545ieee80211_vif_get_num_mcast_if(struct ieee80211_sub_if_data *sdata)
1546{
1547 if (sdata->vif.type == NL80211_IFTYPE_AP)
1548 return atomic_read(&sdata->u.ap.num_mcast_sta);
1549 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta)
1550 return atomic_read(&sdata->u.vlan.num_mcast_sta);
1551 return -1;
1552}
1553
1530u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,1554u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
1531 struct ieee80211_rx_status *status,1555 struct ieee80211_rx_status *status,
1532 unsigned int mpdu_len,1556 unsigned int mpdu_len,
net/mac80211/iface.c+16−0
@@ -1998,3 +1998,19 @@ void ieee80211_iface_exit(void) · 1997 unmodified lines
1998{1998{
1999 unregister_netdevice_notifier(&mac80211_netdev_notifier);1999 unregister_netdevice_notifier(&mac80211_netdev_notifier);
2000}2000}
2001
2002void ieee80211_vif_inc_num_mcast(struct ieee80211_sub_if_data *sdata)
2003{
2004 if (sdata->vif.type == NL80211_IFTYPE_AP)
2005 atomic_inc(&sdata->u.ap.num_mcast_sta);
2006 else if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
2007 atomic_inc(&sdata->u.vlan.num_mcast_sta);
2008}
2009
2010void ieee80211_vif_dec_num_mcast(struct ieee80211_sub_if_data *sdata)
2011{
2012 if (sdata->vif.type == NL80211_IFTYPE_AP)
2013 atomic_dec(&sdata->u.ap.num_mcast_sta);
2014 else if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
2015 atomic_dec(&sdata->u.vlan.num_mcast_sta);
2016}
net/mac80211/main.c+5−0
@@ -549,6 +549,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len, · 548 unmodified lines
549 NL80211_FEATURE_MAC_ON_CREATE |549 NL80211_FEATURE_MAC_ON_CREATE |
550 NL80211_FEATURE_USERSPACE_MPM |550 NL80211_FEATURE_USERSPACE_MPM |
551 NL80211_FEATURE_FULL_AP_CLIENT_STATE;551 NL80211_FEATURE_FULL_AP_CLIENT_STATE;
552 wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_FILS_STA);
552 553
553 if (!ops->hw_scan)554 if (!ops->hw_scan)
554 wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN |555 wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN |
@@ -821,6 +822,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) · 266 unmodified lines
821 !local->ops->tdls_recv_channel_switch))822 !local->ops->tdls_recv_channel_switch))
822 return -EOPNOTSUPP;823 return -EOPNOTSUPP;
823 824
825 if (WARN_ON(ieee80211_hw_check(hw, SUPPORTS_TX_FRAG) &&
826 !local->ops->set_frag_threshold))
827 return -EINVAL;
828
824 if (WARN_ON(local->hw.wiphy->interface_modes &829 if (WARN_ON(local->hw.wiphy->interface_modes &
825 BIT(NL80211_IFTYPE_NAN) &&830 BIT(NL80211_IFTYPE_NAN) &&
826 (!local->ops->start_nan || !local->ops->stop_nan)))831 (!local->ops->start_nan || !local->ops->stop_nan)))
net/mac80211/mlme.c+51−9
@@ -30,6 +30,7 @@ · 29 unmodified lines
30#include "driver-ops.h"30#include "driver-ops.h"
31#include "rate.h"31#include "rate.h"
32#include "led.h"32#include "led.h"
33#include "fils_aead.h"
33 34
34#define IEEE80211_AUTH_TIMEOUT (HZ / 5)35#define IEEE80211_AUTH_TIMEOUT (HZ / 5)
35#define IEEE80211_AUTH_TIMEOUT_LONG (HZ / 2)36#define IEEE80211_AUTH_TIMEOUT_LONG (HZ / 2)
@@ -652,6 +653,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 616 unmodified lines
652 2 + sizeof(struct ieee80211_ht_cap) + /* HT */653 2 + sizeof(struct ieee80211_ht_cap) + /* HT */
653 2 + sizeof(struct ieee80211_vht_cap) + /* VHT */654 2 + sizeof(struct ieee80211_vht_cap) + /* VHT */
654 assoc_data->ie_len + /* extra IEs */655 assoc_data->ie_len + /* extra IEs */
656 (assoc_data->fils_kek_len ? 16 /* AES-SIV */ : 0) +
655 9, /* WMM */657 9, /* WMM */
656 GFP_KERNEL);658 GFP_KERNEL);
657 if (!skb)659 if (!skb)
@@ -875,6 +877,12 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 217 unmodified lines
875 memcpy(pos, assoc_data->ie + offset, noffset - offset);877 memcpy(pos, assoc_data->ie + offset, noffset - offset);
876 }878 }
877 879
880 if (assoc_data->fils_kek_len &&
881 fils_encrypt_assoc_req(skb, assoc_data) < 0) {
882 dev_kfree_skb(skb);
883 return;
884 }
885
878 drv_mgd_prepare_tx(local, sdata);886 drv_mgd_prepare_tx(local, sdata);
879 887
880 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;888 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
@@ -2618,6 +2626,9 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, · 1737 unmodified lines
2618 case WLAN_AUTH_LEAP:2626 case WLAN_AUTH_LEAP:
2619 case WLAN_AUTH_FT:2627 case WLAN_AUTH_FT:
2620 case WLAN_AUTH_SAE:2628 case WLAN_AUTH_SAE:
2629 case WLAN_AUTH_FILS_SK:
2630 case WLAN_AUTH_FILS_SK_PFS:
2631 case WLAN_AUTH_FILS_PK:
2621 break;2632 break;
2622 case WLAN_AUTH_SHARED_KEY:2633 case WLAN_AUTH_SHARED_KEY:
2623 if (ifmgd->auth_data->expected_transaction != 4) {2634 if (ifmgd->auth_data->expected_transaction != 4) {
@@ -3143,6 +3154,10 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 519 unmodified lines
3143 reassoc ? "Rea" : "A", mgmt->sa,3154 reassoc ? "Rea" : "A", mgmt->sa,
3144 capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14))));3155 capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14))));
3145 3156
3157 if (assoc_data->fils_kek_len &&
3158 fils_decrypt_assoc_resp(sdata, (u8 *)mgmt, &len, assoc_data) < 0)
3159 return;
3160
3146 pos = mgmt->u.assoc_resp.variable;3161 pos = mgmt->u.assoc_resp.variable;
3147 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), false, &elems);3162 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), false, &elems);
3148 3163
@@ -3193,7 +3208,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 44 unmodified lines
3193 uapsd_queues = 0;3208 uapsd_queues = 0;
3194 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)3209 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
3195 if (sdata->tx_conf[ac].uapsd)3210 if (sdata->tx_conf[ac].uapsd)
3196 uapsd_queues |= BIT(ac);3211 uapsd_queues |= ieee80211_ac_to_qos_mask[ac];
3197 }3212 }
3198 3213
3199 cfg80211_rx_assoc_resp(sdata->dev, bss, (u8 *)mgmt, len, uapsd_queues);3214 cfg80211_rx_assoc_resp(sdata->dev, bss, (u8 *)mgmt, len, uapsd_queues);
@@ -4479,24 +4494,36 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, · 1279 unmodified lines
4479 case NL80211_AUTHTYPE_SAE:4494 case NL80211_AUTHTYPE_SAE:
4480 auth_alg = WLAN_AUTH_SAE;4495 auth_alg = WLAN_AUTH_SAE;
4481 break;4496 break;
4497 case NL80211_AUTHTYPE_FILS_SK:
4498 auth_alg = WLAN_AUTH_FILS_SK;
4499 break;
4500 case NL80211_AUTHTYPE_FILS_SK_PFS:
4501 auth_alg = WLAN_AUTH_FILS_SK_PFS;
4502 break;
4503 case NL80211_AUTHTYPE_FILS_PK:
4504 auth_alg = WLAN_AUTH_FILS_PK;
4505 break;
4482 default:4506 default:
4483 return -EOPNOTSUPP;4507 return -EOPNOTSUPP;
4484 }4508 }
4485 4509
4486 auth_data = kzalloc(sizeof(*auth_data) + req->sae_data_len +4510 auth_data = kzalloc(sizeof(*auth_data) + req->auth_data_len +
4487 req->ie_len, GFP_KERNEL);4511 req->ie_len, GFP_KERNEL);
4488 if (!auth_data)4512 if (!auth_data)
4489 return -ENOMEM;4513 return -ENOMEM;
4490 4514
4491 auth_data->bss = req->bss;4515 auth_data->bss = req->bss;
4492 4516
4493 if (req->sae_data_len >= 4) {4517 if (req->auth_data_len >= 4) {
4494 __le16 *pos = (__le16 *) req->sae_data;4518 if (req->auth_type == NL80211_AUTHTYPE_SAE) {
4495 auth_data->sae_trans = le16_to_cpu(pos[0]);4519 __le16 *pos = (__le16 *) req->auth_data;
4496 auth_data->sae_status = le16_to_cpu(pos[1]);4520
4497 memcpy(auth_data->data, req->sae_data + 4,4521 auth_data->sae_trans = le16_to_cpu(pos[0]);
4498 req->sae_data_len - 4);4522 auth_data->sae_status = le16_to_cpu(pos[1]);
4499 auth_data->data_len += req->sae_data_len - 4;4523 }
4524 memcpy(auth_data->data, req->auth_data + 4,
4525 req->auth_data_len - 4);
4526 auth_data->data_len += req->auth_data_len - 4;
4500 }4527 }
4501 4528
4502 if (req->ie && req->ie_len) {4529 if (req->ie && req->ie_len) {
@@ -4692,6 +4719,21 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, · 189 unmodified lines
4692 assoc_data->ie_len = req->ie_len;4719 assoc_data->ie_len = req->ie_len;
4693 }4720 }
4694 4721
4722 if (req->fils_kek) {
4723 /* should already be checked in cfg80211 - so warn */
4724 if (WARN_ON(req->fils_kek_len > FILS_MAX_KEK_LEN)) {
4725 err = -EINVAL;
4726 goto err_free;
4727 }
4728 memcpy(assoc_data->fils_kek, req->fils_kek,
4729 req->fils_kek_len);
4730 assoc_data->fils_kek_len = req->fils_kek_len;
4731 }
4732
4733 if (req->fils_nonces)
4734 memcpy(assoc_data->fils_nonces, req->fils_nonces,
4735 2 * FILS_NONCE_LEN);
4736
4695 assoc_data->bss = req->bss;4737 assoc_data->bss = req->bss;
4696 4738
4697 if (ifmgd->req_smps == IEEE80211_SMPS_AUTOMATIC) {4739 if (ifmgd->req_smps == IEEE80211_SMPS_AUTOMATIC) {
net/mac80211/rx.c+7−4
@@ -1394,13 +1394,15 @@ void ieee80211_sta_uapsd_trigger(struct ieee80211_sta *pubsta, u8 tid) · 1393 unmodified lines
1394 u8 ac = ieee802_1d_to_ac[tid & 7];1394 u8 ac = ieee802_1d_to_ac[tid & 7];
1395 1395
1396 /*1396 /*
1397 * If this AC is not trigger-enabled do nothing.1397 * If this AC is not trigger-enabled do nothing unless the
1398 * driver is calling us after it already checked.
1398 *1399 *
1399 * NB: This could/should check a separate bitmap of trigger-1400 * NB: This could/should check a separate bitmap of trigger-
1400 * enabled queues, but for now we only implement uAPSD w/o1401 * enabled queues, but for now we only implement uAPSD w/o
1401 * TSPEC changes to the ACs, so they're always the same.1402 * TSPEC changes to the ACs, so they're always the same.
1402 */1403 */
1403 if (!(sta->sta.uapsd_queues & BIT(ac)))1404 if (!(sta->sta.uapsd_queues & ieee80211_ac_to_qos_mask[ac]) &&
1405 tid != IEEE80211_NUM_TIDS)
1404 return;1406 return;
1405 1407
1406 /* if we are in a service period, do nothing */1408 /* if we are in a service period, do nothing */
@@ -2215,7 +2217,8 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) · 808 unmodified lines
2215 sdata->vif.type == NL80211_IFTYPE_AP_VLAN) &&2217 sdata->vif.type == NL80211_IFTYPE_AP_VLAN) &&
2216 !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) &&2218 !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) &&
2217 (sdata->vif.type != NL80211_IFTYPE_AP_VLAN || !sdata->u.vlan.sta)) {2219 (sdata->vif.type != NL80211_IFTYPE_AP_VLAN || !sdata->u.vlan.sta)) {
2218 if (is_multicast_ether_addr(ehdr->h_dest)) {2220 if (is_multicast_ether_addr(ehdr->h_dest) &&
2221 ieee80211_vif_get_num_mcast_if(sdata) != 0) {
2219 /*2222 /*
2220 * send multicast frames both to higher layers in2223 * send multicast frames both to higher layers in
2221 * local net stack and back to the wireless medium2224 * local net stack and back to the wireless medium
@@ -2224,7 +2227,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) · 2 unmodified lines
2224 if (!xmit_skb)2227 if (!xmit_skb)
2225 net_info_ratelimited("%s: failed to clone multicast frame\n",2228 net_info_ratelimited("%s: failed to clone multicast frame\n",
2226 dev->name);2229 dev->name);
2227 } else {2230 } else if (!is_multicast_ether_addr(ehdr->h_dest)) {
2228 dsta = sta_info_get(sdata, skb->data);2231 dsta = sta_info_get(sdata, skb->data);
2229 if (dsta) {2232 if (dsta) {
2230 /*2233 /*
net/mac80211/sta_info.c+10−13
@@ -709,7 +709,7 @@ static void __sta_info_recalc_tim(struct sta_info *sta, bool ignore_pending) · 708 unmodified lines
709 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {709 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
710 unsigned long tids;710 unsigned long tids;
711 711
712 if (ignore_for_tim & BIT(ac))712 if (ignore_for_tim & ieee80211_ac_to_qos_mask[ac])
713 continue;713 continue;
714 714
715 indicate_tim |= !skb_queue_empty(&sta->tx_filtered[ac]) ||715 indicate_tim |= !skb_queue_empty(&sta->tx_filtered[ac]) ||
@@ -1389,7 +1389,7 @@ ieee80211_sta_ps_more_data(struct sta_info *sta, u8 ignored_acs, · 673 unmodified lines
1389 return true;1389 return true;
1390 1390
1391 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {1391 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
1392 if (ignored_acs & BIT(ac))1392 if (ignored_acs & ieee80211_ac_to_qos_mask[ac])
1393 continue;1393 continue;
1394 1394
1395 if (!skb_queue_empty(&sta->tx_filtered[ac]) ||1395 if (!skb_queue_empty(&sta->tx_filtered[ac]) ||
@@ -1414,7 +1414,7 @@ ieee80211_sta_ps_get_frames(struct sta_info *sta, int n_frames, u8 ignored_acs, · 18 unmodified lines
1414 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {1414 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
1415 unsigned long tids;1415 unsigned long tids;
1416 1416
1417 if (ignored_acs & BIT(ac))1417 if (ignored_acs & ieee80211_ac_to_qos_mask[ac])
1418 continue;1418 continue;
1419 1419
1420 tids = ieee80211_tids_for_ac(ac);1420 tids = ieee80211_tids_for_ac(ac);
@@ -1482,7 +1482,7 @@ ieee80211_sta_ps_deliver_response(struct sta_info *sta, · 61 unmodified lines
1482 BIT(find_highest_prio_tid(driver_release_tids));1482 BIT(find_highest_prio_tid(driver_release_tids));
1483 1483
1484 if (skb_queue_empty(&frames) && !driver_release_tids) {1484 if (skb_queue_empty(&frames) && !driver_release_tids) {
1485 int tid;1485 int tid, ac;
1486 1486
1487 /*1487 /*
1488 * For PS-Poll, this can only happen due to a race condition1488 * For PS-Poll, this can only happen due to a race condition
@@ -1500,7 +1500,10 @@ ieee80211_sta_ps_deliver_response(struct sta_info *sta, · 11 unmodified lines
1500 */1500 */
1501 1501
1502 /* This will evaluate to 1, 3, 5 or 7. */1502 /* This will evaluate to 1, 3, 5 or 7. */
1503 tid = 7 - ((ffs(~ignored_acs) - 1) << 1);1503 for (ac = IEEE80211_AC_VO; ac < IEEE80211_NUM_ACS; ac++)
1504 if (ignored_acs & BIT(ac))
1505 continue;
1506 tid = 7 - 2 * ac;
1504 1507
1505 ieee80211_send_null_response(sta, tid, reason, true, false);1508 ieee80211_send_null_response(sta, tid, reason, true, false);
1506 } else if (!driver_release_tids) {1509 } else if (!driver_release_tids) {
@@ -1871,10 +1874,7 @@ int sta_info_move_state(struct sta_info *sta, · 364 unmodified lines
1871 if (!sta->sta.support_p2p_ps)1874 if (!sta->sta.support_p2p_ps)
1872 ieee80211_recalc_p2p_go_ps_allowed(sta->sdata);1875 ieee80211_recalc_p2p_go_ps_allowed(sta->sdata);
1873 } else if (sta->sta_state == IEEE80211_STA_AUTHORIZED) {1876 } else if (sta->sta_state == IEEE80211_STA_AUTHORIZED) {
1874 if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||1877 ieee80211_vif_dec_num_mcast(sta->sdata);
1875 (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
1876 !sta->sdata->u.vlan.sta))
1877 atomic_dec(&sta->sdata->bss->num_mcast_sta);
1878 clear_bit(WLAN_STA_AUTHORIZED, &sta->_flags);1878 clear_bit(WLAN_STA_AUTHORIZED, &sta->_flags);
1879 ieee80211_clear_fast_xmit(sta);1879 ieee80211_clear_fast_xmit(sta);
1880 ieee80211_clear_fast_rx(sta);1880 ieee80211_clear_fast_rx(sta);
@@ -1882,10 +1882,7 @@ int sta_info_move_state(struct sta_info *sta, · 1 unmodified line
1882 break;1882 break;
1883 case IEEE80211_STA_AUTHORIZED:1883 case IEEE80211_STA_AUTHORIZED:
1884 if (sta->sta_state == IEEE80211_STA_ASSOC) {1884 if (sta->sta_state == IEEE80211_STA_ASSOC) {
1885 if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||1885 ieee80211_vif_inc_num_mcast(sta->sdata);
1886 (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
1887 !sta->sdata->u.vlan.sta))
1888 atomic_inc(&sta->sdata->bss->num_mcast_sta);
1889 set_bit(WLAN_STA_AUTHORIZED, &sta->_flags);1886 set_bit(WLAN_STA_AUTHORIZED, &sta->_flags);
1890 ieee80211_check_fast_xmit(sta);1887 ieee80211_check_fast_xmit(sta);
1891 ieee80211_check_fast_rx(sta);1888 ieee80211_check_fast_rx(sta);
net/mac80211/sta_info.h+2−2
@@ -184,7 +184,6 @@ struct tid_ampdu_tx { · 183 unmodified lines
184 * @ssn: Starting Sequence Number expected to be aggregated.184 * @ssn: Starting Sequence Number expected to be aggregated.
185 * @buf_size: buffer size for incoming A-MPDUs185 * @buf_size: buffer size for incoming A-MPDUs
186 * @timeout: reset timer value (in TUs).186 * @timeout: reset timer value (in TUs).
187 * @dialog_token: dialog token for aggregation session
188 * @rcu_head: RCU head used for freeing this struct187 * @rcu_head: RCU head used for freeing this struct
189 * @reorder_lock: serializes access to reorder buffer, see below.188 * @reorder_lock: serializes access to reorder buffer, see below.
190 * @auto_seq: used for offloaded BA sessions to automatically pick head_seq_and189 * @auto_seq: used for offloaded BA sessions to automatically pick head_seq_and
@@ -213,7 +212,6 @@ struct tid_ampdu_rx { · 22 unmodified lines
213 u16 ssn;212 u16 ssn;
214 u16 buf_size;213 u16 buf_size;
215 u16 timeout;214 u16 timeout;
216 u8 dialog_token;
217 bool auto_seq;215 bool auto_seq;
218 bool removed;216 bool removed;
219};217};
@@ -225,6 +223,7 @@ struct tid_ampdu_rx { · 5 unmodified lines
225 * to tid_tx[idx], which are protected by the sta spinlock)223 * to tid_tx[idx], which are protected by the sta spinlock)
226 * tid_start_tx is also protected by sta->lock.224 * tid_start_tx is also protected by sta->lock.
227 * @tid_rx: aggregation info for Rx per TID -- RCU protected225 * @tid_rx: aggregation info for Rx per TID -- RCU protected
226 * @tid_rx_token: dialog tokens for valid aggregation sessions
228 * @tid_rx_timer_expired: bitmap indicating on which TIDs the227 * @tid_rx_timer_expired: bitmap indicating on which TIDs the
229 * RX timer expired until the work for it runs228 * RX timer expired until the work for it runs
230 * @tid_rx_stop_requested: bitmap indicating which BA sessions per TID the229 * @tid_rx_stop_requested: bitmap indicating which BA sessions per TID the
@@ -243,6 +242,7 @@ struct sta_ampdu_mlme { · 12 unmodified lines
243 struct mutex mtx;242 struct mutex mtx;
244 /* rx */243 /* rx */
245 struct tid_ampdu_rx __rcu *tid_rx[IEEE80211_NUM_TIDS];244 struct tid_ampdu_rx __rcu *tid_rx[IEEE80211_NUM_TIDS];
245 u8 tid_rx_token[IEEE80211_NUM_TIDS];
246 unsigned long tid_rx_timer_expired[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];246 unsigned long tid_rx_timer_expired[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
247 unsigned long tid_rx_stop_requested[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];247 unsigned long tid_rx_stop_requested[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
248 unsigned long agg_session_valid[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];248 unsigned long agg_session_valid[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
net/mac80211/tx.c+40−15
@@ -331,9 +331,8 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) · 330 unmodified lines
331 I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc);331 I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc);
332 return TX_DROP;332 return TX_DROP;
333 }333 }
334 } else if (unlikely(tx->sdata->vif.type == NL80211_IFTYPE_AP &&334 } else if (unlikely(ieee80211_is_data(hdr->frame_control) &&
335 ieee80211_is_data(hdr->frame_control) &&335 ieee80211_vif_get_num_mcast_if(tx->sdata) == 0)) {
336 !atomic_read(&tx->sdata->u.ap.num_mcast_sta))) {
337 /*336 /*
338 * No associated STAs - no need to send multicast337 * No associated STAs - no need to send multicast
339 * frames.338 * frames.
@@ -935,7 +934,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) · 595 unmodified lines
935 if (info->flags & IEEE80211_TX_CTL_DONTFRAG)934 if (info->flags & IEEE80211_TX_CTL_DONTFRAG)
936 return TX_CONTINUE;935 return TX_CONTINUE;
937 936
938 if (tx->local->ops->set_frag_threshold)937 if (ieee80211_hw_check(&tx->local->hw, SUPPORTS_TX_FRAG))
939 return TX_CONTINUE;938 return TX_CONTINUE;
940 939
941 /*940 /*
@@ -2801,7 +2800,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta) · 1859 unmodified lines
2801 2800
2802 /* fast-xmit doesn't handle fragmentation at all */2801 /* fast-xmit doesn't handle fragmentation at all */
2803 if (local->hw.wiphy->frag_threshold != (u32)-1 &&2802 if (local->hw.wiphy->frag_threshold != (u32)-1 &&
2804 !local->ops->set_frag_threshold)2803 !ieee80211_hw_check(&local->hw, SUPPORTS_TX_FRAG))
2805 goto out;2804 goto out;
2806 2805
2807 rcu_read_lock();2806 rcu_read_lock();
@@ -3060,11 +3059,12 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata, · 252 unmodified lines
3060 struct ieee80211_local *local = sdata->local;3059 struct ieee80211_local *local = sdata->local;
3061 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);3060 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
3062 struct ieee80211_hdr *hdr;3061 struct ieee80211_hdr *hdr;
3063 struct ethhdr amsdu_hdr;3062 struct ethhdr *amsdu_hdr;
3064 int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header);3063 int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header);
3065 int subframe_len = skb->len - hdr_len;3064 int subframe_len = skb->len - hdr_len;
3066 void *data;3065 void *data;
3067 u8 *qc;3066 u8 *qc, *h_80211_src, *h_80211_dst;
3067 const u8 *bssid;
3068 3068
3069 if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)3069 if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
3070 return false;3070 return false;
@@ -3072,19 +3072,44 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata, · 1 unmodified line
3072 if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)3072 if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
3073 return true;3073 return true;
3074 3074
3075 if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(amsdu_hdr),3075 if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(*amsdu_hdr),
3076 &subframe_len))3076 &subframe_len))
3077 return false;3077 return false;
3078 3078
3079 amsdu_hdr.h_proto = cpu_to_be16(subframe_len);3079 data = skb_push(skb, sizeof(*amsdu_hdr));
3080 memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);3080 memmove(data, data + sizeof(*amsdu_hdr), hdr_len);
3081 memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);3081 hdr = data;
3082 amsdu_hdr = data + hdr_len;
3083 /* h_80211_src/dst is addr* field within hdr */
3084 h_80211_src = data + fast_tx->sa_offs;
3085 h_80211_dst = data + fast_tx->da_offs;
3086
3087 amsdu_hdr->h_proto = cpu_to_be16(subframe_len);
3088 ether_addr_copy(amsdu_hdr->h_source, h_80211_src);
3089 ether_addr_copy(amsdu_hdr->h_dest, h_80211_dst);
3090
3091 /* according to IEEE 802.11-2012 8.3.2 table 8-19, the outer SA/DA
3092 * fields needs to be changed to BSSID for A-MSDU frames depending
3093 * on FromDS/ToDS values.
3094 */
3095 switch (sdata->vif.type) {
3096 case NL80211_IFTYPE_STATION:
3097 bssid = sdata->u.mgd.bssid;
3098 break;
3099 case NL80211_IFTYPE_AP:
3100 case NL80211_IFTYPE_AP_VLAN:
3101 bssid = sdata->vif.addr;
3102 break;
3103 default:
3104 bssid = NULL;
3105 }
3082 3106
3083 data = skb_push(skb, sizeof(amsdu_hdr));3107 if (bssid && ieee80211_has_fromds(hdr->frame_control))
3084 memmove(data, data + sizeof(amsdu_hdr), hdr_len);3108 ether_addr_copy(h_80211_src, bssid);
3085 memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));3109
3110 if (bssid && ieee80211_has_tods(hdr->frame_control))
3111 ether_addr_copy(h_80211_dst, bssid);
3086 3112
3087 hdr = data;
3088 qc = ieee80211_get_qos_ctl(hdr);3113 qc = ieee80211_get_qos_ctl(hdr);
3089 *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;3114 *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
3090 3115
net/mac80211/util.c+37−24
@@ -3308,10 +3308,11 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, · 3307 unmodified lines
3308 struct ieee80211_local *local = sdata->local;3308 struct ieee80211_local *local = sdata->local;
3309 struct ieee80211_sub_if_data *sdata_iter;3309 struct ieee80211_sub_if_data *sdata_iter;
3310 enum nl80211_iftype iftype = sdata->wdev.iftype;3310 enum nl80211_iftype iftype = sdata->wdev.iftype;
3311 int num[NUM_NL80211_IFTYPES];
3312 struct ieee80211_chanctx *ctx;3311 struct ieee80211_chanctx *ctx;
3313 int num_different_channels = 0;
3314 int total = 1;3312 int total = 1;
3313 struct iface_combination_params params = {
3314 .radar_detect = radar_detect,
3315 };
3315 3316
3316 lockdep_assert_held(&local->chanctx_mtx);3317 lockdep_assert_held(&local->chanctx_mtx);
3317 3318
@@ -3322,12 +3323,19 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, · 4 unmodified lines
3322 !chandef->chan))3323 !chandef->chan))
3323 return -EINVAL;3324 return -EINVAL;
3324 3325
3325 if (chandef)
3326 num_different_channels = 1;
3327
3328 if (WARN_ON(iftype >= NUM_NL80211_IFTYPES))3326 if (WARN_ON(iftype >= NUM_NL80211_IFTYPES))
3329 return -EINVAL;3327 return -EINVAL;
3330 3328
3329 if (sdata->vif.type == NL80211_IFTYPE_AP ||
3330 sdata->vif.type == NL80211_IFTYPE_MESH_POINT) {
3331 /*
3332 * always passing this is harmless, since it'll be the
3333 * same value that cfg80211 finds if it finds the same
3334 * interface ... and that's always allowed
3335 */
3336 params.new_beacon_int = sdata->vif.bss_conf.beacon_int;
3337 }
3338
3331 /* Always allow software iftypes */3339 /* Always allow software iftypes */
3332 if (local->hw.wiphy->software_iftypes & BIT(iftype)) {3340 if (local->hw.wiphy->software_iftypes & BIT(iftype)) {
3333 if (radar_detect)3341 if (radar_detect)
@@ -3335,24 +3343,26 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, · 1 unmodified line
3335 return 0;3343 return 0;
3336 }3344 }
3337 3345
3338 memset(num, 0, sizeof(num));3346 if (chandef)
3347 params.num_different_channels = 1;
3339 3348
3340 if (iftype != NL80211_IFTYPE_UNSPECIFIED)3349 if (iftype != NL80211_IFTYPE_UNSPECIFIED)
3341 num[iftype] = 1;3350 params.iftype_num[iftype] = 1;
3342 3351
3343 list_for_each_entry(ctx, &local->chanctx_list, list) {3352 list_for_each_entry(ctx, &local->chanctx_list, list) {
3344 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)3353 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)
3345 continue;3354 continue;
3346 radar_detect |= ieee80211_chanctx_radar_detect(local, ctx);3355 params.radar_detect |=
3356 ieee80211_chanctx_radar_detect(local, ctx);
3347 if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) {3357 if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) {
3348 num_different_channels++;3358 params.num_different_channels++;
3349 continue;3359 continue;
3350 }3360 }
3351 if (chandef && chanmode == IEEE80211_CHANCTX_SHARED &&3361 if (chandef && chanmode == IEEE80211_CHANCTX_SHARED &&
3352 cfg80211_chandef_compatible(chandef,3362 cfg80211_chandef_compatible(chandef,
3353 &ctx->conf.def))3363 &ctx->conf.def))
3354 continue;3364 continue;
3355 num_different_channels++;3365 params.num_different_channels++;
3356 }3366 }
3357 3367
3358 list_for_each_entry_rcu(sdata_iter, &local->interfaces, list) {3368 list_for_each_entry_rcu(sdata_iter, &local->interfaces, list) {
@@ -3365,16 +3375,14 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, · 6 unmodified lines
3365 local->hw.wiphy->software_iftypes & BIT(wdev_iter->iftype))3375 local->hw.wiphy->software_iftypes & BIT(wdev_iter->iftype))
3366 continue;3376 continue;
3367 3377
3368 num[wdev_iter->iftype]++;3378 params.iftype_num[wdev_iter->iftype]++;
3369 total++;3379 total++;
3370 }3380 }
3371 3381
3372 if (total == 1 && !radar_detect)3382 if (total == 1 && !params.radar_detect)
3373 return 0;3383 return 0;
3374 3384
3375 return cfg80211_check_combinations(local->hw.wiphy,3385 return cfg80211_check_combinations(local->hw.wiphy, &params);
3376 num_different_channels,
3377 radar_detect, num);
3378}3386}
3379 3387
3380static void3388static void
@@ -3390,12 +3398,10 @@ ieee80211_iter_max_chans(const struct ieee80211_iface_combination *c, · 9 unmodified lines
3390int ieee80211_max_num_channels(struct ieee80211_local *local)3398int ieee80211_max_num_channels(struct ieee80211_local *local)
3391{3399{
3392 struct ieee80211_sub_if_data *sdata;3400 struct ieee80211_sub_if_data *sdata;
3393 int num[NUM_NL80211_IFTYPES] = {};
3394 struct ieee80211_chanctx *ctx;3401 struct ieee80211_chanctx *ctx;
3395 int num_different_channels = 0;
3396 u8 radar_detect = 0;
3397 u32 max_num_different_channels = 1;3402 u32 max_num_different_channels = 1;
3398 int err;3403 int err;
3404 struct iface_combination_params params = {0};
3399 3405
3400 lockdep_assert_held(&local->chanctx_mtx);3406 lockdep_assert_held(&local->chanctx_mtx);
3401 3407
@@ -3403,17 +3409,17 @@ int ieee80211_max_num_channels(struct ieee80211_local *local) · 1 unmodified line
3403 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)3409 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)
3404 continue;3410 continue;
3405 3411
3406 num_different_channels++;3412 params.num_different_channels++;
3407 3413
3408 radar_detect |= ieee80211_chanctx_radar_detect(local, ctx);3414 params.radar_detect |=
3415 ieee80211_chanctx_radar_detect(local, ctx);
3409 }3416 }
3410 3417
3411 list_for_each_entry_rcu(sdata, &local->interfaces, list)3418 list_for_each_entry_rcu(sdata, &local->interfaces, list)
3412 num[sdata->wdev.iftype]++;3419 params.iftype_num[sdata->wdev.iftype]++;
3413 3420
3414 err = cfg80211_iter_combinations(local->hw.wiphy,3421 err = cfg80211_iter_combinations(local->hw.wiphy, &params,
3415 num_different_channels, radar_detect,3422 ieee80211_iter_max_chans,
3416 num, ieee80211_iter_max_chans,
3417 &max_num_different_channels);3423 &max_num_different_channels);
3418 if (err < 0)3424 if (err < 0)
3419 return err;3425 return err;
@@ -3456,3 +3462,10 @@ void ieee80211_txq_get_depth(struct ieee80211_txq *txq, · 36 unmodified lines
3456 *byte_cnt = txqi->tin.backlog_bytes + frag_bytes;3462 *byte_cnt = txqi->tin.backlog_bytes + frag_bytes;
3457}3463}
3458EXPORT_SYMBOL(ieee80211_txq_get_depth);3464EXPORT_SYMBOL(ieee80211_txq_get_depth);
3465
3466const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS] = {
3467 IEEE80211_WMM_IE_STA_QOSINFO_AC_VO,
3468 IEEE80211_WMM_IE_STA_QOSINFO_AC_VI,
3469 IEEE80211_WMM_IE_STA_QOSINFO_AC_BE,
3470 IEEE80211_WMM_IE_STA_QOSINFO_AC_BK
3471};
net/mac80211/wme.c+16−7
@@ -236,26 +236,35 @@ void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, · 235 unmodified lines
236{236{
237 struct ieee80211_hdr *hdr = (void *)skb->data;237 struct ieee80211_hdr *hdr = (void *)skb->data;
238 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);238 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
239 u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
240 u8 flags;
239 u8 *p;241 u8 *p;
240 u8 ack_policy, tid;
241 242
242 if (!ieee80211_is_data_qos(hdr->frame_control))243 if (!ieee80211_is_data_qos(hdr->frame_control))
243 return;244 return;
244 245
245 p = ieee80211_get_qos_ctl(hdr);246 p = ieee80211_get_qos_ctl(hdr);
246 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
247 247
248 /* preserve EOSP bit */248 /* set up the first byte */
249 ack_policy = *p & IEEE80211_QOS_CTL_EOSP;249
250 /*
251 * preserve everything but the TID and ACK policy
252 * (which we both write here)
253 */
254 flags = *p & ~(IEEE80211_QOS_CTL_TID_MASK |
255 IEEE80211_QOS_CTL_ACK_POLICY_MASK);
250 256
251 if (is_multicast_ether_addr(hdr->addr1) ||257 if (is_multicast_ether_addr(hdr->addr1) ||
252 sdata->noack_map & BIT(tid)) {258 sdata->noack_map & BIT(tid)) {
253 ack_policy |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK;259 flags |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK;
254 info->flags |= IEEE80211_TX_CTL_NO_ACK;260 info->flags |= IEEE80211_TX_CTL_NO_ACK;
255 }261 }
256 262
257 /* qos header is 2 bytes */263 *p = flags | tid;
258 *p++ = ack_policy | tid;264
265 /* set up the second byte */
266 p++;
267
259 if (ieee80211_vif_is_mesh(&sdata->vif)) {268 if (ieee80211_vif_is_mesh(&sdata->vif)) {
260 /* preserve RSPI and Mesh PS Level bit */269 /* preserve RSPI and Mesh PS Level bit */
261 *p &= ((IEEE80211_QOS_CTL_RSPI |270 *p &= ((IEEE80211_QOS_CTL_RSPI |
net/mac80211/wpa.c+1−1
@@ -57,7 +57,7 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx) · 56 unmodified lines
57 57
58 if (info->control.hw_key &&58 if (info->control.hw_key &&
59 (info->flags & IEEE80211_TX_CTL_DONTFRAG ||59 (info->flags & IEEE80211_TX_CTL_DONTFRAG ||
60 tx->local->ops->set_frag_threshold) &&60 ieee80211_hw_check(&tx->local->hw, SUPPORTS_TX_FRAG)) &&
61 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) {61 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) {
62 /* hwaccel - with no need for SW-generated MMIC */62 /* hwaccel - with no need for SW-generated MMIC */
63 return TX_CONTINUE;63 return TX_CONTINUE;
net/wireless/core.c+29−4
@@ -210,11 +210,11 @@ void cfg80211_stop_p2p_device(struct cfg80211_registered_device *rdev, · 209 unmodified lines
210 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_P2P_DEVICE))210 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_P2P_DEVICE))
211 return;211 return;
212 212
213 if (!wdev->p2p_started)213 if (!wdev_running(wdev))
214 return;214 return;
215 215
216 rdev_stop_p2p_device(rdev, wdev);216 rdev_stop_p2p_device(rdev, wdev);
217 wdev->p2p_started = false;217 wdev->is_running = false;
218 218
219 rdev->opencount--;219 rdev->opencount--;
220 220
@@ -233,11 +233,11 @@ void cfg80211_stop_nan(struct cfg80211_registered_device *rdev, · 12 unmodified lines
233 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_NAN))233 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_NAN))
234 return;234 return;
235 235
236 if (!wdev->nan_started)236 if (!wdev_running(wdev))
237 return;237 return;
238 238
239 rdev_stop_nan(rdev, wdev);239 rdev_stop_nan(rdev, wdev);
240 wdev->nan_started = false;240 wdev->is_running = false;
241 241
242 rdev->opencount--;242 rdev->opencount--;
243}243}
@@ -562,6 +562,21 @@ static int wiphy_verify_combinations(struct wiphy *wiphy) · 318 unmodified lines
562 c->limits[j].max > 1))562 c->limits[j].max > 1))
563 return -EINVAL;563 return -EINVAL;
564 564
565 /*
566 * This isn't well-defined right now. If you have an
567 * IBSS interface, then its beacon interval may change
568 * by joining other networks, and nothing prevents it
569 * from doing that.
570 * So technically we probably shouldn't even allow AP
571 * and IBSS in the same interface, but it seems that
572 * some drivers support that, possibly only with fixed
573 * beacon intervals for IBSS.
574 */
575 if (WARN_ON(types & BIT(NL80211_IFTYPE_ADHOC) &&
576 c->beacon_int_min_gcd)) {
577 return -EINVAL;
578 }
579
565 cnt += c->limits[j].max;580 cnt += c->limits[j].max;
566 /*581 /*
567 * Don't advertise an unsupported type582 * Don't advertise an unsupported type
@@ -571,6 +586,11 @@ static int wiphy_verify_combinations(struct wiphy *wiphy) · 3 unmodified lines
571 return -EINVAL;586 return -EINVAL;
572 }587 }
573 588
589#ifndef CONFIG_WIRELESS_WDS
590 if (WARN_ON(all_iftypes & BIT(NL80211_IFTYPE_WDS)))
591 return -EINVAL;
592#endif
593
574 /* You can't even choose that many! */594 /* You can't even choose that many! */
575 if (WARN_ON(cnt < c->max_interfaces))595 if (WARN_ON(cnt < c->max_interfaces))
576 return -EINVAL;596 return -EINVAL;
@@ -609,6 +629,11 @@ int wiphy_register(struct wiphy *wiphy) · 32 unmodified lines
609 !rdev->ops->add_nan_func || !rdev->ops->del_nan_func)))629 !rdev->ops->add_nan_func || !rdev->ops->del_nan_func)))
610 return -EINVAL;630 return -EINVAL;
611 631
632#ifndef CONFIG_WIRELESS_WDS
633 if (WARN_ON(wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS)))
634 return -EINVAL;
635#endif
636
612 /*637 /*
613 * if a wiphy has unsupported modes for regulatory channel enforcement,638 * if a wiphy has unsupported modes for regulatory channel enforcement,
614 * opt-out of enforcement checking639 * opt-out of enforcement checking
net/wireless/core.h+2−2
@@ -345,7 +345,7 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev, · 344 unmodified lines
345 const u8 *ssid, int ssid_len,345 const u8 *ssid, int ssid_len,
346 const u8 *ie, int ie_len,346 const u8 *ie, int ie_len,
347 const u8 *key, int key_len, int key_idx,347 const u8 *key, int key_len, int key_idx,
348 const u8 *sae_data, int sae_data_len);348 const u8 *auth_data, int auth_data_len);
349int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,349int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
350 struct net_device *dev,350 struct net_device *dev,
351 struct ieee80211_channel *chan,351 struct ieee80211_channel *chan,
@@ -475,7 +475,7 @@ int ieee80211_get_ratemask(struct ieee80211_supported_band *sband, · 123 unmodified lines
475 u32 *mask);475 u32 *mask);
476 476
477int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,477int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
478 u32 beacon_int);478 enum nl80211_iftype iftype, u32 beacon_int);
479 479
480void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,480void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,
481 enum nl80211_iftype iftype, int num);481 enum nl80211_iftype iftype, int num);
net/wireless/mesh.c+2−0
@@ -183,6 +183,7 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, · 182 unmodified lines
183 memcpy(wdev->ssid, setup->mesh_id, setup->mesh_id_len);183 memcpy(wdev->ssid, setup->mesh_id, setup->mesh_id_len);
184 wdev->mesh_id_len = setup->mesh_id_len;184 wdev->mesh_id_len = setup->mesh_id_len;
185 wdev->chandef = setup->chandef;185 wdev->chandef = setup->chandef;
186 wdev->beacon_interval = setup->beacon_interval;
186 }187 }
187 188
188 return err;189 return err;
@@ -258,6 +259,7 @@ int __cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, · 69 unmodified lines
258 err = rdev_leave_mesh(rdev, dev);259 err = rdev_leave_mesh(rdev, dev);
259 if (!err) {260 if (!err) {
260 wdev->mesh_id_len = 0;261 wdev->mesh_id_len = 0;
262 wdev->beacon_interval = 0;
261 memset(&wdev->chandef, 0, sizeof(wdev->chandef));263 memset(&wdev->chandef, 0, sizeof(wdev->chandef));
262 rdev_set_qos_map(rdev, dev, NULL);264 rdev_set_qos_map(rdev, dev, NULL);
263 }265 }
net/wireless/mlme.c+3−3
@@ -204,14 +204,14 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev, · 203 unmodified lines
204 const u8 *ssid, int ssid_len,204 const u8 *ssid, int ssid_len,
205 const u8 *ie, int ie_len,205 const u8 *ie, int ie_len,
206 const u8 *key, int key_len, int key_idx,206 const u8 *key, int key_len, int key_idx,
207 const u8 *sae_data, int sae_data_len)207 const u8 *auth_data, int auth_data_len)
208{208{
209 struct wireless_dev *wdev = dev->ieee80211_ptr;209 struct wireless_dev *wdev = dev->ieee80211_ptr;
210 struct cfg80211_auth_request req = {210 struct cfg80211_auth_request req = {
211 .ie = ie,211 .ie = ie,
212 .ie_len = ie_len,212 .ie_len = ie_len,
213 .sae_data = sae_data,213 .auth_data = auth_data,
214 .sae_data_len = sae_data_len,214 .auth_data_len = auth_data_len,
215 .auth_type = auth_type,215 .auth_type = auth_type,
216 .key = key,216 .key = key,
217 .key_len = key_len,217 .key_len = key_len,
net/wireless/nl80211.c+273−172
@@ -343,7 +343,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 342 unmodified lines
343 [NL80211_ATTR_BG_SCAN_PERIOD] = { .type = NLA_U16 },343 [NL80211_ATTR_BG_SCAN_PERIOD] = { .type = NLA_U16 },
344 [NL80211_ATTR_WDEV] = { .type = NLA_U64 },344 [NL80211_ATTR_WDEV] = { .type = NLA_U64 },
345 [NL80211_ATTR_USER_REG_HINT_TYPE] = { .type = NLA_U32 },345 [NL80211_ATTR_USER_REG_HINT_TYPE] = { .type = NLA_U32 },
346 [NL80211_ATTR_SAE_DATA] = { .type = NLA_BINARY, },346 [NL80211_ATTR_AUTH_DATA] = { .type = NLA_BINARY, },
347 [NL80211_ATTR_VHT_CAPABILITY] = { .len = NL80211_VHT_CAPABILITY_LEN },347 [NL80211_ATTR_VHT_CAPABILITY] = { .len = NL80211_VHT_CAPABILITY_LEN },
348 [NL80211_ATTR_SCAN_FLAGS] = { .type = NLA_U32 },348 [NL80211_ATTR_SCAN_FLAGS] = { .type = NLA_U32 },
349 [NL80211_ATTR_P2P_CTWINDOW] = { .type = NLA_U8 },349 [NL80211_ATTR_P2P_CTWINDOW] = { .type = NLA_U8 },
@@ -400,6 +400,10 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 50 unmodified lines
400 [NL80211_ATTR_NAN_MASTER_PREF] = { .type = NLA_U8 },400 [NL80211_ATTR_NAN_MASTER_PREF] = { .type = NLA_U8 },
401 [NL80211_ATTR_NAN_DUAL] = { .type = NLA_U8 },401 [NL80211_ATTR_NAN_DUAL] = { .type = NLA_U8 },
402 [NL80211_ATTR_NAN_FUNC] = { .type = NLA_NESTED },402 [NL80211_ATTR_NAN_FUNC] = { .type = NLA_NESTED },
403 [NL80211_ATTR_FILS_KEK] = { .type = NLA_BINARY,
404 .len = FILS_MAX_KEK_LEN },
405 [NL80211_ATTR_FILS_NONCES] = { .len = 2 * FILS_NONCE_LEN },
406 [NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED] = { .type = NLA_FLAG, },
403};407};
404 408
405/* policy for the key attributes */409/* policy for the key attributes */
@@ -421,6 +425,7 @@ nl80211_key_default_policy[NUM_NL80211_KEY_DEFAULT_TYPES] = { · 15 unmodified lines
421 [NL80211_KEY_DEFAULT_TYPE_MULTICAST] = { .type = NLA_FLAG },425 [NL80211_KEY_DEFAULT_TYPE_MULTICAST] = { .type = NLA_FLAG },
422};426};
423 427
428#ifdef CONFIG_PM
424/* policy for WoWLAN attributes */429/* policy for WoWLAN attributes */
425static const struct nla_policy430static const struct nla_policy
426nl80211_wowlan_policy[NUM_NL80211_WOWLAN_TRIG] = {431nl80211_wowlan_policy[NUM_NL80211_WOWLAN_TRIG] = {
@@ -454,6 +459,7 @@ nl80211_wowlan_tcp_policy[NUM_NL80211_WOWLAN_TCP] = { · 27 unmodified lines
454 [NL80211_WOWLAN_TCP_WAKE_PAYLOAD] = { .len = 1 },459 [NL80211_WOWLAN_TCP_WAKE_PAYLOAD] = { .len = 1 },
455 [NL80211_WOWLAN_TCP_WAKE_MASK] = { .len = 1 },460 [NL80211_WOWLAN_TCP_WAKE_MASK] = { .len = 1 },
456};461};
462#endif /* CONFIG_PM */
457 463
458/* policy for coalesce rule attributes */464/* policy for coalesce rule attributes */
459static const struct nla_policy465static const struct nla_policy
@@ -1062,6 +1068,10 @@ static int nl80211_put_iface_combinations(struct wiphy *wiphy, · 602 unmodified lines
1062 nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,1068 nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,
1063 c->radar_detect_regions)))1069 c->radar_detect_regions)))
1064 goto nla_put_failure;1070 goto nla_put_failure;
1071 if (c->beacon_int_min_gcd &&
1072 nla_put_u32(msg, NL80211_IFACE_COMB_BI_MIN_GCD,
1073 c->beacon_int_min_gcd))
1074 goto nla_put_failure;
1065 1075
1066 nla_nest_end(msg, nl_combi);1076 nla_nest_end(msg, nl_combi);
1067 }1077 }
@@ -1309,6 +1319,95 @@ nl80211_send_mgmt_stypes(struct sk_buff *msg, · 241 unmodified lines
1309 return 0;1319 return 0;
1310}1320}
1311 1321
1322#define CMD(op, n) \
1323 do { \
1324 if (rdev->ops->op) { \
1325 i++; \
1326 if (nla_put_u32(msg, i, NL80211_CMD_ ## n)) \
1327 goto nla_put_failure; \
1328 } \
1329 } while (0)
1330
1331static int nl80211_add_commands_unsplit(struct cfg80211_registered_device *rdev,
1332 struct sk_buff *msg)
1333{
1334 int i = 0;
1335
1336 /*
1337 * do *NOT* add anything into this function, new things need to be
1338 * advertised only to new versions of userspace that can deal with
1339 * the split (and they can't possibly care about new features...
1340 */
1341 CMD(add_virtual_intf, NEW_INTERFACE);
1342 CMD(change_virtual_intf, SET_INTERFACE);
1343 CMD(add_key, NEW_KEY);
1344 CMD(start_ap, START_AP);
1345 CMD(add_station, NEW_STATION);
1346 CMD(add_mpath, NEW_MPATH);
1347 CMD(update_mesh_config, SET_MESH_CONFIG);
1348 CMD(change_bss, SET_BSS);
1349 CMD(auth, AUTHENTICATE);
1350 CMD(assoc, ASSOCIATE);
1351 CMD(deauth, DEAUTHENTICATE);
1352 CMD(disassoc, DISASSOCIATE);
1353 CMD(join_ibss, JOIN_IBSS);
1354 CMD(join_mesh, JOIN_MESH);
1355 CMD(set_pmksa, SET_PMKSA);
1356 CMD(del_pmksa, DEL_PMKSA);
1357 CMD(flush_pmksa, FLUSH_PMKSA);
1358 if (rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL)
1359 CMD(remain_on_channel, REMAIN_ON_CHANNEL);
1360 CMD(set_bitrate_mask, SET_TX_BITRATE_MASK);
1361 CMD(mgmt_tx, FRAME);
1362 CMD(mgmt_tx_cancel_wait, FRAME_WAIT_CANCEL);
1363 if (rdev->wiphy.flags & WIPHY_FLAG_NETNS_OK) {
1364 i++;
1365 if (nla_put_u32(msg, i, NL80211_CMD_SET_WIPHY_NETNS))
1366 goto nla_put_failure;
1367 }
1368 if (rdev->ops->set_monitor_channel || rdev->ops->start_ap ||
1369 rdev->ops->join_mesh) {
1370 i++;
1371 if (nla_put_u32(msg, i, NL80211_CMD_SET_CHANNEL))
1372 goto nla_put_failure;
1373 }
1374 CMD(set_wds_peer, SET_WDS_PEER);
1375 if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) {
1376 CMD(tdls_mgmt, TDLS_MGMT);
1377 CMD(tdls_oper, TDLS_OPER);
1378 }
1379 if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN)
1380 CMD(sched_scan_start, START_SCHED_SCAN);
1381 CMD(probe_client, PROBE_CLIENT);
1382 CMD(set_noack_map, SET_NOACK_MAP);
1383 if (rdev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS) {
1384 i++;
1385 if (nla_put_u32(msg, i, NL80211_CMD_REGISTER_BEACONS))
1386 goto nla_put_failure;
1387 }
1388 CMD(start_p2p_device, START_P2P_DEVICE);
1389 CMD(set_mcast_rate, SET_MCAST_RATE);
1390#ifdef CONFIG_NL80211_TESTMODE
1391 CMD(testmode_cmd, TESTMODE);
1392#endif
1393
1394 if (rdev->ops->connect || rdev->ops->auth) {
1395 i++;
1396 if (nla_put_u32(msg, i, NL80211_CMD_CONNECT))
1397 goto nla_put_failure;
1398 }
1399
1400 if (rdev->ops->disconnect || rdev->ops->deauth) {
1401 i++;
1402 if (nla_put_u32(msg, i, NL80211_CMD_DISCONNECT))
1403 goto nla_put_failure;
1404 }
1405
1406 return i;
1407 nla_put_failure:
1408 return -ENOBUFS;
1409}
1410
1312struct nl80211_dump_wiphy_state {1411struct nl80211_dump_wiphy_state {
1313 s64 filter_wiphy;1412 s64 filter_wiphy;
1314 long start;1413 long start;
@@ -1536,68 +1635,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, · 221 unmodified lines
1536 if (!nl_cmds)1635 if (!nl_cmds)
1537 goto nla_put_failure;1636 goto nla_put_failure;
1538 1637
1539 i = 0;1638 i = nl80211_add_commands_unsplit(rdev, msg);
1540#define CMD(op, n) \1639 if (i < 0)
1541 do { \1640 goto nla_put_failure;
1542 if (rdev->ops->op) { \
1543 i++; \
1544 if (nla_put_u32(msg, i, NL80211_CMD_ ## n)) \
1545 goto nla_put_failure; \
1546 } \
1547 } while (0)
1548
1549 CMD(add_virtual_intf, NEW_INTERFACE);
1550 CMD(change_virtual_intf, SET_INTERFACE);
1551 CMD(add_key, NEW_KEY);
1552 CMD(start_ap, START_AP);
1553 CMD(add_station, NEW_STATION);
1554 CMD(add_mpath, NEW_MPATH);
1555 CMD(update_mesh_config, SET_MESH_CONFIG);
1556 CMD(change_bss, SET_BSS);
1557 CMD(auth, AUTHENTICATE);
1558 CMD(assoc, ASSOCIATE);
1559 CMD(deauth, DEAUTHENTICATE);
1560 CMD(disassoc, DISASSOCIATE);
1561 CMD(join_ibss, JOIN_IBSS);
1562 CMD(join_mesh, JOIN_MESH);
1563 CMD(set_pmksa, SET_PMKSA);
1564 CMD(del_pmksa, DEL_PMKSA);
1565 CMD(flush_pmksa, FLUSH_PMKSA);
1566 if (rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL)
1567 CMD(remain_on_channel, REMAIN_ON_CHANNEL);
1568 CMD(set_bitrate_mask, SET_TX_BITRATE_MASK);
1569 CMD(mgmt_tx, FRAME);
1570 CMD(mgmt_tx_cancel_wait, FRAME_WAIT_CANCEL);
1571 if (rdev->wiphy.flags & WIPHY_FLAG_NETNS_OK) {
1572 i++;
1573 if (nla_put_u32(msg, i, NL80211_CMD_SET_WIPHY_NETNS))
1574 goto nla_put_failure;
1575 }
1576 if (rdev->ops->set_monitor_channel || rdev->ops->start_ap ||
1577 rdev->ops->join_mesh) {
1578 i++;
1579 if (nla_put_u32(msg, i, NL80211_CMD_SET_CHANNEL))
1580 goto nla_put_failure;
1581 }
1582 CMD(set_wds_peer, SET_WDS_PEER);
1583 if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) {
1584 CMD(tdls_mgmt, TDLS_MGMT);
1585 CMD(tdls_oper, TDLS_OPER);
1586 }
1587 if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN)
1588 CMD(sched_scan_start, START_SCHED_SCAN);
1589 CMD(probe_client, PROBE_CLIENT);
1590 CMD(set_noack_map, SET_NOACK_MAP);
1591 if (rdev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS) {
1592 i++;
1593 if (nla_put_u32(msg, i, NL80211_CMD_REGISTER_BEACONS))
1594 goto nla_put_failure;
1595 }
1596 CMD(start_p2p_device, START_P2P_DEVICE);
1597 CMD(set_mcast_rate, SET_MCAST_RATE);
1598#ifdef CONFIG_NL80211_TESTMODE
1599 CMD(testmode_cmd, TESTMODE);
1600#endif
1601 if (state->split) {1641 if (state->split) {
1602 CMD(crit_proto_start, CRIT_PROTOCOL_START);1642 CMD(crit_proto_start, CRIT_PROTOCOL_START);
1603 CMD(crit_proto_stop, CRIT_PROTOCOL_STOP);1643 CMD(crit_proto_stop, CRIT_PROTOCOL_STOP);
@@ -1607,22 +1647,11 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, · 3 unmodified lines
1607 if (rdev->wiphy.features &1647 if (rdev->wiphy.features &
1608 NL80211_FEATURE_SUPPORTS_WMM_ADMISSION)1648 NL80211_FEATURE_SUPPORTS_WMM_ADMISSION)
1609 CMD(add_tx_ts, ADD_TX_TS);1649 CMD(add_tx_ts, ADD_TX_TS);
1650 CMD(set_multicast_to_unicast, SET_MULTICAST_TO_UNICAST);
1651 CMD(update_connect_params, UPDATE_CONNECT_PARAMS);
1610 }1652 }
1611 /* add into the if now */
1612#undef CMD1653#undef CMD
1613 1654
1614 if (rdev->ops->connect || rdev->ops->auth) {
1615 i++;
1616 if (nla_put_u32(msg, i, NL80211_CMD_CONNECT))
1617 goto nla_put_failure;
1618 }
1619
1620 if (rdev->ops->disconnect || rdev->ops->deauth) {
1621 i++;
1622 if (nla_put_u32(msg, i, NL80211_CMD_DISCONNECT))
1623 goto nla_put_failure;
1624 }
1625
1626 nla_nest_end(msg, nl_cmds);1655 nla_nest_end(msg, nl_cmds);
1627 state->split_start++;1656 state->split_start++;
1628 if (state->split)1657 if (state->split)
@@ -2283,10 +2312,9 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) · 654 unmodified lines
2283 nla_for_each_nested(nl_txq_params,2312 nla_for_each_nested(nl_txq_params,
2284 info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS],2313 info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS],
2285 rem_txq_params) {2314 rem_txq_params) {
2286 result = nla_parse(tb, NL80211_TXQ_ATTR_MAX,2315 result = nla_parse_nested(tb, NL80211_TXQ_ATTR_MAX,
2287 nla_data(nl_txq_params),2316 nl_txq_params,
2288 nla_len(nl_txq_params),2317 txq_params_policy);
2289 txq_params_policy);
2290 if (result)2318 if (result)
2291 return result;2319 return result;
2292 result = parse_txq_params(tb, &txq_params);2320 result = parse_txq_params(tb, &txq_params);
@@ -3536,8 +3564,8 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, · 1243 unmodified lines
3536 sband = rdev->wiphy.bands[band];3564 sband = rdev->wiphy.bands[band];
3537 if (sband == NULL)3565 if (sband == NULL)
3538 return -EINVAL;3566 return -EINVAL;
3539 err = nla_parse(tb, NL80211_TXRATE_MAX, nla_data(tx_rates),3567 err = nla_parse_nested(tb, NL80211_TXRATE_MAX, tx_rates,
3540 nla_len(tx_rates), nl80211_txattr_policy);3568 nl80211_txattr_policy);
3541 if (err)3569 if (err)
3542 return err;3570 return err;
3543 if (tb[NL80211_TXRATE_LEGACY]) {3571 if (tb[NL80211_TXRATE_LEGACY]) {
@@ -3743,12 +3771,23 @@ static bool nl80211_valid_auth_type(struct cfg80211_registered_device *rdev, · 199 unmodified lines
3743 if (!(rdev->wiphy.features & NL80211_FEATURE_SAE) &&3771 if (!(rdev->wiphy.features & NL80211_FEATURE_SAE) &&
3744 auth_type == NL80211_AUTHTYPE_SAE)3772 auth_type == NL80211_AUTHTYPE_SAE)
3745 return false;3773 return false;
3774 if (!wiphy_ext_feature_isset(&rdev->wiphy,
3775 NL80211_EXT_FEATURE_FILS_STA) &&
3776 (auth_type == NL80211_AUTHTYPE_FILS_SK ||
3777 auth_type == NL80211_AUTHTYPE_FILS_SK_PFS ||
3778 auth_type == NL80211_AUTHTYPE_FILS_PK))
3779 return false;
3746 return true;3780 return true;
3747 case NL80211_CMD_CONNECT:3781 case NL80211_CMD_CONNECT:
3748 case NL80211_CMD_START_AP:3782 case NL80211_CMD_START_AP:
3749 /* SAE not supported yet */3783 /* SAE not supported yet */
3750 if (auth_type == NL80211_AUTHTYPE_SAE)3784 if (auth_type == NL80211_AUTHTYPE_SAE)
3751 return false;3785 return false;
3786 /* FILS not supported yet */
3787 if (auth_type == NL80211_AUTHTYPE_FILS_SK ||
3788 auth_type == NL80211_AUTHTYPE_FILS_SK_PFS ||
3789 auth_type == NL80211_AUTHTYPE_FILS_PK)
3790 return false;
3752 return true;3791 return true;
3753 default:3792 default:
3754 return false;3793 return false;
@@ -3790,7 +3829,8 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) · 35 unmodified lines
3790 params.dtim_period =3829 params.dtim_period =
3791 nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]);3830 nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]);
3792 3831
3793 err = cfg80211_validate_beacon_int(rdev, params.beacon_interval);3832 err = cfg80211_validate_beacon_int(rdev, dev->ieee80211_ptr->iftype,
3833 params.beacon_interval);
3794 if (err)3834 if (err)
3795 return err;3835 return err;
3796 3836
@@ -6292,9 +6332,8 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) · 2495 unmodified lines
6292 6332
6293 nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES],6333 nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES],
6294 rem_reg_rules) {6334 rem_reg_rules) {
6295 r = nla_parse(tb, NL80211_REG_RULE_ATTR_MAX,6335 r = nla_parse_nested(tb, NL80211_REG_RULE_ATTR_MAX,
6296 nla_data(nl_reg_rule), nla_len(nl_reg_rule),6336 nl_reg_rule, reg_rule_policy);
6297 reg_rule_policy);
6298 if (r)6337 if (r)
6299 goto bad_reg;6338 goto bad_reg;
6300 r = parse_reg_rule(tb, &rd->reg_rules[rule_idx]);6339 r = parse_reg_rule(tb, &rd->reg_rules[rule_idx]);
@@ -6361,8 +6400,8 @@ static int parse_bss_select(struct nlattr *nla, struct wiphy *wiphy, · 60 unmodified lines
6361 if (!nla_ok(nest, nla_len(nest)))6400 if (!nla_ok(nest, nla_len(nest)))
6362 return -EINVAL;6401 return -EINVAL;
6363 6402
6364 err = nla_parse(attr, NL80211_BSS_SELECT_ATTR_MAX, nla_data(nest),6403 err = nla_parse_nested(attr, NL80211_BSS_SELECT_ATTR_MAX, nest,
6365 nla_len(nest), nl80211_bss_select_policy);6404 nl80211_bss_select_policy);
6366 if (err)6405 if (err)
6367 return err;6406 return err;
6368 6407
@@ -6752,9 +6791,8 @@ nl80211_parse_sched_scan_plans(struct wiphy *wiphy, int n_plans, · 383 unmodified lines
6752 if (WARN_ON(i >= n_plans))6791 if (WARN_ON(i >= n_plans))
6753 return -EINVAL;6792 return -EINVAL;
6754 6793
6755 err = nla_parse(plan, NL80211_SCHED_SCAN_PLAN_MAX,6794 err = nla_parse_nested(plan, NL80211_SCHED_SCAN_PLAN_MAX,
6756 nla_data(attr), nla_len(attr),6795 attr, nl80211_plan_policy);
6757 nl80211_plan_policy);
6758 if (err)6796 if (err)
6759 return err;6797 return err;
6760 6798
@@ -6843,9 +6881,9 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, · 82 unmodified lines
6843 tmp) {6881 tmp) {
6844 struct nlattr *rssi;6882 struct nlattr *rssi;
6845 6883
6846 err = nla_parse(tb, NL80211_SCHED_SCAN_MATCH_ATTR_MAX,6884 err = nla_parse_nested(tb,
6847 nla_data(attr), nla_len(attr),6885 NL80211_SCHED_SCAN_MATCH_ATTR_MAX,
6848 nl80211_match_policy);6886 attr, nl80211_match_policy);
6849 if (err)6887 if (err)
6850 return ERR_PTR(err);6888 return ERR_PTR(err);
6851 /* add other standalone attributes here */6889 /* add other standalone attributes here */
@@ -7016,9 +7054,9 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, · 164 unmodified lines
7016 tmp) {7054 tmp) {
7017 struct nlattr *ssid, *rssi;7055 struct nlattr *ssid, *rssi;
7018 7056
7019 err = nla_parse(tb, NL80211_SCHED_SCAN_MATCH_ATTR_MAX,7057 err = nla_parse_nested(tb,
7020 nla_data(attr), nla_len(attr),7058 NL80211_SCHED_SCAN_MATCH_ATTR_MAX,
7021 nl80211_match_policy);7059 attr, nl80211_match_policy);
7022 if (err)7060 if (err)
7023 goto out_free;7061 goto out_free;
7024 ssid = tb[NL80211_SCHED_SCAN_MATCH_ATTR_SSID];7062 ssid = tb[NL80211_SCHED_SCAN_MATCH_ATTR_SSID];
@@ -7696,8 +7734,8 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) · 671 unmodified lines
7696 struct cfg80211_registered_device *rdev = info->user_ptr[0];7734 struct cfg80211_registered_device *rdev = info->user_ptr[0];
7697 struct net_device *dev = info->user_ptr[1];7735 struct net_device *dev = info->user_ptr[1];
7698 struct ieee80211_channel *chan;7736 struct ieee80211_channel *chan;
7699 const u8 *bssid, *ssid, *ie = NULL, *sae_data = NULL;7737 const u8 *bssid, *ssid, *ie = NULL, *auth_data = NULL;
7700 int err, ssid_len, ie_len = 0, sae_data_len = 0;7738 int err, ssid_len, ie_len = 0, auth_data_len = 0;
7701 enum nl80211_auth_type auth_type;7739 enum nl80211_auth_type auth_type;
7702 struct key_parse key;7740 struct key_parse key;
7703 bool local_state_change;7741 bool local_state_change;
@@ -7777,17 +7815,23 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) · 73 unmodified lines
7777 if (!nl80211_valid_auth_type(rdev, auth_type, NL80211_CMD_AUTHENTICATE))7815 if (!nl80211_valid_auth_type(rdev, auth_type, NL80211_CMD_AUTHENTICATE))
7778 return -EINVAL;7816 return -EINVAL;
7779 7817
7780 if (auth_type == NL80211_AUTHTYPE_SAE &&7818 if ((auth_type == NL80211_AUTHTYPE_SAE ||
7781 !info->attrs[NL80211_ATTR_SAE_DATA])7819 auth_type == NL80211_AUTHTYPE_FILS_SK ||
7820 auth_type == NL80211_AUTHTYPE_FILS_SK_PFS ||
7821 auth_type == NL80211_AUTHTYPE_FILS_PK) &&
7822 !info->attrs[NL80211_ATTR_AUTH_DATA])
7782 return -EINVAL;7823 return -EINVAL;
7783 7824
7784 if (info->attrs[NL80211_ATTR_SAE_DATA]) {7825 if (info->attrs[NL80211_ATTR_AUTH_DATA]) {
7785 if (auth_type != NL80211_AUTHTYPE_SAE)7826 if (auth_type != NL80211_AUTHTYPE_SAE &&
7827 auth_type != NL80211_AUTHTYPE_FILS_SK &&
7828 auth_type != NL80211_AUTHTYPE_FILS_SK_PFS &&
7829 auth_type != NL80211_AUTHTYPE_FILS_PK)
7786 return -EINVAL;7830 return -EINVAL;
7787 sae_data = nla_data(info->attrs[NL80211_ATTR_SAE_DATA]);7831 auth_data = nla_data(info->attrs[NL80211_ATTR_AUTH_DATA]);
7788 sae_data_len = nla_len(info->attrs[NL80211_ATTR_SAE_DATA]);7832 auth_data_len = nla_len(info->attrs[NL80211_ATTR_AUTH_DATA]);
7789 /* need to include at least Auth Transaction and Status Code */7833 /* need to include at least Auth Transaction and Status Code */
7790 if (sae_data_len < 4)7834 if (auth_data_len < 4)
7791 return -EINVAL;7835 return -EINVAL;
7792 }7836 }
7793 7837
@@ -7804,7 +7848,7 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) · 10 unmodified lines
7804 err = cfg80211_mlme_auth(rdev, dev, chan, auth_type, bssid,7848 err = cfg80211_mlme_auth(rdev, dev, chan, auth_type, bssid,
7805 ssid, ssid_len, ie, ie_len,7849 ssid, ssid_len, ie, ie_len,
7806 key.p.key, key.p.key_len, key.idx,7850 key.p.key, key.p.key_len, key.idx,
7807 sae_data, sae_data_len);7851 auth_data, auth_data_len);
7808 wdev_unlock(dev->ieee80211_ptr);7852 wdev_unlock(dev->ieee80211_ptr);
7809 return err;7853 return err;
7810}7854}
@@ -7983,6 +8027,15 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info) · 172 unmodified lines
7983 req.flags |= ASSOC_REQ_USE_RRM;8027 req.flags |= ASSOC_REQ_USE_RRM;
7984 }8028 }
7985 8029
8030 if (info->attrs[NL80211_ATTR_FILS_KEK]) {
8031 req.fils_kek = nla_data(info->attrs[NL80211_ATTR_FILS_KEK]);
8032 req.fils_kek_len = nla_len(info->attrs[NL80211_ATTR_FILS_KEK]);
8033 if (!info->attrs[NL80211_ATTR_FILS_NONCES])
8034 return -EINVAL;
8035 req.fils_nonces =
8036 nla_data(info->attrs[NL80211_ATTR_FILS_NONCES]);
8037 }
8038
7986 err = nl80211_crypto_settings(rdev, info, &req.crypto, 1);8039 err = nl80211_crypto_settings(rdev, info, &req.crypto, 1);
7987 if (!err) {8040 if (!err) {
7988 wdev_lock(dev->ieee80211_ptr);8041 wdev_lock(dev->ieee80211_ptr);
@@ -8140,7 +8193,8 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) · 151 unmodified lines
8140 ibss.beacon_interval =8193 ibss.beacon_interval =
8141 nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);8194 nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
8142 8195
8143 err = cfg80211_validate_beacon_int(rdev, ibss.beacon_interval);8196 err = cfg80211_validate_beacon_int(rdev, NL80211_IFTYPE_ADHOC,
8197 ibss.beacon_interval);
8144 if (err)8198 if (err)
8145 return err;8199 return err;
8146 8200
@@ -8713,6 +8767,37 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) · 566 unmodified lines
8713 return err;8767 return err;
8714}8768}
8715 8769
8770static int nl80211_update_connect_params(struct sk_buff *skb,
8771 struct genl_info *info)
8772{
8773 struct cfg80211_connect_params connect = {};
8774 struct cfg80211_registered_device *rdev = info->user_ptr[0];
8775 struct net_device *dev = info->user_ptr[1];
8776 struct wireless_dev *wdev = dev->ieee80211_ptr;
8777 u32 changed = 0;
8778 int ret;
8779
8780 if (!rdev->ops->update_connect_params)
8781 return -EOPNOTSUPP;
8782
8783 if (info->attrs[NL80211_ATTR_IE]) {
8784 if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE]))
8785 return -EINVAL;
8786 connect.ie = nla_data(info->attrs[NL80211_ATTR_IE]);
8787 connect.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]);
8788 changed |= UPDATE_ASSOC_IES;
8789 }
8790
8791 wdev_lock(dev->ieee80211_ptr);
8792 if (!wdev->current_bss)
8793 ret = -ENOLINK;
8794 else
8795 ret = rdev_update_connect_params(rdev, dev, &connect, changed);
8796 wdev_unlock(dev->ieee80211_ptr);
8797
8798 return ret;
8799}
8800
8716static int nl80211_disconnect(struct sk_buff *skb, struct genl_info *info)8801static int nl80211_disconnect(struct sk_buff *skb, struct genl_info *info)
8717{8802{
8718 struct cfg80211_registered_device *rdev = info->user_ptr[0];8803 struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -9404,7 +9489,9 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) · 685 unmodified lines
9404 setup.beacon_interval =9489 setup.beacon_interval =
9405 nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);9490 nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
9406 9491
9407 err = cfg80211_validate_beacon_int(rdev, setup.beacon_interval);9492 err = cfg80211_validate_beacon_int(rdev,
9493 NL80211_IFTYPE_MESH_POINT,
9494 setup.beacon_interval);
9408 if (err)9495 if (err)
9409 return err;9496 return err;
9410 }9497 }
@@ -9715,9 +9802,8 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev, · 304 unmodified lines
9715 if (!rdev->wiphy.wowlan->tcp)9802 if (!rdev->wiphy.wowlan->tcp)
9716 return -EINVAL;9803 return -EINVAL;
9717 9804
9718 err = nla_parse(tb, MAX_NL80211_WOWLAN_TCP,9805 err = nla_parse_nested(tb, MAX_NL80211_WOWLAN_TCP, attr,
9719 nla_data(attr), nla_len(attr),9806 nl80211_wowlan_tcp_policy);
9720 nl80211_wowlan_tcp_policy);
9721 if (err)9807 if (err)
9722 return err;9808 return err;
9723 9809
@@ -9862,9 +9948,7 @@ static int nl80211_parse_wowlan_nd(struct cfg80211_registered_device *rdev, · 138 unmodified lines
9862 goto out;9948 goto out;
9863 }9949 }
9864 9950
9865 err = nla_parse(tb, NL80211_ATTR_MAX,9951 err = nla_parse_nested(tb, NL80211_ATTR_MAX, attr, nl80211_policy);
9866 nla_data(attr), nla_len(attr),
9867 nl80211_policy);
9868 if (err)9952 if (err)
9869 goto out;9953 goto out;
9870 9954
@@ -9898,10 +9982,9 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info) · 27 unmodified lines
9898 goto set_wakeup;9982 goto set_wakeup;
9899 }9983 }
9900 9984
9901 err = nla_parse(tb, MAX_NL80211_WOWLAN_TRIG,9985 err = nla_parse_nested(tb, MAX_NL80211_WOWLAN_TRIG,
9902 nla_data(info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]),9986 info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS],
9903 nla_len(info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]),9987 nl80211_wowlan_policy);
9904 nl80211_wowlan_policy);
9905 if (err)9988 if (err)
9906 return err;9989 return err;
9907 9990
@@ -9983,8 +10066,8 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info) · 75 unmodified lines
9983 rem) {10066 rem) {
9984 u8 *mask_pat;10067 u8 *mask_pat;
9985 10068
9986 nla_parse(pat_tb, MAX_NL80211_PKTPAT, nla_data(pat),10069 nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat,
9987 nla_len(pat), NULL);10070 NULL);
9988 err = -EINVAL;10071 err = -EINVAL;
9989 if (!pat_tb[NL80211_PKTPAT_MASK] ||10072 if (!pat_tb[NL80211_PKTPAT_MASK] ||
9990 !pat_tb[NL80211_PKTPAT_PATTERN])10073 !pat_tb[NL80211_PKTPAT_PATTERN])
@@ -10194,8 +10277,8 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev, · 203 unmodified lines
10194 int rem, pat_len, mask_len, pkt_offset, n_patterns = 0;10277 int rem, pat_len, mask_len, pkt_offset, n_patterns = 0;
10195 struct nlattr *pat_tb[NUM_NL80211_PKTPAT];10278 struct nlattr *pat_tb[NUM_NL80211_PKTPAT];
10196 10279
10197 err = nla_parse(tb, NL80211_ATTR_COALESCE_RULE_MAX, nla_data(rule),10280 err = nla_parse_nested(tb, NL80211_ATTR_COALESCE_RULE_MAX, rule,
10198 nla_len(rule), nl80211_coalesce_policy);10281 nl80211_coalesce_policy);
10199 if (err)10282 if (err)
10200 return err;10283 return err;
10201 10284
@@ -10233,8 +10316,7 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev, · 31 unmodified lines
10233 rem) {10316 rem) {
10234 u8 *mask_pat;10317 u8 *mask_pat;
10235 10318
10236 nla_parse(pat_tb, MAX_NL80211_PKTPAT, nla_data(pat),10319 nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat, NULL);
10237 nla_len(pat), NULL);
10238 if (!pat_tb[NL80211_PKTPAT_MASK] ||10320 if (!pat_tb[NL80211_PKTPAT_MASK] ||
10239 !pat_tb[NL80211_PKTPAT_PATTERN])10321 !pat_tb[NL80211_PKTPAT_PATTERN])
10240 return -EINVAL;10322 return -EINVAL;
@@ -10353,10 +10435,9 @@ static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info) · 112 unmodified lines
10353 if (!info->attrs[NL80211_ATTR_REKEY_DATA])10435 if (!info->attrs[NL80211_ATTR_REKEY_DATA])
10354 return -EINVAL;10436 return -EINVAL;
10355 10437
10356 err = nla_parse(tb, MAX_NL80211_REKEY_DATA,10438 err = nla_parse_nested(tb, MAX_NL80211_REKEY_DATA,
10357 nla_data(info->attrs[NL80211_ATTR_REKEY_DATA]),10439 info->attrs[NL80211_ATTR_REKEY_DATA],
10358 nla_len(info->attrs[NL80211_ATTR_REKEY_DATA]),10440 nl80211_rekey_policy);
10359 nl80211_rekey_policy);
10360 if (err)10441 if (err)
10361 return err;10442 return err;
10362 10443
@@ -10505,7 +10586,7 @@ static int nl80211_start_p2p_device(struct sk_buff *skb, struct genl_info *info) · 142 unmodified lines
10505 if (wdev->iftype != NL80211_IFTYPE_P2P_DEVICE)10586 if (wdev->iftype != NL80211_IFTYPE_P2P_DEVICE)
10506 return -EOPNOTSUPP;10587 return -EOPNOTSUPP;
10507 10588
10508 if (wdev->p2p_started)10589 if (wdev_running(wdev))
10509 return 0;10590 return 0;
10510 10591
10511 if (rfkill_blocked(rdev->rfkill))10592 if (rfkill_blocked(rdev->rfkill))
@@ -10515,7 +10596,7 @@ static int nl80211_start_p2p_device(struct sk_buff *skb, struct genl_info *info) · 3 unmodified lines
10515 if (err)10596 if (err)
10516 return err;10597 return err;
10517 10598
10518 wdev->p2p_started = true;10599 wdev->is_running = true;
10519 rdev->opencount++;10600 rdev->opencount++;
10520 10601
10521 return 0;10602 return 0;
@@ -10547,7 +10628,7 @@ static int nl80211_start_nan(struct sk_buff *skb, struct genl_info *info) · 25 unmodified lines
10547 if (wdev->iftype != NL80211_IFTYPE_NAN)10628 if (wdev->iftype != NL80211_IFTYPE_NAN)
10548 return -EOPNOTSUPP;10629 return -EOPNOTSUPP;
10549 10630
10550 if (wdev->nan_started)10631 if (!wdev_running(wdev))
10551 return -EEXIST;10632 return -EEXIST;
10552 10633
10553 if (rfkill_blocked(rdev->rfkill))10634 if (rfkill_blocked(rdev->rfkill))
@@ -10570,7 +10651,7 @@ static int nl80211_start_nan(struct sk_buff *skb, struct genl_info *info) · 16 unmodified lines
10570 if (err)10651 if (err)
10571 return err;10652 return err;
10572 10653
10573 wdev->nan_started = true;10654 wdev->is_running = true;
10574 rdev->opencount++;10655 rdev->opencount++;
10575 10656
10576 return 0;10657 return 0;
@@ -10654,7 +10735,7 @@ static int nl80211_nan_add_func(struct sk_buff *skb, · 77 unmodified lines
10654 if (wdev->iftype != NL80211_IFTYPE_NAN)10735 if (wdev->iftype != NL80211_IFTYPE_NAN)
10655 return -EOPNOTSUPP;10736 return -EOPNOTSUPP;
10656 10737
10657 if (!wdev->nan_started)10738 if (!wdev_running(wdev))
10658 return -ENOTCONN;10739 return -ENOTCONN;
10659 10740
10660 if (!info->attrs[NL80211_ATTR_NAN_FUNC])10741 if (!info->attrs[NL80211_ATTR_NAN_FUNC])
@@ -10664,10 +10745,9 @@ static int nl80211_nan_add_func(struct sk_buff *skb, · 3 unmodified lines
10664 wdev->owner_nlportid != info->snd_portid)10745 wdev->owner_nlportid != info->snd_portid)
10665 return -ENOTCONN;10746 return -ENOTCONN;
10666 10747
10667 err = nla_parse(tb, NL80211_NAN_FUNC_ATTR_MAX,10748 err = nla_parse_nested(tb, NL80211_NAN_FUNC_ATTR_MAX,
10668 nla_data(info->attrs[NL80211_ATTR_NAN_FUNC]),10749 info->attrs[NL80211_ATTR_NAN_FUNC],
10669 nla_len(info->attrs[NL80211_ATTR_NAN_FUNC]),10750 nl80211_nan_func_policy);
10670 nl80211_nan_func_policy);
10671 if (err)10751 if (err)
10672 return err;10752 return err;
10673 10753
@@ -10762,9 +10842,9 @@ static int nl80211_nan_add_func(struct sk_buff *skb, · 88 unmodified lines
10762 if (tb[NL80211_NAN_FUNC_SRF]) {10842 if (tb[NL80211_NAN_FUNC_SRF]) {
10763 struct nlattr *srf_tb[NUM_NL80211_NAN_SRF_ATTR];10843 struct nlattr *srf_tb[NUM_NL80211_NAN_SRF_ATTR];
10764 10844
10765 err = nla_parse(srf_tb, NL80211_NAN_SRF_ATTR_MAX,10845 err = nla_parse_nested(srf_tb, NL80211_NAN_SRF_ATTR_MAX,
10766 nla_data(tb[NL80211_NAN_FUNC_SRF]),10846 tb[NL80211_NAN_FUNC_SRF],
10767 nla_len(tb[NL80211_NAN_FUNC_SRF]), NULL);10847 nl80211_nan_srf_policy);
10768 if (err)10848 if (err)
10769 goto out;10849 goto out;
10770 10850
@@ -10890,7 +10970,7 @@ static int nl80211_nan_del_func(struct sk_buff *skb, · 119 unmodified lines
10890 if (wdev->iftype != NL80211_IFTYPE_NAN)10970 if (wdev->iftype != NL80211_IFTYPE_NAN)
10891 return -EOPNOTSUPP;10971 return -EOPNOTSUPP;
10892 10972
10893 if (!wdev->nan_started)10973 if (!wdev_running(wdev))
10894 return -ENOTCONN;10974 return -ENOTCONN;
10895 10975
10896 if (!info->attrs[NL80211_ATTR_COOKIE])10976 if (!info->attrs[NL80211_ATTR_COOKIE])
@@ -10918,7 +10998,7 @@ static int nl80211_nan_change_config(struct sk_buff *skb, · 21 unmodified lines
10918 if (wdev->iftype != NL80211_IFTYPE_NAN)10998 if (wdev->iftype != NL80211_IFTYPE_NAN)
10919 return -EOPNOTSUPP;10999 return -EOPNOTSUPP;
10920 11000
10921 if (!wdev->nan_started)11001 if (!wdev_running(wdev))
10922 return -ENOTCONN;11002 return -ENOTCONN;
10923 11003
10924 if (info->attrs[NL80211_ATTR_NAN_MASTER_PREF]) {11004 if (info->attrs[NL80211_ATTR_NAN_MASTER_PREF]) {
@@ -11230,10 +11310,7 @@ static int nl80211_vendor_cmd(struct sk_buff *skb, struct genl_info *info) · 305 unmodified lines
11230 return -EINVAL;11310 return -EINVAL;
11231 11311
11232 if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_RUNNING) {11312 if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_RUNNING) {
11233 if (wdev->netdev &&11313 if (!wdev_running(wdev))
11234 !netif_running(wdev->netdev))
11235 return -ENETDOWN;
11236 if (!wdev->netdev && !wdev->p2p_started)
11237 return -ENETDOWN;11314 return -ENETDOWN;
11238 }11315 }
11239 11316
@@ -11394,10 +11471,7 @@ static int nl80211_vendor_cmd_dump(struct sk_buff *skb, · 154 unmodified lines
11394 return -EINVAL;11471 return -EINVAL;
11395 11472
11396 if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_RUNNING) {11473 if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_RUNNING) {
11397 if (wdev->netdev &&11474 if (!wdev_running(wdev))
11398 !netif_running(wdev->netdev))
11399 return -ENETDOWN;
11400 if (!wdev->netdev && !wdev->p2p_started)
11401 return -ENETDOWN;11475 return -ENETDOWN;
11402 }11476 }
11403 }11477 }
@@ -11710,6 +11784,31 @@ static int nl80211_tdls_cancel_channel_switch(struct sk_buff *skb, · 306 unmodified lines
11710 return 0;11784 return 0;
11711}11785}
11712 11786
11787static int nl80211_set_multicast_to_unicast(struct sk_buff *skb,
11788 struct genl_info *info)
11789{
11790 struct cfg80211_registered_device *rdev = info->user_ptr[0];
11791 struct net_device *dev = info->user_ptr[1];
11792 struct wireless_dev *wdev = dev->ieee80211_ptr;
11793 const struct nlattr *nla;
11794 bool enabled;
11795
11796 if (netif_running(dev))
11797 return -EBUSY;
11798
11799 if (!rdev->ops->set_multicast_to_unicast)
11800 return -EOPNOTSUPP;
11801
11802 if (wdev->iftype != NL80211_IFTYPE_AP &&
11803 wdev->iftype != NL80211_IFTYPE_P2P_GO)
11804 return -EOPNOTSUPP;
11805
11806 nla = info->attrs[NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED];
11807 enabled = nla_get_flag(nla);
11808
11809 return rdev_set_multicast_to_unicast(rdev, dev, enabled);
11810}
11811
11713#define NL80211_FLAG_NEED_WIPHY 0x0111812#define NL80211_FLAG_NEED_WIPHY 0x01
11714#define NL80211_FLAG_NEED_NETDEV 0x0211813#define NL80211_FLAG_NEED_NETDEV 0x02
11715#define NL80211_FLAG_NEED_RTNL 0x0411814#define NL80211_FLAG_NEED_RTNL 0x04
@@ -11768,29 +11867,15 @@ static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb, · 52 unmodified lines
11768 info->user_ptr[1] = wdev;11867 info->user_ptr[1] = wdev;
11769 }11868 }
11770 11869
11771 if (dev) {11870 if (ops->internal_flags & NL80211_FLAG_CHECK_NETDEV_UP &&
11772 if (ops->internal_flags & NL80211_FLAG_CHECK_NETDEV_UP &&11871 !wdev_running(wdev)) {
11773 !netif_running(dev)) {11872 if (rtnl)
11774 if (rtnl)11873 rtnl_unlock();
11775 rtnl_unlock();11874 return -ENETDOWN;
11776 return -ENETDOWN;11875 }
11777 }
11778 11876
11877 if (dev)
11779 dev_hold(dev);11878 dev_hold(dev);
11780 } else if (ops->internal_flags & NL80211_FLAG_CHECK_NETDEV_UP) {
11781 if (wdev->iftype == NL80211_IFTYPE_P2P_DEVICE &&
11782 !wdev->p2p_started) {
11783 if (rtnl)
11784 rtnl_unlock();
11785 return -ENETDOWN;
11786 }
11787 if (wdev->iftype == NL80211_IFTYPE_NAN &&
11788 !wdev->nan_started) {
11789 if (rtnl)
11790 rtnl_unlock();
11791 return -ENETDOWN;
11792 }
11793 }
11794 11879
11795 info->user_ptr[0] = rdev;11880 info->user_ptr[0] = rdev;
11796 }11881 }
@@ -12162,6 +12247,14 @@ static const struct genl_ops nl80211_ops[] = { · 365 unmodified lines
12162 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |12247 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
12163 NL80211_FLAG_NEED_RTNL,12248 NL80211_FLAG_NEED_RTNL,
12164 },12249 },
12250 {
12251 .cmd = NL80211_CMD_UPDATE_CONNECT_PARAMS,
12252 .doit = nl80211_update_connect_params,
12253 .policy = nl80211_policy,
12254 .flags = GENL_ADMIN_PERM,
12255 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
12256 NL80211_FLAG_NEED_RTNL,
12257 },
12165 {12258 {
12166 .cmd = NL80211_CMD_DISCONNECT,12259 .cmd = NL80211_CMD_DISCONNECT,
12167 .doit = nl80211_disconnect,12260 .doit = nl80211_disconnect,
@@ -12583,6 +12676,14 @@ static const struct genl_ops nl80211_ops[] = { · 415 unmodified lines
12583 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |12676 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
12584 NL80211_FLAG_NEED_RTNL,12677 NL80211_FLAG_NEED_RTNL,
12585 },12678 },
12679 {
12680 .cmd = NL80211_CMD_SET_MULTICAST_TO_UNICAST,
12681 .doit = nl80211_set_multicast_to_unicast,
12682 .policy = nl80211_policy,
12683 .flags = GENL_UNS_ADMIN_PERM,
12684 .internal_flags = NL80211_FLAG_NEED_NETDEV |
12685 NL80211_FLAG_NEED_RTNL,
12686 },
12586};12687};
12587 12688
12588static struct genl_family nl80211_fam __ro_after_init = {12689static struct genl_family nl80211_fam __ro_after_init = {
net/wireless/rdev-ops.h+24−0
@@ -490,6 +490,18 @@ static inline int rdev_connect(struct cfg80211_registered_device *rdev, · 489 unmodified lines
490 return ret;490 return ret;
491}491}
492 492
493static inline int
494rdev_update_connect_params(struct cfg80211_registered_device *rdev,
495 struct net_device *dev,
496 struct cfg80211_connect_params *sme, u32 changed)
497{
498 int ret;
499 trace_rdev_update_connect_params(&rdev->wiphy, dev, sme, changed);
500 ret = rdev->ops->update_connect_params(&rdev->wiphy, dev, sme, changed);
501 trace_rdev_return_int(&rdev->wiphy, ret);
502 return ret;
503}
504
493static inline int rdev_disconnect(struct cfg80211_registered_device *rdev,505static inline int rdev_disconnect(struct cfg80211_registered_device *rdev,
494 struct net_device *dev, u16 reason_code)506 struct net_device *dev, u16 reason_code)
495{507{
@@ -562,6 +574,18 @@ static inline int rdev_set_wds_peer(struct cfg80211_registered_device *rdev, · 66 unmodified lines
562 return ret;574 return ret;
563}575}
564 576
577static inline int
578rdev_set_multicast_to_unicast(struct cfg80211_registered_device *rdev,
579 struct net_device *dev,
580 const bool enabled)
581{
582 int ret;
583 trace_rdev_set_multicast_to_unicast(&rdev->wiphy, dev, enabled);
584 ret = rdev->ops->set_multicast_to_unicast(&rdev->wiphy, dev, enabled);
585 trace_rdev_return_int(&rdev->wiphy, ret);
586 return ret;
587}
588
565static inline void rdev_rfkill_poll(struct cfg80211_registered_device *rdev)589static inline void rdev_rfkill_poll(struct cfg80211_registered_device *rdev)
566{590{
567 trace_rdev_rfkill_poll(&rdev->wiphy);591 trace_rdev_rfkill_poll(&rdev->wiphy);
net/wireless/sme.c+1−1
@@ -1088,7 +1088,7 @@ int cfg80211_disconnect(struct cfg80211_registered_device *rdev, · 1087 unmodified lines
1088 err = cfg80211_sme_disconnect(wdev, reason);1088 err = cfg80211_sme_disconnect(wdev, reason);
1089 else if (!rdev->ops->disconnect)1089 else if (!rdev->ops->disconnect)
1090 cfg80211_mlme_down(rdev, dev);1090 cfg80211_mlme_down(rdev, dev);
1091 else if (wdev->current_bss)1091 else if (wdev->ssid_len)
1092 err = rdev_disconnect(rdev, dev, reason);1092 err = rdev_disconnect(rdev, dev, reason);
1093 1093
1094 return err;1094 return err;
net/wireless/trace.h+37−0
@@ -1281,6 +1281,24 @@ TRACE_EVENT(rdev_connect, · 1280 unmodified lines
1281 __entry->wpa_versions, __entry->flags, MAC_PR_ARG(prev_bssid))1281 __entry->wpa_versions, __entry->flags, MAC_PR_ARG(prev_bssid))
1282);1282);
1283 1283
1284TRACE_EVENT(rdev_update_connect_params,
1285 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1286 struct cfg80211_connect_params *sme, u32 changed),
1287 TP_ARGS(wiphy, netdev, sme, changed),
1288 TP_STRUCT__entry(
1289 WIPHY_ENTRY
1290 NETDEV_ENTRY
1291 __field(u32, changed)
1292 ),
1293 TP_fast_assign(
1294 WIPHY_ASSIGN;
1295 NETDEV_ASSIGN;
1296 __entry->changed = changed;
1297 ),
1298 TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", parameters changed: %u",
1299 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->changed)
1300);
1301
1284TRACE_EVENT(rdev_set_cqm_rssi_config,1302TRACE_EVENT(rdev_set_cqm_rssi_config,
1285 TP_PROTO(struct wiphy *wiphy,1303 TP_PROTO(struct wiphy *wiphy,
1286 struct net_device *netdev, s32 rssi_thold,1304 struct net_device *netdev, s32 rssi_thold,
@@ -3030,6 +3048,25 @@ DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan, · 1743 unmodified lines
3030 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),3048 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
3031 TP_ARGS(wiphy, wdev)3049 TP_ARGS(wiphy, wdev)
3032);3050);
3051
3052TRACE_EVENT(rdev_set_multicast_to_unicast,
3053 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
3054 const bool enabled),
3055 TP_ARGS(wiphy, netdev, enabled),
3056 TP_STRUCT__entry(
3057 WIPHY_ENTRY
3058 NETDEV_ENTRY
3059 __field(bool, enabled)
3060 ),
3061 TP_fast_assign(
3062 WIPHY_ASSIGN;
3063 NETDEV_ASSIGN;
3064 __entry->enabled = enabled;
3065 ),
3066 TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", unicast: %s",
3067 WIPHY_PR_ARG, NETDEV_PR_ARG,
3068 BOOL_TO_STR(__entry->enabled))
3069);
3033#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */3070#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
3034 3071
3035#undef TRACE_INCLUDE_PATH3072#undef TRACE_INCLUDE_PATH
net/wireless/util.c+96−29
@@ -13,6 +13,7 @@ · 12 unmodified lines
13#include <net/dsfield.h>13#include <net/dsfield.h>
14#include <linux/if_vlan.h>14#include <linux/if_vlan.h>
15#include <linux/mpls.h>15#include <linux/mpls.h>
16#include <linux/gcd.h>
16#include "core.h"17#include "core.h"
17#include "rdev-ops.h"18#include "rdev-ops.h"
18 19
@@ -1381,6 +1382,25 @@ static bool ieee80211_id_in_list(const u8 *ids, int n_ids, u8 id) · 1362 unmodified lines
1381 return false;1382 return false;
1382}1383}
1383 1384
1385static size_t skip_ie(const u8 *ies, size_t ielen, size_t pos)
1386{
1387 /* we assume a validly formed IEs buffer */
1388 u8 len = ies[pos + 1];
1389
1390 pos += 2 + len;
1391
1392 /* the IE itself must have 255 bytes for fragments to follow */
1393 if (len < 255)
1394 return pos;
1395
1396 while (pos < ielen && ies[pos] == WLAN_EID_FRAGMENT) {
1397 len = ies[pos + 1];
1398 pos += 2 + len;
1399 }
1400
1401 return pos;
1402}
1403
1384size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,1404size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
1385 const u8 *ids, int n_ids,1405 const u8 *ids, int n_ids,
1386 const u8 *after_ric, int n_after_ric,1406 const u8 *after_ric, int n_after_ric,
@@ -1390,14 +1410,14 @@ size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen, · 3 unmodified lines
1390 1410
1391 while (pos < ielen && ieee80211_id_in_list(ids, n_ids, ies[pos])) {1411 while (pos < ielen && ieee80211_id_in_list(ids, n_ids, ies[pos])) {
1392 if (ies[pos] == WLAN_EID_RIC_DATA && n_after_ric) {1412 if (ies[pos] == WLAN_EID_RIC_DATA && n_after_ric) {
1393 pos += 2 + ies[pos + 1];1413 pos = skip_ie(ies, ielen, pos);
1394 1414
1395 while (pos < ielen &&1415 while (pos < ielen &&
1396 !ieee80211_id_in_list(after_ric, n_after_ric,1416 !ieee80211_id_in_list(after_ric, n_after_ric,
1397 ies[pos]))1417 ies[pos]))
1398 pos += 2 + ies[pos + 1];1418 pos = skip_ie(ies, ielen, pos);
1399 } else {1419 } else {
1400 pos += 2 + ies[pos + 1];1420 pos = skip_ie(ies, ielen, pos);
1401 }1421 }
1402 }1422 }
1403 1423
@@ -1558,31 +1578,57 @@ bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef, · 154 unmodified lines
1558}1578}
1559EXPORT_SYMBOL(ieee80211_chandef_to_operating_class);1579EXPORT_SYMBOL(ieee80211_chandef_to_operating_class);
1560 1580
1561int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,1581static void cfg80211_calculate_bi_data(struct wiphy *wiphy, u32 new_beacon_int,
1562 u32 beacon_int)1582 u32 *beacon_int_gcd,
1583 bool *beacon_int_different)
1563{1584{
1564 struct wireless_dev *wdev;1585 struct wireless_dev *wdev;
1565 int res = 0;
1566 1586
1567 if (beacon_int < 10 || beacon_int > 10000)1587 *beacon_int_gcd = 0;
1568 return -EINVAL;1588 *beacon_int_different = false;
1569 1589
1570 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {1590 list_for_each_entry(wdev, &wiphy->wdev_list, list) {
1571 if (!wdev->beacon_interval)1591 if (!wdev->beacon_interval)
1572 continue;1592 continue;
1573 if (wdev->beacon_interval != beacon_int) {1593
1574 res = -EINVAL;1594 if (!*beacon_int_gcd) {
1575 break;1595 *beacon_int_gcd = wdev->beacon_interval;
1596 continue;
1576 }1597 }
1598
1599 if (wdev->beacon_interval == *beacon_int_gcd)
1600 continue;
1601
1602 *beacon_int_different = true;
1603 *beacon_int_gcd = gcd(*beacon_int_gcd, wdev->beacon_interval);
1577 }1604 }
1578 1605
1579 return res;1606 if (new_beacon_int && *beacon_int_gcd != new_beacon_int) {
1607 if (*beacon_int_gcd)
1608 *beacon_int_different = true;
1609 *beacon_int_gcd = gcd(*beacon_int_gcd, new_beacon_int);
1610 }
1611}
1612
1613int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
1614 enum nl80211_iftype iftype, u32 beacon_int)
1615{
1616 /*
1617 * This is just a basic pre-condition check; if interface combinations
1618 * are possible the driver must already be checking those with a call
1619 * to cfg80211_check_combinations(), in which case we'll validate more
1620 * through the cfg80211_calculate_bi_data() call and code in
1621 * cfg80211_iter_combinations().
1622 */
1623
1624 if (beacon_int < 10 || beacon_int > 10000)
1625 return -EINVAL;
1626
1627 return 0;
1580}1628}
1581 1629
1582int cfg80211_iter_combinations(struct wiphy *wiphy,1630int cfg80211_iter_combinations(struct wiphy *wiphy,
1583 const int num_different_channels,1631 struct iface_combination_params *params,
1584 const u8 radar_detect,
1585 const int iftype_num[NUM_NL80211_IFTYPES],
1586 void (*iter)(const struct ieee80211_iface_combination *c,1632 void (*iter)(const struct ieee80211_iface_combination *c,
1587 void *data),1633 void *data),
1588 void *data)1634 void *data)
@@ -1592,8 +1638,23 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, · 3 unmodified lines
1592 int i, j, iftype;1638 int i, j, iftype;
1593 int num_interfaces = 0;1639 int num_interfaces = 0;
1594 u32 used_iftypes = 0;1640 u32 used_iftypes = 0;
1641 u32 beacon_int_gcd;
1642 bool beacon_int_different;
1643
1644 /*
1645 * This is a bit strange, since the iteration used to rely only on
1646 * the data given by the driver, but here it now relies on context,
1647 * in form of the currently operating interfaces.
1648 * This is OK for all current users, and saves us from having to
1649 * push the GCD calculations into all the drivers.
1650 * In the future, this should probably rely more on data that's in
1651 * cfg80211 already - the only thing not would appear to be any new
1652 * interfaces (while being brought up) and channel/radar data.
1653 */
1654 cfg80211_calculate_bi_data(wiphy, params->new_beacon_int,
1655 &beacon_int_gcd, &beacon_int_different);
1595 1656
1596 if (radar_detect) {1657 if (params->radar_detect) {
1597 rcu_read_lock();1658 rcu_read_lock();
1598 regdom = rcu_dereference(cfg80211_regdomain);1659 regdom = rcu_dereference(cfg80211_regdomain);
1599 if (regdom)1660 if (regdom)
@@ -1602,8 +1663,8 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, · 2 unmodified lines
1602 }1663 }
1603 1664
1604 for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) {1665 for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) {
1605 num_interfaces += iftype_num[iftype];1666 num_interfaces += params->iftype_num[iftype];
1606 if (iftype_num[iftype] > 0 &&1667 if (params->iftype_num[iftype] > 0 &&
1607 !(wiphy->software_iftypes & BIT(iftype)))1668 !(wiphy->software_iftypes & BIT(iftype)))
1608 used_iftypes |= BIT(iftype);1669 used_iftypes |= BIT(iftype);
1609 }1670 }
@@ -1617,7 +1678,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, · 7 unmodified lines
1617 1678
1618 if (num_interfaces > c->max_interfaces)1679 if (num_interfaces > c->max_interfaces)
1619 continue;1680 continue;
1620 if (num_different_channels > c->num_different_channels)1681 if (params->num_different_channels > c->num_different_channels)
1621 continue;1682 continue;
1622 1683
1623 limits = kmemdup(c->limits, sizeof(limits[0]) * c->n_limits,1684 limits = kmemdup(c->limits, sizeof(limits[0]) * c->n_limits,
@@ -1632,16 +1693,17 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, · 8 unmodified lines
1632 all_iftypes |= limits[j].types;1693 all_iftypes |= limits[j].types;
1633 if (!(limits[j].types & BIT(iftype)))1694 if (!(limits[j].types & BIT(iftype)))
1634 continue;1695 continue;
1635 if (limits[j].max < iftype_num[iftype])1696 if (limits[j].max < params->iftype_num[iftype])
1636 goto cont;1697 goto cont;
1637 limits[j].max -= iftype_num[iftype];1698 limits[j].max -= params->iftype_num[iftype];
1638 }1699 }
1639 }1700 }
1640 1701
1641 if (radar_detect != (c->radar_detect_widths & radar_detect))1702 if (params->radar_detect !=
1703 (c->radar_detect_widths & params->radar_detect))
1642 goto cont;1704 goto cont;
1643 1705
1644 if (radar_detect && c->radar_detect_regions &&1706 if (params->radar_detect && c->radar_detect_regions &&
1645 !(c->radar_detect_regions & BIT(region)))1707 !(c->radar_detect_regions & BIT(region)))
1646 goto cont;1708 goto cont;
1647 1709
@@ -1653,6 +1715,14 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, · 5 unmodified lines
1653 if ((all_iftypes & used_iftypes) != used_iftypes)1715 if ((all_iftypes & used_iftypes) != used_iftypes)
1654 goto cont;1716 goto cont;
1655 1717
1718 if (beacon_int_gcd) {
1719 if (c->beacon_int_min_gcd &&
1720 beacon_int_gcd < c->beacon_int_min_gcd)
1721 goto cont;
1722 if (!c->beacon_int_min_gcd && beacon_int_different)
1723 goto cont;
1724 }
1725
1656 /* This combination covered all interface types and1726 /* This combination covered all interface types and
1657 * supported the requested numbers, so we're good.1727 * supported the requested numbers, so we're good.
1658 */1728 */
@@ -1675,14 +1745,11 @@ cfg80211_iter_sum_ifcombs(const struct ieee80211_iface_combination *c, · 16 unmodified lines
1675}1745}
1676 1746
1677int cfg80211_check_combinations(struct wiphy *wiphy,1747int cfg80211_check_combinations(struct wiphy *wiphy,
1678 const int num_different_channels,1748 struct iface_combination_params *params)
1679 const u8 radar_detect,
1680 const int iftype_num[NUM_NL80211_IFTYPES])
1681{1749{
1682 int err, num = 0;1750 int err, num = 0;
1683 1751
1684 err = cfg80211_iter_combinations(wiphy, num_different_channels,1752 err = cfg80211_iter_combinations(wiphy, params,
1685 radar_detect, iftype_num,
1686 cfg80211_iter_sum_ifcombs, &num);1753 cfg80211_iter_sum_ifcombs, &num);
1687 if (err)1754 if (err)
1688 return err;1755 return err;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t