Commit Graph

1374 Commits

Author SHA1 Message Date
Bjoern A. Zeeb
91b4225aa1 net80211: introduce (*iv_update_bss)()
Introduce (*iv_update_bss)() with a default implementation to allow
drivers to overload/intercept the time when we swap iv_bss.

This helps firmware based drivers to synchronize state with firmware.
Otherwise, for some state changes, we begin with one ni (and in
LinuxKPI lsta) and try to finish with another ni (and a new lsta
in different state) and may no longer have access to the previous state.
This also saves us from constantly checking for ni changes complicating
code.

No functional changes intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
X-MFC:		move (*iv_update_bss) to spare area
2022-03-22 18:51:43 +00:00
Bjoern A. Zeeb
453d1a90f8 net80211: improve one debug logging
When forcing DEUATH in ieee80211_sta_join1() log the current state
we are coming from as well.  Note this isn't always the state we
are expecting as iv_state was updated already, so contrary to the
comment we usually do not see RUN there.
Leave a comment earlier with regards to this as well.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-22 18:51:43 +00:00
Bjoern A. Zeeb
32cf376a01 net80211: enhance (disabled) debugging
Add maxchans to the disabled debugging in addchan() and copychan_prev()
to aid debugging possible errors rreturned due to reaching maxchans
limits.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-02-14 22:16:59 +00:00
Bjoern A. Zeeb
c3db9d4a14 net80211: ieee80211_dump_node() cosmetics
Printing %p does not need the 0x prefix and while here mark the
ieee80211_node_table argument unused given we do not need it in the
current incarnation of the function.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-01-17 00:01:46 +00:00
Bjoern A. Zeeb
2e59c9c7f0 net80211: adjust a printf to toeee80211_note
Throughout net80211 there are multiple ways to log (debugging)
information.  Start to clenaup one as I kept hitting it to harmonize
the output.  The more we get away from printfs into either wrapper
functions or macros the more likely we can use holistic systematic
tracing in the future.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-12-26 17:26:58 +00:00
Bjoern A. Zeeb
04efa18f83 net80211: add debugging information
Add more STATE / DEBUG probes and enhance the output of one in order
to track state changes triggered by "ack" (or not).
This helped to narrow down causes from drivers or the LinuxKPI 802.11
compat framework which kept us in a scan -> auth -> scan loop.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-12-26 17:25:57 +00:00
Bjoern A. Zeeb
04435a1b14 net80211: format debug functions as single line
Making use of the debug output was hard given debug lines were run in
parts through vlog (if_printf) and in (multiple) parts through printf(s).

Like some of the functions alreay have, use a local buffer to format
the string and then use a single if_printf;  in addition given these
functions are debug-only, add an extra printf in case we find our
buffers still to be too small so we can adjust for the future.
We already found that 128 characters are to short for some log messages.
Bump the buffer sizes collectively to 256 characters which also is
the maximum of if_vlog() so getting longer would need further changes
elsewhere.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-12-26 17:24:04 +00:00
Bjoern A. Zeeb
e51b46cefb net80211: fix debug printf
We are printing %p in _db_show_sta(), there is no need to prefix it
with 0x again to get a 0x0x...

Spsonsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-12-23 15:21:32 +00:00
Gordon Bergling
a9beea0511 net80211(4): Fix a typo in a sysctl description
- s/travelse/traversal/

MFC after:	3 days
2021-12-04 12:09:17 +01:00
Bjoern A. Zeeb
05ea7a3e5e net80211: fix -Wunused-but-set-variable warnings
Put the offending variables under the appropriate #ifdefs
(mostly IEEE80211_DEBUG, in one case IEEE80211_SUPPORT_SUPERG, and
in two cases under __notyet__ to revisit why these had been left
there but not used).

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2021-11-24 17:39:19 +00:00
Bjoern A. Zeeb
f7c526ab3f net80211: radiotap add another define
Add a define needed by latest iwlwifi-next.

Sponsored by:	The FreeBSD Foundation
2021-11-18 14:59:04 +00:00
Bjoern A. Zeeb
917181dddf net80211: add a driver-private pointer to struct ieee80211_node
Add a void *ni_drv_data field to struct ieee80211_node that drivers
can use to backtrack to their internal state from a net80211 node.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
X-Differential Revision: https://reviews.freebsd.org/D30654 (abandoned)
2021-10-31 19:08:28 +00:00
Bjoern A. Zeeb
3dc7a1897e net80211: correct input_sta length checks and control frame handling
Correct input_sta "assertion" checks.  CTS/ACK CTRL frames are shorter
then sizeof(struct ieee80211_frame_min) and were thus running into the
is_rx_tooshort error case.
Use ieee80211_anyhdrsize() to handle this better but make sure we do
at least have the first 2 octets needed for that.
While here move the safety checks before any code which may not obey
them later, just for good style.

The non-scanning check further down assumes a frame format also not
matching control frames.  For now skip the checks for control frames
which allows us to deal with some of them at least now.

Sponsored by:	The FreeBSD Foundation
Obtained from:	20210906 wireless v0.91 code drop
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D32238
2021-10-22 10:42:06 +00:00
Bjoern A. Zeeb
9a6695532b net80211/drivers: improve ieee80211_rx_stats for band
While IEEE80211_R_BAND was defined, there was no place to store the
band.  Add a field for that, adjust ieee80211_lookup_channel_rxstatus()
to require it, and update drivers passing "R_{FREQ|IEEE}" in already to
provide the band as well.  For the moment keep the fall-back code
requiring all three fields.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D30662
2021-10-22 09:55:54 +00:00
Bjoern A. Zeeb
0525ece355 net80211: fix build for 526370fb85
In 526370fb85 "net80211: proper ssid
length check in setmlme_assoc_adhoc()" we are checking the
sizeof on an array function parameter which leads to a warning that
it will resturn the size of the type of the array rather than the
array size itself.  Use the defined length used both in the ioctl
and the sizing of the array function parameter instead.

Reported by:	CI
MFC after:	3 days
X-MFC with:	526370fb85
2021-10-08 11:21:44 +00:00
Bjoern A. Zeeb
09dd08f167 net80211: correct length check in ieee80211_ies_expand()
In ieee80211_ies_expand() we are looping over Elements
(also known as Information Elements or IEs).
The comment suggests that we assume well-formedness of
the IEs themselves.
Checking the buffer length being least 2 (1 byte Element ID and
1 byte Length fields) rather than just 1 before accessing ie[1]
is still good practise and can prevent and out-of-bounds read in
case the input is not behaving according to the comment.

Reported by:	(coypu sdf.org)
admbugs:	857
MFC after:	3 days
Reviewed by:	adrian, markj
Differential Revision: https://reviews.freebsd.org/D32340
2021-10-08 10:26:22 +00:00
Bjoern A. Zeeb
526370fb85 net80211: proper ssid length check in setmlme_assoc_adhoc()
A user supplied SSID length is used without proper checks in
setmlme_assoc_adhoc() which can lead to copies beyond the end
of the user supplied buffer.
The ssid is a fixed size array for the ioctl and the argument
to setmlme_assoc_adhoc().
In addition to an ssid_len check of 0 also error in case the
ssid_len is larger than the size of the ssid array to prevent
problems.

PR:		254737
Reported by:	Tommaso (cutesmilee.research protonmail.com)
MFC after:	3 days
Reviewed by:	emaste, adrian
Differential Revision: https://reviews.freebsd.org/D32341
2021-10-08 10:23:31 +00:00
Mathy Vanhoef
ffc19cf52d net80211: prevent plaintext injection by A-MSDU RFC1042/EAPOL frames
No longer accept plaintext A-MSDU frames that start with an RFC1042
header with EtherType EAPOL.  This is done by only accepting EAPOL
packets that are included in non-aggregated 802.11 frames.

Note that before this patch, FreeBSD also only accepted EAPOL frames
that are sent in a non-aggregated 802.11 frame due to bugs in
processing EAPOL packets inside A-MSDUs. In other words,
compatibility with legitimate devices remains the same.

This relates to section 6.5 in the 2021 Usenix "FragAttacks" (Fragment
and Forge: Breaking Wi-Fi Through Frame Aggregation and Fragmentation)
paper.

Submitted by:	Mathy Vanhoef (Mathy.Vanhoef kuleuven.be)
Security:	CVE-2020-26144
PR:		256120
MFC after:	7 days
Differential Revision: https://reviews.freebsd.org/D30665
2021-09-30 14:54:04 +00:00
Mathy Vanhoef
f024bdf115 net80211: mitigation against A-MSDU design flaw
Mitigate A-MSDU injection attacks by detecting if the destination address
of a subframe equals an RFC1042 (i.e., LLC/SNAP) header, and if so
dropping the complete A-MSDU frame.  This mitigates known attacks,
although new (unknown) aggregation-based attacks may remain possible.

This defense works because in A-MSDU aggregation injection attacks, a
normal encrypted Wi-Fi frame is turned into an A-MSDU frame. This means
the first 6 bytes of the first A-MSDU subframe correspond to an RFC1042
header. In other words, the destination MAC address of the first A-MSDU
subframe contains the start of an RFC1042 header during an aggregation
attack. We can detect this and thereby prevent this specific attack.

This relates to section 7.2 in the 2021 Usenix "FragAttacks" (Fragment
and Forge: Breaking Wi-Fi Through Frame Aggregation and Fragmentation)
paper.

Submitted by:	Mathy Vanhoef (Mathy.Vanhoef kuleuven.be)
Security:	CVE-2020-24588
PR:		256119
Differential Revision: https://reviews.freebsd.org/D30664
2021-09-30 14:50:45 +00:00
Mathy Vanhoef
11572d7d7f net80211: reject mixed plaintext/encrypted fragments
ieee80211_defrag() accepts fragmented 802.11 frames in a protected Wi-Fi
network even when some of the fragments are not encrypted.
Track whether the fragments are encrypted or not and only accept
successive ones if they match the state of the first fragment.

This relates to section 6.3 in the 2021 Usenix "FragAttacks" (Fragment
and Forge: Breaking Wi-Fi Through Frame Aggregation and Fragmentation)
paper.

Submitted by:	Mathy Vanhoef (Mathy.Vanhoef kuleuven.be)
Security:	CVE-2020-26147
PR:		256118
Differential Revision: https://reviews.freebsd.org/D30663
2021-09-30 14:47:41 +00:00
Gordon Bergling
2ec4c3c7f3 net80211(4): Fix a few common typos in source code comments
- s/annoucement/announcement/
- s/setings/settings/

MFC after:	1 week
2021-09-25 13:57:41 +02:00
Bjoern A. Zeeb
cb5c07649a net80211: add func/line information to IEEE80211_DISCARD* macros
While debugging is very good in net80211, some log messages are
repeated in multiple places 1:1.  In order to distinguish where the
discard happened and to speed up analysis, add __func__:__LINE__
information to all these messages.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-09-04 09:24:51 +00:00
Bjoern A. Zeeb
49c220b021 net80211: comments and whitespace
Add a missing '.', fix spelling of "failed" and unwrap a closing );
No functional changes.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-09-04 09:16:25 +00:00
Ed Maste
9feff969a0 Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights
These ones were unambiguous cases where the Foundation was the only
listed copyright holder (in the associated license block).

Sponsored by:	The FreeBSD Foundation
2021-08-08 10:42:24 -04:00
Bjoern A. Zeeb
243b95978d net80211: ieee80211_probereq_ie fix length calculation for hw scans
c338cf2c6d split up ieee80211_probereq_ie().
For HW scans we usually do not want to add a SSID to the IEs.
During that split we allocate memory based on the length which will
always include the length of the SSID and only later we reduced the
length but never updated the value passed back to the caller.
Split the SSID handling up and reduce the length before malloc().
This not only makes us not over-allocate in these situatoins but also
fixes the length returned to the caller and with that usually directly
passed to firmware.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D30813
2021-06-28 12:17:11 +00:00
Bjoern A. Zeeb
b5d37e5a20 net80211/LinuxKPI: add more radiotap definitions
Add more raditap definitions based on "names" found in actual drivers
and based on documentation from radiotap.org (where avail).

Leave one specific "duplicate" in the LinuxKPI implementation but
otherwise manage it all in net80211.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	hselasky, adrian, sam
Differential Revision: https://reviews.freebsd.org/D30641
2021-06-05 16:21:49 +00:00
Bjoern A. Zeeb
af7d9f8e31 net80211: prefix get_random_bytes() with net80211_
Both linux/random.h and net80211 have a function named
get_random_bytes().  With overlapping files included these collide.
Arguably the function could be renamed in linuxkpi but the generic
name should also not be used in net80211 so rename it there.

Sponsored-by:	The FreeBSD Foundation
MFC-after:	2 weeks
Reviewed-by:	philip, adrian
Differential Revision:	https://reviews.freebsd.org/D29335
2021-03-24 22:16:09 +00:00
Bjoern A. Zeeb
c338cf2c6d net80211: split up ieee80211_probereq()
Factor out ieee80211_probereq_ie() and ieee80211_probereq_ie_len()
and make the length dynamic rather than static max.  The latter is
needed as our current fixed length was longer than some "hw scan",
e.g. that of ath10k, will take.  This way we can pass what we have.
Should this not be sufficient in the future we might have to deal
with filtering and much more error handling.

This also removes a duplicate calculation for ieee80211_ie_wpa [1].

Repoprted-by:	Martin Husemann <martin NetBSD.org> [1]
Sponsored-by:	Rubicon Communications, LLC ("Netgate")
Sponsored-by:	The FreeBSD Foundation (update for alloc)
Reviewed-by:	adrian, martin NetBSD.org (earlier version)
Reviewed-by:	philip
MFC-after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D26545
2021-03-18 11:02:45 +00:00
Gordon Bergling
d197bf2b20 net80211: Fix a typo in a comment
- destionation -> destination
- while here, fix some whitespace issues

MFC after:	1 week
2021-03-13 15:51:30 +01:00
Bjoern A. Zeeb
3fca90af43 net80211: ratectl header guard against multiple inclusions
Add missing #ifndef/#define/#endif guards against multiple inclusions
to ieee80211_ratectl.h as they are missing.

MFC after:	3 days
Sponsored-by:	Rubicon Communications, LLC ("Netgate")
2021-03-07 17:35:58 +00:00
Bjoern A. Zeeb
a9cc796fa7 net80211: rx_stats add 160Mhz channel width.
Add the missing receive stat(u)s flag for 160Mhz channel width.
While here correct the comment for c_phytype to reference the correct
flags.

MFC-after:	3 days
Sponsored-by:	Rubicon Communications, LLC ("Netgate")
2021-02-28 19:24:22 +00:00
Bjoern A. Zeeb
60ec31e93f net80211: fix a typo
Correct a typo referring to the wrong flags in a comment.
No functional changes.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
2020-11-04 12:07:33 +00:00
Bjoern A. Zeeb
01e579408b net80211: factor out the priv(9) checks into OS specifc code.
Factor out the priv(9) checks into OS specifc code so other OSes can equally
implement them.  This sorts out those XXX in the net80211 code.
We provide 3 arguments (cmd, vap, ifp) where available to the functions, in
order to allow other OSes to use that data but also in case we'd add auditing
to these check to have the information available. For now the arguments are
marked __unused.

PR:		249403
Reported by:	martin(NetBSD)
Reviewed by:	adrian, martin(NetBSD)
MFC after:	10 days
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision:	https://reviews.freebsd.org/D26541
2020-10-18 21:34:04 +00:00
Bjoern A. Zeeb
04e7bb08a5 net80211: update for (more) VHT160 support
Implement two macros IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ()
and its 80+80 counter part to check in vhtcaps for appropriate
levels of support and use the macros throughout the code.

Add vht160_chan_ranges/is_vht160_valid_freq and handle analogue
to vht80 in various parts of the code.

Add ieee80211_add_channel_cbw() which also takes the CBW flag
fields and make the former ieee80211_add_channel() a wrapper to it.
With the CBW flags we can add HT/VHT channels passing them to
getflags() for the 2/5ghz functions.

In ifconfig(8) add the regdomain_addchans() support for VHT160
and VHT80P80.

With this (+ regdoain.xml updates) VHT160 channels can be
configured, listed, and pass regdomain where appropriate.

Tested with:	iwlwifi
Reviewed by:	adrian
MFC after:	10 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D26712
2020-10-18 00:27:20 +00:00
Bjoern A. Zeeb
5152b4f74f net80211: whitespace
Fix indentation for the multi-line copies of
ieee80211_add_channel_list_5ghz() for the 3 bands.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-10-07 22:52:24 +00:00
Bjoern A. Zeeb
1e375f3aa7 80211: non-functional changes
Sort a few VHT160 and 80+80 lines, update some comments, and remove
a superfluous ','.

No functional changes intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-10-07 21:56:58 +00:00
Bjoern A. Zeeb
fe5ebb23cc Provide MS() and SM() macros for 80211 and wireless drivers.
We have (two versions) of MS() and SM() macros which we use throughout
the wireless code.  Change all but three places (ath_hal, rtwn, and rsu)
to the newly provided _IEEE80211_MASKSHIFT() and _IEEE80211_SHIFTMASK()
macros.  Also change one internal case using both _S and _M instead of
just _S away from _M (one of the reasons rtwn and rsu were not changed).

This was done semi-mechanically.  No functional changes intended.

Requested by:	gnn (D26091)
Reviewed by:	adrian (pre line wrap)
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision:	https://reviews.freebsd.org/D26539
2020-09-24 10:57:39 +00:00
Mateusz Guzik
662c13053f net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
Bjoern A. Zeeb
2b9f12f6b2 net80211: enhance getflags*() and ieee80211_add_channel*()
For ieee80211_add_channel+*() we are passing in an int flag for
ht40 and in some cases another int flag for vht80 where we'd only
need two bits really.
Convert these variables to a bitflag and fold them together into one.
This also allows for VHT160 and VHT80P80 and whatever may come to
be considered. Define the various options currently needed.

Change the drivers (rtwn and rsu) which actually set this bit to non-0.
For convenience the "1" currently used for HT40 is preserved.

Enahnce getflags_5ghz() to handle the full set of VHT flags based
on the input flags from the the driver.

Update the regdomain implementation as well to make use of the new
flags and deal with higher [V]HT bandwidths.

ieee80211_add_channel() specifically did not take flags so it will
not support naything beyond 20Mhz channels.

Note: I am not entirely happy with the "cbw_flag[s]" name, but we
do use chan_flags elsewhere already.

MFC after:	2 weeks
Reviewed by:	adrian, gnn
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
Differential revision:	https://reviews.freebsd.org/D26091
2020-08-24 13:15:08 +00:00
Bjoern A. Zeeb
8f32e493cc net80211: improve media information for VHT5GHZ
Improve ieee80211_media_setup(), media2mode(), and
ieee80211_rate2media() for VHT5GHZ at least.

Reviewed by:	adrian, gnn
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision:	https://reviews.freebsd.org/D26089
2020-08-23 21:42:23 +00:00
Bjoern A. Zeeb
30fdd33ca3 net80211: set_vht_extchan() reverse order to always return best
In set_vht_extchan() the checks are performed in the order of VHT20/40/80.
That means if a channel has a lower and higheer VHT flag set we would
return the lower first.
We normally do not set more than one VHT flag so this change is supposed
to be a NOP but follows the logical thinking order of returning the best
first. Also we nowhere assert a single VHT flag so make sure we'll not
be stuck with VHT20 when we could do more.

While here add the debugging printfs for VHT160 and VHT80P80 which still
need doing once we deal with a driver at that level.

Reviewed by:	adrian, gnn
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision:	https://reviews.freebsd.org/D26088
2020-08-23 21:37:20 +00:00
Bjoern A. Zeeb
976485968e net80211: replace magic number by define
Rather than coding an array size of [4] replace the number with
WME_NUM_AC.

MFC after:	2 weeks
Reviewed by:	adrian
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision:	https://reviews.freebsd.org/D26090
2020-08-17 20:18:01 +00:00
Bjoern A. Zeeb
97d9ee18a9 net80211: VHT correct NSS Set loop boundary
For the <VHT-MCS, NSS> tuple, NSS is 1..8 (or in our loop case 0..7
but not 0..6). Correct the boundry to check for < 8 and not < 7.

MFC after:	2 weeks
Reviewed by:	adrian
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision:	https://reviews.freebsd.org/D26087
2020-08-17 20:16:33 +00:00
Bjoern A. Zeeb
a666b24ea5 net80211: return 80P80 before 160
In ieee80211_vht_get_chwidth_ie() we need to return 80P80 (3) before
VHT160 (2) as otherwise we'll never use 80P80.  Fix the order.

MFC after:	2 weeks
X-MFC with:	r364303 (which missed this)
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
2020-08-17 16:51:21 +00:00
Bjoern A. Zeeb
372c7b9504 net80211: remove vertical whitespace
No functional changes.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
2020-08-17 16:28:59 +00:00
Bjoern A. Zeeb
4b1c248795 80211: consistently order 160 and 80+80
For flags and checks the order goes VHT160 and then VHT80P80 unless
checks are in reverse order ("more comes first") in which case we
deal with VHT80P80 first.
The one reverse order to pick out is where we check channel
prefernences.  While it may seem that VHT160 is better, finding
two "free" channels (VHT 80+80) is more likely so we do prefer that.

While dealing with VHT160 and VHT80P80 add extra clauses previously
missing or marked TODO in a few places.

Reviewed by:	adrian, gnn
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision:	https://reviews.freebsd.org/D26002
2020-08-17 13:04:18 +00:00
Bjoern A. Zeeb
fd6eb8fec7 80211: consistently spell 80P80
The standard uses 80+80 and 80p80 but nowhere 80_80.
Switch the latter to 80P80 for all the macros and comments refering
to #defined flags which I could find.
The only place we leave as 80p80 is the ifconfig command line arguments
as we spell them all in lower case.
Ideally we would use 80+80 for any interactions with the user and
80P80 for anything internal but let us not confuse parsers and
hence avoid the '+' in either case.

Reviewed by:	adrian, gnn
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision:	https://reviews.freebsd.org/D26001
2020-08-17 12:52:57 +00:00
Bjoern A. Zeeb
96811be22f net80211 / ifconfig: cleanup the use of IEEE80211_FVHT_USEVHT*
Rather then using magic numbers duplicate IEEE80211_FVHT_VHT* in
ifconfig (cleanup of these and other flags used and not exposed by
net80211 should happen later) and use those.
In the kernel this simplifies one ioctl path (the other one currently
relies on individual bit flags being passed in).
We also re-order the 80P80 and 160 flag for 160 to come before 80+80
and more clearly leave the flags as TODO in one of the 160/80+80 cases.

Reviewed by:	adrian
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision:	https://reviews.freebsd.org/D26000
2020-08-17 12:43:07 +00:00
Bjoern A. Zeeb
7d1d4407f5 net80211/ifconfig: print hardware device name for wlan interfaces
Add IEEE80211_IOC_IC_NAME to query the ic_name field and in ifconfig
to print the parent interface again. This functionality was lost
around r287197. It helps in case of multiple wlan interfaces and
multiple underlying hardware devices to keep track which wlan
interface belongs to which physical device.

Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
Reviewed by:	adrian, Idwer Vollering
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D25832
2020-08-07 12:24:23 +00:00
Adrian Chadd
f7d38a13a8 [net80211] Add new privileges; restrict what can be done in a jail.
Split the MANAGE privilege into MANAGE, SETMAC and CREATE_VAP.

+ VAP_MANAGE is everything but setting the MAC and creating a VAP.
+ VAP_SETMAC is setting the MAC address of the VAP.
  Typically you wouldn't want the jail to be able to modify this.
+ CREATE_VAP is to create a new VAP. Again, you don't want to be doing
  this in a jail, but this DOES stop being able to run some corner
  cases like Dynamic WDS (DWDS) AP in a jail/vnet. We can figure this
  bit out later.

This allows me to run wpa_supplicant in a jail after transferring
a STA VAP into it. I unfortunately can't currently set the wlan
debugging inside the jail; that would be super useful!

Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D25630
2020-07-19 15:16:27 +00:00