Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'mac80211-next-for-net-next-2020-03-20' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next

Johannes Berg says:

====================
Another set of changes:
* HE ranging (fine timing measurement) API support
* hwsim gets virtio support, for use with wmediumd,
to be able to simulate with multiple machines
* eapol-over-nl80211 improvements to exclude preauth
* IBSS reset support, to recover connections from
userspace
* and various others.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+596 -44
+309 -18
drivers/net/wireless/mac80211_hwsim.c
··· 4 4 * Copyright (c) 2008, Jouni Malinen <j@w1.fi> 5 5 * Copyright (c) 2011, Javier Lopez <jlopex@gmail.com> 6 6 * Copyright (c) 2016 - 2017 Intel Deutschland GmbH 7 - * Copyright (C) 2018 Intel Corporation 7 + * Copyright (C) 2018 - 2020 Intel Corporation 8 8 */ 9 9 10 10 /* ··· 33 33 #include <net/netns/generic.h> 34 34 #include <linux/rhashtable.h> 35 35 #include <linux/nospec.h> 36 + #include <linux/virtio.h> 37 + #include <linux/virtio_ids.h> 38 + #include <linux/virtio_config.h> 36 39 #include "mac80211_hwsim.h" 37 40 38 41 #define WARN_QUEUE 100 ··· 616 613 /* MAC80211_HWSIM netlink policy */ 617 614 618 615 static const struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = { 619 - [HWSIM_ATTR_ADDR_RECEIVER] = { .type = NLA_UNSPEC, .len = ETH_ALEN }, 620 - [HWSIM_ATTR_ADDR_TRANSMITTER] = { .type = NLA_UNSPEC, .len = ETH_ALEN }, 616 + [HWSIM_ATTR_ADDR_RECEIVER] = NLA_POLICY_ETH_ADDR_COMPAT, 617 + [HWSIM_ATTR_ADDR_TRANSMITTER] = NLA_POLICY_ETH_ADDR_COMPAT, 621 618 [HWSIM_ATTR_FRAME] = { .type = NLA_BINARY, 622 619 .len = IEEE80211_MAX_DATA_LEN }, 623 620 [HWSIM_ATTR_FLAGS] = { .type = NLA_U32 }, 624 621 [HWSIM_ATTR_RX_RATE] = { .type = NLA_U32 }, 625 622 [HWSIM_ATTR_SIGNAL] = { .type = NLA_U32 }, 626 - [HWSIM_ATTR_TX_INFO] = { .type = NLA_UNSPEC, 623 + [HWSIM_ATTR_TX_INFO] = { .type = NLA_BINARY, 627 624 .len = IEEE80211_TX_MAX_RATES * 628 625 sizeof(struct hwsim_tx_rate)}, 629 626 [HWSIM_ATTR_COOKIE] = { .type = NLA_U64 }, ··· 633 630 [HWSIM_ATTR_REG_CUSTOM_REG] = { .type = NLA_U32 }, 634 631 [HWSIM_ATTR_REG_STRICT_REG] = { .type = NLA_FLAG }, 635 632 [HWSIM_ATTR_SUPPORT_P2P_DEVICE] = { .type = NLA_FLAG }, 633 + [HWSIM_ATTR_USE_CHANCTX] = { .type = NLA_FLAG }, 636 634 [HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE] = { .type = NLA_FLAG }, 637 635 [HWSIM_ATTR_RADIO_NAME] = { .type = NLA_STRING }, 638 636 [HWSIM_ATTR_NO_VIF] = { .type = NLA_FLAG }, 639 637 [HWSIM_ATTR_FREQ] = { .type = NLA_U32 }, 640 - [HWSIM_ATTR_PERM_ADDR] = { .type = NLA_UNSPEC, .len = ETH_ALEN }, 638 + [HWSIM_ATTR_TX_INFO_FLAGS] = { .type = NLA_BINARY }, 639 + [HWSIM_ATTR_PERM_ADDR] = NLA_POLICY_ETH_ADDR_COMPAT, 641 640 [HWSIM_ATTR_IFTYPE_SUPPORT] = { .type = NLA_U32 }, 642 641 [HWSIM_ATTR_CIPHER_SUPPORT] = { .type = NLA_BINARY }, 643 642 }; 643 + 644 + #if IS_REACHABLE(CONFIG_VIRTIO) 645 + 646 + /* MAC80211_HWSIM virtio queues */ 647 + static struct virtqueue *hwsim_vqs[HWSIM_NUM_VQS]; 648 + static bool hwsim_virtio_enabled; 649 + static spinlock_t hwsim_virtio_lock; 650 + 651 + static void hwsim_virtio_rx_work(struct work_struct *work); 652 + static DECLARE_WORK(hwsim_virtio_rx, hwsim_virtio_rx_work); 653 + 654 + static int hwsim_tx_virtio(struct mac80211_hwsim_data *data, 655 + struct sk_buff *skb) 656 + { 657 + struct scatterlist sg[1]; 658 + unsigned long flags; 659 + int err; 660 + 661 + spin_lock_irqsave(&hwsim_virtio_lock, flags); 662 + if (!hwsim_virtio_enabled) { 663 + err = -ENODEV; 664 + goto out_free; 665 + } 666 + 667 + sg_init_one(sg, skb->head, skb_end_offset(skb)); 668 + err = virtqueue_add_outbuf(hwsim_vqs[HWSIM_VQ_TX], sg, 1, skb, 669 + GFP_ATOMIC); 670 + if (err) 671 + goto out_free; 672 + virtqueue_kick(hwsim_vqs[HWSIM_VQ_TX]); 673 + spin_unlock_irqrestore(&hwsim_virtio_lock, flags); 674 + return 0; 675 + 676 + out_free: 677 + spin_unlock_irqrestore(&hwsim_virtio_lock, flags); 678 + nlmsg_free(skb); 679 + return err; 680 + } 681 + #else 682 + /* cause a linker error if this ends up being needed */ 683 + extern int hwsim_tx_virtio(struct mac80211_hwsim_data *data, 684 + struct sk_buff *skb); 685 + #define hwsim_virtio_enabled false 686 + #endif 644 687 645 688 static void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, 646 689 struct sk_buff *skb, ··· 1187 1138 goto nla_put_failure; 1188 1139 1189 1140 genlmsg_end(skb, msg_head); 1190 - if (hwsim_unicast_netgroup(data, skb, dst_portid)) 1191 - goto err_free_txskb; 1141 + 1142 + if (hwsim_virtio_enabled) { 1143 + if (hwsim_tx_virtio(data, skb)) 1144 + goto err_free_txskb; 1145 + } else { 1146 + if (hwsim_unicast_netgroup(data, skb, dst_portid)) 1147 + goto err_free_txskb; 1148 + } 1192 1149 1193 1150 /* Enqueue the packet */ 1194 1151 skb_queue_tail(&data->pending, my_skb); ··· 1496 1441 /* wmediumd mode check */ 1497 1442 _portid = READ_ONCE(data->wmediumd); 1498 1443 1499 - if (_portid) 1444 + if (_portid || hwsim_virtio_enabled) 1500 1445 return mac80211_hwsim_tx_frame_nl(hw, skb, _portid); 1501 1446 1502 1447 /* NO wmediumd detected, perfect medium simulation */ ··· 1602 1547 1603 1548 mac80211_hwsim_monitor_rx(hw, skb, chan); 1604 1549 1605 - if (_pid) 1550 + if (_pid || hwsim_virtio_enabled) 1606 1551 return mac80211_hwsim_tx_frame_nl(hw, skb, _pid); 1607 1552 1608 1553 mac80211_hwsim_tx_frame_no_nl(hw, skb, chan); ··· 3348 3293 if (!data2) 3349 3294 goto out; 3350 3295 3351 - if (hwsim_net_get_netgroup(genl_info_net(info)) != data2->netgroup) 3352 - goto out; 3296 + if (!hwsim_virtio_enabled) { 3297 + if (hwsim_net_get_netgroup(genl_info_net(info)) != 3298 + data2->netgroup) 3299 + goto out; 3353 3300 3354 - if (info->snd_portid != data2->wmediumd) 3355 - goto out; 3301 + if (info->snd_portid != data2->wmediumd) 3302 + goto out; 3303 + } 3356 3304 3357 3305 /* look for the skb matching the cookie passed back from user */ 3358 3306 skb_queue_walk_safe(&data2->pending, skb, tmp) { ··· 3445 3387 if (!data2) 3446 3388 goto out; 3447 3389 3448 - if (hwsim_net_get_netgroup(genl_info_net(info)) != data2->netgroup) 3449 - goto out; 3390 + if (!hwsim_virtio_enabled) { 3391 + if (hwsim_net_get_netgroup(genl_info_net(info)) != 3392 + data2->netgroup) 3393 + goto out; 3450 3394 3451 - if (info->snd_portid != data2->wmediumd) 3452 - goto out; 3395 + if (info->snd_portid != data2->wmediumd) 3396 + goto out; 3397 + } 3453 3398 3454 3399 /* check if radio is configured properly */ 3455 3400 ··· 3993 3932 genl_unregister_family(&hwsim_genl_family); 3994 3933 } 3995 3934 3935 + #if IS_REACHABLE(CONFIG_VIRTIO) 3936 + static void hwsim_virtio_tx_done(struct virtqueue *vq) 3937 + { 3938 + unsigned int len; 3939 + struct sk_buff *skb; 3940 + unsigned long flags; 3941 + 3942 + spin_lock_irqsave(&hwsim_virtio_lock, flags); 3943 + while ((skb = virtqueue_get_buf(vq, &len))) 3944 + nlmsg_free(skb); 3945 + spin_unlock_irqrestore(&hwsim_virtio_lock, flags); 3946 + } 3947 + 3948 + static int hwsim_virtio_handle_cmd(struct sk_buff *skb) 3949 + { 3950 + struct nlmsghdr *nlh; 3951 + struct genlmsghdr *gnlh; 3952 + struct nlattr *tb[HWSIM_ATTR_MAX + 1]; 3953 + struct genl_info info = {}; 3954 + int err; 3955 + 3956 + nlh = nlmsg_hdr(skb); 3957 + gnlh = nlmsg_data(nlh); 3958 + err = genlmsg_parse(nlh, &hwsim_genl_family, tb, HWSIM_ATTR_MAX, 3959 + hwsim_genl_policy, NULL); 3960 + if (err) { 3961 + pr_err_ratelimited("hwsim: genlmsg_parse returned %d\n", err); 3962 + return err; 3963 + } 3964 + 3965 + info.attrs = tb; 3966 + 3967 + switch (gnlh->cmd) { 3968 + case HWSIM_CMD_FRAME: 3969 + hwsim_cloned_frame_received_nl(skb, &info); 3970 + break; 3971 + case HWSIM_CMD_TX_INFO_FRAME: 3972 + hwsim_tx_info_frame_received_nl(skb, &info); 3973 + break; 3974 + default: 3975 + pr_err_ratelimited("hwsim: invalid cmd: %d\n", gnlh->cmd); 3976 + return -EPROTO; 3977 + } 3978 + return 0; 3979 + } 3980 + 3981 + static void hwsim_virtio_rx_work(struct work_struct *work) 3982 + { 3983 + struct virtqueue *vq; 3984 + unsigned int len; 3985 + struct sk_buff *skb; 3986 + struct scatterlist sg[1]; 3987 + int err; 3988 + unsigned long flags; 3989 + 3990 + spin_lock_irqsave(&hwsim_virtio_lock, flags); 3991 + if (!hwsim_virtio_enabled) 3992 + goto out_unlock; 3993 + 3994 + skb = virtqueue_get_buf(hwsim_vqs[HWSIM_VQ_RX], &len); 3995 + if (!skb) 3996 + goto out_unlock; 3997 + spin_unlock_irqrestore(&hwsim_virtio_lock, flags); 3998 + 3999 + skb->data = skb->head; 4000 + skb_set_tail_pointer(skb, len); 4001 + hwsim_virtio_handle_cmd(skb); 4002 + 4003 + spin_lock_irqsave(&hwsim_virtio_lock, flags); 4004 + if (!hwsim_virtio_enabled) { 4005 + nlmsg_free(skb); 4006 + goto out_unlock; 4007 + } 4008 + vq = hwsim_vqs[HWSIM_VQ_RX]; 4009 + sg_init_one(sg, skb->head, skb_end_offset(skb)); 4010 + err = virtqueue_add_inbuf(vq, sg, 1, skb, GFP_KERNEL); 4011 + if (WARN(err, "virtqueue_add_inbuf returned %d\n", err)) 4012 + nlmsg_free(skb); 4013 + else 4014 + virtqueue_kick(vq); 4015 + schedule_work(&hwsim_virtio_rx); 4016 + 4017 + out_unlock: 4018 + spin_unlock_irqrestore(&hwsim_virtio_lock, flags); 4019 + } 4020 + 4021 + static void hwsim_virtio_rx_done(struct virtqueue *vq) 4022 + { 4023 + schedule_work(&hwsim_virtio_rx); 4024 + } 4025 + 4026 + static int init_vqs(struct virtio_device *vdev) 4027 + { 4028 + vq_callback_t *callbacks[HWSIM_NUM_VQS] = { 4029 + [HWSIM_VQ_TX] = hwsim_virtio_tx_done, 4030 + [HWSIM_VQ_RX] = hwsim_virtio_rx_done, 4031 + }; 4032 + const char *names[HWSIM_NUM_VQS] = { 4033 + [HWSIM_VQ_TX] = "tx", 4034 + [HWSIM_VQ_RX] = "rx", 4035 + }; 4036 + 4037 + return virtio_find_vqs(vdev, HWSIM_NUM_VQS, 4038 + hwsim_vqs, callbacks, names, NULL); 4039 + } 4040 + 4041 + static int fill_vq(struct virtqueue *vq) 4042 + { 4043 + int i, err; 4044 + struct sk_buff *skb; 4045 + struct scatterlist sg[1]; 4046 + 4047 + for (i = 0; i < virtqueue_get_vring_size(vq); i++) { 4048 + skb = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_KERNEL); 4049 + if (!skb) 4050 + return -ENOMEM; 4051 + 4052 + sg_init_one(sg, skb->head, skb_end_offset(skb)); 4053 + err = virtqueue_add_inbuf(vq, sg, 1, skb, GFP_KERNEL); 4054 + if (err) { 4055 + nlmsg_free(skb); 4056 + return err; 4057 + } 4058 + } 4059 + virtqueue_kick(vq); 4060 + return 0; 4061 + } 4062 + 4063 + static void remove_vqs(struct virtio_device *vdev) 4064 + { 4065 + int i; 4066 + 4067 + vdev->config->reset(vdev); 4068 + 4069 + for (i = 0; i < ARRAY_SIZE(hwsim_vqs); i++) { 4070 + struct virtqueue *vq = hwsim_vqs[i]; 4071 + struct sk_buff *skb; 4072 + 4073 + while ((skb = virtqueue_detach_unused_buf(vq))) 4074 + nlmsg_free(skb); 4075 + } 4076 + 4077 + vdev->config->del_vqs(vdev); 4078 + } 4079 + 4080 + static int hwsim_virtio_probe(struct virtio_device *vdev) 4081 + { 4082 + int err; 4083 + unsigned long flags; 4084 + 4085 + spin_lock_irqsave(&hwsim_virtio_lock, flags); 4086 + if (hwsim_virtio_enabled) { 4087 + spin_unlock_irqrestore(&hwsim_virtio_lock, flags); 4088 + return -EEXIST; 4089 + } 4090 + spin_unlock_irqrestore(&hwsim_virtio_lock, flags); 4091 + 4092 + err = init_vqs(vdev); 4093 + if (err) 4094 + return err; 4095 + 4096 + err = fill_vq(hwsim_vqs[HWSIM_VQ_RX]); 4097 + if (err) 4098 + goto out_remove; 4099 + 4100 + spin_lock_irqsave(&hwsim_virtio_lock, flags); 4101 + hwsim_virtio_enabled = true; 4102 + spin_unlock_irqrestore(&hwsim_virtio_lock, flags); 4103 + 4104 + schedule_work(&hwsim_virtio_rx); 4105 + return 0; 4106 + 4107 + out_remove: 4108 + remove_vqs(vdev); 4109 + return err; 4110 + } 4111 + 4112 + static void hwsim_virtio_remove(struct virtio_device *vdev) 4113 + { 4114 + hwsim_virtio_enabled = false; 4115 + 4116 + cancel_work_sync(&hwsim_virtio_rx); 4117 + 4118 + remove_vqs(vdev); 4119 + } 4120 + 4121 + /* MAC80211_HWSIM virtio device id table */ 4122 + static const struct virtio_device_id id_table[] = { 4123 + { VIRTIO_ID_MAC80211_HWSIM, VIRTIO_DEV_ANY_ID }, 4124 + { 0 } 4125 + }; 4126 + MODULE_DEVICE_TABLE(virtio, id_table); 4127 + 4128 + static struct virtio_driver virtio_hwsim = { 4129 + .driver.name = KBUILD_MODNAME, 4130 + .driver.owner = THIS_MODULE, 4131 + .id_table = id_table, 4132 + .probe = hwsim_virtio_probe, 4133 + .remove = hwsim_virtio_remove, 4134 + }; 4135 + 4136 + static int hwsim_register_virtio_driver(void) 4137 + { 4138 + spin_lock_init(&hwsim_virtio_lock); 4139 + 4140 + return register_virtio_driver(&virtio_hwsim); 4141 + } 4142 + 4143 + static void hwsim_unregister_virtio_driver(void) 4144 + { 4145 + unregister_virtio_driver(&virtio_hwsim); 4146 + } 4147 + #else 4148 + static inline int hwsim_register_virtio_driver(void) 4149 + { 4150 + return 0; 4151 + } 4152 + 4153 + static inline void hwsim_unregister_virtio_driver(void) 4154 + { 4155 + } 4156 + #endif 4157 + 3996 4158 static int __init init_mac80211_hwsim(void) 3997 4159 { 3998 4160 int i, err; ··· 4244 3960 if (err) 4245 3961 goto out_unregister_driver; 4246 3962 3963 + err = hwsim_register_virtio_driver(); 3964 + if (err) 3965 + goto out_exit_netlink; 3966 + 4247 3967 hwsim_class = class_create(THIS_MODULE, "mac80211_hwsim"); 4248 3968 if (IS_ERR(hwsim_class)) { 4249 3969 err = PTR_ERR(hwsim_class); 4250 - goto out_exit_netlink; 3970 + goto out_exit_virtio; 4251 3971 } 4252 3972 4253 3973 for (i = 0; i < radios; i++) { ··· 4363 4075 free_netdev(hwsim_mon); 4364 4076 out_free_radios: 4365 4077 mac80211_hwsim_free(); 4078 + out_exit_virtio: 4079 + hwsim_unregister_virtio_driver(); 4366 4080 out_exit_netlink: 4367 4081 hwsim_exit_netlink(); 4368 4082 out_unregister_driver: ··· 4381 4091 { 4382 4092 pr_debug("mac80211_hwsim: unregister radios\n"); 4383 4093 4094 + hwsim_unregister_virtio_driver(); 4384 4095 hwsim_exit_netlink(); 4385 4096 4386 4097 mac80211_hwsim_free();
+21
drivers/net/wireless/mac80211_hwsim.h
··· 3 3 * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211 4 4 * Copyright (c) 2008, Jouni Malinen <j@w1.fi> 5 5 * Copyright (c) 2011, Javier Lopez <jlopex@gmail.com> 6 + * Copyright (C) 2020 Intel Corporation 6 7 */ 7 8 8 9 #ifndef __MAC80211_HWSIM_H ··· 246 245 s8 idx; 247 246 u16 flags; 248 247 } __packed; 248 + 249 + /** 250 + * DOC: Frame transmission support over virtio 251 + * 252 + * Frame transmission is also supported over virtio to allow communication 253 + * with external entities. 254 + */ 255 + 256 + /** 257 + * enum hwsim_vqs - queues for virtio frame transmission 258 + * 259 + * @HWSIM_VQ_TX: send frames to external entity 260 + * @HWSIM_VQ_RX: receive frames and transmission info reports 261 + * @HWSIM_NUM_VQS: enum limit 262 + */ 263 + enum { 264 + HWSIM_VQ_TX, 265 + HWSIM_VQ_RX, 266 + HWSIM_NUM_VQS, 267 + }; 249 268 #endif /* __MAC80211_HWSIM_H */
+10 -2
drivers/net/wireless/virt_wifi.c
··· 436 436 return 0; 437 437 } 438 438 439 + static int virt_wifi_net_device_get_iflink(const struct net_device *dev) 440 + { 441 + struct virt_wifi_netdev_priv *priv = netdev_priv(dev); 442 + 443 + return priv->lowerdev->ifindex; 444 + } 445 + 439 446 static const struct net_device_ops virt_wifi_ops = { 440 447 .ndo_start_xmit = virt_wifi_start_xmit, 441 - .ndo_open = virt_wifi_net_device_open, 442 - .ndo_stop = virt_wifi_net_device_stop, 448 + .ndo_open = virt_wifi_net_device_open, 449 + .ndo_stop = virt_wifi_net_device_stop, 450 + .ndo_get_iflink = virt_wifi_net_device_get_iflink, 443 451 }; 444 452 445 453 /* Invoked as part of rtnl lock release. */
+32 -4
include/net/cfg80211.h
··· 7 7 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 8 8 * Copyright 2013-2014 Intel Mobile Communications GmbH 9 9 * Copyright 2015-2017 Intel Deutschland GmbH 10 - * Copyright (C) 2018-2019 Intel Corporation 10 + * Copyright (C) 2018-2020 Intel Corporation 11 11 */ 12 12 13 13 #include <linux/netdevice.h> ··· 924 924 __be16 control_port_ethertype; 925 925 bool control_port_no_encrypt; 926 926 bool control_port_over_nl80211; 927 + bool control_port_no_preauth; 927 928 struct key_params *wep_keys; 928 929 int wep_tx_key; 929 930 const u8 *psk; ··· 1055 1054 * @flags: flags, as defined in enum cfg80211_ap_settings_flags 1056 1055 * @he_obss_pd: OBSS Packet Detection settings 1057 1056 * @he_bss_color: BSS Color settings 1057 + * @he_oper: HE operation IE (or %NULL if HE isn't enabled) 1058 1058 */ 1059 1059 struct cfg80211_ap_settings { 1060 1060 struct cfg80211_chan_def chandef; ··· 1080 1078 const struct ieee80211_ht_cap *ht_cap; 1081 1079 const struct ieee80211_vht_cap *vht_cap; 1082 1080 const struct ieee80211_he_cap_elem *he_cap; 1081 + const struct ieee80211_he_operation *he_oper; 1083 1082 bool ht_required, vht_required; 1084 1083 bool twt_responder; 1085 1084 u32 flags; ··· 2699 2696 * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the 2700 2697 * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be 2701 2698 * %NULL). 2699 + * @pmk_lifetime: Maximum lifetime for PMKSA in seconds 2700 + * (dot11RSNAConfigPMKLifetime) or 0 if not specified. 2701 + * The configured PMKSA must not be used for PMKSA caching after 2702 + * expiration and any keys derived from this PMK become invalid on 2703 + * expiration, i.e., the current association must be dropped if the PMK 2704 + * used for it expires. 2705 + * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of 2706 + * PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified. 2707 + * Drivers are expected to trigger a full authentication instead of using 2708 + * this PMKSA for caching when reassociating to a new BSS after this 2709 + * threshold to generate a new PMK before the current one expires. 2702 2710 */ 2703 2711 struct cfg80211_pmksa { 2704 2712 const u8 *bssid; ··· 2719 2705 const u8 *ssid; 2720 2706 size_t ssid_len; 2721 2707 const u8 *cache_id; 2708 + u32 pmk_lifetime; 2709 + u8 pmk_reauth_threshold; 2722 2710 }; 2723 2711 2724 2712 /** ··· 3285 3269 * @ftmr_retries: number of retries for FTM request 3286 3270 * @request_lci: request LCI information 3287 3271 * @request_civicloc: request civic location information 3272 + * @trigger_based: use trigger based ranging for the measurement 3273 + * If neither @trigger_based nor @non_trigger_based is set, 3274 + * EDCA based ranging will be used. 3275 + * @non_trigger_based: use non trigger based ranging for the measurement 3276 + * If neither @trigger_based nor @non_trigger_based is set, 3277 + * EDCA based ranging will be used. 3288 3278 * 3289 3279 * See also nl80211 for the respective attribute documentation. 3290 3280 */ ··· 3300 3278 u8 requested:1, 3301 3279 asap:1, 3302 3280 request_lci:1, 3303 - request_civicloc:1; 3281 + request_civicloc:1, 3282 + trigger_based:1, 3283 + non_trigger_based:1; 3304 3284 u8 num_bursts_exp; 3305 3285 u8 burst_duration; 3306 3286 u8 ftms_per_burst; ··· 3428 3404 * @set_default_key: set the default key on an interface 3429 3405 * 3430 3406 * @set_default_mgmt_key: set the default management frame key on an interface 3431 - 3407 + * 3432 3408 * @set_default_beacon_key: set the default Beacon frame key on an interface 3433 3409 * 3434 3410 * @set_rekey_data: give the data necessary for GTK rekeying to the driver ··· 4458 4434 * forbid using the value 15 to let the responder pick) 4459 4435 * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if 4460 4436 * not limited) 4437 + * @ftm.trigger_based: trigger based ranging measurement is supported 4438 + * @ftm.non_trigger_based: non trigger based ranging measurement is supported 4461 4439 */ 4462 4440 struct cfg80211_pmsr_capabilities { 4463 4441 unsigned int max_peers; ··· 4475 4449 asap:1, 4476 4450 non_asap:1, 4477 4451 request_lci:1, 4478 - request_civicloc:1; 4452 + request_civicloc:1, 4453 + trigger_based:1, 4454 + non_trigger_based:1; 4479 4455 } ftm; 4480 4456 }; 4481 4457
+5
include/net/mac80211.h
··· 1987 1987 * @support_p2p_ps: indicates whether the STA supports P2P PS mechanism or not. 1988 1988 * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control. 1989 1989 * @max_tid_amsdu_len: Maximum A-MSDU size in bytes for this TID 1990 + * @txpwr: the station tx power configuration 1990 1991 * @txq: per-TID data TX queues (if driver uses the TXQ abstraction); note that 1991 1992 * the last entry (%IEEE80211_NUM_TIDS) is used for non-data frames 1992 1993 */ ··· 3451 3450 * associated station, AP, IBSS/WDS/mesh peer etc. For a VIF operating 3452 3451 * in AP mode, this callback will not be called when the flag 3453 3452 * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic. 3453 + * 3454 + * @sta_set_txpwr: Configure the station tx power. This callback set the tx 3455 + * power for the station. 3456 + * This callback can sleep. 3454 3457 * 3455 3458 * @sta_state: Notifies low level driver about state transition of a 3456 3459 * station (which can be the AP, a client, IBSS/WDS/mesh peer etc.)
+71 -2
include/uapi/linux/nl80211.h
··· 11 11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com> 12 12 * Copyright 2008 Colin McCabe <colin@cozybit.com> 13 13 * Copyright 2015-2017 Intel Deutschland GmbH 14 - * Copyright (C) 2018-2019 Intel Corporation 14 + * Copyright (C) 2018-2020 Intel Corporation 15 15 * 16 16 * Permission to use, copy, modify, and/or distribute this software for any 17 17 * purpose with or without fee is hereby granted, provided that the above ··· 1632 1632 * flag is included, then control port frames are sent over NL80211 instead 1633 1633 * using %CMD_CONTROL_PORT_FRAME. If control port routing over NL80211 is 1634 1634 * to be used then userspace must also use the %NL80211_ATTR_SOCKET_OWNER 1635 - * flag. 1635 + * flag. When used with %NL80211_ATTR_CONTROL_PORT_NO_PREAUTH, pre-auth 1636 + * frames are not forwared over the control port. 1636 1637 * 1637 1638 * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver. 1638 1639 * We recommend using nested, driver-specific attributes within this. ··· 2443 2442 * on output (in wiphy attributes) it contains only the feature sub- 2444 2443 * attributes. 2445 2444 * 2445 + * @NL80211_ATTR_CONTROL_PORT_NO_PREAUTH: disable preauth frame rx on control 2446 + * port in order to forward/receive them as ordinary data frames. 2447 + * 2448 + * @NL80211_ATTR_PMK_LIFETIME: Maximum lifetime for PMKSA in seconds (u32, 2449 + * dot11RSNAConfigPMKReauthThreshold; 0 is not a valid value). 2450 + * An optional parameter configured through %NL80211_CMD_SET_PMKSA. 2451 + * Drivers that trigger roaming need to know the lifetime of the 2452 + * configured PMKSA for triggering the full vs. PMKSA caching based 2453 + * authentication. This timeout helps authentication methods like SAE, 2454 + * where PMK gets updated only by going through a full (new SAE) 2455 + * authentication instead of getting updated during an association for EAP 2456 + * authentication. No new full authentication within the PMK expiry shall 2457 + * result in a disassociation at the end of the lifetime. 2458 + * 2459 + * @NL80211_ATTR_PMK_REAUTH_THRESHOLD: Reauthentication threshold time, in 2460 + * terms of percentage of %NL80211_ATTR_PMK_LIFETIME 2461 + * (u8, dot11RSNAConfigPMKReauthThreshold, 1..100). This is an optional 2462 + * parameter configured through %NL80211_CMD_SET_PMKSA. Requests the 2463 + * driver to trigger a full authentication roam (without PMKSA caching) 2464 + * after the reauthentication threshold time, but before the PMK lifetime 2465 + * has expired. 2466 + * 2467 + * Authentication methods like SAE need to be able to generate a new PMKSA 2468 + * entry without having to force a disconnection after the PMK timeout. If 2469 + * no roaming occurs between the reauth threshold and PMK expiration, 2470 + * disassociation is still forced. 2471 + * 2446 2472 * @NUM_NL80211_ATTR: total number of nl80211_attrs available 2447 2473 * @NL80211_ATTR_MAX: highest attribute number currently defined 2448 2474 * @__NL80211_ATTR_AFTER_LAST: internal use ··· 2939 2911 NL80211_ATTR_IFTYPE_AKM_SUITES, 2940 2912 2941 2913 NL80211_ATTR_TID_CONFIG, 2914 + 2915 + NL80211_ATTR_CONTROL_PORT_NO_PREAUTH, 2916 + 2917 + NL80211_ATTR_PMK_LIFETIME, 2918 + NL80211_ATTR_PMK_REAUTH_THRESHOLD, 2942 2919 2943 2920 /* add attributes here, update the policy in nl80211.c */ 2944 2921 ··· 5675 5642 * @NL80211_EXT_FEATURE_BEACON_PROTECTION: The driver supports Beacon protection 5676 5643 * and can receive key configuration for BIGTK using key indexes 6 and 7. 5677 5644 * 5645 + * @NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH: The driver can disable the 5646 + * forwarding of preauth frames over the control port. They are then 5647 + * handled as ordinary data frames. 5648 + * 5649 + * @NL80211_EXT_FEATURE_PROTECTED_TWT: Driver supports protected TWT frames 5650 + * 5651 + * @NL80211_EXT_FEATURE_DEL_IBSS_STA: The driver supports removing stations 5652 + * in IBSS mode, essentially by dropping their state. 5653 + * 5678 5654 * @NUM_NL80211_EXT_FEATURES: number of extended features. 5679 5655 * @MAX_NL80211_EXT_FEATURES: highest extended feature index. 5680 5656 */ ··· 5732 5690 NL80211_EXT_FEATURE_VLAN_OFFLOAD, 5733 5691 NL80211_EXT_FEATURE_AQL, 5734 5692 NL80211_EXT_FEATURE_BEACON_PROTECTION, 5693 + NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH, 5694 + NL80211_EXT_FEATURE_PROTECTED_TWT, 5695 + NL80211_EXT_FEATURE_DEL_IBSS_STA, 5735 5696 5736 5697 /* add new features before the definition below */ 5737 5698 NUM_NL80211_EXT_FEATURES, ··· 6357 6312 * @NL80211_PREAMBLE_HT: HT preamble 6358 6313 * @NL80211_PREAMBLE_VHT: VHT preamble 6359 6314 * @NL80211_PREAMBLE_DMG: DMG preamble 6315 + * @NL80211_PREAMBLE_HE: HE preamble 6360 6316 */ 6361 6317 enum nl80211_preamble { 6362 6318 NL80211_PREAMBLE_LEGACY, 6363 6319 NL80211_PREAMBLE_HT, 6364 6320 NL80211_PREAMBLE_VHT, 6365 6321 NL80211_PREAMBLE_DMG, 6322 + NL80211_PREAMBLE_HE, 6366 6323 }; 6367 6324 6368 6325 /** ··· 6557 6510 * is valid) 6558 6511 * @NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST: u32 attribute indicating 6559 6512 * the maximum FTMs per burst (if not present anything is valid) 6513 + * @NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED: flag attribute indicating if 6514 + * trigger based ranging measurement is supported 6515 + * @NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED: flag attribute indicating 6516 + * if non trigger based ranging measurement is supported 6560 6517 * 6561 6518 * @NUM_NL80211_PMSR_FTM_CAPA_ATTR: internal 6562 6519 * @NL80211_PMSR_FTM_CAPA_ATTR_MAX: highest attribute number ··· 6576 6525 NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS, 6577 6526 NL80211_PMSR_FTM_CAPA_ATTR_MAX_BURSTS_EXPONENT, 6578 6527 NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST, 6528 + NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED, 6529 + NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED, 6579 6530 6580 6531 /* keep last */ 6581 6532 NUM_NL80211_PMSR_FTM_CAPA_ATTR, ··· 6607 6554 * @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI: request LCI data (flag) 6608 6555 * @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC: request civic location data 6609 6556 * (flag) 6557 + * @NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED: request trigger based ranging 6558 + * measurement (flag). 6559 + * This attribute and %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED are 6560 + * mutually exclusive. 6561 + * if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor 6562 + * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based 6563 + * ranging will be used. 6564 + * @NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED: request non trigger based 6565 + * ranging measurement (flag) 6566 + * This attribute and %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED are 6567 + * mutually exclusive. 6568 + * if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor 6569 + * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based 6570 + * ranging will be used. 6610 6571 * 6611 6572 * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal 6612 6573 * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number ··· 6637 6570 NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES, 6638 6571 NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI, 6639 6572 NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC, 6573 + NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED, 6574 + NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED, 6640 6575 6641 6576 /* keep last */ 6642 6577 NUM_NL80211_PMSR_FTM_REQ_ATTR,
+1
include/uapi/linux/virtio_ids.h
··· 46 46 #define VIRTIO_ID_IOMMU 23 /* virtio IOMMU */ 47 47 #define VIRTIO_ID_FS 26 /* virtio filesystem */ 48 48 #define VIRTIO_ID_PMEM 27 /* virtio pmem */ 49 + #define VIRTIO_ID_MAC80211_HWSIM 29 /* virtio mac80211-hwsim */ 49 50 50 51 #endif /* _LINUX_VIRTIO_IDS_H */
+13 -3
net/mac80211/cfg.c
··· 5 5 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 6 6 * Copyright 2013-2015 Intel Mobile Communications GmbH 7 7 * Copyright (C) 2015-2017 Intel Deutschland GmbH 8 - * Copyright (C) 2018-2019 Intel Corporation 9 - * Copyright (C) 2018 Intel Corporation 8 + * Copyright (C) 2018-2020 Intel Corporation 10 9 */ 11 10 12 11 #include <linux/ieee80211.h> ··· 1011 1012 prev_beacon_int = sdata->vif.bss_conf.beacon_int; 1012 1013 sdata->vif.bss_conf.beacon_int = params->beacon_interval; 1013 1014 1014 - if (params->he_cap) 1015 + if (params->he_cap && params->he_oper) { 1015 1016 sdata->vif.bss_conf.he_support = true; 1017 + sdata->vif.bss_conf.htc_trig_based_pkt_ext = 1018 + le32_get_bits(params->he_oper->he_oper_params, 1019 + IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK); 1020 + sdata->vif.bss_conf.frame_time_rts_th = 1021 + le32_get_bits(params->he_oper->he_oper_params, 1022 + IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK); 1023 + } 1016 1024 1017 1025 mutex_lock(&local->mtx); 1018 1026 err = ieee80211_vif_use_channel(sdata, &params->chandef, ··· 1040 1034 sdata->control_port_no_encrypt = params->crypto.control_port_no_encrypt; 1041 1035 sdata->control_port_over_nl80211 = 1042 1036 params->crypto.control_port_over_nl80211; 1037 + sdata->control_port_no_preauth = 1038 + params->crypto.control_port_no_preauth; 1043 1039 sdata->encrypt_headroom = ieee80211_cs_headroom(sdata->local, 1044 1040 &params->crypto, 1045 1041 sdata->vif.type); ··· 1053 1045 params->crypto.control_port_no_encrypt; 1054 1046 vlan->control_port_over_nl80211 = 1055 1047 params->crypto.control_port_over_nl80211; 1048 + vlan->control_port_no_preauth = 1049 + params->crypto.control_port_no_preauth; 1056 1050 vlan->encrypt_headroom = 1057 1051 ieee80211_cs_headroom(sdata->local, 1058 1052 &params->crypto,
+1
net/mac80211/ieee80211_i.h
··· 912 912 u16 sequence_number; 913 913 __be16 control_port_protocol; 914 914 bool control_port_no_encrypt; 915 + bool control_port_no_preauth; 915 916 bool control_port_over_nl80211; 916 917 int encrypt_headroom; 917 918
+4
net/mac80211/iface.c
··· 519 519 master->control_port_no_encrypt; 520 520 sdata->control_port_over_nl80211 = 521 521 master->control_port_over_nl80211; 522 + sdata->control_port_no_preauth = 523 + master->control_port_no_preauth; 522 524 sdata->vif.cab_queue = master->vif.cab_queue; 523 525 memcpy(sdata->vif.hw_queue, master->vif.hw_queue, 524 526 sizeof(sdata->vif.hw_queue)); ··· 1465 1463 1466 1464 sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE); 1467 1465 sdata->control_port_no_encrypt = false; 1466 + sdata->control_port_over_nl80211 = false; 1467 + sdata->control_port_no_preauth = false; 1468 1468 sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM; 1469 1469 sdata->vif.bss_conf.idle = true; 1470 1470 sdata->vif.bss_conf.txpower = INT_MIN; /* unset */
+7 -1
net/mac80211/main.c
··· 576 576 WIPHY_FLAG_REPORTS_OBSS | 577 577 WIPHY_FLAG_OFFCHAN_TX; 578 578 579 - if (ops->remain_on_channel) 579 + if (!use_chanctx || ops->remain_on_channel) 580 580 wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; 581 581 582 582 wiphy->features |= NL80211_FEATURE_SK_TX_STATUS | ··· 589 589 wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_FILS_STA); 590 590 wiphy_ext_feature_set(wiphy, 591 591 NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211); 592 + wiphy_ext_feature_set(wiphy, 593 + NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH); 592 594 593 595 if (!ops->hw_scan) { 594 596 wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN | ··· 1082 1080 wiphy_ext_feature_set(local->hw.wiphy, 1083 1081 NL80211_EXT_FEATURE_EXT_KEY_ID); 1084 1082 } 1083 + 1084 + if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_ADHOC)) 1085 + wiphy_ext_feature_set(local->hw.wiphy, 1086 + NL80211_EXT_FEATURE_DEL_IBSS_STA); 1085 1087 1086 1088 /* 1087 1089 * Calculate scan IE length -- we need this to alloc
+1
net/mac80211/mlme.c
··· 5458 5458 sdata->control_port_no_encrypt = req->crypto.control_port_no_encrypt; 5459 5459 sdata->control_port_over_nl80211 = 5460 5460 req->crypto.control_port_over_nl80211; 5461 + sdata->control_port_no_preauth = req->crypto.control_port_no_preauth; 5461 5462 sdata->encrypt_headroom = ieee80211_cs_headroom(local, &req->crypto, 5462 5463 sdata->vif.type); 5463 5464
+2 -1
net/mac80211/rx.c
··· 2497 2497 struct net_device *dev = sdata->dev; 2498 2498 2499 2499 if (unlikely((skb->protocol == sdata->control_port_protocol || 2500 - skb->protocol == cpu_to_be16(ETH_P_PREAUTH)) && 2500 + (skb->protocol == cpu_to_be16(ETH_P_PREAUTH) && 2501 + !sdata->control_port_no_preauth)) && 2501 2502 sdata->control_port_over_nl80211)) { 2502 2503 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 2503 2504 bool noencrypt = !(status->flag & RX_FLAG_DECRYPTED);
+29 -6
net/mac80211/sta_info.c
··· 2150 2150 return 0; 2151 2151 } 2152 2152 2153 + static inline u64 sta_get_tidstats_msdu(struct ieee80211_sta_rx_stats *rxstats, 2154 + int tid) 2155 + { 2156 + unsigned int start; 2157 + u64 value; 2158 + 2159 + do { 2160 + start = u64_stats_fetch_begin(&rxstats->syncp); 2161 + value = rxstats->msdu[tid]; 2162 + } while (u64_stats_fetch_retry(&rxstats->syncp, start)); 2163 + 2164 + return value; 2165 + } 2166 + 2153 2167 static void sta_set_tidstats(struct sta_info *sta, 2154 2168 struct cfg80211_tid_stats *tidstats, 2155 2169 int tid) 2156 2170 { 2157 2171 struct ieee80211_local *local = sta->local; 2172 + int cpu; 2158 2173 2159 2174 if (!(tidstats->filled & BIT(NL80211_TID_STATS_RX_MSDU))) { 2160 - unsigned int start; 2175 + if (!ieee80211_hw_check(&local->hw, USES_RSS)) 2176 + tidstats->rx_msdu += 2177 + sta_get_tidstats_msdu(&sta->rx_stats, tid); 2161 2178 2162 - do { 2163 - start = u64_stats_fetch_begin(&sta->rx_stats.syncp); 2164 - tidstats->rx_msdu = sta->rx_stats.msdu[tid]; 2165 - } while (u64_stats_fetch_retry(&sta->rx_stats.syncp, start)); 2179 + if (sta->pcpu_rx_stats) { 2180 + for_each_possible_cpu(cpu) { 2181 + struct ieee80211_sta_rx_stats *cpurxs; 2182 + 2183 + cpurxs = per_cpu_ptr(sta->pcpu_rx_stats, cpu); 2184 + tidstats->rx_msdu += 2185 + sta_get_tidstats_msdu(cpurxs, tid); 2186 + } 2187 + } 2166 2188 2167 2189 tidstats->filled |= BIT(NL80211_TID_STATS_RX_MSDU); 2168 2190 } ··· 2288 2266 2289 2267 if (!(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_RX_BYTES64) | 2290 2268 BIT_ULL(NL80211_STA_INFO_RX_BYTES)))) { 2291 - sinfo->rx_bytes += sta_get_stats_bytes(&sta->rx_stats); 2269 + if (!ieee80211_hw_check(&local->hw, USES_RSS)) 2270 + sinfo->rx_bytes += sta_get_stats_bytes(&sta->rx_stats); 2292 2271 2293 2272 if (sta->pcpu_rx_stats) { 2294 2273 for_each_possible_cpu(cpu) {
+5 -1
net/mac80211/tx.c
··· 4670 4670 { 4671 4671 ieee80211_tx_result res; 4672 4672 struct ieee80211_tx_data tx; 4673 + struct sk_buff *check_skb; 4673 4674 4674 4675 memset(&tx, 0, sizeof(tx)); 4675 4676 tx.key = rcu_dereference(sdata->default_beacon_key); ··· 4681 4680 __skb_queue_head_init(&tx.skbs); 4682 4681 __skb_queue_tail(&tx.skbs, skb); 4683 4682 res = ieee80211_tx_h_encrypt(&tx); 4683 + check_skb = __skb_dequeue(&tx.skbs); 4684 + /* we may crash after this, but it'd be a bug in crypto */ 4685 + WARN_ON(check_skb != skb); 4684 4686 if (WARN_ON_ONCE(res != TX_CONTINUE)) 4685 - return -1; 4687 + return -EINVAL; 4686 4688 4687 4689 return 0; 4688 4690 }
+5 -1
net/mac80211/util.c
··· 912 912 break; 913 913 case WLAN_EID_EXT_HE_OPERATION: 914 914 if (len >= sizeof(*elems->he_operation) && 915 - len == ieee80211_he_oper_size(data) - 1) 915 + len == ieee80211_he_oper_size(data) - 1) { 916 + if (crc) 917 + *crc = crc32_be(*crc, (void *)elem, 918 + elem->datalen + 2); 916 919 elems->he_operation = data; 920 + } 917 921 break; 918 922 case WLAN_EID_EXT_UORA: 919 923 if (len == 1)
+6
net/wireless/core.c
··· 693 693 ~(BIT(NL80211_PREAMBLE_LEGACY) | 694 694 BIT(NL80211_PREAMBLE_HT) | 695 695 BIT(NL80211_PREAMBLE_VHT) | 696 + BIT(NL80211_PREAMBLE_HE) | 696 697 BIT(NL80211_PREAMBLE_DMG)))) 698 + return -EINVAL; 699 + if (WARN_ON((wiphy->pmsr_capa->ftm.trigger_based || 700 + wiphy->pmsr_capa->ftm.non_trigger_based) && 701 + !(wiphy->pmsr_capa->ftm.preambles & 702 + BIT(NL80211_PREAMBLE_HE)))) 697 703 return -EINVAL; 698 704 if (WARN_ON(wiphy->pmsr_capa->ftm.bandwidths & 699 705 ~(BIT(NL80211_CHAN_WIDTH_20_NOHT) |
+42 -5
net/wireless/nl80211.c
··· 5 5 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 6 6 * Copyright 2013-2014 Intel Mobile Communications GmbH 7 7 * Copyright 2015-2017 Intel Deutschland GmbH 8 - * Copyright (C) 2018-2019 Intel Corporation 8 + * Copyright (C) 2018-2020 Intel Corporation 9 9 */ 10 10 11 11 #include <linux/if.h> ··· 276 276 [NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES] = { .type = NLA_U8 }, 277 277 [NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI] = { .type = NLA_FLAG }, 278 278 [NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC] = { .type = NLA_FLAG }, 279 + [NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED] = { .type = NLA_FLAG }, 280 + [NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED] = { .type = NLA_FLAG }, 279 281 }; 280 282 281 283 static const struct nla_policy ··· 660 658 [NL80211_ATTR_HE_BSS_COLOR] = NLA_POLICY_NESTED(he_bss_color_policy), 661 659 [NL80211_ATTR_TID_CONFIG] = 662 660 NLA_POLICY_NESTED_ARRAY(nl80211_tid_config_attr_policy), 661 + [NL80211_ATTR_CONTROL_PORT_NO_PREAUTH] = { .type = NLA_FLAG }, 662 + [NL80211_ATTR_PMK_LIFETIME] = NLA_POLICY_MIN(NLA_U32, 1), 663 + [NL80211_ATTR_PMK_REAUTH_THRESHOLD] = NLA_POLICY_RANGE(NLA_U8, 1, 100), 663 664 }; 664 665 665 666 /* policy for the key attributes */ ··· 1888 1883 if (cap->ftm.max_ftms_per_burst && 1889 1884 nla_put_u32(msg, NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST, 1890 1885 cap->ftm.max_ftms_per_burst)) 1886 + return -ENOBUFS; 1887 + if (cap->ftm.trigger_based && 1888 + nla_put_flag(msg, NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED)) 1889 + return -ENOBUFS; 1890 + if (cap->ftm.non_trigger_based && 1891 + nla_put_flag(msg, NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED)) 1891 1892 return -ENOBUFS; 1892 1893 1893 1894 nla_nest_end(msg, ftm); ··· 4759 4748 cap = cfg80211_find_ext_ie(WLAN_EID_EXT_HE_CAPABILITY, ies, ies_len); 4760 4749 if (cap && cap[1] >= sizeof(*params->he_cap) + 1) 4761 4750 params->he_cap = (void *)(cap + 3); 4751 + cap = cfg80211_find_ext_ie(WLAN_EID_EXT_HE_OPERATION, ies, ies_len); 4752 + if (cap && cap[1] >= sizeof(*params->he_oper) + 1) 4753 + params->he_oper = (void *)(cap + 3); 4762 4754 } 4763 4755 4764 4756 static bool nl80211_get_ap_channel(struct cfg80211_registered_device *rdev, ··· 6285 6271 if (info->attrs[NL80211_ATTR_MAC]) 6286 6272 params.mac = nla_data(info->attrs[NL80211_ATTR_MAC]); 6287 6273 6288 - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && 6289 - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && 6290 - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT && 6291 - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) 6274 + switch (dev->ieee80211_ptr->iftype) { 6275 + case NL80211_IFTYPE_AP: 6276 + case NL80211_IFTYPE_AP_VLAN: 6277 + case NL80211_IFTYPE_MESH_POINT: 6278 + case NL80211_IFTYPE_P2P_GO: 6279 + /* always accept these */ 6280 + break; 6281 + case NL80211_IFTYPE_ADHOC: 6282 + /* conditionally accept */ 6283 + if (wiphy_ext_feature_isset(&rdev->wiphy, 6284 + NL80211_EXT_FEATURE_DEL_IBSS_STA)) 6285 + break; 6292 6286 return -EINVAL; 6287 + default: 6288 + return -EINVAL; 6289 + } 6293 6290 6294 6291 if (!rdev->ops->del_station) 6295 6292 return -EOPNOTSUPP; ··· 9331 9306 return r; 9332 9307 9333 9308 settings->control_port_over_nl80211 = true; 9309 + 9310 + if (info->attrs[NL80211_ATTR_CONTROL_PORT_NO_PREAUTH]) 9311 + settings->control_port_no_preauth = true; 9334 9312 } 9335 9313 9336 9314 if (info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]) { ··· 10521 10493 pmksa.pmk = nla_data(info->attrs[NL80211_ATTR_PMK]); 10522 10494 pmksa.pmk_len = nla_len(info->attrs[NL80211_ATTR_PMK]); 10523 10495 } 10496 + 10497 + if (info->attrs[NL80211_ATTR_PMK_LIFETIME]) 10498 + pmksa.pmk_lifetime = 10499 + nla_get_u32(info->attrs[NL80211_ATTR_PMK_LIFETIME]); 10500 + 10501 + if (info->attrs[NL80211_ATTR_PMK_REAUTH_THRESHOLD]) 10502 + pmksa.pmk_reauth_threshold = 10503 + nla_get_u8( 10504 + info->attrs[NL80211_ATTR_PMK_REAUTH_THRESHOLD]); 10524 10505 10525 10506 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && 10526 10507 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT &&
+32
net/wireless/pmsr.c
··· 126 126 "FTM: civic location request not supported"); 127 127 } 128 128 129 + out->ftm.trigger_based = 130 + !!tb[NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED]; 131 + if (out->ftm.trigger_based && !capa->ftm.trigger_based) { 132 + NL_SET_ERR_MSG_ATTR(info->extack, 133 + tb[NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED], 134 + "FTM: trigger based ranging is not supported"); 135 + return -EINVAL; 136 + } 137 + 138 + out->ftm.non_trigger_based = 139 + !!tb[NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED]; 140 + if (out->ftm.non_trigger_based && !capa->ftm.non_trigger_based) { 141 + NL_SET_ERR_MSG_ATTR(info->extack, 142 + tb[NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED], 143 + "FTM: trigger based ranging is not supported"); 144 + return -EINVAL; 145 + } 146 + 147 + if (out->ftm.trigger_based && out->ftm.non_trigger_based) { 148 + NL_SET_ERR_MSG(info->extack, 149 + "FTM: can't set both trigger based and non trigger based"); 150 + return -EINVAL; 151 + } 152 + 153 + if ((out->ftm.trigger_based || out->ftm.non_trigger_based) && 154 + out->ftm.preamble != NL80211_PREAMBLE_HE) { 155 + NL_SET_ERR_MSG_ATTR(info->extack, 156 + tb[NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE], 157 + "FTM: non EDCA based ranging must use HE preamble"); 158 + return -EINVAL; 159 + } 160 + 129 161 return 0; 130 162 } 131 163