summaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
AgeCommit message (Collapse)AuthorFilesLines
2022-12-01wifi: nl80211: Add checks for nla_nest_start() in nl80211_send_iface()Yuan Can1-0/+3
As the nla_nest_start() may fail with NULL returned, the return value needs to be checked. Fixes: ce08cd344a00 ("wifi: nl80211: expose link information for interfaces") Signed-off-by: Yuan Can <yuancan@huawei.com> Link: https://lore.kernel.org/r/20221129014211.56558-1-yuancan@huawei.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-11-07genetlink: introduce split op representationJakub Kicinski1-2/+4
We currently have two forms of operations - small ops and "full" ops (or just ops). The former does not have pointers for some of the less commonly used features (namely dump start/done and policy). The "full" ops, however, still don't contain all the necessary information. In particular the policy is per command ID, while do and dump often accept different attributes. It's also not possible to define different pre_doit and post_doit callbacks for different commands within the family. At the same time a lot of commands do not support dumping and therefore all the dump-related information is wasted space. Create a new command representation which can hold info about a do implementation or a dump implementation, but not both at the same time. Use this new representation on the command execution path (genl_family_rcv_msg) as we either run a do or a dump and don't have to create a "full" op there. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-10-10Merge remote-tracking branch 'wireless/main' into wireless-nextJohannes Berg1-1/+3
Pull in wireless/main content since some new code would otherwise conflict with it. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-10-07cfg80211: Update Transition Disable policy during port authorizationVinayak Yadawad1-1/+7
In case of 4way handshake offload, transition disable policy updated by the AP during EAPOL 3/4 is not updated to the upper layer. This results in mismatch between transition disable policy between the upper layer and the driver. This patch addresses this issue by updating transition disable policy as part of port authorization indication. Signed-off-by: Vinayak Yadawad <vinayak.yadawad@broadcom.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-10-07wifi: nl80211: use link ID in NL80211_CMD_SET_BSSJohannes Berg1-1/+3
We clearly need the link ID here, to know the right BSS to configure. Use/require it. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-10-07wifi: cfg80211: support reporting failed linksJohannes Berg1-1/+4
For assoc and connect result APIs, support reporting failed links; they should still come with the BSS pointer in the case of assoc, so they're released correctly. In the case of connect result, this is optional. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-10-07wifi: nl80211: Split memcpy() of struct nl80211_wowlan_tcp_data_token ↵Kees Cook1-1/+3
flexible array To work around a misbehavior of the compiler's ability to see into composite flexible array structs (as detailed in the coming memcpy() hardening series[1]), split the memcpy() of the header and the payload so no false positive run-time overflow warning will be generated. [1] https://lore.kernel.org/linux-hardening/20220901065914.1417829-2-keescook@chromium.org/ Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-09-04Merge tag 'wireless-next-2022-09-03' of ↵David S. Miller1-6/+5
git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next Johannes Berg says: ==================== drivers - rtw89: large update across the map, e.g. coex, pci(e), etc. - ath9k: uninit memory read fix - ath10k: small peer map fix and a WCN3990 device fix - wfx: underflow stack - the "change MAC address while IFF_UP" change from James we discussed - more MLO work, including a set of fixes for the previous code, now that we have more code we can exercise it more - prevent some features with MLO that aren't ready yet (AP_VLAN and 4-address connections) ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2022-09-03wifi: nl80211: add MLD address to assoc BSS entriesJohannes Berg1-2/+4
Add an MLD address attribute to BSS entries that the interface is currently associated with to help userspace figure out what's going on. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-09-03wifi: nl80211: remove redundant err variableJinpeng Cui1-4/+1
Return value from rdev_set_mcast_rate() directly instead of taking this in another redundant variable. Reported-by: Zeal Robot <zealci@zte.com.cn> Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-08-29genetlink: start to validate reserved header bytesJakub Kicinski1-0/+1
We had historically not checked that genlmsghdr.reserved is 0 on input which prevents us from using those precious bytes in the future. One use case would be to extend the cmd field, which is currently just 8 bits wide and 256 is not a lot of commands for some core families. To make sure that new families do the right thing by default put the onus of opting out of validation on existing families. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Acked-by: Paul Moore <paul@paul-moore.com> (NetLabel) Signed-off-by: David S. Miller <davem@davemloft.net>
2022-08-25wifi: cfg80211: Add link_id to cfg80211_ch_switch_started_notify()Veerendranath Jakkam1-4/+14
Add link_id parameter to cfg80211_ch_switch_started_notify() to allow driver to indicate on which link channel switch started on MLD. Send the data to userspace so it knows as well. Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com> Link: https://lore.kernel.org/r/20220722131143.3438042-1-quic_vjakkam@quicinc.com Link: https://lore.kernel.org/r/20220722131143.3438042-2-quic_vjakkam@quicinc.com [squash two patches] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-08-25wifi: nl80211: send MLO links channel info in GET_INTERFACEVeerendranath Jakkam1-0/+7
Currently, MLO link level channel information not sent to userspace when NL80211_CMD_GET_INTERFACE requested on MLD. Add support to send channel information for all valid links for NL80211_CMD_GET_INTERFACE request. Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com> Link: https://lore.kernel.org/r/20220722131000.3437894-1-quic_vjakkam@quicinc.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-08-25wifi: cfg80211/mac80211: check EHT capability size correctlyJohannes Berg1-5/+13
For AP/non-AP the EHT MCS/NSS subfield size differs, the 4-octet subfield is only used for 20 MHz-only non-AP STA. Pass an argument around everywhere to be able to parse it properly. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-08-25wifi: cfg80211: Add link_id parameter to various key operations for MLOVeerendranath Jakkam1-29/+97
Add support for various key operations on MLD by adding new parameter link_id. Pass the link_id received from userspace to driver for add_key, get_key, del_key, set_default_key, set_default_mgmt_key and set_default_beacon_key to support configuring keys specific to each MLO link. Userspace must not specify link ID for MLO pairwise key since it is common for all the MLO links. Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com> Link: https://lore.kernel.org/r/20220730052643.1959111-4-quic_vjakkam@quicinc.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-08-25wifi: cfg80211: add link id to txq paramsShaul Triebitz1-2/+15
The Tx queue parameters are per link, so add the link ID from nl80211 parameters to the API. While at it, lock the wdev when calling into the driver so it (and we) can check the link ID appropriately. Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-22wifi: nl80211: add MLO link ID to the NL80211_CMD_FRAME TX APIJohannes Berg1-0/+12
Allow optionally specifying the link ID to transmit on, which can be done instead of the link frequency, on an MLD addressed frame. Both can also be omitted in which case the frame must be MLD addressed and link selection (and address translation) will be done on lower layers. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-22wifi: cfg80211: report link ID in NL80211_CMD_FRAMEJohannes Berg1-0/+2
If given by the underlying driver, report the link ID for MLO in NL80211_CMD_FRAME. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-22wifi: cfg80211: add hardware timestamps to frame RX infoAvraham Stern1-1/+9
Add hardware timestamps to management frame RX info. This shall be used by drivers that support hardware timestamping for Timing measurement and Fine timing measurement action frames RX. Signed-off-by: Avraham Stern <avraham.stern@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-22wifi: cfg80211/nl80211: move rx management data into a structAvraham Stern1-10/+9
The functions for reporting rx management take many arguments. Collect all the arguments into a struct, which also make it easier to add more arguments if needed. Signed-off-by: Avraham Stern <avraham.stern@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-22wifi: cfg80211: add a function for reporting TX status with hardware timestampsAvraham Stern1-14/+28
Add a function for reporting TX status with hardware timestamps. This function shall be used for reporting the TX status of Timing measurement and Fine timing measurement action frames by devices that support reporting hardware timestamps. Signed-off-by: Avraham Stern <avraham.stern@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-22wifi: nl80211: require MLD address on link STA add/modifyJohannes Berg1-3/+2
We always need the MLD address and link ID to add or modify the link STA, so require it in the API. Fixes: 577e5b8c3924 ("wifi: cfg80211: add API to add/modify/remove a link station") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: fix some attribute policy entriesJohannes Berg1-9/+9
The new NL80211_CMD_ADD_LINK_STA and NL80211_CMD_MODIFY_LINK_STA commands have strict policy validation, so fix the policy so it can be validated correctly. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: reject fragmented and non-inheritance elementsJohannes Berg1-0/+25
The underlying mac80211 code cannot deal with fragmented elements for purposes of sorting the elements into the association frame, so reject those inside the link. We might want to reject them inside the assoc frame, but they're used today for FILS, so cannot do that. The non-inheritance element inside the links similarly cannot be handled by mac80211, and outside the links it makes no sense. Reject both since using them could lead to an incorrect implementation. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: reject link specific elements on assoc linkJohannes Berg1-0/+7
When we associate, we'll include all the elements for the link we're sending the association request on in the frame and the specific ones for other links in the multi-link element container. Prohibit adding link-specific elements for the association link. Fixes: d648c23024bd ("wifi: nl80211: support MLO in auth/assoc") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: advertise MLO supportJohannes Berg1-0/+3
At least while we don't have any more specific interface combinations support, add a simple flag for MLO support, we can keep this later based on something other than the wiphy flag. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: allow link ID in set_wiphy with frequencyIlan Peer1-2/+5
This simplifies hostapd implementation, since it didn't switch to NL80211_CMD_SET_CHANNEL. Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: cfg80211/mac80211: Support control port TX from specific linkAndrei Otcheretianski1-1/+4
In case of authentication with a legacy station, link addressed EAPOL frames should be sent. Support it. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: Support MLD parameters in nl80211_set_station()Andrei Otcheretianski1-1/+22
Set the MLD parameters in NL80211_CMD_SET_STATION handling to be able to change an MLD station. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: check MLO support in authenticateJohannes Berg1-0/+2
We should check that MLO connections are supported before attempting to authenticate with MLO parameters, check that. Fixes: d648c23024bd ("wifi: nl80211: support MLO in auth/assoc") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: set BSS to NULL if IS_ERR()Johannes Berg1-0/+1
If the BSS lookup returned an error, set it to NULL so we don't try to free it. Fixes: d648c23024bd ("wifi: nl80211: support MLO in auth/assoc") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: add EML/MLD capabilities to per-iftype capabilitiesJohannes Berg1-0/+9
We have the per-interface type capabilities, currently for extended capabilities, add the EML/MLD capabilities there to have this advertised by the driver. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: better validate link ID for stationsJohannes Berg1-9/+17
If we add a station on an MLD, we need a link ID to see where it lives (by default). Validate the link ID against the valid_links. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: cfg80211: clean up links appropriatelyJohannes Berg1-9/+2
This was missing earlier, we need to remove links when interfaces are being destroyed, and we also need to stop (AP) operations when a link is being destroyed. Address these issues to remove many warnings that will otherwise appear in mac80211. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: cfg80211: put cfg80211_rx_assoc_resp() arguments into a structJohannes Berg1-6/+6
For MLO we'll need a lot more arguments, including all the BSS pointers and link addresses, so move the data to a struct to be able to extend it more easily later. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: cfg80211: adjust assoc comeback for MLOJohannes Berg1-3/+3
We only report the BSSID to userspace, so change the argument from BSS struct pointer to AP address, which we'll use to carry either the BSSID or AP MLD address. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: acquire wdev mutex for dump_surveyJohannes Berg1-0/+2
At least the quantenna driver calls wdev_chandef() here which now requires the lock, so acquire it. Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: enable setting the link address at new stationShaul Triebitz1-1/+19
Since for an MLD station the default link is added together with the add station command, allow also setting the link MAC address. Otherwise, it is needed to use the modify link API only for setting the link MAC address. Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: hold wdev mutex for station APIsJohannes Berg1-1/+10
Since this will need to refer - at least in part - to the link stations of an MLD, hold the wdev mutex for driver convenience. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: hold wdev mutex for channel switch APIsJohannes Berg1-5/+16
Since we deal with links in an MLD here, hold the wdev mutex now. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: nl80211: hold wdev mutex in add/mod/del link stationJohannes Berg1-3/+13
Since we deal with links, and that requires looking at wdev links, we should hold the wdev mutex for driver convenience. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: cfg80211/mac80211: separate link params from station paramsShaul Triebitz1-46/+51
Put the link_station_parameters structure in the station_parameters structure (and remove the station_parameters fields already existing in link_station_parameters). Now, for an MLD station, the default link is added together with the station. Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: cfg80211: add API to add/modify/remove a link stationShaul Triebitz1-8/+160
Add an API for adding/modifying/removing a link of a station. Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-11wifi: nl80211: fix sending link ID info of associated BSSVeerendranath Jakkam1-1/+2
commit dd374f84baec ("wifi: nl80211: expose link ID for associated BSSes") used a top-level attribute to send link ID of the associated BSS in the nested attribute NL80211_ATTR_BSS. But since NL80211_ATTR_BSS is a nested attribute of the attributes defined in enum nl80211_bss, define a new attribute in enum nl80211_bss and use it for sending the link ID of the BSS. Fixes: dd374f84baec ("wifi: nl80211: expose link ID for associated BSSes") Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com> Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com> Link: https://lore.kernel.org/r/20220708122607.1836958-1-quic_vjakkam@quicinc.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-11wifi: nl80211: Fix reading NL80211_ATTR_MLO_LINK_ID in nl80211_pre_doitVeerendranath Jakkam1-1/+1
nl80211_pre_doit() using nla_get_u16() to read u8 attribute NL80211_ATTR_MLO_LINK_ID. Fix this by using nla_get_u8() to read NL80211_ATTR_MLO_LINK_ID attribute. Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com> Link: https://lore.kernel.org/r/1657517683-5724-1-git-send-email-quic_vjakkam@quicinc.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-01wifi: nl80211: retrieve EHT related elements in AP modeAloka Dixit1-2/+24
Add support to retrieve EHT capabilities and EHT operation elements passed by the userspace in the beacon template and store the pointers in struct cfg80211_ap_settings to be used by the drivers. Co-developed-by: Vikram Kandukuri <quic_vikram@quicinc.com> Signed-off-by: Vikram Kandukuri <quic_vikram@quicinc.com> Co-developed-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com> Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com> Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com> Link: https://lore.kernel.org/r/20220523064904.28523-1-quic_alokad@quicinc.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-01wifi: cfg80211: Increase akm_suites array size in cfg80211_crypto_settingsVeerendranath Jakkam1-1/+6
Increase akm_suites array size in struct cfg80211_crypto_settings to 10 and advertise the capability to userspace. This allows userspace to send more than two AKMs to driver in netlink commands such as NL80211_CMD_CONNECT. This capability is needed for implementing WPA3-Personal transition mode correctly with any driver that handles roaming internally. Currently, the possible AKMs for multi-AKM connect can include PSK, PSK-SHA-256, SAE, FT-PSK and FT-SAE. Since the count is already 5, increasing the akm_suites array size to 10 should be reasonable for future usecases. Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com> Link: https://lore.kernel.org/r/1653312358-12321-1-git-send-email-quic_vjakkam@quicinc.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-01wifi: nl80211: acquire wdev mutex earlier in start_apJohannes Berg1-12/+13
We need to hold the wdev mutex already in order to call nl80211_parse_tx_bitrate_mask(), so acquire it earlier. Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-01wifi: nl80211: hold wdev mutex for tid configJohannes Berg1-0/+3
We need wdev_chandef() in this code, which now requires the wdev mutex due to the per-link nature. Hold it here to make sure we can access the link. Reported-by: syzbot+b4e9aa0f32ffd9902442@syzkaller.appspotmail.com Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-01wifi: cfg80211: handle IBSS in channel switchJohannes Berg1-0/+3
Prior to commit 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs") the interface type didn't really matter here, but now we need to handle all of the possible cases. Add IBSS ("ADHOC") and handle it. Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs") Reported-by: syzbot+90d912872157e63589e4@syzkaller.appspotmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>