Re: wpa_suuplicant(8) & wlan(4) vs. an(4) et al.

From: Sam Leffler <sam_at_freebsd.org>
Date: Wed, 08 Oct 2008 16:32:46 -0700
David Wolfskill wrote:
> A while back (Jan 2006, at the latest), I perceived a need to set up my
> wireless NIC in a way appropriate to the environment in which we found
> ourselves.  Others have done this in various ways; I cobbled up a Perl
> script that has received various tweaks over the years, but which has
> worked reasonably well for wide-open environments and for those where
> WEP is used.
> 
> I recently had occasion to use my laptop in an environment that used
> WPA2; my script doesn't cope with that, and as wpa_supplicant(8) is in
> base, I figured I'd merely switch to using it, and I could quit tweaking
> my script & its associated data files.
> 
> That turns out to have been ... a bit overoptimistic.  (And
> "overoptimism" isn't usually part of my self-image.  Having been in
> sysadmin-type positions for over 3 decades tends to damp such
> tendencies, at best.)
> 
> The types of (wireless) NICs I presently have available are an(4),
> iwi(4), and wi(4).  The  an(4) devices are PCMCIA form factor; the
> others are miniPCI.  (I have a wi(4) PCMCIA card, but I've never got it
> to work -- not that doing so has been a priority.)
> 
> Now, I read the entry about wlan(4) cloning in /usr/src/UPDATING
> (20080420).  And I'm aware that wi(4) only works for me in RELENG_6,
> as it stopped associating after the 802.11 overhaul just before
> RELENG_7 was branched from HEAD.  (I track each of RELENG_6, RELENG_7,
> and HEAD on my laptop, usually on a daily basis; each gets a separate
> slice.  This message is mostly about HEAD; I refer to RELENG_*
> merely asa a point of reference.)
> 
> After building & booting today's CURRENT:
> 
> g1-37(8.0-C)[4] uname -a
> FreeBSD g1-37.catwhisker.org 8.0-CURRENT FreeBSD 8.0-CURRENT #827: Wed Oct  8 06:09:16 PDT 2008     root_at_g1-37.catwhisker.org:/common/S4/obj/usr/src/sys/CANARY  i386
> g1-37(8.0-C)[5] 
> 
> while using the an(4) device as configured by my script, I decided to
> try wpa_supplicant(8) once again.  (There were no changes in src for
> either RELENG_6 or RELENG_7 since yesterday, so I had a bit more time
> than usual before heading in to work.)
> 
> Now yesterday, I had tweaked the startup routine used by my script to
> pay attention & check to see if wpa_supplicant(8) was running; if so,
> the startup script would merely exit.  That way, I wouldn't need to mess
> with the script's execution bits or other ugly stuff if I wanted to
> experiment with wpa_supplicant(8).
> 
> So I edited /etc/rc.conf to include:
> 
> g1-37(8.0-C)[5] grep an0 /etc/rc.conf
> wlans_an0=wlan0
> ifconfig_wlan0="WPA DHCP"
> g1-37(8.0-C)[6] 
> 
> and to ensure a clean start, I rebooted the machine.
> 
> I was mildly surprised, then, to see my script get started anyway.
> (Note: my script doesn't know a thing about wlan(4) or cloning; it uses
> the an(4) device, and it appears to manage to get the NIC properly
> associated, then invokes dhclient(8) & steps out of the way.)
> 
> Checking back on the consle log I saw:
> 
> n0: wlan_clone_create: reject, not an 802.11 device
> ifconfig: SIOCIFCREATE2: Device not configured
> Starting wpa_supplicant.
> /etc/rc.d/wpa_supplicant: WARNING: failed to start wpa_supplicant
> Starting Network: lo0.
> xl0: link state changed to DOWN
> an0: wlan_clone_create: reject, not an 802.11 device
> ifconfig: SIOCIFCREATE2: Device not configured
> Starting wpa_supplicant.
> /etc/rc.d/wpa_supplicant: WARNING: failed to start wpa_supplicant
> lock order reversal:
> 
> Hmmm....  "reject, not an 802.11 device" seems a bit harsh, given:
> 
> g1-37(8.0-C)[7] ifconfig an0
> an0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
>         ether 00:40:96:40:5d:44
>         inet 172.17.1.37 netmask 0xffff0000 broadcast 172.17.255.255
>         media: IEEE 802.11 Wireless Ethernet autoselect (DS/11Mbps)
>         status: associated
>         ssid  1:lmdhw-net channel 6 (2437 Mhz 11b)
>         stationname FreeBSD
>         authmode OPEN privacy ON deftxkey 1 txpower 0 rtsthreshold 0
>         fragthreshold 0 bmiss 0 ucastrate 0 mcastrate 0 mgmtrate 0 maxretry 0
>         roaming DEVICE bintval 0
> g1-37(8.0-C)[8] 
> 
> but I expect that's merely an artifact of an(4) not having been
> overhauled to the new(er) wlan(4) framework or some such thing.  (Though
> I could well be completely wrong about this, as I confess I've not
> actually looked at the code in a long time.)

Correct, an does not use net80211 so cannot be used to clone wlan vap's.
 The "not an 802.11 device" is because the wlan clone routine checks the
ifnet's type to be sure it's IFT_IEE80211 and not IFT_ETHER.

It's entirely possible to make an use net80211 and/or do wpa but noone's
made the effort.


> 
> (Rather off-topic, but I did manage to get wpa_supplicant(8) to
> work in RELENG_7 using WPA2 (though contrary to the man page, I was
> unable to specify that protocol in wpa_supplicant.conf), but only
> using the iwi(4) device -- and it would lose connectivity with
> maddening frequency during the period I was trying to use it.  I
> was also able to get wpa_supplicant(8) to associate using a small access
> point I carry in my laptop bag, but I have not been able to get it to
> associate at home (where I use WEP).  Weird.)
> 
> I'm not enough of a hacker to overhaul a device driver, but I am willing
> (as some here might attest) to test patches & report back.
> 
> I wouldn't mind being able to delete my script -- while retaining my
> ability to have network connetivity.  :-}

I guess you were also asking about using iwi and wi devices.  iwi should
work; if it does not then please provide info though I'm overloaded and
may not have time to respond quickly.  Submitting a PR would be useful.

wi was rewritten in HEAD and does support WPA but only with a subset of
the hardware (and firmware) that used to be usable.  I believe the
manual page calls out what hardware is supported.

	Sam
Received on Wed Oct 08 2008 - 22:13:35 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:36 UTC