History log of /src/sys/net80211/ieee80211_ioctl.c (Results 1 – 25 of 735)
Revision Date Author Comments
# 674362e2 01-Jun-2025 Adrian Chadd <adrian@FreeBSD.org>

net80211: migrate direct printf() to net80211_printf()

Mechanically migrate printf() -> net80211_printf().
A few places looked like they should be using net80211_vap_printf(),
so migrate those appro

net80211: migrate direct printf() to net80211_printf()

Mechanically migrate printf() -> net80211_printf().
A few places looked like they should be using net80211_vap_printf(),
so migrate those appropriately.

Differential Revision: https://reviews.freebsd.org/D50644
Reviewed by: bz

show more ...


# 32af70fa 24-May-2025 Bjoern A. Zeeb <bz@FreeBSD.org>

net80211: make sure to not start a BGSCAN if not enabled

On drivers not supporting background scanning (not having announced
IEEE80211_C_BGSCAN) we repeatedly have seen scanning issues and
BGSCAN wa

net80211: make sure to not start a BGSCAN if not enabled

On drivers not supporting background scanning (not having announced
IEEE80211_C_BGSCAN) we repeatedly have seen scanning issues and
BGSCAN was "on" according to, e.g., ddb show com /a.

Turns out there are multiple problems:
(a) the ioctl scanreq code can pass IEEE80211_[IOC_]SCAN_BGSCAN in
(ifconfig wlanX scan will do so by default). That flag ends up
on flags in the scanning code which have no other checks, and
we are doing a BGSCAN.
So make sure BGSCAN is announced by the driver and enabled
(and it's STA mode for the full check) or filter the BGSCAN out.

(b) ieee80211_bg_scan() never checked if background scanning was
available/enabled. Do so now.

(c) ieee80211_swscan_start_scan_locked() as a consequence of (a) would
start the BGSCAN unconditionally. Also check for BGSCAN to be
available/enabled here.

Lastly, we should no longer reach ieee80211_swscan_bg_scan() without
background scanning being available/enabled, so document that fact
by placing a KASSERT. That will also help in case future changes
will open a new hole or there are further which I have not noticed.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D50513

show more ...


# a278d11a 18-May-2025 Adrian Chadd <adrian@FreeBSD.org>

net80211: refactor out ifp->if_broadcastaddr into ieee80211_freebsd.c

* create ieee80211_vap_get_broadcast_address() to fetch the broadcast
MAC address for the given VAP
* refactor references to i

net80211: refactor out ifp->if_broadcastaddr into ieee80211_freebsd.c

* create ieee80211_vap_get_broadcast_address() to fetch the broadcast
MAC address for the given VAP
* refactor references to ifp->if_broadcastaddr ->
ieee80211_vap_get_broadcast_address()

Differential Revision: https://reviews.freebsd.org/D50406
Reviewed by: bz

show more ...


# ed987e16 18-May-2025 Adrian Chadd <adrian@FreeBSD.org>

net80211: migrate if_flags, if_drvflags out of most source files

Migrate both if_flags and if_drvflags out of most source files.
Ideally it'd only be referenced in ieee80211_freebsd.c, but for now
i

net80211: migrate if_flags, if_drvflags out of most source files

Migrate both if_flags and if_drvflags out of most source files.
Ideally it'd only be referenced in ieee80211_freebsd.c, but for now
it also ignores references in ieee80211_ioctl.c.

* migrate if_flags set to if_setflags
* migrate if_flags get to if_getflags
* migrate if_drvflags get to if_getdrvflags
* add ieee80211_vap_ifp_check_is_monitor() and
ieee8021_vap_ifp_check_is_simplex() to abstract out the IFF_MONITOR
and IFF_SIMPLEX flag checks.
* add ieee80211_vap_ifp_check_is_running() and
ieee80211_vap_ifp_set_running_state() to represent what IFF_DRV_RUNNING
means (ie, mark the underlying OS network interface as active and
inactive.)

Notably this doesn't yet clear up OACTIVE; I need to better describe
that.

Differential Revision: https://reviews.freebsd.org/D50405
Reviewed by: bz

show more ...


# e035e866 25-Apr-2025 Adrian Chadd <adrian@FreeBSD.org>

net80211: move references to IF_LLADDR() into ieee80211_freebsd.c

* Move references to IF_LLADDR() into ieee80211_freebsd.c
* Add a comment on one that I need to verify before I move it
* Implement

net80211: move references to IF_LLADDR() into ieee80211_freebsd.c

* Move references to IF_LLADDR() into ieee80211_freebsd.c
* Add a comment on one that I need to verify before I move it
* Implement ieee80211_vap_sync_mac_address() which syncs the VAP
mac address from the network interface MAC address.
This uses FreeBSD-isms (network epoch, IF_LLADDR()) so it shouldn't
be in net80211 itself.

Differential Revision: https://reviews.freebsd.org/D50023

show more ...


# aff56b4f 16-Apr-2025 Bjoern A. Zeeb <bz@FreeBSD.org>

net80211: fix a race between ieee80211_sta_join and scan entries

We were seeing panics during ieee80211_sta_join() which seemed that
the ni->ni_chan was not valid anymore, which was true.
We also sa

net80211: fix a race between ieee80211_sta_join and scan entries

We were seeing panics during ieee80211_sta_join() which seemed that
the ni->ni_chan was not valid anymore, which was true.
We also saw errors indicating data put into ni_ies became inalid.

The problem was that the ieee80211_scan_entry passed into
ieee80211_sta_join() (in the observed case from setmlme_assoc_sta())
became invalid during ieee80211_alloc_node().
As a result for the ni_chan case the the rateset and len in rates[1]
became invalid. Similarly for the IEs.

Make a (deep)copy of the scan entry in setmlme_assoc_sta() and return
the copy as once we leave ieee80211_scan_iterate() we can no longer
rely on the scan entry to be valid.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reported by: rm, ziaee, bz
Tested by: rm, ziaee, bz
PR: 286063
Reviewed by: adrian (,emaste)
Differential Revision: https://reviews.freebsd.org/D49865

show more ...


# 17e8437e 17-Jan-2025 Adrian Chadd <adrian@FreeBSD.org>

net80211: update get_sta_info() to only populate isi_txrate for legacy rates

The isi_txrate field is 8 bits and only represents legacy/HT rates.
So to avoid logging a warning, only populate if it's

net80211: update get_sta_info() to only populate isi_txrate for legacy rates

The isi_txrate field is 8 bits and only represents legacy/HT rates.
So to avoid logging a warning, only populate if it's a legacy/HT
rate.

Differential Revision: https://reviews.freebsd.org/D48616

show more ...


# 38075f7d 02-Jan-2025 Adrian Chadd <adrian@FreeBSD.org>

net80211: remove direct use of ni->ni_txrate, add indirection methods

The summary:

* Refactor ni_txrate access into ieee80211_node_get_txrate_dot11rate()
and ieee80211_node_set_txrate_dot11rate()

net80211: remove direct use of ni->ni_txrate, add indirection methods

The summary:

* Refactor ni_txrate access into ieee80211_node_get_txrate_dot11rate()
and ieee80211_node_set_txrate_dot11rate(). These wrap the ni->ni_txrate
access and will eventually be able to do runtime sanity checks and
fallback where necessary.

* Refactor ieee80211_node_get_txrate_kbit() from the ioctl code which
sets isi_txmbps (which is in 0.5Mbit/s units.) This new routine
returns the TX rate in kbit/s units.

* Also use ieee80211_node_get_txrate_kbit() in various places in the
code where the dot11rate was turned into a Mbit/sec value, which was
very wrong for HT (but also only used for logging, so it didn't
have an effect on normal runtime.)

* Mb -> Mbit/s

The long version:

The current ni->ni_txrate value is what net80211's phy code
calls a 'dot11rate'. Inside the ieee80211_phy.c tables you'll
find a bunch of tables which represent:

* for legacy rates its in 1/2 mbit units.
* for turbo (Atheros 40MHz OFDM) it's the non-turbo rates, but the
turbo rate speed in kbit/sec.
* for 802.11n rates its the MCS, starting at 0x80.

However there are a couple of catches with this:

* Basic rates are represented in the pre-11n rates using the high bit
(IEEE80211_RATE_BASIC)
* 11n rates are also represented using the high bit (IEEE80211_RATE_MCS)

Now, ni->ni_txrate will clear the IEEE80211_RATE_BASIC flag before
storing it, so if the high bit exists it must be an 802.11n rate.
However, there's still a bunch of code everywhere that purposefully
filters that out.

The goals of this commit:

* Provide an easy API to migrate existing drivers and other consumers
to - ieee80211_node_get_txrate_dot11rate() is defined as "will return
the normal legacy or HT rate" so all the existing code can work.
* Lay the ground work for extending ni_txrate (and a rate representation
in general) that can represent legacy, HT, VHT, EHT, HE, etc rates.
* Create a central place where ni_txrate is updated from rate control,
drivers that will update ni_txrate itself, and consumers,
so we can provide some basic runtime checks / logging as VHT, EHT, HE,
etc rates are eventually added.

For example, a VHT driver will eventually receive VHT rates, but an
existing HT driver will not, so the API should log and return a
sensible default when something like a VHT rate shows up on a HT only
device.

The rate control code currently returns a rix, and sets ni_txrate to the
dot11rate. Drivers can choose either. However, choosing the rix is
risky because you need to know if it's the ni_rates or ni_htrates, which
requires a lot of duplicate work that lines up consistently at all
layers (see the AMRR code for an example.)

Differential Revision: https://reviews.freebsd.org/D48601
Reviewed by: bz, thj

show more ...


# 243f6925 28-Nov-2024 Bjoern A. Zeeb <bz@FreeBSD.org>

net80211: 11ac: add options to manage VHT STBC

Add IEEE80211_FVHT_STBC_(TX|RX) flags to allow userspace to manage
if STBC will be allowed for VHT RX/TX.
For RX this will only allow us to turn it off

net80211: 11ac: add options to manage VHT STBC

Add IEEE80211_FVHT_STBC_(TX|RX) flags to allow userspace to manage
if STBC will be allowed for VHT RX/TX.
For RX this will only allow us to turn it off but no fine grained
control of the number of supported spatial streams.

Introduce IEEE80211_FVHT_CHANWIDTH_MASK as a helper to make the
spelling out of the IEEE80211_FVHT_MASK more readable.

Update ifconfig to allow setting of these flags.

Sponsored by: The FreeBSD Foundation
MFC atfer: 3 days
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D47838

show more ...


# 1116e8b9 17-Apr-2024 Adrian Chadd <adrian@FreeBSD.org>

net80211: add a new field specifically for announcing specific ciphers

This dates way, way back with the original net80211 support w/ atheros chips.

The earliest chip (AR5210) had limitations suppo

net80211: add a new field specifically for announcing specific ciphers

This dates way, way back with the original net80211 support w/ atheros chips.

The earliest chip (AR5210) had limitations supporting software encryption.
It only had the four WEP slots, and not any keycache entries. So when
trying to do CCMP/TKIP encryption would be enabled and the key slots
would have nothing useful in them, resulting in garbage encryption/decryption.

I changed this back in 2012 to disable supporting hardware WEP for AR5210
so if_ath(4) / net80211 crypto is all done in software and yes,
I could do CCMP/TKIP on AR5210 in software.

Fast-forward to newer-ish hardware - the Qualcomm 11ac hardware.
Those also don't support pass-through keycache slots! Well, the hardware
does at that layer, but then there's a whole offload data path encap/decap
layer that's turning the frames from raw wifi into ethernet frames (for
"dumb" AP behaviours) or "wifi direct" frames (ie, "windows".)
This hides a bunch of header frame contents required for doing the software
encryption / decryption path.

But then if you enable the raw transmit/receive frame format it ALSO
bypasses the hardware encryption/decryption engine!

So for those NICs:

* If you want to do encryption, you can only use the firmware supported
ciphers w/ wifi direct or ethernet;
* If you want to use software encrypt/decrypt, you MUST disable all encryption
and instead use 100% software encryption.

The wpa_supplicant bsd driver code has a specific comment about this and
flips on supporting WEP/TKIP/CCMP, which is understandable but it doesn't
fix the ACTUAL intention of all of this stuff.

So:

* create a new field, ic_sw_cryptocaps
* populate it with the default supported set of ciphers for net80211
(right now wep, tkip, ccmp)
* Communicate the combination of both ic_sw_cryptocaps and ic_cryptocaps
to wpa_supplicant via the relevant devcap ioctl.
* Update manpage.

I'll follow this up with a driver_bsd.c change in wpa_supplicant to
trust this again, and then start adding the other cipher support there.

Differential Revision: https://reviews.freebsd.org/D44820

show more ...


# d760d74d 19-Dec-2023 Mark Johnston <markj@FreeBSD.org>

ieee80211: Check for copyout() errors in the SIOCG80211STATS handler

In preparation for annotating copyin() and related functions with
__result_use_check.

Reviewed by: bz, emaste
MFC after: 1 week

ieee80211: Check for copyout() errors in the SIOCG80211STATS handler

In preparation for annotating copyin() and related functions with
__result_use_check.

Reviewed by: bz, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43095

show more ...


# 562adbe1 27-Oct-2023 Bjoern A. Zeeb <bz@FreeBSD.org>

net80211: migrate ic_vhtcaps, ic_vht_mcsinfo, ic_flags_vht

Like for the VAP rename ic_flags_vht to ic_vht_flags for consistency to
keep "VHT" fields together and merge ic_vhtcaps and ic_vht_mcsinfo

net80211: migrate ic_vhtcaps, ic_vht_mcsinfo, ic_flags_vht

Like for the VAP rename ic_flags_vht to ic_vht_flags for consistency to
keep "VHT" fields together and merge ic_vhtcaps and ic_vht_mcsinfo
into struct ieee80211_vht_cap ic_vht_cap.

While the structure layout changes no other functional changes intended.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: adrian, cc
Differential Revision: https://reviews.freebsd.org/D42421

show more ...


# ef48d4fa 27-Oct-2023 Bjoern A. Zeeb <bz@FreeBSD.org>

net80211: rename iv_flags_vht to iv_vht_flags

While the flag field is internal start naming it as well as "iv_vht*"
so we keep all "VHT" fields together. This breaks with what was done
done for HT

net80211: rename iv_flags_vht to iv_vht_flags

While the flag field is internal start naming it as well as "iv_vht*"
so we keep all "VHT" fields together. This breaks with what was done
done for HT but with HE, EHT, .. coming one day seems the more logic
choice.

No functional changes intended.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: adrian, cc
Differential Revision: https://reviews.freebsd.org/D42419

show more ...


# 33396ec2 14-Sep-2023 Bjoern A. Zeeb <bz@FreeBSD.org>

net80211: improve scan debugging

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 wa

net80211: improve scan debugging

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

show more ...


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

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

show more ...


# 3d0d5b21 23-Jan-2023 Justin Hibbits <jhibbits@FreeBSD.org>

IfAPI: Explicitly include <net/if_private.h> in netstack

Summary:
In preparation of making if_t completely opaque outside of the netstack,
explicitly include the header. <net/if_var.h> will stop in

IfAPI: Explicitly include <net/if_private.h> in netstack

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

show more ...


# bd29f817 17-Aug-2022 Bjoern A. Zeeb <bz@FreeBSD.org>

net80211: consistently use the IEEE80211_M_ memory related options

Replace a malloc() by IEEE80211_MALLOC().
For malloc flags even in the local ieee80211_freebsd.c there was a mix
of both versions M

net80211: consistently use the IEEE80211_M_ memory related options

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

show more ...


# 0525ece3 08-Oct-2021 Bjoern A. Zeeb <bz@FreeBSD.org>

net80211: fix build for 526370fb85db4b659cff4625eb2f379acaa4a1a8

In 526370fb85db4b659cff4625eb2f379acaa4a1a8 "net80211: proper ssid
length check in setmlme_assoc_adhoc()" we are checking the
sizeof

net80211: fix build for 526370fb85db4b659cff4625eb2f379acaa4a1a8

In 526370fb85db4b659cff4625eb2f379acaa4a1a8 "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: 526370fb85db4b659cff4625eb2f379acaa4a1a8

show more ...


# 526370fb 06-Oct-2021 Bjoern A. Zeeb <bz@FreeBSD.org>

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 sup

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

show more ...


# 01e57940 18-Oct-2020 Bjoern A. Zeeb <bz@FreeBSD.org>

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 c

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

show more ...


# fe5ebb23 24-Sep-2020 Bjoern A. Zeeb <bz@FreeBSD.org>

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, an

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

show more ...


# 662c1305 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

net: clean up empty lines in .c and .h files


# e2515283 27-Aug-2020 Glen Barber <gjb@FreeBSD.org>

MFH

Sponsored by: Rubicon Communications, LLC (netgate.com)


# 372c7b95 17-Aug-2020 Bjoern A. Zeeb <bz@FreeBSD.org>

net80211: remove vertical whitespace

No functional changes.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")


12345678910>>...30