History log of /freebsd-11-stable/sbin/ifconfig/ifieee80211.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 368298 03-Dec-2020 hselasky

MFC r368058:
Ensure consistent error messages from ifconfig(8).

If multiple threads are invoking "ifconfig XXX create" a race may occur
which can lead to two different error messages for the same error.

a) ifconfig: SIOCIFCREATE2: File exists
b) ifconfig: interface XXX already exists

This patch ensures ifconfig prints the same error code
for the same case.

Reviewed by: imp@ and kib@
Differential Revision: https://reviews.freebsd.org/D27380
Sponsored by: Mellanox Technologies // NVIDIA Networking


# 344196 16-Feb-2019 avos

MFC r343980:
ifconfig(8): display 802.11n rates correctly for 'roam:rate' parameter


# 343974 10-Feb-2019 avos

MFC r343698, r343700:
ifconfig(8): display management / multicast wlan(4) rates properly

For 11n / 11ac we are still using non-11n rates for management and
multicast traffic by default; check 'MCS rate' bit to determine how
to print them correctly.

PR: 161035


# 343506 28-Jan-2019 avos

MFC r343341:
ifconfig: drop unused macros from ifieee80211.c


# 336344 16-Jul-2018 kevans

MFC r335757:

ifconfig(8): Attempt to render non-printable sequences w/ UTF-8 Environment

Currently ifconfig(8) only prints the hex representation of ssid names
with non-ASCII characters. Many modern terminals are able to properly render
non-ASCII characters. This change checks if the terminal charmap is UTF-8,
and if so, will render the characters, rather than the hex value.

This behavior is circumvented by running ifconfig(8) in a non-UTF8 locale;
e.g. C or POSIX.

It was pointed out by kp@ during the review that APs have the option to
broadcast whether their SSIDs may be interpreted as UTF-8. Ideally, we would
honor this and only attempt this behavior if it's so-broadcasted by the AP.

However, a sample survey showed that hostapd will advertise this if
indicated in config but it doesn't seem to be so common in the AP market, so
this would be effectively useless as we'll rarely know if the SSID should be
renderable as UTF-8.

Despite this, it was decided to be OK with this anyways- there's a
straightforward path to doing it the right way based on advertisement by AP
if we need to go that route, and one can revert to old behavior easily
enough at runtime if we get it wrong.


# 330468 05-Mar-2018 eadler

MFC r313978:

[ifconfig] fix a memory leak.


# 330459 05-Mar-2018 eadler

MFC r306836:

[ifconfig] correctly display RSSI.


# 330449 05-Mar-2018 eadler

MFC r326276:

various: general adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.


# 330448 05-Mar-2018 eadler

MFC r314181:

[ifconfig] handle illegal WPS frames

Some APs broadcast WPS IE frames with totally broken data. Ifconfig's printwpsie()
loops through WPS frames printing the attributes out; if the frame's data is bad,
printwpsie() can end up looking at out-of-bounds addresses causing ifconfig to
bus error.

Thanks to Takashi Inoue at Nihon U for his efforts in debugging this.

PR: bin/217312


# 312778 25-Jan-2017 avos

MFC r312560:
ifconfig(8): fix '-stbc' parameter name.


# 310235 18-Dec-2016 avos

MFC r310089:
ifconfig: do not truncate SSID in verbose mode.

Fix 32-character SSID abbreviation for 'ifconfig -v wlan0 scan' command.

PR: 215301
Submitted by: <ms-freebsd-bugzilla@stoffnet.at>


# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 301651 08-Jun-2016 avos

ifconfig: fix wlan creation when unit number is not provided
(was broken after r300738).

Reported by: Yoshihiro Ota <ota@j.email.ne.jp>, adrian
Tested by: Yoshihiro Ota <ota@j.email.ne.jp>


# 300738 26-May-2016 avos

ifconfig: set by default FCC regulatory domain for wireless interfaces.

Change default regulatory domain from DEBUG (no limitations;
exposes all device channels) to FCC; as a result, newly created wireless
interface with default settings will have less chances to violate
country-specific regulations.

This change will not affect drivers with pre-initialized regdomain
structure (currentry ath(4) and mwl(4)); in that case, the default
channel list must correspond to the default regdomain / country setting.

You can switch to another regdomain / country via corresponding
ifconfig(8) options; the driver must implement ic_getradiocaps()
method to restore full channel list.

Full country / regdomain list may be obtained via
'ifconfig <iface> list countries' command.

Example: change country to Germany:
ifconfig wlan0 down # all wlans on the device must be down
ifconfig wlan0 country DE
ifconfig wlan0 up
# wpa_supplicant(8), dhclient(8) etc

At the creation time:
ifconfig wlan0 create wlandev wpi0 country DE

To make changes permanent add the following line to the rc.conf(5):
create_args_wlan0="country DE"

Tested with
- Intel 3945BG (wpi(4)).
- WUSB54GC (rum(4)).

Reviewed by: adrian
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D6228


# 299921 16-May-2016 truckman

Add an assertion to catch a potential underflow in an array index
calculation, though this should not happen in the current code.

Reported by: Coverity
CID: 1008486
MFC after: 3 weeks


# 299873 15-May-2016 truckman

Use strlcpy() instead of strncpy() when copying ifname to ensure
that it is NUL terminated. Additional NUL padding is not required
for short names.

Use sizeof(destination) in a few places instead of IFNAMSIZ.

Cast afp->af_ridreq and afp->af_addreq to make the intent of
the code more obvious.

Reported by: Coverity
CID: 1009628, 1009630, 1009631, 1009632, 1009633, 1009635, 1009638
CID: 1009639, 1009640, 1009641, 1009642, 1009643, 1009644, 1009645
CID: 1009646, 1009647, 1010049, 1010050, 1010051, 1010052, 1010053
CID: 1010054, 1011293, 1011294, 1011295, 1011296, 1011297, 1011298
CID: 1011299, 1305821, 1351720, 1351721
MFC after: 1 week


# 299264 09-May-2016 avos

ifconfig: fix check for 40 MHz channels while applying country/regdomain.

Do not use 20 MHz channel list while checking 40 MHz channels;
it may be different. Just use the corresponding list instead.

Tested by: Masachika ISHIZUKA <ish@amail.plala.or.jp>

PR: 209328


# 298606 25-Apr-2016 adrian

[ifconfig] add STBC TX/RX configuration

This adds the ability to view and configure the STBC parameter for
both transmit and receive.

Whilst here, fix a typo for AMSDU.

TODO:

* manpage update


# 298556 24-Apr-2016 pfg

ifconfig: prevent some improbable signed integer overflows.

ic_nchans, from struct:ieee80211req_chaninfo, is an unsigned int.
Use an unsigned index to prevent overflowing the index.

Adopt unsigned integers in other cases where it is useful
to be aware of the unsigned quantities and there is no
risk of the values being negative.

MFC after: 1 week


# 298252 19-Apr-2016 adrian

Add VHT power envelope parsing to ifconfig.


# 297010 18-Mar-2016 adrian

Add parsing for AP channel report IE.

Eg:

TP-LINK_D579 60:e3:27:e1:d5:79 10 54M -72:-95 100 EP SSID<TP-LINK_D579> RATES<B2,B4,B11,B22,18,36,72,108>
DSPARMS<10> XRATES<12,24,48,96> COUNTRY<US 1-11,20> APCHANREP<class 32, chan:[1,2,3,4,5,6,7]> APCHANREP<class 33, chan:[5,6,7,8,9,10,11]>
TIM<050400010000> ERP<0x4> HTCAP<cap 0x106e param 0x17 mcsset[0-15,32] extcap 0x0 txbf 0x0 antenna 0x0> HTINFO<ctl 10, 7,0,0,0 basicmcs[]>
???<4a0e14000a002c01c800140005001900> RSN<v1 mc:AES-CCMP uc:AES-CCMP km:8021X-PSK>
WME<qosinfo 0x0 BE[aifsn 3 cwmin 4 cwmax 10 txop 0] BK[aifsn 7 cwmin 4 cwmax 10 txop 0] VO[aifsn 2 cwmin 3 cwmax 4 txop 94] VI[aifsn 2 cwmin 2 cwmax 3 txop 47]>
BSSLOAD<sta count 0, chan load 11, aac 18> VEN<dd07000c4300000000>


# 297009 18-Mar-2016 adrian

Remove duplicate LE_READ_4() definition.

Tested:

* typed 'make', seemed to work.


# 297007 18-Mar-2016 adrian

Decode VHTCAP, VHTINFO and BSSLOAD.

BSSLOAD is based on work from Idwer Vollering.

Obtained from: Idwer Vollering <vidwer@gmail.com> (bssload)


# 296931 16-Mar-2016 adrian

Display the VHT IE names.

This doesn't decode the IEs just yet.

Tested:

* Archer c2 AP:

TP-LINK_D579_5G 60:e3:27:e1:d5:78 44 54M 26:0 100 EP SSID<TP-LINK_D579_5G> RATES<B12,18,B24,36,B48,72,96,108> DSPARMS<44> COUNTRY<US 36-48,20> TIM<050400010000> HTCAP<cap 0x6e param 0x16 mcsset[0-7,32] extcap 0x0 txbf 0x0 antenna 0x0> HTINFO<ctl 44, 5,0,0,0 basicmcs[]> VHTCAP<bf0c2000c031feff2401feff2401> VHTOPMODE<c005012a00feff> RSN<v1 mc:AES-CCMP uc:AES-CCMP km:8021X-PSK> WME<qosinfo 0x0 BE[aifsn 3 cwmin 4 cwmax 10 txop 0] BK[aifsn 7 cwmin 4 cwmax 10 txop 0] VO[aifsn 2 cwmin 3 cwmax 4 txop 94] VI[aifsn 2 cwmin 2 cwmax 3 txop 47]> BSSLOAD<0b05000001127a> VEN<dd07000c4300000000>


# 296823 14-Mar-2016 adrian

[net80211] handle unlisted information elements.

This displays the IE names in ifconfig but it doesn't yet decode things.

Submitted by: Idwer Vollering <vidwer@gmail.com>
Differential Revision: https://reviews.freebsd.org/D3782


# 291470 30-Nov-2015 adrian

Convert ifconfig to use lib80211.

* remove regdomain.[ch] - it's now part of lib80211.
* convert ifieee80211.c to use the ioctl routines in lib80211 and
implement the "error? exit" wrapper behaviour the callers expect.


# 291352 26-Nov-2015 adrian

[ifconfig] handle IBSS mediatype correctly.

Right now net80211 is configured as type IBSS but then treats it
as mediatype ADHOC. This doesn't change that; it just correctly handles
being given a mediatype of IBSS.


# 290438 06-Nov-2015 avos

ifconfig: fix padding for '<ifname> scan' command output
(S:N and beacon interval fields).

Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D4085


# 288305 27-Sep-2015 ngie

Replace N #defines with nitems to simplify ifconfig code slightly

MFC after: 1 week


# 246505 07-Feb-2013 monthadar

Mark a mesh path to a mesh gate with a 'G'.

Approved by: adrian (mentor)


# 234895 01-May-2012 monthadar

* Modified ifconfig to show the IEEE80211_MESHRT_FLAGS_DISCOVER flag with a 'D';

Approved by: adrian


# 234893 01-May-2012 monthadar

* Added new command to ifconfig to activate Mesh Gate Announcement called
meshgate with corresponding explanation;

Approved by: adrian


# 233382 23-Mar-2012 bschmidt

Also fix the parameter usage in set80211meshpeering().

Submitted by: Monthadar Al Jaberi
MFC after: 1 week
X-MFC after: r233328


# 233328 22-Mar-2012 adrian

Fix an incorrect parameter usage here.

Submitted by: monthadar@gmail.com


# 229914 10-Jan-2012 eadler

Fix warning when compiling with gcc46:
error: variable 'firstkey' set but not used

Approved by: dim
MFC after: 3 days


# 229778 07-Jan-2012 uqs

Spelling fixes for sbin/


# 227336 08-Nov-2011 adrian

Add quiet time element configuration support to ifconfig.

This allows a hostap to specify to a set of stations that they
should not transmit for a certain period of time after each
beacon interval has expired. This is used when searching for
radar pulses or general interference.

Submitted by: Himali Patel <himali.patel@sibridgetech.com>
Sponsored by: Sibridge Technologies


# 224224 20-Jul-2011 adrian

This patch removes a check in ifconfig which disables HT/40 channels
on frequency bands with DFS. All Atheros chipsets >= AR9001 support
radar event detection on HT40 extension channels.

This should be a chipset specific item rather than enforced in the
regulatory domain database.

In addition, it's irrelevant for STA mode, as the radar detection is
done by the access point, not the STA.

Approved by: re (kib)


# 224219 19-Jul-2011 adrian

This patch enables listing DFS related flags when 'ifconfig -v wlanX
list channel' is run. The following new options are introduced:

* D: channel requires DFS
* R: channel has a radar event
* I: channel has detected inteference
* C: the CAC period has completed on a channel that requires it (ie,
DFS + PASSIVE.)

It's relevant for developing, debugging and using the DFS and
interference options.

Approved by: re (bz)


# 220935 21-Apr-2011 adrian

Revert r220907 and r220915.

Changing the size of struct ieee80211_mimo_info changes
the STA info data, breaking ifconfig in general.


# 220907 21-Apr-2011 adrian

Change the MIMO userland export ABI to include flags, number of radio chains,
extended EVM statistics and EXT channel data.

ifconfig still displays 3 chains worth of ctl noise/rssi.


# 218093 30-Jan-2011 bschmidt

Fix the 'scan hang' issue.

When requesting a scan and one is already in progess, e.g. while in scan
state, we happily wait for a scan done notification. Though, this
notification might never be sent, e.g. if we are trying to find a network
to associate to and there is none. Instead of always waiting for a
notification just do so if a new scan has been started. For both cases the
scan cache is used to report available networks even if the content might
not be fresh.

MFC after: 1 month


# 218090 30-Jan-2011 bschmidt

When doing a scan while being associated it is possible that the scan
is deferred for the time it takes to flush the TX queue. This work being
done the scan then is continued, but only if it is marked to do so. As
the 'ifconfig scan' request is meant to be used after the interface is
brought up, request a background scan by default. This behaviour is
already documented in manual page.

This fixes on possible case where 'ifconfig scan' hangs infinitely.

MFC after: 1 month


# 207320 28-Apr-2010 rpaulo

Fix typos.

Obtained from: DragonFlyBSD


# 205514 23-Mar-2010 rpaulo

Add a missing LINE_BREAK() after printing the roaming parameters in
verbose mode.

Sponsored by: iXsystems, inc.
MFC after: 2 weeks


# 203970 16-Feb-2010 imp

The NetBSD Foundation has granted permission for people to remove
clause 3 and 4 from their software.


# 202161 12-Jan-2010 gavin

Spell "Hz" correctly wherever it is user-visible.

PR: bin/142566
Submitted by: N.J. Mann njm njm.me.uk
Approved by: ed (mentor)
MFC after: 2 weeks


# 197980 12-Oct-2009 rpaulo

Update for latest 802.11s changes in meshconf format.

MFC after: 3 days


# 195908 27-Jul-2009 rpaulo

Mesh fixes, namely:
* don't clobber proxy entries
* HWMP seq number processing, including discard of old frames
* flush routing table entries based on nexthop
* print route flags in ifconfig
* more debugging messages and comments

Proxy changes submitted by sam.

Approved by: re (kib)


# 195784 20-Jul-2009 rpaulo

More mesh bits, namely:
* bridge support (sam)
* handling of errors (sam)
* deletion of inactive routing entries
* more debug msgs (sam)
* fixed some inconsistencies with the spec.
* decap is now specific to mesh (sam)
* print mesh seq. no. on ifconfig list mesh
* small perf. improvements

Reviewed by: sam
Approved by: re (kib)


# 195618 11-Jul-2009 rpaulo

Implementation of the upcoming Wireless Mesh standard, 802.11s, on the
net80211 wireless stack. This work is based on the March 2009 D3.0 draft
standard. This standard is expected to become final next year.
This includes two main net80211 modules, ieee80211_mesh.c
which deals with peer link management, link metric calculation,
routing table control and mesh configuration and ieee80211_hwmp.c
which deals with the actually routing process on the mesh network.
HWMP is the mandatory routing protocol on by the mesh standard, but
others, such as RA-OLSR, can be implemented.

Authentication and encryption are not implemented.

There are several scripts under tools/tools/net80211/scripts that can be
used to test different mesh network topologies and they also teach you
how to setup a mesh vap (for the impatient: ifconfig wlan0 create
wlandev ... wlanmode mesh).

A new build option is available: IEEE80211_SUPPORT_MESH and it's enabled
by default on GENERIC kernels for i386, amd64, sparc64 and pc98.

Drivers that support mesh networks right now are: ath, ral and mwl.

More information at: http://wiki.freebsd.org/WifiMesh

Please note that this work is experimental. Also, please note that
bridging a mesh vap with another network interface is not yet supported.

Many thanks to the FreeBSD Foundation for sponsoring this project and to
Sam Leffler for his support.
Also, I would like to thank Gateworks Corporation for sending me a
Cambria board which was used during the development of this project.

Reviewed by: sam
Approved by: re (kensmith)
Obtained from: projects/mesh11s


# 194136 13-Jun-2009 sam

Rev IEEE80211_IOC_STA_INFO abi: ni_flags grew from 16 bits to 32
bits but isi_state did not follow; expand it to 32 bits and pad to
maintain alignment. Note this is an incompatible change that
requires rebuilding of user applications.

Submitted by: rpaulo, cbzimmer, avatar


# 193447 04-Jun-2009 sam

track rename of CSA ie

Submitted by: wxs


# 190456 26-Mar-2009 sam

add superg+tdma include files for protocol defs needed to do ie parsing


# 189096 26-Feb-2009 rpaulo

Replace clone_setcallback() with a new function clone_setdefcallback()
that selects a callback from an interface prefix name. This allows us to
report a meaningful error when the user types 'ifconfig wlan0 create',
for example, and also kills some redundant code.

Reviewed by: sam (earlier version)


# 188784 19-Feb-2009 sam

Fixup handling of roaming and xmit parameters to support 1/2 and 1/4-width
channel modes:
o usurp 'h' mode flag for half-width channels
o add 'q' mode flag for quarter-width channels
o rewrite rate parameter parsing to handle fractional values
o merge mode loops to eliminate ordering assumptions
o replace 0x80 with IEEE80211_RATE_MCS


# 188258 06-Feb-2009 sam

Regulatory fixups:
o add missing channel flags for ECM, indoor, and outdoor constraints
o use HT capabilities to short-circuit HT20/HT40 channel construction
o rewrite 1/2 and 1/4 width channel handling yet again; previously
we assumed there was a full-width version of the channel in the
calibration table but that's not always true (e.g. for the Public
Safety Band), now we first check the calibration table for the
exact channel we want then fall back to the heuristics we used before
o fix HT channel construction; wasn't adjusting band edges for HT40
channel bandwidth requirements


# 188038 02-Feb-2009 delphij

Use %u instead of %zu when we intend to print integer constant.


# 187845 28-Jan-2009 sam

include the channel list in list caps when -v is set; ieee channel
#'s are not available and we have to hack around the mapchan routine
but it lets us see the calibration table w/o forcing the debug regdomain


# 187844 28-Jan-2009 sam

pritize the channel we display with list chans so that, among other
things, 1/2 and 1/4 width channels are hidden behind the full width
channel; this is needed because they are ordered such that they
appear after in the channel table


# 187843 28-Jan-2009 sam

simplify display of 1/2 and 1/4 width channels


# 187842 28-Jan-2009 sam

improve debug msgs for regdomain operations; print channel flags
symbolically so it's easier to identify channels and why they
are added (or not)


# 187841 28-Jan-2009 sam

Fix 1/2 and 1/4 width channel handling:
o only include 1/2 and 1/4 width channels when they are specified in the
regulatory database description; previously we treated them as if they
were part of the band and blindly added them for 11a/g
o check the channel list returned in the devcaps to identify whether a
device supports 1/2 or 1/4 width channels on a band; this might be
better brought out as a capability bit to avoid filling the channel
list w/ 1/2 and 1/4 width channels but then cards that only support
these channels in a range of frequencies could not be described (though
right now we don't check frequency range only band)


# 187801 27-Jan-2009 sam

Remove assumptions about the max # channels in ioctl's:
o change ioctl's that pass channel lists in/out to handle variable-size
arrays instead of a fixed (compile-time) value; we do this in a way
that maintains binary compatibility
o change ifconfig so all channel list data structures are now allocated
to hold MAXCHAN entries (1536); this, for example, allows the kernel
to return > IEEE80211_CHAN_MAX entries for calls like IEEE80211_IOC_DEVCAPS


# 187798 27-Jan-2009 sam

remove %b msg bit defines now public


# 187342 16-Jan-2009 sam

Fix 1/2 and 1/4 width channel handling for non-GSM operation:
o correct typo that caused random channel selection
o explicitly add 1/2 and 1/4 width channels because channel lookups match
flags that include IEEE80211_CHANNEL_HALF and IEEE80211_CHANNEL_QUARTER


# 186904 08-Jan-2009 sam

TDMA support for long distance point-to-point links using ath devices:
o add net80211 support for a tdma vap that is built on top of the
existing adhoc-demo support
o add tdma scheduling of frame transmission to the ath driver; it's
conceivable other devices might be capable of this too in which case
they can make use of the 802.11 protocol additions etc.
o add minor bits to user tools that need to know: ifconfig to setup and
configure, new statistics in athstats, and new debug mask bits

While the architecture can support >2 slots in a TDMA BSS the current
design is intended (and tested) for only 2 slots.

Sponsored by: Intel


# 186105 14-Dec-2008 sam

move channel parsing to a getchannel routine so it can be reused to check
the channel argument supplied to chanswitch


# 186104 14-Dec-2008 sam

fix handling of sku codes like country codes


# 186103 14-Dec-2008 sam

fix handling of unknown country codes; atoi doesn't return -1
for an invalid string as I thought; so use strtol instead


# 186102 14-Dec-2008 sam

0 is a potential ISO CC; use new NO_COUNTRY #define to identify
when the CC is not set. Note NO_COUNTRY is set to 0xffff for now
(must be 16 bits as ieee80211_regdomain struct defines sku's and
cc's as uint16_t which may need fixing).


# 186101 14-Dec-2008 sam

o distinguish between adhoc and ahdemo modes
o do not require 1/2 and 1/4 rate channels be present in the
calibration list when doing a gsm regulatory change; the
existing 900MHz cards are not self-identifying so there is
no way (using the calibration channel list) to check


# 183261 21-Sep-2008 sam

MIMO power save and RIFS; while here also update per-node state/flags for ampdu


# 183260 21-Sep-2008 sam

"ampdudensity -" is too subtle; use "NA" for any and accept it as a parameter


# 181722 14-Aug-2008 thompsa

Fix channel parsing which was broken in r179958, the channel number may be
suffixed with :flag and /width.


# 181454 09-Aug-2008 sam

recognize WPS ie's

Submitted by: "Chuck Tuffli" <chuck@tuffli.net>
MFC after: 1 week


# 181199 02-Aug-2008 sam

change list wme to only print the channel parameters; to
get channel+bss use -v


# 181198 02-Aug-2008 sam

don't silently exit if the regdomain.xml file is missing


# 181102 31-Jul-2008 sam

add missing capability bits


# 179958 23-Jun-2008 thompsa

Ensure the channel is a number and not a range, the 'channel' command can be
easily mixed up with 'chanlist' and would give unexpected results by fixing the
channel on the first number in the range.


# 178354 20-Apr-2008 sam

Multi-bss (aka vap) support for 802.11 devices.

Note this includes changes to all drivers and moves some device firmware
loading to use firmware(9) and a separate module (e.g. ral). Also there
no longer are separate wlan_scan* modules; this functionality is now
bundled into the wlan module.

Supported by: Hobnob and Marvell
Reviewed by: many
Obtained from: Atheros (some bits)


# 175953 03-Feb-2008 sam

correct tx rate displayed by list sta: the reported legacy tx rate
is still an index into the rate set and not (yet) the rate code

Noticed by: JoaoBR


# 175952 03-Feb-2008 sam

fix list mac; broken in delta 1.48

Noticed by: JoaoBR


# 173275 02-Nov-2007 sam

sync with vap code base; updates for 11n support and some
general code cleanups

Reviewed by: thompsa, avatar
MFC after: 1 week


# 170588 11-Jun-2007 thompsa

Reset the pointer to the ioctl buffer after it gets changed.


# 170531 11-Jun-2007 sam

Update for revised 802.11 support:
o revised channel handling support; ifconfig now queries the kernel to
find the list of available channels and handles channel promotion;
channel attributes can be specified as part of the channel; e.g. 36:a
for channel 36 in 11a (as opposed to turbo A or HT A)
o use channel list to map between freq and IEEE channel #; this eliminates
all knowledge of how the mapping is done and fixes handling of cases
where channels overlap in the IEEE channel # space but are distinct in
the frequency+attributes space (e.g. PSB)
o add new knobs: bgscan, ff (Atheors fast frames), dturbo (Atheros
Dynamic Turbo mode), bgscanidle, bgscanintvl, scanvalid, roam:rssi11a,
roam:rssi11b, roam:rssi11g, roam:rate11a, roam:rate11b, roam:rate11g
(roaming parameters), burst, doth (forthcoming 11h support)
o print contents of WME, ATH, WPA, RSN, information elements with -v option
o print signal strength in dBm
o print noise floor in dBm
o add list txpow to print tx power caps/channel
o change default channel display in status to be more informative


# 168075 30-Mar-2007 sam

don't display ssid cloaking status as "ssid HIDE", use the cmd line
parameter like everything else

MFC after: 2 weeks


# 166803 17-Feb-2007 sam

remove (now) duplicate definition of IEEE80211_IS_CHAN_PASSIVE


# 166015 14-Jan-2007 sam

Add initial support for 900MHz channels; still has some rough
edges but ifconfig ath0 list chan works and you can use ieee
channel #'s to lock/select a channel.

MFC after: 1 month


# 165570 27-Dec-2006 sam

Add half/quarter rate 11a channel support:
o add hack/nonstandard channel mapping for public safety band channels to
mirror kernel (temporary until we have proper 802.11 state)
o change ieee80211_mhz2ieee to take channel flags (unused right now)

While here do some minor fixups like using IEEE80211_IS_CHAN_ANYG.


# 165045 09-Dec-2006 sam

fix handling of ssid "-" etc; we're writing 1 byte past the
end of the result buffer

Noticed by: Sepherosa Zieha
Reviewed by: cperciva
MFC after: 2 weeks


# 161147 10-Aug-2006 sam

fixup list station support:
o add sanity check to avoid possible looping
o use intended api for IEEE80211_IOC_STA_INFO
o when operating in sta mode get the sta info for the ap


# 160687 26-Jul-2006 sam

add beacon miss threshold control

Submitted by: Henrik Brix Andersen <henrik@brixandersen.dk>
MFC after: 2 weeks


# 159885 23-Jun-2006 sam

remove display of the ERP ie from the list sta output (it's always
zero); replace it with station capabilities

MFC after: 1 month


# 155931 22-Feb-2006 sam

cleanup line break formatting

MFC after: 1 week


# 155702 14-Feb-2006 sam

fix off by one malloc sizes

Submitted by: Michal Mertl
MFC after: 1 week


# 155461 08-Feb-2006 sam

really truncate long ssid's when !verbose

MFC after: 1 week


# 155009 29-Jan-2006 maxim

Fix an off-by-one error.

Reviewed by: sam


# 154522 18-Jan-2006 sam

don't widen the ssid field by default, this screws up other formatting;
make it available with the -v option


# 153892 30-Dec-2005 rwatson

When printing SSID's in ifconfig(8)'s scan mode, set the width of the
ssid field to 32 characters instead of 14, as long SSID's are quite
common and hard to type in if you can't read them.


# 153422 14-Dec-2005 sam

add control for packet bursting


# 153405 13-Dec-2005 sam

display a bssid that's zero with the -v option


# 153354 12-Dec-2005 sam

add mcastrate support

MFC after: 1 week


# 151883 30-Oct-2005 brooks

SSIDs are of length 32-bytes and not NUL terminated. Use the correct
length and bail immediatly if the returned length is wrong rather than
attempting to set an correct value.

This commit differs from the patch in the PR in the use of exit instead
of return and the use of a defined value for the array.

Submitted by: Daan Vreeken [PA4DAN] <Danovitsch at Vitsch dot net>
PR: bin/74509


# 151827 28-Oct-2005 brooks

Don't crash when given an invalid nwkey string.

PR: misc/88159


# 150708 29-Sep-2005 ru

err() -> errx() where appropriate.


# 149029 13-Aug-2005 sam

add list mac and mac:kick support

Submitted by: Michal Mertl (original version)
MFC after: 2 weeks


# 148686 03-Aug-2005 stefanf

Fix commen typos.


# 148621 01-Aug-2005 sam

acm and ack are specified per-ac

MFC after: 3 days


# 148554 30-Jul-2005 sam

oops, revert previous change


# 148553 30-Jul-2005 sam

MFC: add fragthreshold parameter and accept - (or any) for rtsthreshold

Approved by: re (kensmith)


# 148416 26-Jul-2005 sam

o add fragthreshold support now that the ioctl exists
o accept rtsthreshold - (or any) as a shorthand for rtsthreshold 2346

MFC after: 3 days


# 148001 14-Jul-2005 rwatson

Add a new flag '-k' to ifconfig(8), indicating that it is alright to
print potentially sensitive keying material to stdout. With the new
802.11 support, ifconfig(8) is now capable of printing 802.11 keys,
and did by default for the root user, which is undesirable in some
environments. Now it will not print keying material unless requested
(and available to the user).

MFC after: 1 week


# 147795 06-Jul-2005 sam

add pureg/-pureg parameter for controlling pureg ap mode support

Reviewed by: avatar
Approved by: re (scottl)


# 147489 20-Jun-2005 avatar

Appending "..." to a SSID which contains unprintable characters only when
necessary.

Submitted by: sam
Approved by: re (scottl)


# 146873 01-Jun-2005 jhb

Fix some warnings on 64-bit archs.

Reviewed by: sam


# 139494 31-Dec-2004 sam

Fix special status reporting. Prior to the reorg there was
special-purpose code to display status for an interface for
state that was not address-oriented. This status reporting
was merged in to the address-oriented status reporting but
did not work for link address reporting (as discovered with
fwip interfaces). Correct this mis-merge and eliminate the
bogus kludge that was used for link-level address reporting.

o add an af_other_status method for an address family for
reporting status of things like media, vlan, etc.
o call the af_other_status methods after reporting address
status for an interface
o special-case link address status; when reporting all
status for an interface invoke it specially prior to
reporting af_other_status methods (since it requires the
sockaddr_dl that is passed in to status separately from
the rtmsg address state)
o correct the calling convention for link address status;
don't cast types, construct the proper parameter

This fixes ifconfig on fwip interfaces.


# 139493 31-Dec-2004 sam

o accept deftxkey as a synonym for weptxkey since that is what is
printed for status (allows cut&paste)
o accept undef for the deftxkey/weptxkey so you can reset state

Requested by: phk


# 139492 31-Dec-2004 sam

recognize atheros information elements


# 138718 12-Dec-2004 sam

always display the deftxkey for an 802.11 device if privacy is enabled


# 138593 08-Dec-2004 sam

Overhaul to cleanup some of the tangled logic that's grown over the years.

o break per-address family support out into separate files
o modularize per-address family and functional operations using
a registration mechanism; this permits configuration according
to which files you include (but beware that order of the files
is important to insure backwards compatibility)
o many cleanups to eliminate incestuous behaviour, global variables,
and poor coding practices (still much more to fix)

The original motivation of this work was to support dynamic addition
of functionality based on the interface so we can eliminate the various
little control programs and so that vendors can distribute ifconfig
plugins that support their in-kernel code. That work is still to be
completed.

o Update 802.11 support for all the new net80211 functionality; some
of these operations (e.g. list *) may be better suited in a different
program


# 127831 04-Apr-2004 phk

Fix an off-by-one error in the function used to input the ascii/hex strings.
Be a little bit more helpful in error messages.


# 127649 30-Mar-2004 sam

add support for setting 802.11 rtsthreshold, transmit power,
and 11g protection mode

Reviewed by: imp (just code)


# 121827 31-Oct-2003 brooks

We want the length of the string, not the size of its pointer.


# 120178 17-Sep-2003 sam

o add support for setting 128-bit WEP keys
o use IEEE80211_KEYBUF_SIZE instead of magic numbers
o distinguish between 40-, 104-, and 128-bit WEP keys when printing status


# 116957 28-Jun-2003 sam

o update for new 802.11 support
o fix channel command so channel - does what the man page says


# 95005 18-Apr-2002 imp

De-__P, use ansi function definitions


# 91454 27-Feb-2002 brooks

Some style(9) whitespace fixes and a correction to the copyright.


# 88748 31-Dec-2001 ambrisko

Fix bugs in the structure for rx_frame by making gap length one byte and
a packed array so sizeof work. This broke RFMON mode and passing
up 802.11 packets.

The Linux emulation code was derived from the open source Linux driver to
maintain compatibility.

LEAP support is added, hints from Richard Johnson. I've verified this
locally with PC350v42510.img firmware. More bug fixing from Marco to
fix long passwords.

Change DELAYs in flash part of driver to FLASH_DELAY which uses tsleep
so it doesn't look like your system died during a flash update.

Install header files in /usr/include/dev/an

Cleanup some ifmedia bugs add "Home" key mode to ifmedia and ancontrol.
This way you can manage 2 keys a little easier. Map the home mode into
key 5. Enhance ifconfig to dump the various configured SSIDs. I use
a bunch of different ones and roam between them. Use the syntax similar
to the WEP keys to deal with setting difference SSIDs.

Bump up up the Card capabilities RID since they added 2 bytes to it
in the latest firmware. Thankfully we changed it from a terminal
failure so the card still worked but the driver whined.

Some cleanup patches from Marco Molteni.

Submitted by: Richard Johnson <raj@cisco.com>
Marco Molteni <molter@tin.it>
and myself
Various checks: David Wolfskill <david@catwhisker.org>
Reviewed by: Brooks Davis <brooks@freebsd.org>
Warner Losh <imp@freebsd.org>
Approved by: Brooks Davis <brooks@freebsd.org>
Warner Losh <imp@freebsd.org>
Obtained from: Linux emulation API's from Aironet driver.


# 80315 25-Jul-2001 brooks

Fix a stupid bug which resulted in a blank line in the status output if
WEP is supported, but not keys are set.

MFC after: 3 days


# 77218 26-May-2001 phk

Forgot to cvs add these two files for the previous commit.