CFT: 802.11 vap code

Sam Leffler sam at
Sun Apr 13 23:18:59 UTC 2008

A patch to integrate my multi-bss (aka vap) support for wireless can be
found here:

Note this is a shell script that overlays the CVS contents for HEAD.
To apply it you do something like:

cvs -d /usr/ncvs co src
cd src
gzcat ../ | sh

The changes are extensive and require a full buildworld and kernel
rebuild.  Committers with perforce access can find this code in the
sam_vap branch.

So what is this stuff?  This is work I started many years ago to
virtualize 802.11 wireless devices.  The intent was (mostly) to
support multiple access points operating on top of a single radio.
The classic example is you want to run a Hotspot and offer quality
service to paying customers but still provide some level of service
to freeloaders.  You can define two Virtual AP's (VAP's) and make
one open with the second require authorization.  This is done by
cloning virtual ifnet's from the parent device using ifconfig; e.g.

ifconfig wlan create wlandev ral0 wlanmode hostap

will generate a wlanX ifnet that supports ap operation.  Different
devices are capable of supporting different services; some
drivers/devices only support one vap at a time which is equivalent
to what is currently in CVS but without using the mediaopt mechanism
to switch "operating modes" (with vaps an interface never changes
it's operating mode; when you no longer want to use one you just
destroy it and create something else).

In practice most casual users will not encounter vaps except when
they run ifconfig and see wlanX interfaces.  rc support is present
to automatically create vaps' for station mode operation.  If you
have an ath0 device you add this to your rc.conf:

ifconfig_wlan0="DHCP WPA"

and you'll get a wlan0 ifnet created and wpa_supplicant will be
brought up as usual (thanks to Brooks Davis for this work).

Vaps were motivated by doing multi-bss ap services but evolved to
support many other features.  In particular WDS support falls out
and later grew to support Dynamic WDS (DWDS) which is a follow-on
design that combines WDS operation (i.e. 4-address frame encapsulation
of wireless traffic) with normal station and access point operation
to build more powerful and useful applications.  Sample scripts to
setup DWDS relay and master nodes can be found in the directory:


along with many other scripts used in testing.

This code includes a major rewrite of the net80211 layer and
significant changes to all wireless drivers.  Two drivers are still
not converted: ipw and ndis.  Station and access point operation
are well tested but adhoc mode is untested and likely broken.
Monitor mode works but has one design/usage issue that may require
changes.  The documentation is alpha-quality and needs work.

This work has been used in several products and been heavily tested
in various forms but on non-FreeBSD platforms.  Work on the current
version has been supported by Hobnob.  The most recent previous
work was supported by Marvell (who also supported development of
the mwl driver).  Atheros contributed code that was used to kickstart
the vap + 802.11n functionality.  Any issues you hit are likely to be in
drivers and not net80211--particularlly drivers that are less frequently

My goal is to get this work into CVS asap.  There is one outstanding
locking issue that people may encounter: the net80211 layer holds a
lock over calls to the driver's init method which can cause WITNESS
complaints if the driver sleeps.  This is most noticeable on drivers
that load firmware or otherwise sleep (e.g. usb drivers).  Some drivers
can avoid this by loading firmware in the vap create method but the
usb drivers may have to drop the lock and open a race.  Folks are
encouraged to pitch in to help with these and any other issues they

Note there are a few new drivers included: iwn (Intel 4965), bwi
(Broadcom 43xx), and mwl (Marvell 88W8363).  The iwn driver is
unfinished; it should support 802.11n but progress has been slow
due to poor vendor involvement.  The bwi driver is experimental and
folks are encouraged to help sephe get it into shape for commit (it
currently is not ready CVS).  mwl is provided as an example of a
working 11n driver; I'm not aware of any cardbus/pci retail products
that use this part and firmware is presently unavailable (we could
get firmware but since all applications are presently embedded
anyone that would want firmware already has it).  Finally, wi users
should note there is a rewrite of the driver that now works properly
with wpa_supplicant and supports WPA (both in station and ap modes)
with Intersil Prism cards and rev 1.7.0 and later firmware.  (But
the flip side is that Symbol card support was dropped and some older
cards may not work well w/o fixups.)

Please report problems to the public mailing lists.  My time is scarce
so please investigate fixes and not just report problems.

BSDCan plug: I'll be giving a tutorial in Ottawa that uses this work
so folks looking to attend can get a headstart.


More information about the freebsd-current mailing list