aboutsummaryrefslogtreecommitdiff
path: root/sys/net80211
Commit message (Collapse)AuthorAgeFilesLines
* net80211: pass __func__, __LINE__ also to ieee80211_alloc_node()Bjoern A. Zeeb2023-10-061-7/+22
| | | | | | | | | Pass caller information to ieee80211_alloc_node() so that in case IEEE80211_DEBUG_REFCNT is compiled in we can (better) track references, in this case the initial ieee80211_node_initref(). Sponsored by: The FreeBSD Foundation MFC after: 3 days
* net80211: de-inline ieee80211_ref_node()Bjoern A. Zeeb2023-10-052-7/+18
| | | | | | | | | | | | | | Make ieee80211_ref_node() a macro so we can pass __func__, __LINE__ in for IEEE80211_DEBUG_REFCNT as we do for other refcount related functions. Add the appropriate IEEE80211_DPRINTF() call to the _ieee80211_ref_node() implementation to support wlandebug(8) +node printf style tracing. As a plus we can now also use Dtrace fbt on the _ieee80211_{ref,free}_node() implementations with futher logic, gathering backtraces, etc. more flexibly. Sponsored by: The FreeBSD Foundation X-MFC: never
* net80211: remove ieee80211_unref_node()Bjoern A. Zeeb2023-10-052-9/+2
| | | | | | | | | | | | | | ieee80211_unref_node() was only used in two error cases in ieee80211_send_nulldata(). There we do not need to guard against ni pointer reuse after decrementing the refcount of the ni as we only update the stats and return. Update the man page and remove the link for the now gone function. Sponsored by: The FreeBSD Foundation X-MFC: never Reviewed by: adrian, emaste Differential Revision: https://reviews.freebsd.org/D42035
* net80211: make ieee80211_alloc_node() privateBjoern A. Zeeb2023-10-022-4/+4
| | | | | | | | | | | | Looking through the allocation/free and reference cycle of nodes we have a few (publicly) (almost) unused macros and functions. Start making them private and reducing the amount of entry paths to the same/similar functionality. First is to make ieee80211_alloc_node() static as it is nowhere used in the tree outside this file. Sponsored by: The FreeBSD Foundation X-MFC: no
* net80211: improve ddb output for sta and rateBjoern A. Zeeb2023-10-021-0/+53
| | | | | | | | | | | | | Add more missing fields to the ddb output of sta (including spares so people will notice if they use them to adjust ddb as well). There are still more missing fields (some left as reminder in an uncompiled __notyet__ block). Add _db_show_rate() to print iv_rate as well optionally including function pointers. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* net80211: introduce two extra ieee80211_notify_scan_done()Bjoern A. Zeeb2023-09-211-2/+4
| | | | | | | | | | | | | | | | | | | | | We have multiple problems with scanning currently, one being that an initial scan restarts itself and we are unable to start another scan. wpa_supplicant in that case never shows scan results. Starting wpa_cli you may see: <3>CTRL-EVENT-SCAN-FAILED ret=-1 retry=1 messages. Add two extra calls to ieee80211_notify_scan_done() at the end of scans (before possible restarts). That will get wpa_supplicant to get scan results and possibly start associating to a BSSID and get us out of scan. This is kind-of a bandaid but on short notice may help to improve the situation for some. Based on analysis by: enweiwu Submitted by: enweiwu (initial version) Sponsored by: The FreeBSD Foundation MFC after: 3 days Tested by: cy, (others I cannot find email/PR for anymore) Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D38661
* net80211: improve scan debuggingBjoern A. Zeeb2023-09-143-9/+77
| | | | | | | | | | | | | | While debugging other problems I ran into the case where net80211 was thinking a scan was ongoing and new scans could not be started but given other logging there was clearly no more scan running. It was hard after the fact to quickly determine enough state to reconstruct or validate assumptions. Improve a MSG_SCAN debug logging and implement _db_show_scan() ddb output which can be printed along with show com /S or /a. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* net80211: mark argument to scan_curchan_task() __unusedBjoern A. Zeeb2023-09-141-1/+1
| | | | | | | | | | Mostly as documentation mark an unused argument to scan_curchan_task() as __unused. We may possibly want to check all callers in the future and see if the argument was supposed to be useful or should be entirely removed. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* net80211: fix ddb print alignmentBjoern A. Zeeb2023-09-111-2/+2
| | | | | | | | Add missing \ts after new lines to properly align output of ddb show commands. Sponsored by: The FreeBSD Foundation MFC after: 10 days
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1640-67/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-164-4/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-1629-58/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* net80211: Radiotap: add two more EHT definesBjoern A. Zeeb2023-08-071-0/+2
| | | | | | | An updated iwlwifi needs further radiotap updates for EHT. Sponsored by: The FreeBSD Foundation MFC after: 10 days
* net80211: Radiotap: update for definesBjoern A. Zeeb2023-05-201-5/+8
| | | | | | | | ath1xk drivers require further HE defines. Some of those we had already predicted as comments in the past. Sponsored by: The FreeBSD Foundation MFC after: 10 days
* net80211: Radiotap: update for newer standards (add EHT, U-SIG)Bjoern A. Zeeb2023-05-161-4/+128
| | | | | | | | | | iwlwifi already uses suggested EHT and U-SIG bits as well as some more TLV bits. Update radiotap to know of those even if they might get updated again in the future in order to get newer versions of the driver to compile. Sponsored by: The FreeBSD Foundation MFC after: 10 days
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1265-65/+65
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* net80211: Remove double words in source code commentsGordon Bergling2023-04-182-3/+3
| | | | | | - s/we we/we/ MFC after: 5 days
* net80211: fix a typo in Rx MCS set for unequal modulation caseMikhail Pchelin2023-04-141-1/+1
| | | | | | | | | | | | | | | | | RX MCS set defines which MCSs are supported for RX, bits 0-31 are for equal modulation of the streams, bits 33-76 are for unequal case. Current code checks txstreams variable instead of rxstreams to set bits from 53 to 76 for 4 spatial streams case. The modulations are defined in tables 19-38 and 19-41 of the IEEE Std 802.11-2020. Spotted by bz in https://reviews.freebsd.org/D39476 Reviewed by: bz Approved by: bz Sponsored by: Serenity Cybersecurity, LLC Differential Revision: https://reviews.freebsd.org/D39568
* net80211: wrong transmit MCS set in HT cap IEMikhail Pchelin2023-04-141-3/+3
| | | | | | | | | | | | | Current code checks whether or not txstreams are equal to rxstreams and if it isn't - sets needed bits in "Transmit MCS Set". But if they are equal it sets whole set to zero, which contradicts the standard, if tx and rx streams are equal 'Tx MCS Set Defined' (table 9-186, IEEE Std 802.11-2020) must be set to one. Reviewed by: bz Approved by: bz Sponsored by: Serenity Cybersecurity, LLC Differential Revision: https://reviews.freebsd.org/D39476
* net80211: fail for unicast traffic without unicast keydomienschepers2023-04-101-5/+11
| | | | | | | | | | | | | Falling back to the multicast key may cause unicast traffic to leak. Instead fail when no key is found. For more information see the 'Framing Frames: Bypassing Wi-Fi Encryption by Manipulating Transmit Queues' paper. [ I updated the commit message to reference the paper and the code comment to record historic behaviour as discussed in private email. ] Security: CVE-2022-47522
* net80211: make ieee80211_scan_dump_channels privateBjoern A. Zeeb2023-03-142-4/+2
| | | | | | | | | | | ieee80211_scan_dump_channels() is only used locally and only when IEEE80211_DEBUG is compiled. Stop exporting it, make it file local and hide under the #ifdef to reduce the footprint for production kernels a tiny bit. Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D38833
* net80211: define mask for ss_flags rather than using hardcoded 0xfffBjoern A. Zeeb2023-03-142-3/+3
| | | | | | | | | | | | | | | scan state ss_flags in two places cut off the "internal" GOTPICK options. Replace the hardcoded 0xfff with a defined mask. Note that "internal" flags is confusing as we also supplement the the 16bit by another 16bit of "internal flags" passed around but comaparing to GOTPICK never stored to my understanding. No functional change. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D38832
* net80211: ieee80211_swscan_bg_scan() track return variable under lockBjoern A. Zeeb2023-02-231-3/+5
| | | | | | | | | | | | | As the comment says it probably does not matter but use a local variable to track state under lock so we can return the last known good state of what we thought we were operating under after unlocking. Likely no functional changes. Sponsored by: The FreeBSD Foundation MFC atfer: 3 days Reviewed by: enweiwu, adrian Differential Revision: https://reviews.freebsd.org/D38660
* IfAPI: Explicitly include <net/if_private.h> in netstackJustin Hibbits2023-01-3114-3/+16
| | | | | | | | | | | Summary: In preparation of making if_t completely opaque outside of the netstack, explicitly include the header. <net/if_var.h> will stop including the header in the future. Sponsored by: Juniper Networks, Inc. Reviewed by: glebius, melifaro Differential Revision: https://reviews.freebsd.org/D38200
* iee80211_hwmp: Don't dereference NULL ni in debug printf.John Baldwin2022-12-211-2/+2
| | | | | | | | | | | | In this call to IEEE80211_NOTE, ni is always NULL due to the assignment a few lines earlier at the start of the function. If debug traces are enabled, then this will pass an invalid pointer as the 'mac' pointer to ieee80211_note_mac. Use IEEE80211_DPRINTF which doesn't take a 'ni' argument instead. Reported by: GCC -Wstringop-overread Reviewed by: bz, emaste Differential Revision: https://reviews.freebsd.org/D37626
* netlink: add interface notification on link status / flags change.Alexander V. Chernikov2022-12-093-5/+5
| | | | | | | | | | | | | | | | * Add link-state change notifications by subscribing to ifnet_link_event. In the Linux netlink model, link state is reported in 2 places: first is the IFLA_OPERSTATE, which stores state per RFC2863. The second is an IFF_LOWER_UP interface flag. As many applications rely on the latter, reserve 1 bit from if_flags, named as IFF_NETLINK_1. This flag is mapped to IFF_LOWER_UP in the netlink headers. This is done to avoid making applications think this flag is actually supported / presented in non-netlink outputs. * Add flag change notifications, by hooking into rt_ifmsg(). In the netlink model, notification should include the bitmask for the change flags. Update rt_ifmsg() to include such bitmask. Differential Revision: https://reviews.freebsd.org/D37597
* net80211: Fix mismatches in array bounds.John Baldwin2022-12-073-5/+6
| | | | | | Reported by: GCC -Warray-parameter Reviewed by: imp, emaste (earlier version) Differential Revision: https://reviews.freebsd.org/D37546
* net80211: fix IEEE80211_DEBUG_REFCNT buildsBjoern A. Zeeb2022-11-292-111/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the KPI/KBI changes from ieee80211_node.h and always use the macros to pass in __func__ and __LINE__ to the functions. The actual implementations are prefixed by "_" rather than suffixed by "_debug" as they no longer are "debug"-specific. Some of the select functions were not actually using the passed in func, line options; however they are calling other functions which use them. Directly call the internal implementation in those cases passing the arguments on. Use a file-local __debrefcnt_used define to mark the arguments __unused in cases when we compile without IEEE80211_DEBUG_REFCNT and hope the toolchain is intelligent enough to not pass them at all in those cases. Also _ieee80211_free_node() now has a conflict so make the previous _ieee80211_free_node() the new __ieee80211_free_node(). Add IEEE80211_DEBUG_REFCNT to the NOTES file on amd64 to keep exercising the option. Sponsored by: The FreeBSD Foundation X-MFC: never Discussed on: freebsd-wireless Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D37529
* net8021: Fix a typo in a kernel error messageGordon Bergling2022-10-251-1/+1
| | | | | | - s/missmatch/mismatch/ MFC after: 1 week
* net80211: move IEEE80211_F_WME check to vap for consistencyBjoern A. Zeeb2022-09-291-1/+1
| | | | | | | | | | | | The IEEE80211_F_WME checks done on the ic were changed to be per-vap back in the time when multi-bss was introduced or earlier in 2008. This one was left out but given it is a (re-)accos-req case I see no reason not to use the vap value here for consistency too. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D36733
* if_clone: migrate some consumers to the new KPI.Alexander V. Chernikov2022-09-221-8/+17
| | | | | | | | | Convert most of the cloner customers who require custom params to the new if_clone KPI. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D36636 MFC after: 2 weeks
* LinuxKPI: 80211 (+net80211): update and cleanup headersBjoern A. Zeeb2022-09-091-0/+6
| | | | | | | | | | | | | | | | | | | | | | Fix types for various struct fields (initially added as int). Move structs and inline functions logically together, e.g., for wowlan. Add more skeleton functions and #defines needed for iwlwifi d3.c in the future. Add struct ieee80211_vht_cap (without "_ie") to net80211 and remove duplicate definitions in LinuxKPI headers now using net80211 structs. For now leave ieee80211_ie_vhtcap in net80211. I am not sure yet if we actually need it as such. That'll be cleaned up with more VHT updates in net80211 in the future. No functional changes in currently compiled code intended. Try to implement ieee80211_action_contains_tpc() as I ran into it with an older iwlwifi chipset. This depends on c994352a8841eb453. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* net80211: update (parts of) Action field categoriesBjoern A. Zeeb2022-09-071-10/+59
| | | | | | | | | | | | | | Update to the full list of action field category values based on 802.11-2020 with 11ax extensions and remove one value Reserved nowadays. While here annotate them with descriptions. Also add Spectrum Management and Radio Measurement action field values needed in LinuxKPI. No functional changes. Sponsored by: The FreeBSD Foundation MFC after: 1 week
* net80211(4): Correct a grammar mistake in a source code commentGordon Bergling2022-09-071-1/+1
| | | | | | | | | - s/the/be the/ - s/Mhz/MHz/ - s/it'll/it will/ Reported by: bz, danfe MFC after: 3 days
* net80211(4): Remove a double word in a source code commentGordon Bergling2022-09-041-1/+1
| | | | | | - s/the the/the/ MFC after: 3 days
* net80211: update (parts of) frame types and subtypes and annotateBjoern A. Zeeb2022-09-031-43/+74
| | | | | | | | | | | | | | | | Update to the full list of frame type and subtype values based on 802.11-2020 with 11ax and 11ay extensions. This includes the 4th type "Extension" (IEEE80211_FC0_TYPE_EXT). While here annotate them with descriptions which should help matching names (as at times things get confusing with LinuxKPI). Also remove some 802.11-1997 values Reserved nowadays. No functional changes. Sponsored by: The FreeBSD Foundation MFC after: 5 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D36410
* net80211 / drivers: rename to IEEE80211_FC0_SUBTYPE_QOS_DATABjoern A. Zeeb2022-09-037-17/+17
| | | | | | | | | | | | | | Going through the Frame (Sub)types the "QOS Data" being called "QOS" scheme leads to a naming conflict for QOS_CFPOLL and QOS_CFACKPOLL (if added). Rename QOS* to QOS_DATA* to avoid the conflict and to also better match the standards name. No functional changes intended. Sponsored by: The FreeBSD Foundation MFC after: 5 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36409
* net80211: simplify an #ifdef INET/INET6 blockBjoern A. Zeeb2022-09-031-10/+17
| | | | | | | | | | | | | I got lost in the #ifdef #endif here so I changed the code to a switch block with two non-overlapping #ifdef parts and a default which makes it a lot easier to read. No functional changes. Sponsored by: The FreeBSD Foundation Reviewed by: (zlei.huang gmail.com) MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D36411
* mbufs: isolate max_linkhdr and max_protohdr handling in the mbuf codeGleb Smirnoff2022-08-301-6/+1
| | | | | | | | | | | | | | | | o Statically initialize max_linkhdr to default value without relying on domain(9) code doing that. o Statically initialize max_protohdr to a sane value, without relying on TCP being always compiled in. o Retire max_datalen. Set, but not used. o Don't make the domain(9) system responsible in validating these values and updating max_hdr. Instead provide KPI max_linkhdr_grow() and max_protohdr_grow(). o Call max_linkhdr_grow() from IEEE802.11 and max_protohdr_grow() from TCP. Those are the only protocols today that may want to grow. Reviewed by: tuexen Differential revision: https://reviews.freebsd.org/D36376
* net80211: LinuxKPI 802.11: harmonize IEEE80211_VHT_MCS_*Bjoern A. Zeeb2022-08-181-4/+8
| | | | | | | | | | | | Rather than defining the same values in two places and having to do conflict resulution on the name in LKPI, change the defines to an enum in net80211. In addition to de-duplication this also gives us value checks in certain cases. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D36250
* net80211: consistently use the IEEE80211_M_ memory related optionsBjoern A. Zeeb2022-08-1814-41/+43
| | | | | | | | | | | | | | Replace a malloc() by IEEE80211_MALLOC(). For malloc flags even in the local ieee80211_freebsd.c there was a mix of both versions M_ and IEEE80211_M_. Consistently use the IEEE80211_M_ malloc options everywhere. If the field is changed for malloc, it'll also be changed for the other accessor functions taking a "how" field to avoid any confusion. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D36249
* net80211: ieee80211_ies_expand() add extra length checkBjoern A. Zeeb2022-08-181-0/+8
| | | | | | | | | | | | Make sure the given IE length fits into the total length left when parsing through the information elements. In theory I would say discard everything if there is an error but that proves hard with the current code. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D36245
* net80211: add an IEEE80211_IS_PROTECTED() macroAdrian Chadd2022-08-148-11/+14
| | | | | | | | | | | | | | | Summary: This returns whether the given 802.11 frame has the protected bit set. Test Plan: * tested in AP/STA mode * STA mode - local athp/ath10k driver * AP mode - in tree ath driver Subscribers: imp, melifaro, glebius Reviewed by: bz Approved by: bz Differential Revision: https://reviews.freebsd.org/D36183
* net80211(4): Fix a typo in a source code commentGordon Bergling2022-08-071-1/+1
| | | | | | - s/paramaters/parameters/ MFC after: 3 days
* net80211: Remove tautological state displayCy Schubert2022-08-061-2/+2
| | | | | | | | | | When printing the current state name and the old state numeric value, both are always the same. Remove the redundant ostate. It is always the same as iv_state. Reviewed by: bz MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D35849
* net80211: change order in ieee80211_vhtchanflags()Bjoern A. Zeeb2022-07-291-2/+2
| | | | | | | | | | While 80P80 is less likely to be used, VHT160 (a single contiguous width) is harder to acquire but also preferable so return that first. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D35977
* net80211: VHT correct check/option in ieee80211_vht_adjust_channel()Bjoern A. Zeeb2022-07-291-3/+2
| | | | | | | | | | | | | | | | | In ieee80211_vht_adjust_channel() we have to check for all possible IEEE80211_FVHT_VHT* options using the mask rather than just checking for IEEE80211_FVHT_VHT; ieee80211_vhtchanflags() (contrary to its HT counterpart) only returns the "highest" flag nor or-ing them together with the base flag. For the moment this seems to make sense as with more width options we'd add a pyramid. Later on, in the same function when we get VHT160 actually go and look for VHT160 and not VHT80. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D35977
* net80211: add VHT5G and VHT2G checks/return to media_statusBjoern A. Zeeb2022-07-291-1/+5
| | | | | | | | | | Add the fields for VHT (2Ghz and 5Ghz) to report back by media_status so we actually have a chance to get the right information. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D35977
* net80211: improve DDB output.Bjoern A. Zeeb2022-07-291-3/+24
| | | | | | | | | | | Start adding more fields to DDB output related to VHT (11ac) and mark COM, VAP, and STA more explicitly to make show all vaps /.. more readable. Sponsored by: The FreeBSD Foundaton MFC after: 1 week Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D35977