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
6060 hostapd hostapd.conf
6161
6262 # Run wpa_supplicant (station) for wlan1
63−wpa_supplicant -Dwext -iwlan1 -c wpa_supplicant.conf
63+wpa_supplicant -Dnl80211 -iwlan1 -c wpa_supplicant.conf
6464
6565
6666 More test cases are available in hostap.git:
drivers/net/wireless/Kconfig+13−0
@@ -17,6 +17,19 @@ menuconfig WLAN · 16 unmodified lines
1717
1818 if WLAN
1919
20+config 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+
2033 source "drivers/net/wireless/admtek/Kconfig"
2134 source "drivers/net/wireless/ath/Kconfig"
2235 source "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
78817881 ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF);
78827882 ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA);
78837883 ieee80211_hw_set(ar->hw, QUEUE_CONTROL);
7884+ ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG);
78847885
78857886 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags))
78867887 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
734734 BIT(NL80211_IFTYPE_P2P_GO) },
735735 };
736736
737+#ifdef CONFIG_WIRELESS_WDS
737738 static const struct ieee80211_iface_limit wds_limits[] = {
738739 { .max = 2048, .types = BIT(NL80211_IFTYPE_WDS) },
739740 };
741+#endif
740742
741743 #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
742744
@@ -774,6 +776,7 @@ static const struct ieee80211_iface_combination if_comb[] = { · 31 unmodified lines
774776 BIT(NL80211_CHAN_WIDTH_40),
775777 #endif
776778 },
779+#ifdef CONFIG_WIRELESS_WDS
777780 {
778781 .limits = wds_limits,
779782 .n_limits = ARRAY_SIZE(wds_limits),
@@ -781,6 +784,7 @@ static const struct ieee80211_iface_combination if_comb[] = { · 1 unmodified line
781784 .num_different_channels = 1,
782785 .beacon_int_infra_match = true,
783786 },
787+#endif
784788 };
785789
786790 #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
851855 BIT(NL80211_IFTYPE_STATION) |
852856 BIT(NL80211_IFTYPE_ADHOC) |
853857 BIT(NL80211_IFTYPE_MESH_POINT) |
858+#ifdef CONFIG_WIRELESS_WDS
854859 BIT(NL80211_IFTYPE_WDS) |
860+#endif
855861 BIT(NL80211_IFTYPE_OCB);
856862
857863 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
55915591 BIT(NL80211_IFTYPE_AP) |
55925592 BIT(NL80211_IFTYPE_MESH_POINT) |
55935593 BIT(NL80211_IFTYPE_STATION) |
5594+#ifdef CONFIG_WIRELESS_WDS
55945595 BIT(NL80211_IFTYPE_WDS) |
5596+#endif
55955597 BIT(NL80211_IFTYPE_ADHOC);
55965598
55975599 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
38383838 hw->wiphy->interface_modes =
38393839 BIT(NL80211_IFTYPE_AP) |
38403840 BIT(NL80211_IFTYPE_STATION) |
3841+#ifdef CONFIG_WIRELESS_WDS
38413842 BIT(NL80211_IFTYPE_WDS) |
3843+#endif
38423844 BIT(NL80211_IFTYPE_ADHOC);
38433845 hw->queues = 1; /* FIXME: hardware has more queues */
38443846 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
414414 struct brcmf_cfg80211_vif *vif,
415415 enum nl80211_iftype new_type)
416416 {
417− int iftype_num[NUM_NL80211_IFTYPES];
418417 struct brcmf_cfg80211_vif *pos;
419418 bool check_combos = false;
420419 int ret = 0;
420+ struct iface_combination_params params = {
421+ .num_different_channels = 1,
422+ };
421423
422− memset(&iftype_num[0], 0, sizeof(iftype_num));
423424 list_for_each_entry(pos, &cfg->vif_list, list)
424425 if (pos == vif) {
425− iftype_num[new_type]++;
426+ params.iftype_num[new_type]++;
426427 } else {
427428 /* concurrent interfaces so need check combinations */
428429 check_combos = true;
429− iftype_num[pos->wdev.iftype]++;
430+ params.iftype_num[pos->wdev.iftype]++;
430431 }
431432
432433 if (check_combos)
433− ret = cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
434+ ret = cfg80211_check_combinations(cfg->wiphy, &params);
434435
435436 return ret;
436437 }
@@ -438,15 +439,16 @@ static int brcmf_vif_change_validate(struct brcmf_cfg80211_info *cfg, · 1 unmodified line
438439 static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,
439440 enum nl80211_iftype new_type)
440441 {
441− int iftype_num[NUM_NL80211_IFTYPES];
442442 struct brcmf_cfg80211_vif *pos;
443+ struct iface_combination_params params = {
444+ .num_different_channels = 1,
445+ };
443446
444− memset(&iftype_num[0], 0, sizeof(iftype_num));
445447 list_for_each_entry(pos, &cfg->vif_list, list)
446− iftype_num[pos->wdev.iftype]++;
448+ params.iftype_num[pos->wdev.iftype]++;
447449
448− iftype_num[new_type]++;
449− return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
450+ params.iftype_num[new_type]++;
451+ return cfg80211_check_combinations(cfg->wiphy, &params);
450452 }
451453
452454 static 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
22492249 WARN_ON(i != MAC80211_HWSIM_SSTATS_LEN);
22502250 }
22512251
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+
22522277 static const struct ieee80211_ops mac80211_hwsim_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,
2278+ HWSIM_COMMON_OPS
22702279 .sw_scan_start = mac80211_hwsim_sw_scan,
22712280 .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,
22782281 };
22792282
2280−static struct ieee80211_ops mac80211_hwsim_mchan_ops;
2283+static 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+};
22812297
22822298 struct hwsim_new_radio_params {
22832299 unsigned int channels;
@@ -3362,21 +3378,6 @@ static int __init init_mac80211_hwsim(void) · 1078 unmodified lines
33623378 if (channels < 1)
33633379 return -EINVAL;
33643380
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−
33803381 spin_lock_init(&hwsim_radio_lock);
33813382
33823383 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
13621362 if (rt2x00dev->bcn->limit > 0)
13631363 rt2x00dev->hw->wiphy->interface_modes |=
13641364 BIT(NL80211_IFTYPE_ADHOC) |
1365− BIT(NL80211_IFTYPE_AP) |
13661365 #ifdef CONFIG_MAC80211_MESH
13671366 BIT(NL80211_IFTYPE_MESH_POINT) |
13681367 #endif
1369− BIT(NL80211_IFTYPE_WDS);
1368+#ifdef CONFIG_WIRELESS_WDS
1369+ BIT(NL80211_IFTYPE_WDS) |
1370+#endif
1371+ BIT(NL80211_IFTYPE_AP);
13701372
13711373 rt2x00dev->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
13721374
drivers/net/wireless/ti/wlcore/main.c+1−0
@@ -6086,6 +6086,7 @@ static int wl1271_init_ieee80211(struct wl1271 *wl) · 6085 unmodified lines
60866086 ieee80211_hw_set(wl->hw, SUPPORTS_DYNAMIC_PS);
60876087 ieee80211_hw_set(wl->hw, SIGNAL_DBM);
60886088 ieee80211_hw_set(wl->hw, SUPPORTS_PS);
6089+ ieee80211_hw_set(wl->hw, SUPPORTS_TX_FRAG);
60896090
60906091 wl->hw->wiphy->cipher_suites = cipher_suites;
60916092 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
15761576 #define WLAN_AUTH_SHARED_KEY 1
15771577 #define WLAN_AUTH_FT 2
15781578 #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
15791582 #define WLAN_AUTH_LEAP 128
15801583
15811584 #define WLAN_AUTH_CHALLENGE_LEN 128
@@ -1960,6 +1963,26 @@ enum ieee80211_eid { · 378 unmodified lines
19601963
19611964 WLAN_EID_VENDOR_SPECIFIC = 221,
19621965 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 */
1975+enum 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,
19631986 };
19641987
19651988 /* Action category code */
@@ -2073,6 +2096,9 @@ enum ieee80211_key_len { · 107 unmodified lines
20732096 #define IEEE80211_GCMP_MIC_LEN 16
20742097 #define IEEE80211_GCMP_PN_LEN 6
20752098
2099+#define FILS_NONCE_LEN 16
2100+#define FILS_MAX_KEK_LEN 64
2101+
20762102 /* Public action codes */
20772103 enum ieee80211_pub_actioncode {
20782104 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4,
include/net/cfg80211.h+117−33
@@ -771,6 +771,30 @@ struct cfg80211_csa_settings { · 770 unmodified lines
771771 u8 count;
772772 };
773773
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+ */
791+struct 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+
774798 /**
775799 * enum station_parameters_apply_mask - station parameter values to apply
776800 * @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
17611785 * @key_len: length of WEP key for shared key authentication
17621786 * @key_idx: index of WEP key for shared key authentication
17631787 * @key: WEP key for shared key authentication
1764− * @sae_data: Non-IE data to use with SAE or %NULL. This starts with
1765− * Authentication transaction sequence number field.
1766− * @sae_data_len: Length of sae_data buffer in octets
1788+ * @auth_data: Fields and elements in Authentication frames. This contains
1789+ * the authentication frame body (non-IE and IE data), excluding the
1790+ * 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
17671793 */
17681794 struct cfg80211_auth_request {
17691795 struct cfg80211_bss *bss;
@@ -1772,8 +1798,8 @@ struct cfg80211_auth_request { · 2 unmodified lines
17721798 enum nl80211_auth_type auth_type;
17731799 const u8 *key;
17741800 u8 key_len, key_idx;
1775− const u8 *sae_data;
1776− size_t sae_data_len;
1801+ const u8 *auth_data;
1802+ size_t auth_data_len;
17771803 };
17781804
17791805 /**
@@ -1814,6 +1840,12 @@ enum cfg80211_assoc_req_flags { · 34 unmodified lines
18141840 * @ht_capa_mask: The bits of ht_capa which are to be used.
18151841 * @vht_capa: VHT capability override
18161842 * @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.
18171849 */
18181850 struct cfg80211_assoc_request {
18191851 struct cfg80211_bss *bss;
@@ -1825,6 +1857,9 @@ struct cfg80211_assoc_request { · 5 unmodified lines
18251857 struct ieee80211_ht_cap ht_capa;
18261858 struct ieee80211_ht_cap ht_capa_mask;
18271859 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;
18281863 };
18291864
18301865 /**
@@ -2015,6 +2050,18 @@ struct cfg80211_connect_params { · 184 unmodified lines
20152050 const u8 *prev_bssid;
20162051 };
20172052
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+ */
2061+enum cfg80211_connect_params_changed {
2062+ UPDATE_ASSOC_IES = BIT(0),
2063+};
2064+
20182065 /**
20192066 * enum wiphy_params_flags - set_wiphy_params bitfield values
20202067 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
@@ -2536,9 +2583,18 @@ struct cfg80211_nan_func { · 515 unmodified lines
25362583 * cases, the result of roaming is indicated with a call to
25372584 * cfg80211_roamed() or cfg80211_roamed_bss().
25382585 * (invoked with the wireless_dev mutex held)
2539− * @disconnect: Disconnect from the BSS/ESS. Once done, call
2540− * cfg80211_disconnected().
2586+ * @update_connect_params: Update the connect parameters while connected to a
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.
25412593 * (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().
25422598 *
25432599 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
25442600 * cfg80211_ibss_joined(), also call that function when changing BSSID due
@@ -2706,6 +2762,8 @@ struct cfg80211_nan_func { · 161 unmodified lines
27062762 * @nan_change_conf: changes NAN configuration. The changed parameters must
27072763 * be specified in @changes (using &enum cfg80211_nan_conf_changes);
27082764 * All other parameters must be ignored.
2765+ *
2766+ * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
27092767 */
27102768 struct cfg80211_ops {
27112769 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -2820,6 +2878,10 @@ struct cfg80211_ops { · 108 unmodified lines
28202878
28212879 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
28222880 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);
28232885 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
28242886 u16 reason_code);
28252887
@@ -2982,6 +3044,10 @@ struct cfg80211_ops { · 156 unmodified lines
29823044 struct wireless_dev *wdev,
29833045 struct cfg80211_nan_conf *conf,
29843046 u32 changes);
3047+
3048+ int (*set_multicast_to_unicast)(struct wiphy *wiphy,
3049+ struct net_device *dev,
3050+ const bool enabled);
29853051 };
29863052
29873053 /*
@@ -3080,6 +3146,12 @@ struct ieee80211_iface_limit { · 92 unmodified lines
30803146 * only in special cases.
30813147 * @radar_detect_widths: bitmap of channel widths supported for radar detection
30823148 * @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.
30833155 *
30843156 * With this structure the driver can describe which interface
30853157 * combinations it supports concurrently.
@@ -3138,6 +3210,7 @@ struct ieee80211_iface_combination { · 52 unmodified lines
31383210 bool beacon_int_infra_match;
31393211 u8 radar_detect_widths;
31403212 u8 radar_detect_regions;
3213+ u32 beacon_int_min_gcd;
31413214 };
31423215
31433216 struct ieee80211_txrx_stypes {
@@ -3745,8 +3818,8 @@ struct cfg80211_cached_keys; · 601 unmodified lines
37453818 * @beacon_interval: beacon interval used on this device for transmitting
37463819 * beacons, 0 when not valid
37473820 * @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 started
3749− * @nan_started: true if this is a NAN interface that has been started
3821+ * @is_running: true if this is a non-netdev device that has been started, e.g.
3822+ * the P2P Device.
37503823 * @cac_started: true if DFS channel availability check has been started
37513824 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
37523825 * @cac_time_ms: CAC time in ms
@@ -3778,7 +3851,7 @@ struct wireless_dev { · 25 unmodified lines
37783851
37793852 struct mutex mtx;
37803853
3781− bool use_4addr, p2p_started, nan_started;
3854+ bool use_4addr, is_running;
37823855
37833856 u8 address[ETH_ALEN] __aligned(sizeof(u16));
37843857
@@ -3835,6 +3908,13 @@ static inline u8 *wdev_address(struct wireless_dev *wdev) · 50 unmodified lines
38353908 return wdev->address;
38363909 }
38373910
3911+static 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+
38383918 /**
38393919 * wdev_priv - return wiphy priv from wireless_dev
38403920 *
@@ -4139,6 +4219,27 @@ static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) · 298 unmodified lines
41394219 return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
41404220 }
41414221
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+ */
4237+static 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+
41424243 /**
41434244 * cfg80211_find_vendor_ie - find vendor specific information element in data
41444245 *
@@ -4539,7 +4640,8 @@ void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); · 394 unmodified lines
45394640 * moves to cfg80211 in this call
45404641 * @buf: authentication frame (header + body)
45414642 * @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
45434645 *
45444646 * After being asked to associate via cfg80211_ops::assoc() the driver must
45454647 * 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
55755677 * cfg80211_check_combinations - check interface combinations
55765678 *
55775679 * @wiphy: the wiphy
5578− * @num_different_channels: the number of different channels we want
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.
5680+ * @params: the interface combinations parameter
55865681 *
55875682 * This function can be called by the driver to check whether a
55885683 * combination of interfaces and their types are allowed according to
55895684 * the interface combinations.
55905685 */
55915686 int cfg80211_check_combinations(struct wiphy *wiphy,
5592− const int num_different_channels,
5593− const u8 radar_detect,
5594− const int iftype_num[NUM_NL80211_IFTYPES]);
5687+ struct iface_combination_params *params);
55955688
55965689 /**
55975690 * cfg80211_iter_combinations - iterate over matching combinations
55985691 *
55995692 * @wiphy: the wiphy
5600− * @num_different_channels: the number of different channels we want
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.
5693+ * @params: the interface combinations parameter
56085694 * @iter: function to call for each matching combination
56095695 * @data: pointer to pass to iter function
56105696 *
@@ -5613,9 +5699,7 @@ int cfg80211_check_combinations(struct wiphy *wiphy, · 2 unmodified lines
56135699 * purposes.
56145700 */
56155701 int cfg80211_iter_combinations(struct wiphy *wiphy,
5616− const int num_different_channels,
5617− const u8 radar_detect,
5618− const int iftype_num[NUM_NL80211_IFTYPES],
5702+ struct iface_combination_params *params,
56195703 void (*iter)(const struct ieee80211_iface_combination *c,
56205704 void *data),
56215705 void *data);
include/net/ieee80211_radiotap.h+2−2
@@ -333,9 +333,9 @@ enum ieee80211_radiotap_type { · 332 unmodified lines
333333 #define IEEE80211_RADIOTAP_TIMESTAMP_UNIT_NS 0x0003
334334 #define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_MASK 0x00F0
335335 #define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_BEGIN_MDPU 0x0000
336−#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_EO_MPDU 0x0010
336+#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_PLCP_SIG_ACQ 0x0010
337337 #define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_EO_PPDU 0x0020
338−#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_PLCP_SIG_ACQ 0x0030
338+#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_EO_MPDU 0x0030
339339 #define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_UNKNOWN 0x00F0
340340
341341 #define IEEE80211_RADIOTAP_TIMESTAMP_FLAG_64BIT 0x00
include/net/mac80211.h+15−4
@@ -1438,7 +1438,7 @@ enum ieee80211_vif_flags { · 1437 unmodified lines
14381438 struct ieee80211_vif {
14391439 enum nl80211_iftype type;
14401440 struct ieee80211_bss_conf bss_conf;
1441− u8 addr[ETH_ALEN];
1441+ u8 addr[ETH_ALEN] __aligned(2);
14421442 bool p2p;
14431443 bool csa_active;
14441444 bool mu_mimo_owner;
@@ -1745,7 +1745,8 @@ struct ieee80211_sta_rates { · 300 unmodified lines
17451745 * @drv_priv: data area for driver use, will always be aligned to
17461746 * sizeof(void *), size is determined in hw information.
17471747 * @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_*.
17491750 * @max_sp: max Service Period. Only valid if wme is supported.
17501751 * @bandwidth: current bandwidth the station can receive with
17511752 * @rx_nss: in HT/VHT, the maximum number of spatial streams the
@@ -2025,6 +2026,10 @@ struct ieee80211_txq { · 273 unmodified lines
20252026 * drivers, mac80211 packet loss mechanism will not be triggered and driver
20262027 * is completely depending on firmware event for station kickout.
20272028 *
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+ *
20282033 * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
20292034 */
20302035 enum ieee80211_hw_flags {
@@ -2066,6 +2071,7 @@ enum ieee80211_hw_flags { · 35 unmodified lines
20662071 IEEE80211_HW_TX_AMSDU,
20672072 IEEE80211_HW_TX_FRAG_LIST,
20682073 IEEE80211_HW_REPORTS_LOW_ACK,
2074+ IEEE80211_HW_SUPPORTS_TX_FRAG,
20692075
20702076 /* keep last, obviously */
20712077 NUM_IEEE80211_HW_FLAGS
@@ -3093,8 +3099,9 @@ enum ieee80211_reconfig_type { · 1021 unmodified lines
30933099 * The callback must be atomic.
30943100 *
30953101 * @set_frag_threshold: Configuration of fragmentation threshold. Assign this
3096− * if the device does fragmentation by itself; if this callback is
3097− * implemented then the stack will not do fragmentation.
3102+ * if the device does fragmentation by itself. Note that to prevent the
3103+ * stack from doing fragmentation IEEE80211_HW_SUPPORTS_TX_FRAG
3104+ * should be set as well.
30983105 * The callback can sleep.
30993106 *
31003107 * @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
40874094 * This must be used in conjunction with ieee80211_sta_ps_transition()
40884095 * and possibly ieee80211_sta_pspoll(); calls to all three must be
40894096 * 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.
40904101 */
40914102 void ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, u8 tid);
40924103
include/uapi/linux/nl80211.h+64−5
@@ -600,6 +600,20 @@ · 599 unmodified lines
600600 *
601601 * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface.
602602 *
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+ *
603617 * @NL80211_CMD_JOIN_MESH: Join a mesh. The mesh ID must be given, and initial
604618 * mesh config parameters may be given.
605619 * @NL80211_CMD_LEAVE_MESH: Leave the mesh network -- no special arguments, the
@@ -874,6 +888,12 @@ · 268 unmodified lines
874888 * This will contain a %NL80211_ATTR_NAN_MATCH nested attribute and
875889 * %NL80211_ATTR_COOKIE.
876890 *
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+ *
877897 * @NL80211_CMD_MAX: highest used command number
878898 * @__NL80211_CMD_AFTER_LAST: internal use
879899 */
@@ -1069,6 +1089,10 @@ enum nl80211_commands { · 189 unmodified lines
10691089 NL80211_CMD_CHANGE_NAN_CONFIG,
10701090 NL80211_CMD_NAN_MATCH,
10711091
1092+ NL80211_CMD_SET_MULTICAST_TO_UNICAST,
1093+
1094+ NL80211_CMD_UPDATE_CONNECT_PARAMS,
1095+
10721096 /* add new commands above here */
10731097
10741098 /* used to define NL80211_CMD_MAX below */
@@ -1638,8 +1662,16 @@ enum nl80211_commands { · 563 unmodified lines
16381662 * the connection request from a station. nl80211_connect_failed_reason
16391663 * enum has different reasons of connection failure.
16401664 *
1641− * @NL80211_ATTR_SAE_DATA: SAE elements in Authentication frames. This starts
1642− * with the Authentication transaction sequence number field.
1665+ * @NL80211_ATTR_AUTH_DATA: Fields and elements in Authentication frames.
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.
16431675 *
16441676 * @NL80211_ATTR_VHT_CAPABILITY: VHT Capability information element (from
16451677 * association request when used with NL80211_CMD_NEW_STATION)
@@ -1936,6 +1968,14 @@ enum nl80211_commands { · 290 unmodified lines
19361968 * attribute.
19371969 * @NL80211_ATTR_NAN_MATCH: used to report a match. This is a nested attribute.
19381970 * 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).
19391979 *
19401980 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
19411981 * @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2195,7 +2235,7 @@ enum nl80211_attrs { · 253 unmodified lines
21952235
21962236 NL80211_ATTR_CONN_FAILED_REASON,
21972237
2198− NL80211_ATTR_SAE_DATA,
2238+ NL80211_ATTR_AUTH_DATA,
21992239
22002240 NL80211_ATTR_VHT_CAPABILITY,
22012241
@@ -2336,6 +2376,11 @@ enum nl80211_attrs { · 134 unmodified lines
23362376 NL80211_ATTR_NAN_FUNC,
23372377 NL80211_ATTR_NAN_MATCH,
23382378
2379+ NL80211_ATTR_FILS_KEK,
2380+ NL80211_ATTR_FILS_NONCES,
2381+
2382+ NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED,
2383+
23392384 /* add attributes here, update the policy in nl80211.c */
23402385
23412386 __NL80211_ATTR_AFTER_LAST,
@@ -2347,6 +2392,7 @@ enum nl80211_attrs { · 5 unmodified lines
23472392 #define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
23482393 #define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG
23492394 #define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
2395+#define NL80211_ATTR_SAE_DATA NL80211_ATTR_AUTH_DATA
23502396
23512397 /*
23522398 * Allow user space programs to use #ifdef on new attributes by defining them
@@ -3660,6 +3706,9 @@ enum nl80211_bss_status { · 1307 unmodified lines
36603706 * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r)
36613707 * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP)
36623708 * @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
36633712 * @__NL80211_AUTHTYPE_NUM: internal
36643713 * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm
36653714 * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by
@@ -3672,6 +3721,9 @@ enum nl80211_auth_type { · 6 unmodified lines
36723721 NL80211_AUTHTYPE_FT,
36733722 NL80211_AUTHTYPE_NETWORK_EAP,
36743723 NL80211_AUTHTYPE_SAE,
3724+ NL80211_AUTHTYPE_FILS_SK,
3725+ NL80211_AUTHTYPE_FILS_SK_PFS,
3726+ NL80211_AUTHTYPE_FILS_PK,
36753727
36763728 /* keep last */
36773729 __NL80211_AUTHTYPE_NUM,
@@ -4280,6 +4332,9 @@ enum nl80211_iface_limit_attrs { · 602 unmodified lines
42804332 * of supported channel widths for radar detection.
42814333 * @NL80211_IFACE_COMB_RADAR_DETECT_REGIONS: u32 attribute containing the bitmap
42824334 * 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).
42834338 * @NUM_NL80211_IFACE_COMB: number of attributes
42844339 * @MAX_NL80211_IFACE_COMB: highest attribute number
42854340 *
@@ -4287,8 +4342,8 @@ enum nl80211_iface_limit_attrs { · 1 unmodified line
42874342 * limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 2
42884343 * => allows an AP and a STA that must match BIs
42894344 *
4290− * numbers = [ #{AP, P2P-GO} <= 8 ], channels = 1, max = 8
4291− * => allows 8 of AP/GO
4345+ * numbers = [ #{AP, P2P-GO} <= 8 ], BI min gcd, channels = 1, max = 8,
4346+ * => allows 8 of AP/GO that can have BI gcd >= min gcd
42924347 *
42934348 * numbers = [ #{STA} <= 2 ], channels = 2, max = 2
42944349 * => allows two STAs on different channels
@@ -4314,6 +4369,7 @@ enum nl80211_if_combination_attrs { · 19 unmodified lines
43144369 NL80211_IFACE_COMB_NUM_CHANNELS,
43154370 NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,
43164371 NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,
4372+ NL80211_IFACE_COMB_BI_MIN_GCD,
43174373
43184374 /* keep last */
43194375 NUM_NL80211_IFACE_COMB,
@@ -4634,6 +4690,8 @@ enum nl80211_feature_flags { · 314 unmodified lines
46344690 * configuration (AP/mesh) with HT rates.
46354691 * @NL80211_EXT_FEATURE_BEACON_RATE_VHT: Driver supports beacon rate
46364692 * 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.
46374695 *
46384696 * @NUM_NL80211_EXT_FEATURES: number of extended features.
46394697 * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -4648,6 +4706,7 @@ enum nl80211_ext_feature_index { · 8 unmodified lines
46484706 NL80211_EXT_FEATURE_BEACON_RATE_LEGACY,
46494707 NL80211_EXT_FEATURE_BEACON_RATE_HT,
46504708 NL80211_EXT_FEATURE_BEACON_RATE_VHT,
4709+ NL80211_EXT_FEATURE_FILS_STA,
46514710
46524711 /* add new features before the definition below */
46534712 NUM_NL80211_EXT_FEATURES,
net/mac80211/Makefile+1−0
@@ -19,6 +19,7 @@ mac80211-y := \ · 18 unmodified lines
1919 aes_gcm.o \
2020 aes_cmac.o \
2121 aes_gmac.o \
22+ fils_aead.o \
2223 cfg.o \
2324 ethtool.o \
2425 rx.o \
net/mac80211/aes_cmac.c+4−4
@@ -23,7 +23,7 @@ · 22 unmodified lines
2323 #define AAD_LEN 20
2424
2525
26−static void gf_mulx(u8 *pad)
26+void gf_mulx(u8 *pad)
2727 {
2828 int i, carry;
2929
@@ -35,9 +35,9 @@ static void gf_mulx(u8 *pad) · 5 unmodified lines
3535 pad[AES_BLOCK_SIZE - 1] ^= 0x87;
3636 }
3737
38−static void aes_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
39− const u8 *addr[], const size_t *len, u8 *mac,
40− size_t mac_len)
38+void aes_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
39+ const u8 *addr[], const size_t *len, u8 *mac,
40+ size_t mac_len)
4141 {
4242 u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE];
4343 const u8 *pos, *end;
net/mac80211/aes_cmac.h+4−0
@@ -11,6 +11,10 @@ · 10 unmodified lines
1111
1212 #include <linux/crypto.h>
1313
14+void gf_mulx(u8 *pad);
15+void 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);
1418 struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],
1519 size_t key_len);
1620 void 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
315315 mutex_lock(&sta->ampdu_mlme.mtx);
316316
317317 if (test_bit(tid, sta->ampdu_mlme.agg_session_valid)) {
318− tid_agg_rx = rcu_dereference_protected(
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) {
318+ if (sta->ampdu_mlme.tid_rx_token[tid] == dialog_token) {
323319 ht_dbg_ratelimited(sta->sdata,
324320 "updated AddBA Req from %pM on tid %u\n",
325321 sta->sta.addr, tid);
@@ -396,7 +392,6 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta, · 70 unmodified lines
396392 }
397393
398394 /* update data */
399− tid_agg_rx->dialog_token = dialog_token;
400395 tid_agg_rx->ssn = start_seq_num;
401396 tid_agg_rx->head_seq_num = start_seq_num;
402397 tid_agg_rx->buf_size = buf_size;
@@ -418,6 +413,7 @@ end: · 15 unmodified lines
418413 if (status == WLAN_STATUS_SUCCESS) {
419414 __set_bit(tid, sta->ampdu_mlme.agg_session_valid);
420415 __clear_bit(tid, sta->ampdu_mlme.unexpected_agg);
416+ sta->ampdu_mlme.tid_rx_token[tid] = dialog_token;
421417 }
422418 mutex_unlock(&sta->ampdu_mlme.mtx);
423419
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
357357 mutex_lock(&local->sta_mtx);
358358
359359 if (mac_addr) {
360− if (ieee80211_vif_is_mesh(&sdata->vif))
361− sta = sta_info_get(sdata, mac_addr);
362− else
363− sta = sta_info_get_bss(sdata, mac_addr);
360+ sta = sta_info_get_bss(sdata, mac_addr);
364361 /*
365362 * The ASSOC test makes sure the driver is ready to
366363 * 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
867864 }
868865 sdata->needed_rx_chains = sdata->local->rx_chains;
869866
867+ sdata->vif.bss_conf.beacon_int = params->beacon_interval;
868+
870869 mutex_lock(&local->mtx);
871870 err = ieee80211_vif_use_channel(sdata, &params->chandef,
872871 IEEE80211_CHANCTX_SHARED);
@@ -897,7 +896,6 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, · 24 unmodified lines
897896 vlan->vif.type);
898897 }
899898
900− sdata->vif.bss_conf.beacon_int = params->beacon_interval;
901899 sdata->vif.bss_conf.dtim_period = params->dtim_period;
902900 sdata->vif.bss_conf.enable_beacon = true;
903901 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
15231521 goto out_err;
15241522
15251523 if (params->vlan && params->vlan != sta->sdata->dev) {
1526− bool prev_4addr = false;
1527− bool new_4addr = false;
1528−
15291524 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
15301525
15311526 if (params->vlan->ieee80211_ptr->use_4addr) {
@@ -1535,26 +1530,21 @@ static int ieee80211_change_station(struct wiphy *wiphy, · 3 unmodified lines
15351530 }
15361531
15371532 rcu_assign_pointer(vlansdata->u.vlan.sta, sta);
1538− new_4addr = true;
15391533 __ieee80211_check_fast_rx_iface(vlansdata);
15401534 }
15411535
15421536 if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
1543− sta->sdata->u.vlan.sta) {
1537+ sta->sdata->u.vlan.sta)
15441538 RCU_INIT_POINTER(sta->sdata->u.vlan.sta, NULL);
1545− prev_4addr = true;
1546− }
1539+
1540+ if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
1541+ ieee80211_vif_dec_num_mcast(sta->sdata);
15471542
15481543 sta->sdata = vlansdata;
15491544 ieee80211_check_fast_xmit(sta);
15501545
1551− if (sta->sta_state == IEEE80211_STA_AUTHORIZED &&
1552− prev_4addr != new_4addr) {
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− }
1546+ if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
1547+ ieee80211_vif_inc_num_mcast(sta->sdata);
15581548
15591549 ieee80211_send_layer2_update(sta);
15601550 }
@@ -2480,13 +2470,6 @@ int __ieee80211_request_smps_ap(struct ieee80211_sub_if_data *sdata, · 919 unmodified lines
24802470 smps_mode == IEEE80211_SMPS_AUTOMATIC)
24812471 return 0;
24822472
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−
24902473 ht_dbg(sdata,
24912474 "SMPS %d requested in AP mode, sending Action frame to %d stations\n",
24922475 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
210210 FLAG(TX_AMSDU),
211211 FLAG(TX_FRAG_LIST),
212212 FLAG(REPORTS_LOW_ACK),
213+ FLAG(SUPPORTS_TX_FRAG),
213214 #undef FLAG
214215 };
215216
net/mac80211/debugfs_netdev.c+11−0
@@ -477,6 +477,7 @@ IEEE80211_IF_FILE_RW(tdls_wider_bw); · 476 unmodified lines
477477 IEEE80211_IF_FILE(num_mcast_sta, u.ap.num_mcast_sta, ATOMIC);
478478 IEEE80211_IF_FILE(num_sta_ps, u.ap.ps.num_sta_ps, ATOMIC);
479479 IEEE80211_IF_FILE(dtim_count, u.ap.ps.dtim_count, DEC);
480+IEEE80211_IF_FILE(num_mcast_sta_vlan, u.vlan.num_mcast_sta, ATOMIC);
480481
481482 static ssize_t ieee80211_if_fmt_num_buffered_multicast(
482483 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
684685 DEBUGFS_ADD_MODE(tkip_mic_test, 0200);
685686 }
686687
688+static 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+
687695 static void add_ibss_files(struct ieee80211_sub_if_data *sdata)
688696 {
689697 DEBUGFS_ADD_MODE(tsf, 0600);
@@ -787,6 +795,9 @@ static void add_files(struct ieee80211_sub_if_data *sdata) · 97 unmodified lines
787795 case NL80211_IFTYPE_AP:
788796 add_ap_files(sdata);
789797 break;
798+ case NL80211_IFTYPE_AP_VLAN:
799+ add_vlan_files(sdata);
800+ break;
790801 case NL80211_IFTYPE_WDS:
791802 add_wds_files(sdata);
792803 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
199199 "TID\t\tRX\tDTKN\tSSN\t\tTX\tDTKN\tpending\n");
200200
201201 for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
202+ bool tid_rx_valid;
203+
202204 tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[i]);
203205 tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[i]);
206+ tid_rx_valid = test_bit(i, sta->ampdu_mlme.agg_session_valid);
204207
205208 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);
207211 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);
209214 p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.3x",
210215 tid_rx ? tid_rx->ssn : 0);
211216
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+
18+static 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. */
77+static 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);
148+fail:
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. */
155+static 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+
228+int 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+
278+int 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+
13+int fils_encrypt_assoc_req(struct sk_buff *skb,
14+ struct ieee80211_mgd_assoc_data *assoc_data);
15+int 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
8484 #define IEEE80211_DEFAULT_MAX_SP_LEN \
8585 IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
8686
87+extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS];
88+
8789 #define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */)
8890
8991 #define IEEE80211_MAX_NAN_INSTANCE_ID 255
@@ -307,6 +309,7 @@ struct ieee80211_if_vlan { · 217 unmodified lines
307309
308310 /* used for all tx if the VLAN is configured to 4-addr mode */
309311 struct sta_info __rcu *sta;
312+ atomic_t num_mcast_sta; /* number of stations receiving multicast */
310313 };
311314
312315 struct mesh_stats {
@@ -398,6 +401,10 @@ struct ieee80211_mgd_assoc_data { · 85 unmodified lines
398401
399402 struct ieee80211_vht_cap ap_vht_cap;
400403
404+ u8 fils_nonces[2 * FILS_NONCE_LEN];
405+ u8 fils_kek[FILS_MAX_KEK_LEN];
406+ size_t fils_kek_len;
407+
401408 size_t ie_len;
402409 u8 ie[];
403410 };
@@ -442,7 +449,7 @@ struct ieee80211_if_managed { · 38 unmodified lines
442449 struct ieee80211_mgd_auth_data *auth_data;
443450 struct ieee80211_mgd_assoc_data *assoc_data;
444451
445− u8 bssid[ETH_ALEN];
452+ u8 bssid[ETH_ALEN] __aligned(2);
446453
447454 u16 aid;
448455
@@ -1527,6 +1534,23 @@ ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status) · 1078 unmodified lines
15271534 return false;
15281535 }
15291536
1537+void ieee80211_vif_inc_num_mcast(struct ieee80211_sub_if_data *sdata);
1538+void 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+ */
1544+static inline int
1545+ieee80211_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+
15301554 u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
15311555 struct ieee80211_rx_status *status,
15321556 unsigned int mpdu_len,
net/mac80211/iface.c+16−0
@@ -1998,3 +1998,19 @@ void ieee80211_iface_exit(void) · 1997 unmodified lines
19981998 {
19991999 unregister_netdevice_notifier(&mac80211_netdev_notifier);
20002000 }
2001+
2002+void 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+
2010+void 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
549549 NL80211_FEATURE_MAC_ON_CREATE |
550550 NL80211_FEATURE_USERSPACE_MPM |
551551 NL80211_FEATURE_FULL_AP_CLIENT_STATE;
552+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_FILS_STA);
552553
553554 if (!ops->hw_scan)
554555 wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN |
@@ -821,6 +822,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) · 266 unmodified lines
821822 !local->ops->tdls_recv_channel_switch))
822823 return -EOPNOTSUPP;
823824
825+ if (WARN_ON(ieee80211_hw_check(hw, SUPPORTS_TX_FRAG) &&
826+ !local->ops->set_frag_threshold))
827+ return -EINVAL;
828+
824829 if (WARN_ON(local->hw.wiphy->interface_modes &
825830 BIT(NL80211_IFTYPE_NAN) &&
826831 (!local->ops->start_nan || !local->ops->stop_nan)))
net/mac80211/mlme.c+51−9
@@ -30,6 +30,7 @@ · 29 unmodified lines
3030 #include "driver-ops.h"
3131 #include "rate.h"
3232 #include "led.h"
33+#include "fils_aead.h"
3334
3435 #define IEEE80211_AUTH_TIMEOUT (HZ / 5)
3536 #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
652653 2 + sizeof(struct ieee80211_ht_cap) + /* HT */
653654 2 + sizeof(struct ieee80211_vht_cap) + /* VHT */
654655 assoc_data->ie_len + /* extra IEs */
656+ (assoc_data->fils_kek_len ? 16 /* AES-SIV */ : 0) +
655657 9, /* WMM */
656658 GFP_KERNEL);
657659 if (!skb)
@@ -875,6 +877,12 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 217 unmodified lines
875877 memcpy(pos, assoc_data->ie + offset, noffset - offset);
876878 }
877879
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+
878886 drv_mgd_prepare_tx(local, sdata);
879887
880888 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
26182626 case WLAN_AUTH_LEAP:
26192627 case WLAN_AUTH_FT:
26202628 case WLAN_AUTH_SAE:
2629+ case WLAN_AUTH_FILS_SK:
2630+ case WLAN_AUTH_FILS_SK_PFS:
2631+ case WLAN_AUTH_FILS_PK:
26212632 break;
26222633 case WLAN_AUTH_SHARED_KEY:
26232634 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
31433154 reassoc ? "Rea" : "A", mgmt->sa,
31443155 capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14))));
31453156
3157+ if (assoc_data->fils_kek_len &&
3158+ fils_decrypt_assoc_resp(sdata, (u8 *)mgmt, &len, assoc_data) < 0)
3159+ return;
3160+
31463161 pos = mgmt->u.assoc_resp.variable;
31473162 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), false, &elems);
31483163
@@ -3193,7 +3208,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 44 unmodified lines
31933208 uapsd_queues = 0;
31943209 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
31953210 if (sdata->tx_conf[ac].uapsd)
3196− uapsd_queues |= BIT(ac);
3211+ uapsd_queues |= ieee80211_ac_to_qos_mask[ac];
31973212 }
31983213
31993214 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
44794494 case NL80211_AUTHTYPE_SAE:
44804495 auth_alg = WLAN_AUTH_SAE;
44814496 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;
44824506 default:
44834507 return -EOPNOTSUPP;
44844508 }
44854509
4486− auth_data = kzalloc(sizeof(*auth_data) + req->sae_data_len +
4510+ auth_data = kzalloc(sizeof(*auth_data) + req->auth_data_len +
44874511 req->ie_len, GFP_KERNEL);
44884512 if (!auth_data)
44894513 return -ENOMEM;
44904514
44914515 auth_data->bss = req->bss;
44924516
4493− if (req->sae_data_len >= 4) {
4494− __le16 *pos = (__le16 *) req->sae_data;
4495− auth_data->sae_trans = le16_to_cpu(pos[0]);
4496− auth_data->sae_status = le16_to_cpu(pos[1]);
4497− memcpy(auth_data->data, req->sae_data + 4,
4498− req->sae_data_len - 4);
4499− auth_data->data_len += req->sae_data_len - 4;
4517+ if (req->auth_data_len >= 4) {
4518+ if (req->auth_type == NL80211_AUTHTYPE_SAE) {
4519+ __le16 *pos = (__le16 *) req->auth_data;
4520+
4521+ auth_data->sae_trans = le16_to_cpu(pos[0]);
4522+ auth_data->sae_status = le16_to_cpu(pos[1]);
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;
45004527 }
45014528
45024529 if (req->ie && req->ie_len) {
@@ -4692,6 +4719,21 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, · 189 unmodified lines
46924719 assoc_data->ie_len = req->ie_len;
46934720 }
46944721
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+
46954737 assoc_data->bss = req->bss;
46964738
46974739 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
13941394 u8 ac = ieee802_1d_to_ac[tid & 7];
13951395
13961396 /*
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.
13981399 *
13991400 * NB: This could/should check a separate bitmap of trigger-
14001401 * enabled queues, but for now we only implement uAPSD w/o
14011402 * TSPEC changes to the ACs, so they're always the same.
14021403 */
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)
14041406 return;
14051407
14061408 /* if we are in a service period, do nothing */
@@ -2215,7 +2217,8 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) · 808 unmodified lines
22152217 sdata->vif.type == NL80211_IFTYPE_AP_VLAN) &&
22162218 !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) &&
22172219 (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) {
22192222 /*
22202223 * send multicast frames both to higher layers in
22212224 * local net stack and back to the wireless medium
@@ -2224,7 +2227,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) · 2 unmodified lines
22242227 if (!xmit_skb)
22252228 net_info_ratelimited("%s: failed to clone multicast frame\n",
22262229 dev->name);
2227− } else {
2230+ } else if (!is_multicast_ether_addr(ehdr->h_dest)) {
22282231 dsta = sta_info_get(sdata, skb->data);
22292232 if (dsta) {
22302233 /*
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
709709 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
710710 unsigned long tids;
711711
712− if (ignore_for_tim & BIT(ac))
712+ if (ignore_for_tim & ieee80211_ac_to_qos_mask[ac])
713713 continue;
714714
715715 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
13891389 return true;
13901390
13911391 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
1392− if (ignored_acs & BIT(ac))
1392+ if (ignored_acs & ieee80211_ac_to_qos_mask[ac])
13931393 continue;
13941394
13951395 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
14141414 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
14151415 unsigned long tids;
14161416
1417− if (ignored_acs & BIT(ac))
1417+ if (ignored_acs & ieee80211_ac_to_qos_mask[ac])
14181418 continue;
14191419
14201420 tids = ieee80211_tids_for_ac(ac);
@@ -1482,7 +1482,7 @@ ieee80211_sta_ps_deliver_response(struct sta_info *sta, · 61 unmodified lines
14821482 BIT(find_highest_prio_tid(driver_release_tids));
14831483
14841484 if (skb_queue_empty(&frames) && !driver_release_tids) {
1485− int tid;
1485+ int tid, ac;
14861486
14871487 /*
14881488 * 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
15001500 */
15011501
15021502 /* 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;
15041507
15051508 ieee80211_send_null_response(sta, tid, reason, true, false);
15061509 } else if (!driver_release_tids) {
@@ -1871,10 +1874,7 @@ int sta_info_move_state(struct sta_info *sta, · 364 unmodified lines
18711874 if (!sta->sta.support_p2p_ps)
18721875 ieee80211_recalc_p2p_go_ps_allowed(sta->sdata);
18731876 } else if (sta->sta_state == IEEE80211_STA_AUTHORIZED) {
1874− if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
1875− (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
1876− !sta->sdata->u.vlan.sta))
1877− atomic_dec(&sta->sdata->bss->num_mcast_sta);
1877+ ieee80211_vif_dec_num_mcast(sta->sdata);
18781878 clear_bit(WLAN_STA_AUTHORIZED, &sta->_flags);
18791879 ieee80211_clear_fast_xmit(sta);
18801880 ieee80211_clear_fast_rx(sta);
@@ -1882,10 +1882,7 @@ int sta_info_move_state(struct sta_info *sta, · 1 unmodified line
18821882 break;
18831883 case IEEE80211_STA_AUTHORIZED:
18841884 if (sta->sta_state == IEEE80211_STA_ASSOC) {
1885− if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
1886− (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
1887− !sta->sdata->u.vlan.sta))
1888− atomic_inc(&sta->sdata->bss->num_mcast_sta);
1885+ ieee80211_vif_inc_num_mcast(sta->sdata);
18891886 set_bit(WLAN_STA_AUTHORIZED, &sta->_flags);
18901887 ieee80211_check_fast_xmit(sta);
18911888 ieee80211_check_fast_rx(sta);
net/mac80211/sta_info.h+2−2
@@ -184,7 +184,6 @@ struct tid_ampdu_tx { · 183 unmodified lines
184184 * @ssn: Starting Sequence Number expected to be aggregated.
185185 * @buf_size: buffer size for incoming A-MPDUs
186186 * @timeout: reset timer value (in TUs).
187− * @dialog_token: dialog token for aggregation session
188187 * @rcu_head: RCU head used for freeing this struct
189188 * @reorder_lock: serializes access to reorder buffer, see below.
190189 * @auto_seq: used for offloaded BA sessions to automatically pick head_seq_and
@@ -213,7 +212,6 @@ struct tid_ampdu_rx { · 22 unmodified lines
213212 u16 ssn;
214213 u16 buf_size;
215214 u16 timeout;
216− u8 dialog_token;
217215 bool auto_seq;
218216 bool removed;
219217 };
@@ -225,6 +223,7 @@ struct tid_ampdu_rx { · 5 unmodified lines
225223 * to tid_tx[idx], which are protected by the sta spinlock)
226224 * tid_start_tx is also protected by sta->lock.
227225 * @tid_rx: aggregation info for Rx per TID -- RCU protected
226+ * @tid_rx_token: dialog tokens for valid aggregation sessions
228227 * @tid_rx_timer_expired: bitmap indicating on which TIDs the
229228 * RX timer expired until the work for it runs
230229 * @tid_rx_stop_requested: bitmap indicating which BA sessions per TID the
@@ -243,6 +242,7 @@ struct sta_ampdu_mlme { · 12 unmodified lines
243242 struct mutex mtx;
244243 /* rx */
245244 struct tid_ampdu_rx __rcu *tid_rx[IEEE80211_NUM_TIDS];
245+ u8 tid_rx_token[IEEE80211_NUM_TIDS];
246246 unsigned long tid_rx_timer_expired[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
247247 unsigned long tid_rx_stop_requested[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
248248 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
331331 I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc);
332332 return TX_DROP;
333333 }
334− } else if (unlikely(tx->sdata->vif.type == NL80211_IFTYPE_AP &&
335− ieee80211_is_data(hdr->frame_control) &&
336− !atomic_read(&tx->sdata->u.ap.num_mcast_sta))) {
334+ } else if (unlikely(ieee80211_is_data(hdr->frame_control) &&
335+ ieee80211_vif_get_num_mcast_if(tx->sdata) == 0)) {
337336 /*
338337 * No associated STAs - no need to send multicast
339338 * frames.
@@ -935,7 +934,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) · 595 unmodified lines
935934 if (info->flags & IEEE80211_TX_CTL_DONTFRAG)
936935 return TX_CONTINUE;
937936
938− if (tx->local->ops->set_frag_threshold)
937+ if (ieee80211_hw_check(&tx->local->hw, SUPPORTS_TX_FRAG))
939938 return TX_CONTINUE;
940939
941940 /*
@@ -2801,7 +2800,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta) · 1859 unmodified lines
28012800
28022801 /* fast-xmit doesn't handle fragmentation at all */
28032802 if (local->hw.wiphy->frag_threshold != (u32)-1 &&
2804− !local->ops->set_frag_threshold)
2803+ !ieee80211_hw_check(&local->hw, SUPPORTS_TX_FRAG))
28052804 goto out;
28062805
28072806 rcu_read_lock();
@@ -3060,11 +3059,12 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata, · 252 unmodified lines
30603059 struct ieee80211_local *local = sdata->local;
30613060 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
30623061 struct ieee80211_hdr *hdr;
3063− struct ethhdr amsdu_hdr;
3062+ struct ethhdr *amsdu_hdr;
30643063 int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header);
30653064 int subframe_len = skb->len - hdr_len;
30663065 void *data;
3067− u8 *qc;
3066+ u8 *qc, *h_80211_src, *h_80211_dst;
3067+ const u8 *bssid;
30683068
30693069 if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
30703070 return false;
@@ -3072,19 +3072,44 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata, · 1 unmodified line
30723072 if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
30733073 return true;
30743074
3075− if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(amsdu_hdr),
3075+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(*amsdu_hdr),
30763076 &subframe_len))
30773077 return false;
30783078
3079− amsdu_hdr.h_proto = cpu_to_be16(subframe_len);
3080− memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);
3081− memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);
3079+ data = skb_push(skb, sizeof(*amsdu_hdr));
3080+ memmove(data, data + sizeof(*amsdu_hdr), hdr_len);
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+ }
30823106
3083− data = skb_push(skb, sizeof(amsdu_hdr));
3084− memmove(data, data + sizeof(amsdu_hdr), hdr_len);
3085− memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
3107+ if (bssid && ieee80211_has_fromds(hdr->frame_control))
3108+ ether_addr_copy(h_80211_src, bssid);
3109+
3110+ if (bssid && ieee80211_has_tods(hdr->frame_control))
3111+ ether_addr_copy(h_80211_dst, bssid);
30863112
3087− hdr = data;
30883113 qc = ieee80211_get_qos_ctl(hdr);
30893114 *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
30903115
net/mac80211/util.c+37−24
@@ -3308,10 +3308,11 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, · 3307 unmodified lines
33083308 struct ieee80211_local *local = sdata->local;
33093309 struct ieee80211_sub_if_data *sdata_iter;
33103310 enum nl80211_iftype iftype = sdata->wdev.iftype;
3311− int num[NUM_NL80211_IFTYPES];
33123311 struct ieee80211_chanctx *ctx;
3313− int num_different_channels = 0;
33143312 int total = 1;
3313+ struct iface_combination_params params = {
3314+ .radar_detect = radar_detect,
3315+ };
33153316
33163317 lockdep_assert_held(&local->chanctx_mtx);
33173318
@@ -3322,12 +3323,19 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, · 4 unmodified lines
33223323 !chandef->chan))
33233324 return -EINVAL;
33243325
3325− if (chandef)
3326− num_different_channels = 1;
3327−
33283326 if (WARN_ON(iftype >= NUM_NL80211_IFTYPES))
33293327 return -EINVAL;
33303328
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+
33313339 /* Always allow software iftypes */
33323340 if (local->hw.wiphy->software_iftypes & BIT(iftype)) {
33333341 if (radar_detect)
@@ -3335,24 +3343,26 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, · 1 unmodified line
33353343 return 0;
33363344 }
33373345
3338− memset(num, 0, sizeof(num));
3346+ if (chandef)
3347+ params.num_different_channels = 1;
33393348
33403349 if (iftype != NL80211_IFTYPE_UNSPECIFIED)
3341− num[iftype] = 1;
3350+ params.iftype_num[iftype] = 1;
33423351
33433352 list_for_each_entry(ctx, &local->chanctx_list, list) {
33443353 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)
33453354 continue;
3346− radar_detect |= ieee80211_chanctx_radar_detect(local, ctx);
3355+ params.radar_detect |=
3356+ ieee80211_chanctx_radar_detect(local, ctx);
33473357 if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) {
3348− num_different_channels++;
3358+ params.num_different_channels++;
33493359 continue;
33503360 }
33513361 if (chandef && chanmode == IEEE80211_CHANCTX_SHARED &&
33523362 cfg80211_chandef_compatible(chandef,
33533363 &ctx->conf.def))
33543364 continue;
3355− num_different_channels++;
3365+ params.num_different_channels++;
33563366 }
33573367
33583368 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
33653375 local->hw.wiphy->software_iftypes & BIT(wdev_iter->iftype))
33663376 continue;
33673377
3368− num[wdev_iter->iftype]++;
3378+ params.iftype_num[wdev_iter->iftype]++;
33693379 total++;
33703380 }
33713381
3372− if (total == 1 && !radar_detect)
3382+ if (total == 1 && !params.radar_detect)
33733383 return 0;
33743384
3375− return cfg80211_check_combinations(local->hw.wiphy,
3376− num_different_channels,
3377− radar_detect, num);
3385+ return cfg80211_check_combinations(local->hw.wiphy, &params);
33783386 }
33793387
33803388 static void
@@ -3390,12 +3398,10 @@ ieee80211_iter_max_chans(const struct ieee80211_iface_combination *c, · 9 unmodified lines
33903398 int ieee80211_max_num_channels(struct ieee80211_local *local)
33913399 {
33923400 struct ieee80211_sub_if_data *sdata;
3393− int num[NUM_NL80211_IFTYPES] = {};
33943401 struct ieee80211_chanctx *ctx;
3395− int num_different_channels = 0;
3396− u8 radar_detect = 0;
33973402 u32 max_num_different_channels = 1;
33983403 int err;
3404+ struct iface_combination_params params = {0};
33993405
34003406 lockdep_assert_held(&local->chanctx_mtx);
34013407
@@ -3403,17 +3409,17 @@ int ieee80211_max_num_channels(struct ieee80211_local *local) · 1 unmodified line
34033409 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)
34043410 continue;
34053411
3406− num_different_channels++;
3412+ params.num_different_channels++;
34073413
3408− radar_detect |= ieee80211_chanctx_radar_detect(local, ctx);
3414+ params.radar_detect |=
3415+ ieee80211_chanctx_radar_detect(local, ctx);
34093416 }
34103417
34113418 list_for_each_entry_rcu(sdata, &local->interfaces, list)
3412− num[sdata->wdev.iftype]++;
3419+ params.iftype_num[sdata->wdev.iftype]++;
34133420
3414− err = cfg80211_iter_combinations(local->hw.wiphy,
3415− num_different_channels, radar_detect,
3416− num, ieee80211_iter_max_chans,
3421+ err = cfg80211_iter_combinations(local->hw.wiphy, &params,
3422+ ieee80211_iter_max_chans,
34173423 &max_num_different_channels);
34183424 if (err < 0)
34193425 return err;
@@ -3456,3 +3462,10 @@ void ieee80211_txq_get_depth(struct ieee80211_txq *txq, · 36 unmodified lines
34563462 *byte_cnt = txqi->tin.backlog_bytes + frag_bytes;
34573463 }
34583464 EXPORT_SYMBOL(ieee80211_txq_get_depth);
3465+
3466+const 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
236236 {
237237 struct ieee80211_hdr *hdr = (void *)skb->data;
238238 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
239+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
240+ u8 flags;
239241 u8 *p;
240− u8 ack_policy, tid;
241242
242243 if (!ieee80211_is_data_qos(hdr->frame_control))
243244 return;
244245
245246 p = ieee80211_get_qos_ctl(hdr);
246− tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
247247
248− /* preserve EOSP bit */
249− ack_policy = *p & IEEE80211_QOS_CTL_EOSP;
248+ /* set up the first byte */
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);
250256
251257 if (is_multicast_ether_addr(hdr->addr1) ||
252258 sdata->noack_map & BIT(tid)) {
253− ack_policy |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK;
259+ flags |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK;
254260 info->flags |= IEEE80211_TX_CTL_NO_ACK;
255261 }
256262
257− /* qos header is 2 bytes */
258− *p++ = ack_policy | tid;
263+ *p = flags | tid;
264+
265+ /* set up the second byte */
266+ p++;
267+
259268 if (ieee80211_vif_is_mesh(&sdata->vif)) {
260269 /* preserve RSPI and Mesh PS Level bit */
261270 *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
5757
5858 if (info->control.hw_key &&
5959 (info->flags & IEEE80211_TX_CTL_DONTFRAG ||
60− tx->local->ops->set_frag_threshold) &&
60+ ieee80211_hw_check(&tx->local->hw, SUPPORTS_TX_FRAG)) &&
6161 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) {
6262 /* hwaccel - with no need for SW-generated MMIC */
6363 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
210210 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_P2P_DEVICE))
211211 return;
212212
213− if (!wdev->p2p_started)
213+ if (!wdev_running(wdev))
214214 return;
215215
216216 rdev_stop_p2p_device(rdev, wdev);
217− wdev->p2p_started = false;
217+ wdev->is_running = false;
218218
219219 rdev->opencount--;
220220
@@ -233,11 +233,11 @@ void cfg80211_stop_nan(struct cfg80211_registered_device *rdev, · 12 unmodified lines
233233 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_NAN))
234234 return;
235235
236− if (!wdev->nan_started)
236+ if (!wdev_running(wdev))
237237 return;
238238
239239 rdev_stop_nan(rdev, wdev);
240− wdev->nan_started = false;
240+ wdev->is_running = false;
241241
242242 rdev->opencount--;
243243 }
@@ -562,6 +562,21 @@ static int wiphy_verify_combinations(struct wiphy *wiphy) · 318 unmodified lines
562562 c->limits[j].max > 1))
563563 return -EINVAL;
564564
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+
565580 cnt += c->limits[j].max;
566581 /*
567582 * Don't advertise an unsupported type
@@ -571,6 +586,11 @@ static int wiphy_verify_combinations(struct wiphy *wiphy) · 3 unmodified lines
571586 return -EINVAL;
572587 }
573588
589+#ifndef CONFIG_WIRELESS_WDS
590+ if (WARN_ON(all_iftypes & BIT(NL80211_IFTYPE_WDS)))
591+ return -EINVAL;
592+#endif
593+
574594 /* You can't even choose that many! */
575595 if (WARN_ON(cnt < c->max_interfaces))
576596 return -EINVAL;
@@ -609,6 +629,11 @@ int wiphy_register(struct wiphy *wiphy) · 32 unmodified lines
609629 !rdev->ops->add_nan_func || !rdev->ops->del_nan_func)))
610630 return -EINVAL;
611631
632+#ifndef CONFIG_WIRELESS_WDS
633+ if (WARN_ON(wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS)))
634+ return -EINVAL;
635+#endif
636+
612637 /*
613638 * if a wiphy has unsupported modes for regulatory channel enforcement,
614639 * 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
345345 const u8 *ssid, int ssid_len,
346346 const u8 *ie, int ie_len,
347347 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);
349349 int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
350350 struct net_device *dev,
351351 struct ieee80211_channel *chan,
@@ -475,7 +475,7 @@ int ieee80211_get_ratemask(struct ieee80211_supported_band *sband, · 123 unmodified lines
475475 u32 *mask);
476476
477477 int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
478− u32 beacon_int);
478+ enum nl80211_iftype iftype, u32 beacon_int);
479479
480480 void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,
481481 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
183183 memcpy(wdev->ssid, setup->mesh_id, setup->mesh_id_len);
184184 wdev->mesh_id_len = setup->mesh_id_len;
185185 wdev->chandef = setup->chandef;
186+ wdev->beacon_interval = setup->beacon_interval;
186187 }
187188
188189 return err;
@@ -258,6 +259,7 @@ int __cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, · 69 unmodified lines
258259 err = rdev_leave_mesh(rdev, dev);
259260 if (!err) {
260261 wdev->mesh_id_len = 0;
262+ wdev->beacon_interval = 0;
261263 memset(&wdev->chandef, 0, sizeof(wdev->chandef));
262264 rdev_set_qos_map(rdev, dev, NULL);
263265 }
net/wireless/mlme.c+3−3
@@ -204,14 +204,14 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev, · 203 unmodified lines
204204 const u8 *ssid, int ssid_len,
205205 const u8 *ie, int ie_len,
206206 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)
208208 {
209209 struct wireless_dev *wdev = dev->ieee80211_ptr;
210210 struct cfg80211_auth_request req = {
211211 .ie = ie,
212212 .ie_len = ie_len,
213− .sae_data = sae_data,
214− .sae_data_len = sae_data_len,
213+ .auth_data = auth_data,
214+ .auth_data_len = auth_data_len,
215215 .auth_type = auth_type,
216216 .key = key,
217217 .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
343343 [NL80211_ATTR_BG_SCAN_PERIOD] = { .type = NLA_U16 },
344344 [NL80211_ATTR_WDEV] = { .type = NLA_U64 },
345345 [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, },
347347 [NL80211_ATTR_VHT_CAPABILITY] = { .len = NL80211_VHT_CAPABILITY_LEN },
348348 [NL80211_ATTR_SCAN_FLAGS] = { .type = NLA_U32 },
349349 [NL80211_ATTR_P2P_CTWINDOW] = { .type = NLA_U8 },
@@ -400,6 +400,10 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 50 unmodified lines
400400 [NL80211_ATTR_NAN_MASTER_PREF] = { .type = NLA_U8 },
401401 [NL80211_ATTR_NAN_DUAL] = { .type = NLA_U8 },
402402 [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, },
403407 };
404408
405409 /* policy for the key attributes */
@@ -421,6 +425,7 @@ nl80211_key_default_policy[NUM_NL80211_KEY_DEFAULT_TYPES] = { · 15 unmodified lines
421425 [NL80211_KEY_DEFAULT_TYPE_MULTICAST] = { .type = NLA_FLAG },
422426 };
423427
428+#ifdef CONFIG_PM
424429 /* policy for WoWLAN attributes */
425430 static const struct nla_policy
426431 nl80211_wowlan_policy[NUM_NL80211_WOWLAN_TRIG] = {
@@ -454,6 +459,7 @@ nl80211_wowlan_tcp_policy[NUM_NL80211_WOWLAN_TCP] = { · 27 unmodified lines
454459 [NL80211_WOWLAN_TCP_WAKE_PAYLOAD] = { .len = 1 },
455460 [NL80211_WOWLAN_TCP_WAKE_MASK] = { .len = 1 },
456461 };
462+#endif /* CONFIG_PM */
457463
458464 /* policy for coalesce rule attributes */
459465 static const struct nla_policy
@@ -1062,6 +1068,10 @@ static int nl80211_put_iface_combinations(struct wiphy *wiphy, · 602 unmodified lines
10621068 nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,
10631069 c->radar_detect_regions)))
10641070 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;
10651075
10661076 nla_nest_end(msg, nl_combi);
10671077 }
@@ -1309,6 +1319,95 @@ nl80211_send_mgmt_stypes(struct sk_buff *msg, · 241 unmodified lines
13091319 return 0;
13101320 }
13111321
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+
1331+static 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+
13121411 struct nl80211_dump_wiphy_state {
13131412 s64 filter_wiphy;
13141413 long start;
@@ -1536,68 +1635,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, · 221 unmodified lines
15361635 if (!nl_cmds)
15371636 goto nla_put_failure;
15381637
1539− i = 0;
1540−#define CMD(op, n) \
1541− do { \
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
1638+ i = nl80211_add_commands_unsplit(rdev, msg);
1639+ if (i < 0)
1640+ goto nla_put_failure;
16011641 if (state->split) {
16021642 CMD(crit_proto_start, CRIT_PROTOCOL_START);
16031643 CMD(crit_proto_stop, CRIT_PROTOCOL_STOP);
@@ -1607,22 +1647,11 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, · 3 unmodified lines
16071647 if (rdev->wiphy.features &
16081648 NL80211_FEATURE_SUPPORTS_WMM_ADMISSION)
16091649 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);
16101652 }
1611− /* add into the if now */
16121653 #undef CMD
16131654
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−
16261655 nla_nest_end(msg, nl_cmds);
16271656 state->split_start++;
16281657 if (state->split)
@@ -2283,10 +2312,9 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) · 654 unmodified lines
22832312 nla_for_each_nested(nl_txq_params,
22842313 info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS],
22852314 rem_txq_params) {
2286− result = nla_parse(tb, NL80211_TXQ_ATTR_MAX,
2287− nla_data(nl_txq_params),
2288− nla_len(nl_txq_params),
2289− txq_params_policy);
2315+ result = nla_parse_nested(tb, NL80211_TXQ_ATTR_MAX,
2316+ nl_txq_params,
2317+ txq_params_policy);
22902318 if (result)
22912319 return result;
22922320 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
35363564 sband = rdev->wiphy.bands[band];
35373565 if (sband == NULL)
35383566 return -EINVAL;
3539− err = nla_parse(tb, NL80211_TXRATE_MAX, nla_data(tx_rates),
3540− nla_len(tx_rates), nl80211_txattr_policy);
3567+ err = nla_parse_nested(tb, NL80211_TXRATE_MAX, tx_rates,
3568+ nl80211_txattr_policy);
35413569 if (err)
35423570 return err;
35433571 if (tb[NL80211_TXRATE_LEGACY]) {
@@ -3743,12 +3771,23 @@ static bool nl80211_valid_auth_type(struct cfg80211_registered_device *rdev, · 199 unmodified lines
37433771 if (!(rdev->wiphy.features & NL80211_FEATURE_SAE) &&
37443772 auth_type == NL80211_AUTHTYPE_SAE)
37453773 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;
37463780 return true;
37473781 case NL80211_CMD_CONNECT:
37483782 case NL80211_CMD_START_AP:
37493783 /* SAE not supported yet */
37503784 if (auth_type == NL80211_AUTHTYPE_SAE)
37513785 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;
37523791 return true;
37533792 default:
37543793 return false;
@@ -3790,7 +3829,8 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) · 35 unmodified lines
37903829 params.dtim_period =
37913830 nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]);
37923831
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);
37943834 if (err)
37953835 return err;
37963836
@@ -6292,9 +6332,8 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) · 2495 unmodified lines
62926332
62936333 nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES],
62946334 rem_reg_rules) {
6295− r = nla_parse(tb, NL80211_REG_RULE_ATTR_MAX,
6296− nla_data(nl_reg_rule), nla_len(nl_reg_rule),
6297− reg_rule_policy);
6335+ r = nla_parse_nested(tb, NL80211_REG_RULE_ATTR_MAX,
6336+ nl_reg_rule, reg_rule_policy);
62986337 if (r)
62996338 goto bad_reg;
63006339 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
63616400 if (!nla_ok(nest, nla_len(nest)))
63626401 return -EINVAL;
63636402
6364− err = nla_parse(attr, NL80211_BSS_SELECT_ATTR_MAX, nla_data(nest),
6365− nla_len(nest), nl80211_bss_select_policy);
6403+ err = nla_parse_nested(attr, NL80211_BSS_SELECT_ATTR_MAX, nest,
6404+ nl80211_bss_select_policy);
63666405 if (err)
63676406 return err;
63686407
@@ -6752,9 +6791,8 @@ nl80211_parse_sched_scan_plans(struct wiphy *wiphy, int n_plans, · 383 unmodified lines
67526791 if (WARN_ON(i >= n_plans))
67536792 return -EINVAL;
67546793
6755− err = nla_parse(plan, NL80211_SCHED_SCAN_PLAN_MAX,
6756− nla_data(attr), nla_len(attr),
6757− nl80211_plan_policy);
6794+ err = nla_parse_nested(plan, NL80211_SCHED_SCAN_PLAN_MAX,
6795+ attr, nl80211_plan_policy);
67586796 if (err)
67596797 return err;
67606798
@@ -6843,9 +6881,9 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, · 82 unmodified lines
68436881 tmp) {
68446882 struct nlattr *rssi;
68456883
6846− err = nla_parse(tb, NL80211_SCHED_SCAN_MATCH_ATTR_MAX,
6847− nla_data(attr), nla_len(attr),
6848− nl80211_match_policy);
6884+ err = nla_parse_nested(tb,
6885+ NL80211_SCHED_SCAN_MATCH_ATTR_MAX,
6886+ attr, nl80211_match_policy);
68496887 if (err)
68506888 return ERR_PTR(err);
68516889 /* add other standalone attributes here */
@@ -7016,9 +7054,9 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, · 164 unmodified lines
70167054 tmp) {
70177055 struct nlattr *ssid, *rssi;
70187056
7019− err = nla_parse(tb, NL80211_SCHED_SCAN_MATCH_ATTR_MAX,
7020− nla_data(attr), nla_len(attr),
7021− nl80211_match_policy);
7057+ err = nla_parse_nested(tb,
7058+ NL80211_SCHED_SCAN_MATCH_ATTR_MAX,
7059+ attr, nl80211_match_policy);
70227060 if (err)
70237061 goto out_free;
70247062 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
76967734 struct cfg80211_registered_device *rdev = info->user_ptr[0];
76977735 struct net_device *dev = info->user_ptr[1];
76987736 struct ieee80211_channel *chan;
7699− const u8 *bssid, *ssid, *ie = NULL, *sae_data = NULL;
7700− int err, ssid_len, ie_len = 0, sae_data_len = 0;
7737+ const u8 *bssid, *ssid, *ie = NULL, *auth_data = NULL;
7738+ int err, ssid_len, ie_len = 0, auth_data_len = 0;
77017739 enum nl80211_auth_type auth_type;
77027740 struct key_parse key;
77037741 bool local_state_change;
@@ -7777,17 +7815,23 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) · 73 unmodified lines
77777815 if (!nl80211_valid_auth_type(rdev, auth_type, NL80211_CMD_AUTHENTICATE))
77787816 return -EINVAL;
77797817
7780− if (auth_type == NL80211_AUTHTYPE_SAE &&
7781− !info->attrs[NL80211_ATTR_SAE_DATA])
7818+ if ((auth_type == NL80211_AUTHTYPE_SAE ||
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])
77827823 return -EINVAL;
77837824
7784− if (info->attrs[NL80211_ATTR_SAE_DATA]) {
7785− if (auth_type != NL80211_AUTHTYPE_SAE)
7825+ if (info->attrs[NL80211_ATTR_AUTH_DATA]) {
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)
77867830 return -EINVAL;
7787− sae_data = nla_data(info->attrs[NL80211_ATTR_SAE_DATA]);
7788− sae_data_len = nla_len(info->attrs[NL80211_ATTR_SAE_DATA]);
7831+ auth_data = nla_data(info->attrs[NL80211_ATTR_AUTH_DATA]);
7832+ auth_data_len = nla_len(info->attrs[NL80211_ATTR_AUTH_DATA]);
77897833 /* need to include at least Auth Transaction and Status Code */
7790− if (sae_data_len < 4)
7834+ if (auth_data_len < 4)
77917835 return -EINVAL;
77927836 }
77937837
@@ -7804,7 +7848,7 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) · 10 unmodified lines
78047848 err = cfg80211_mlme_auth(rdev, dev, chan, auth_type, bssid,
78057849 ssid, ssid_len, ie, ie_len,
78067850 key.p.key, key.p.key_len, key.idx,
7807− sae_data, sae_data_len);
7851+ auth_data, auth_data_len);
78087852 wdev_unlock(dev->ieee80211_ptr);
78097853 return err;
78107854 }
@@ -7983,6 +8027,15 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info) · 172 unmodified lines
79838027 req.flags |= ASSOC_REQ_USE_RRM;
79848028 }
79858029
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+
79868039 err = nl80211_crypto_settings(rdev, info, &req.crypto, 1);
79878040 if (!err) {
79888041 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
81408193 ibss.beacon_interval =
81418194 nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
81428195
8143− err = cfg80211_validate_beacon_int(rdev, ibss.beacon_interval);
8196+ err = cfg80211_validate_beacon_int(rdev, NL80211_IFTYPE_ADHOC,
8197+ ibss.beacon_interval);
81448198 if (err)
81458199 return err;
81468200
@@ -8713,6 +8767,37 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) · 566 unmodified lines
87138767 return err;
87148768 }
87158769
8770+static 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+
87168801 static int nl80211_disconnect(struct sk_buff *skb, struct genl_info *info)
87178802 {
87188803 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
94049489 setup.beacon_interval =
94059490 nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
94069491
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);
94089495 if (err)
94099496 return err;
94109497 }
@@ -9715,9 +9802,8 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev, · 304 unmodified lines
97159802 if (!rdev->wiphy.wowlan->tcp)
97169803 return -EINVAL;
97179804
9718− err = nla_parse(tb, MAX_NL80211_WOWLAN_TCP,
9719− nla_data(attr), nla_len(attr),
9720− nl80211_wowlan_tcp_policy);
9805+ err = nla_parse_nested(tb, MAX_NL80211_WOWLAN_TCP, attr,
9806+ nl80211_wowlan_tcp_policy);
97219807 if (err)
97229808 return err;
97239809
@@ -9862,9 +9948,7 @@ static int nl80211_parse_wowlan_nd(struct cfg80211_registered_device *rdev, · 138 unmodified lines
98629948 goto out;
98639949 }
98649950
9865− err = nla_parse(tb, NL80211_ATTR_MAX,
9866− nla_data(attr), nla_len(attr),
9867− nl80211_policy);
9951+ err = nla_parse_nested(tb, NL80211_ATTR_MAX, attr, nl80211_policy);
98689952 if (err)
98699953 goto out;
98709954
@@ -9898,10 +9982,9 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info) · 27 unmodified lines
98989982 goto set_wakeup;
98999983 }
99009984
9901− err = nla_parse(tb, MAX_NL80211_WOWLAN_TRIG,
9902− nla_data(info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]),
9903− nla_len(info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]),
9904− nl80211_wowlan_policy);
9985+ err = nla_parse_nested(tb, MAX_NL80211_WOWLAN_TRIG,
9986+ info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS],
9987+ nl80211_wowlan_policy);
99059988 if (err)
99069989 return err;
99079990
@@ -9983,8 +10066,8 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info) · 75 unmodified lines
998310066 rem) {
998410067 u8 *mask_pat;
998510068
9986− nla_parse(pat_tb, MAX_NL80211_PKTPAT, nla_data(pat),
9987− nla_len(pat), NULL);
10069+ nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat,
10070+ NULL);
998810071 err = -EINVAL;
998910072 if (!pat_tb[NL80211_PKTPAT_MASK] ||
999010073 !pat_tb[NL80211_PKTPAT_PATTERN])
@@ -10194,8 +10277,8 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev, · 203 unmodified lines
1019410277 int rem, pat_len, mask_len, pkt_offset, n_patterns = 0;
1019510278 struct nlattr *pat_tb[NUM_NL80211_PKTPAT];
1019610279
10197− err = nla_parse(tb, NL80211_ATTR_COALESCE_RULE_MAX, nla_data(rule),
10198− nla_len(rule), nl80211_coalesce_policy);
10280+ err = nla_parse_nested(tb, NL80211_ATTR_COALESCE_RULE_MAX, rule,
10281+ nl80211_coalesce_policy);
1019910282 if (err)
1020010283 return err;
1020110284
@@ -10233,8 +10316,7 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev, · 31 unmodified lines
1023310316 rem) {
1023410317 u8 *mask_pat;
1023510318
10236− nla_parse(pat_tb, MAX_NL80211_PKTPAT, nla_data(pat),
10237− nla_len(pat), NULL);
10319+ nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat, NULL);
1023810320 if (!pat_tb[NL80211_PKTPAT_MASK] ||
1023910321 !pat_tb[NL80211_PKTPAT_PATTERN])
1024010322 return -EINVAL;
@@ -10353,10 +10435,9 @@ static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info) · 112 unmodified lines
1035310435 if (!info->attrs[NL80211_ATTR_REKEY_DATA])
1035410436 return -EINVAL;
1035510437
10356− err = nla_parse(tb, MAX_NL80211_REKEY_DATA,
10357− nla_data(info->attrs[NL80211_ATTR_REKEY_DATA]),
10358− nla_len(info->attrs[NL80211_ATTR_REKEY_DATA]),
10359− nl80211_rekey_policy);
10438+ err = nla_parse_nested(tb, MAX_NL80211_REKEY_DATA,
10439+ info->attrs[NL80211_ATTR_REKEY_DATA],
10440+ nl80211_rekey_policy);
1036010441 if (err)
1036110442 return err;
1036210443
@@ -10505,7 +10586,7 @@ static int nl80211_start_p2p_device(struct sk_buff *skb, struct genl_info *info) · 142 unmodified lines
1050510586 if (wdev->iftype != NL80211_IFTYPE_P2P_DEVICE)
1050610587 return -EOPNOTSUPP;
1050710588
10508− if (wdev->p2p_started)
10589+ if (wdev_running(wdev))
1050910590 return 0;
1051010591
1051110592 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
1051510596 if (err)
1051610597 return err;
1051710598
10518− wdev->p2p_started = true;
10599+ wdev->is_running = true;
1051910600 rdev->opencount++;
1052010601
1052110602 return 0;
@@ -10547,7 +10628,7 @@ static int nl80211_start_nan(struct sk_buff *skb, struct genl_info *info) · 25 unmodified lines
1054710628 if (wdev->iftype != NL80211_IFTYPE_NAN)
1054810629 return -EOPNOTSUPP;
1054910630
10550− if (wdev->nan_started)
10631+ if (!wdev_running(wdev))
1055110632 return -EEXIST;
1055210633
1055310634 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
1057010651 if (err)
1057110652 return err;
1057210653
10573− wdev->nan_started = true;
10654+ wdev->is_running = true;
1057410655 rdev->opencount++;
1057510656
1057610657 return 0;
@@ -10654,7 +10735,7 @@ static int nl80211_nan_add_func(struct sk_buff *skb, · 77 unmodified lines
1065410735 if (wdev->iftype != NL80211_IFTYPE_NAN)
1065510736 return -EOPNOTSUPP;
1065610737
10657− if (!wdev->nan_started)
10738+ if (!wdev_running(wdev))
1065810739 return -ENOTCONN;
1065910740
1066010741 if (!info->attrs[NL80211_ATTR_NAN_FUNC])
@@ -10664,10 +10745,9 @@ static int nl80211_nan_add_func(struct sk_buff *skb, · 3 unmodified lines
1066410745 wdev->owner_nlportid != info->snd_portid)
1066510746 return -ENOTCONN;
1066610747
10667− err = nla_parse(tb, NL80211_NAN_FUNC_ATTR_MAX,
10668− nla_data(info->attrs[NL80211_ATTR_NAN_FUNC]),
10669− nla_len(info->attrs[NL80211_ATTR_NAN_FUNC]),
10670− nl80211_nan_func_policy);
10748+ err = nla_parse_nested(tb, NL80211_NAN_FUNC_ATTR_MAX,
10749+ info->attrs[NL80211_ATTR_NAN_FUNC],
10750+ nl80211_nan_func_policy);
1067110751 if (err)
1067210752 return err;
1067310753
@@ -10762,9 +10842,9 @@ static int nl80211_nan_add_func(struct sk_buff *skb, · 88 unmodified lines
1076210842 if (tb[NL80211_NAN_FUNC_SRF]) {
1076310843 struct nlattr *srf_tb[NUM_NL80211_NAN_SRF_ATTR];
1076410844
10765− err = nla_parse(srf_tb, NL80211_NAN_SRF_ATTR_MAX,
10766− nla_data(tb[NL80211_NAN_FUNC_SRF]),
10767− nla_len(tb[NL80211_NAN_FUNC_SRF]), NULL);
10845+ err = nla_parse_nested(srf_tb, NL80211_NAN_SRF_ATTR_MAX,
10846+ tb[NL80211_NAN_FUNC_SRF],
10847+ nl80211_nan_srf_policy);
1076810848 if (err)
1076910849 goto out;
1077010850
@@ -10890,7 +10970,7 @@ static int nl80211_nan_del_func(struct sk_buff *skb, · 119 unmodified lines
1089010970 if (wdev->iftype != NL80211_IFTYPE_NAN)
1089110971 return -EOPNOTSUPP;
1089210972
10893− if (!wdev->nan_started)
10973+ if (!wdev_running(wdev))
1089410974 return -ENOTCONN;
1089510975
1089610976 if (!info->attrs[NL80211_ATTR_COOKIE])
@@ -10918,7 +10998,7 @@ static int nl80211_nan_change_config(struct sk_buff *skb, · 21 unmodified lines
1091810998 if (wdev->iftype != NL80211_IFTYPE_NAN)
1091910999 return -EOPNOTSUPP;
1092011000
10921− if (!wdev->nan_started)
11001+ if (!wdev_running(wdev))
1092211002 return -ENOTCONN;
1092311003
1092411004 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
1123011310 return -EINVAL;
1123111311
1123211312 if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_RUNNING) {
11233− if (wdev->netdev &&
11234− !netif_running(wdev->netdev))
11235− return -ENETDOWN;
11236− if (!wdev->netdev && !wdev->p2p_started)
11313+ if (!wdev_running(wdev))
1123711314 return -ENETDOWN;
1123811315 }
1123911316
@@ -11394,10 +11471,7 @@ static int nl80211_vendor_cmd_dump(struct sk_buff *skb, · 154 unmodified lines
1139411471 return -EINVAL;
1139511472
1139611473 if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_RUNNING) {
11397− if (wdev->netdev &&
11398− !netif_running(wdev->netdev))
11399− return -ENETDOWN;
11400− if (!wdev->netdev && !wdev->p2p_started)
11474+ if (!wdev_running(wdev))
1140111475 return -ENETDOWN;
1140211476 }
1140311477 }
@@ -11710,6 +11784,31 @@ static int nl80211_tdls_cancel_channel_switch(struct sk_buff *skb, · 306 unmodified lines
1171011784 return 0;
1171111785 }
1171211786
11787+static 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+
1171311812 #define NL80211_FLAG_NEED_WIPHY 0x01
1171411813 #define NL80211_FLAG_NEED_NETDEV 0x02
1171511814 #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
1176811867 info->user_ptr[1] = wdev;
1176911868 }
1177011869
11771− if (dev) {
11772− if (ops->internal_flags & NL80211_FLAG_CHECK_NETDEV_UP &&
11773− !netif_running(dev)) {
11774− if (rtnl)
11775− rtnl_unlock();
11776− return -ENETDOWN;
11777− }
11870+ if (ops->internal_flags & NL80211_FLAG_CHECK_NETDEV_UP &&
11871+ !wdev_running(wdev)) {
11872+ if (rtnl)
11873+ rtnl_unlock();
11874+ return -ENETDOWN;
11875+ }
1177811876
11877+ if (dev)
1177911878 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− }
1179411879
1179511880 info->user_ptr[0] = rdev;
1179611881 }
@@ -12162,6 +12247,14 @@ static const struct genl_ops nl80211_ops[] = { · 365 unmodified lines
1216212247 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
1216312248 NL80211_FLAG_NEED_RTNL,
1216412249 },
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+ },
1216512258 {
1216612259 .cmd = NL80211_CMD_DISCONNECT,
1216712260 .doit = nl80211_disconnect,
@@ -12583,6 +12676,14 @@ static const struct genl_ops nl80211_ops[] = { · 415 unmodified lines
1258312676 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
1258412677 NL80211_FLAG_NEED_RTNL,
1258512678 },
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+ },
1258612687 };
1258712688
1258812689 static 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
490490 return ret;
491491 }
492492
493+static inline int
494+rdev_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+
493505 static inline int rdev_disconnect(struct cfg80211_registered_device *rdev,
494506 struct net_device *dev, u16 reason_code)
495507 {
@@ -562,6 +574,18 @@ static inline int rdev_set_wds_peer(struct cfg80211_registered_device *rdev, · 66 unmodified lines
562574 return ret;
563575 }
564576
577+static inline int
578+rdev_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+
565589 static inline void rdev_rfkill_poll(struct cfg80211_registered_device *rdev)
566590 {
567591 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
10881088 err = cfg80211_sme_disconnect(wdev, reason);
10891089 else if (!rdev->ops->disconnect)
10901090 cfg80211_mlme_down(rdev, dev);
1091− else if (wdev->current_bss)
1091+ else if (wdev->ssid_len)
10921092 err = rdev_disconnect(rdev, dev, reason);
10931093
10941094 return err;
net/wireless/trace.h+37−0
@@ -1281,6 +1281,24 @@ TRACE_EVENT(rdev_connect, · 1280 unmodified lines
12811281 __entry->wpa_versions, __entry->flags, MAC_PR_ARG(prev_bssid))
12821282 );
12831283
1284+TRACE_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+
12841302 TRACE_EVENT(rdev_set_cqm_rssi_config,
12851303 TP_PROTO(struct wiphy *wiphy,
12861304 struct net_device *netdev, s32 rssi_thold,
@@ -3030,6 +3048,25 @@ DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan, · 1743 unmodified lines
30303048 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
30313049 TP_ARGS(wiphy, wdev)
30323050 );
3051+
3052+TRACE_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+);
30333070 #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
30343071
30353072 #undef TRACE_INCLUDE_PATH
net/wireless/util.c+96−29
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <net/dsfield.h>
1414 #include <linux/if_vlan.h>
1515 #include <linux/mpls.h>
16+#include <linux/gcd.h>
1617 #include "core.h"
1718 #include "rdev-ops.h"
1819
@@ -1381,6 +1382,25 @@ static bool ieee80211_id_in_list(const u8 *ids, int n_ids, u8 id) · 1362 unmodified lines
13811382 return false;
13821383 }
13831384
1385+static 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+
13841404 size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
13851405 const u8 *ids, int n_ids,
13861406 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
13901410
13911411 while (pos < ielen && ieee80211_id_in_list(ids, n_ids, ies[pos])) {
13921412 if (ies[pos] == WLAN_EID_RIC_DATA && n_after_ric) {
1393− pos += 2 + ies[pos + 1];
1413+ pos = skip_ie(ies, ielen, pos);
13941414
13951415 while (pos < ielen &&
13961416 !ieee80211_id_in_list(after_ric, n_after_ric,
13971417 ies[pos]))
1398− pos += 2 + ies[pos + 1];
1418+ pos = skip_ie(ies, ielen, pos);
13991419 } else {
1400− pos += 2 + ies[pos + 1];
1420+ pos = skip_ie(ies, ielen, pos);
14011421 }
14021422 }
14031423
@@ -1558,31 +1578,57 @@ bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef, · 154 unmodified lines
15581578 }
15591579 EXPORT_SYMBOL(ieee80211_chandef_to_operating_class);
15601580
1561−int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
1562− u32 beacon_int)
1581+static void cfg80211_calculate_bi_data(struct wiphy *wiphy, u32 new_beacon_int,
1582+ u32 *beacon_int_gcd,
1583+ bool *beacon_int_different)
15631584 {
15641585 struct wireless_dev *wdev;
1565− int res = 0;
15661586
1567− if (beacon_int < 10 || beacon_int > 10000)
1568− return -EINVAL;
1587+ *beacon_int_gcd = 0;
1588+ *beacon_int_different = false;
15691589
1570− list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
1590+ list_for_each_entry(wdev, &wiphy->wdev_list, list) {
15711591 if (!wdev->beacon_interval)
15721592 continue;
1573− if (wdev->beacon_interval != beacon_int) {
1574− res = -EINVAL;
1575− break;
1593+
1594+ if (!*beacon_int_gcd) {
1595+ *beacon_int_gcd = wdev->beacon_interval;
1596+ continue;
15761597 }
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);
15771604 }
15781605
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+
1613+int 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;
15801628 }
15811629
15821630 int cfg80211_iter_combinations(struct wiphy *wiphy,
1583− const int num_different_channels,
1584− const u8 radar_detect,
1585− const int iftype_num[NUM_NL80211_IFTYPES],
1631+ struct iface_combination_params *params,
15861632 void (*iter)(const struct ieee80211_iface_combination *c,
15871633 void *data),
15881634 void *data)
@@ -1592,8 +1638,23 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, · 3 unmodified lines
15921638 int i, j, iftype;
15931639 int num_interfaces = 0;
15941640 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);
15951656
1596− if (radar_detect) {
1657+ if (params->radar_detect) {
15971658 rcu_read_lock();
15981659 regdom = rcu_dereference(cfg80211_regdomain);
15991660 if (regdom)
@@ -1602,8 +1663,8 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, · 2 unmodified lines
16021663 }
16031664
16041665 for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) {
1605− num_interfaces += iftype_num[iftype];
1606− if (iftype_num[iftype] > 0 &&
1666+ num_interfaces += params->iftype_num[iftype];
1667+ if (params->iftype_num[iftype] > 0 &&
16071668 !(wiphy->software_iftypes & BIT(iftype)))
16081669 used_iftypes |= BIT(iftype);
16091670 }
@@ -1617,7 +1678,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, · 7 unmodified lines
16171678
16181679 if (num_interfaces > c->max_interfaces)
16191680 continue;
1620− if (num_different_channels > c->num_different_channels)
1681+ if (params->num_different_channels > c->num_different_channels)
16211682 continue;
16221683
16231684 limits = kmemdup(c->limits, sizeof(limits[0]) * c->n_limits,
@@ -1632,16 +1693,17 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, · 8 unmodified lines
16321693 all_iftypes |= limits[j].types;
16331694 if (!(limits[j].types & BIT(iftype)))
16341695 continue;
1635− if (limits[j].max < iftype_num[iftype])
1696+ if (limits[j].max < params->iftype_num[iftype])
16361697 goto cont;
1637− limits[j].max -= iftype_num[iftype];
1698+ limits[j].max -= params->iftype_num[iftype];
16381699 }
16391700 }
16401701
1641− if (radar_detect != (c->radar_detect_widths & radar_detect))
1702+ if (params->radar_detect !=
1703+ (c->radar_detect_widths & params->radar_detect))
16421704 goto cont;
16431705
1644− if (radar_detect && c->radar_detect_regions &&
1706+ if (params->radar_detect && c->radar_detect_regions &&
16451707 !(c->radar_detect_regions & BIT(region)))
16461708 goto cont;
16471709
@@ -1653,6 +1715,14 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, · 5 unmodified lines
16531715 if ((all_iftypes & used_iftypes) != used_iftypes)
16541716 goto cont;
16551717
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+
16561726 /* This combination covered all interface types and
16571727 * supported the requested numbers, so we're good.
16581728 */
@@ -1675,14 +1745,11 @@ cfg80211_iter_sum_ifcombs(const struct ieee80211_iface_combination *c, · 16 unmodified lines
16751745 }
16761746
16771747 int cfg80211_check_combinations(struct wiphy *wiphy,
1678− const int num_different_channels,
1679− const u8 radar_detect,
1680− const int iftype_num[NUM_NL80211_IFTYPES])
1748+ struct iface_combination_params *params)
16811749 {
16821750 int err, num = 0;
16831751
1684− err = cfg80211_iter_combinations(wiphy, num_different_channels,
1685− radar_detect, iftype_num,
1752+ err = cfg80211_iter_combinations(wiphy, params,
16861753 cfg80211_iter_sum_ifcombs, &num);
16871754 if (err)
16881755 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