aboutsummaryrefslogtreecommitdiff
path: root/net/mac80211/ieee80211_i.h
AgeCommit message (Collapse)AuthorFilesLines
2022-10-10wifi: mac80211: fix MBSSID parsing use-after-freeGravatar Johannes Berg 1-0/+8
When we parse a multi-BSSID element, we might point some element pointers into the allocated nontransmitted_profile. However, we free this before returning, causing UAF when the relevant pointers in the parsed elements are accessed. Fix this by not allocating the scratch buffer separately but as part of the returned structure instead, that way, there are no lifetime issues with it. The scratch buffer introduction as part of the returned data here is taken from MLO feature work done by Ilan. This fixes CVE-2022-42719. Fixes: 5023b14cf4df ("mac80211: support profile split between elements") Co-developed-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Ilan Peer <ilan.peer@intel.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-09-06wifi: mac80211: implement link switchingGravatar Johannes Berg 1-0/+4
Implement an API function and debugfs file to switch active links. Also provide an async version of the API so drivers can call it in arbitrary contexts, e.g. while in the authorized callback. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-09-03wifi: mac80211: mlme: refactor QoS settings codeGravatar Johannes Berg 1-0/+1
Refactor the code to apply QoS settings to the driver so we can call it on link switch. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-09-03wifi: mac80211: move link code to a new fileGravatar Johannes Berg 1-3/+11
We probably should've done that originally, we already have about 300 lines of code there, and will add more. Move all the link code we wrote to a new file. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-09-03wifi: mac80211: remove unused arg to ieee80211_chandef_eht_operGravatar Johannes Berg 1-2/+1
We don't need the sdata argument, and it doesn't make any sense for a direct conversion from one value to another, so just remove the argument Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-08-26wifi: mac80211: correct SMPS mode in HE 6 GHz capabilityGravatar Johannes Berg 1-0/+1
If we add 6 GHz capability in MLO, we cannot use the SMPS mode from the deflink. Pass it separately instead since on a second link we don't even have a link data struct yet. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-08-25wifi: cfg80211/mac80211: check EHT capability size correctlyGravatar Johannes Berg 1-1/+5
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: mac80211: properly implement MLO key handlingGravatar Johannes Berg 1-0/+1
Implement key installation and lookup (on TX and RX) for MLO, so we can use multiple GTKs/IGTKs/BIGTKs. Co-authored-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-22wifi: mac80211: rx: track link in RX dataGravatar Johannes Berg 1-0/+1
We'll need the link e.g. for decrypt, and shouldn't be looking it up all the time later, so track it in the RX data. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-22wifi: mac80211: optionally implement MLO multicast TXGravatar Johannes Berg 1-0/+1
For drivers using software encryption for multicast TX, such as mac80211_hwsim, mac80211 needs to duplicate the multicast frames on each link, if MLO is enabled. Do this, but don't just make it dependent on the key but provide a separate flag for drivers to opt out of this. This is not very efficient, I expect that drivers will do it in firmware/hardware or at least with DMA engine assistence, so this is mostly for hwsim. To make this work, also implement the SNS11 sequence number space that an AP MLD shall have, and modify the API to the __ieee80211_subif_start_xmit() function to always require the link ID bits to be set. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-22wifi: mac80211: expand ieee80211_mgmt_tx() for MLOGravatar Johannes Berg 1-4/+4
There are a couple of new things that should be possible with MLO: * selecting the link to transmit to a station by link ID, which a previous patch added to the nl80211 API * selecting the link by frequency, similarly * allowing transmittion to an MLD without specifying any channel or link ID, with MLD addresses Enable these use cases. Also fix the address comparison in client mode to use the AP (MLD) address. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: support MLO authentication/association with one linkGravatar Johannes Berg 1-7/+25
It might seem a bit pointless to do a multi-link operation connection with just a single link, but this is already a big change, so for now, limit MLO connections to a single link. Extending that to multiple links will require * work on parsing the multi-link element with STA profile properly, including element fragmentation; * checking the per-link status in the multi-link element * implementing logic to have active/inactive links to let drivers decide which links should be active; * implementing multicast RX deduplication; * and likely more. For now this is still useful since it lets us do multi-link connections for the purposes of testing APIs and the higher layers such as wpa_supplicant. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: add API to parse multi-link elementGravatar Johannes Berg 1-0/+5
Add the necessary API to parse the multi-link element in the future. For now, link only to the element when found so we can use it in the client-side code later. Later, we'll need to fill this in to deal with element fragmentation, parse the STA profile, etc. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: move IEEE80211_SDATA_OPERATING_GMODE to linkGravatar Johannes Berg 1-2/+4
The flag here is currently per interface, but the way we set and clear it means it should be per link, so change it. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: Support multi link in ieee80211_recalc_min_chandef()Gravatar Andrei Otcheretianski 1-1/+2
Recalculate min channel context for the given or all interface links, depending on the caller. For a station state change, we need to recalculate all of them since we don't know which link (or multiple) it might be on. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: Allow EAPOL tx from specific linkGravatar Andrei Otcheretianski 1-0/+3
Allow link source address on TX. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: cfg80211/mac80211: Support control port TX from specific linkGravatar Andrei Otcheretianski 1-1/+1
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: mac80211: add a helper to fragment an elementGravatar Johannes Berg 1-0/+1
The way this works is that you add all the element data, keeping a pointer to the length field of the element. Then call this helper function, which will fragment the element if there was more than 255 bytes in the element, memmove()ing the data back if needed. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: use only channel width in ieee80211_parse_bitrates()Gravatar Johannes Berg 1-3/+9
For MLO, we may not have a full chandef here later, so change the API to pass only the width. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: fix multi-BSSID element parsingGravatar Johannes Berg 1-14/+8
When parsing a frame containing a multi-BSSID element, we need to know both the transmitted and non-transmitted BSSID so we can parse it correctly. Unfortunately, in quite a number of cases, we got this wrong and were passing the wrong BSSID or useless information: * the mgmt->bssid from a frame is only the transmitted BSSID if the frame is a beacon * passing just one of the parameters as non-NULL isn't useful and ignored In those case where we need to parse for a specific BSS we always have a BSS structure pointer, representing the BSS we need, whether transmitted or not. Thus, pass that pointer to the parsing function instead of the two BSSIDs. Also fix two bugs: * we need to re-parse all the elements for the other BSS when iterating the non-transmitted BSSes in scan * we need to parse for the correct BSS when setting up the channel data in client code Fixes: 78ac51f81532 ("mac80211: support multi-bssid") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: move tdls_chan_switch_prohibited to link dataGravatar Johannes Berg 1-1/+2
This value should be per link, since a TDLS connection is only established on a given link. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: refactor elements parsing with parameter structGravatar Johannes Berg 1-5/+45
Refactor the element parsing into a version that has a parameter struct so we can add more parameters more easily in the future. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: mlme: use ieee80211_get_link_sband()Gravatar Johannes Berg 1-0/+2
This requires a few more changes. While at it, also add a warning to ieee80211_get_sband() to avoid it being used when there are multiple links. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: split IEEE80211_STA_DISABLE_WMM to link dataGravatar Johannes Berg 1-1/+1
If we decide to stop tracking QoS/WMM parameters, then this should be a per-link decision. Move the flag to the link instead. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: mlme: first adjustments for MLOGravatar Johannes Berg 1-2/+2
Do the first adjustments in the client-side code to pass the link pointer (instead of sdata) to most places etc. This is just preparation, so the real MLO patches become smaller. Note that this isn't complete, notably there are still quite a few references to sta->deflink and sta->sta.deflink. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: mlme: do IEEE80211_STA_RESET_SIGNAL_AVE per linkGravatar Johannes Berg 1-1/+1
Remove the IEEE80211_STA_RESET_SIGNAL_AVE flag and use a bool instead, but invert the polarity (now calling it tracking_signal_avg) so we don't have to initialize it, and put that into the link instead. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: change QoS settings API to take link into accountGravatar Johannes Berg 1-2/+3
Take the link into account in the QoS settings (EDCA parameters) APIs. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: set up/tear down client vif links properlyGravatar Johannes Berg 1-0/+2
In station/client mode, the link data needs a bit more initialization and destruction than just zero-init and kfree() respectively, implement that. This required some shuffling of the link data handling in general, as we should set it up in setup and do the teardown in teardown, otherwise we're asymmetric in case of interface type changes. Also stop using kfree_rcu(), we cannot guarantee that nothing is scheduling things that live within the link (e.g. the u.mgd.request_smps_work) until we're sure it cannot be referenced anymore, therefore synchronize instead. This isn't very efficient, but we can always optimize it later. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: move ieee80211_request_smps_mgd_workGravatar Johannes Berg 1-1/+0
This function can be static. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: separate out connection downgrade flagsGravatar Johannes Berg 1-17/+21
Separate out the connection downgrade flags from the ifmgd->flags and put them into the link information instead. While at it, make them a separate sparse type so we don't get confused about where they belong and have static checking on correct handling. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: Align with Draft P802.11be_D1.5Gravatar Ilan Peer 1-0/+4
Align the mac80211 implementation with P802.11be_D1.5. Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: RCU-ify link/link_conf pointersGravatar Johannes Berg 1-10/+11
Since links can be added and removed dynamically, we need to somehow protect the sdata->link[] and vif->link_conf[] array pointers from disappearing when accessing them without locks. RCU-ify the pointers to achieve this, which requires quite a bit of rework. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: add an ieee80211_get_link_sbandGravatar Shaul Triebitz 1-0/+22
Similar to ieee80211_get_sband but get the sband of the link_conf. Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: Remove AP SMPS leftoversGravatar Andrei Otcheretianski 1-1/+0
AP SMPS was removed and not needed anymore. Remove the leftovers. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-15wifi: mac80211: rx: accept link-addressed framesGravatar Johannes Berg 1-0/+2
When checking whether or not to accept a frame in RX, take into account the configured link addresses. Also look up the link station correctly. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-01wifi: mac80211: add a per-PHY AQL limit to improve fairnessGravatar Felix Fietkau 1-0/+1
In order to maintain fairness, the amount of queueing needs to be limited beyond the simple per-station AQL budget, otherwise the driver can simply repeatedly do scheduling rounds until all queues that have not used their AQL budget become eligble. To be conservative, use the high AQL limit for the first txq and add half of the low AQL for each subsequent queue. Signed-off-by: Felix Fietkau <nbd@nbd.name> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk> Link: https://lore.kernel.org/r/20220625212411.36675-5-nbd@nbd.name Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-01wifi: mac80211: keep recently active tx queues in scheduling listGravatar Felix Fietkau 1-0/+7
This allows proper deficit accounting to ensure that they don't carry their deficit until the next time they become active Signed-off-by: Felix Fietkau <nbd@nbd.name> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk> Link: https://lore.kernel.org/r/20220625212411.36675-4-nbd@nbd.name Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-07-01wifi: mac80211: switch airtime fairness back to deficit round-robin schedulingGravatar Felix Fietkau 1-170/+12
This reverts commits 6a789ba679d652587532cec2a0e0274fda172f3b and 2433647bc8d983a543e7d31b41ca2de1c7e2c198. The virtual time scheduler code has a number of issues: - queues slowed down by hardware/firmware powersave handling were not properly handled. - on ath10k in push-pull mode, tx queues that the driver tries to pull from were starved, causing excessive latency - delay between tx enqueue and reported airtime use were causing excessively bursty tx behavior The bursty behavior may also be present on the round-robin scheduler, but there it is much easier to fix without introducing additional regressions Signed-off-by: Felix Fietkau <nbd@nbd.name> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk> Link: https://lore.kernel.org/r/20220625212411.36675-1-nbd@nbd.name Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: maintain link-sta hash tableGravatar Johannes Berg 1-0/+1
Maintain a hash table of link-sta addresses so we can find them for management frames etc. where addresses haven't been replaced by the drivers to the MLD address yet. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: RCU-ify link STA pointersGravatar Johannes Berg 1-15/+15
We need to be able to access these in a race-free way under traffic while adding/removing them, so RCU-ify the pointers. This requires passing a link_sta to a lot of functions so we don't have to do the RCU handling everywhere. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: move ieee80211_bssid_match() functionGravatar Johannes Berg 1-6/+0
This is only used in rx.c, so move it into the file. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: remove band from TX info in MLOGravatar Johannes Berg 1-17/+2
If the interface is an MLD, then we don't know which band the frame will be transmitted on, and we don't know how to look up the band. Set the band information to zero in that case, the driver cannot rely on it anyway. No longer inline ieee80211_tx_skb_tid() since it's even bigger now. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: add vif link addition/removalGravatar Johannes Berg 1-0/+3
Add the necessary infrastructure, including a new driver method, to add/remove links to/from an interface. Also add the missing link address to bss_conf (which we use as link_conf too), and fill it, in station mode for now just randomly, in AP mode we get the address from cfg80211 since the link must be created with an address first. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: status: look up band only where neededGravatar Johannes Berg 1-1/+0
For MLD, we might eventually not really know the band on status, but some code assumes it's there. Move the sband lookup deep to the code that actually needs it, to make it clear where exactly it's needed and for what purposes. For rate control, at least initially we won't support it in MLO, so that won't be an issue. For TX monitoring, we may have to elide the rate and/or rely on ieee80211_tx_status_ext() for rate information. This also simplifies the function prototypes. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: make ieee80211_he_cap_ie_to_sta_he_cap() MLO-awareGravatar Johannes Berg 1-1/+1
Add the link_id parameter and adjust the code accordingly. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: make some SMPS code MLD-awareGravatar Johannes Berg 1-1/+3
Start making some SMPS related code MLD-aware. This isn't really done yet, but again cuts down our 'deflink' reliance. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: HT: make ieee80211_ht_cap_ie_to_sta_ht_cap() MLO-awareGravatar Johannes Berg 1-1/+1
Update ieee80211_ht_cap_ie_to_sta_ht_cap() to handle per-link data. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: add link_id to eht.c code for MLOGravatar Johannes Berg 1-1/+2
Update the code in eht.c and add the link_id parameter where necessary. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: add link_id to vht.c code for MLOGravatar Johannes Berg 1-8/+10
Update the code in vht.c and add the link_id parameter where necessary. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: make channel context code MLO-awareGravatar Johannes Berg 1-23/+28
Make the channel context code MLO aware, along with some functions that it uses, so that the chan.c file is now MLD-clean and no longer uses deflink/bss_conf/etc. Signed-off-by: Johannes Berg <johannes.berg@intel.com>