wpa_supplicant for ad-hoc mode

Shawn Rutledge shawn.t.rutledge
Fri Jan 23 13:00:23 PST 2009

I'm kindof surprised not to get any reply at all on this.

On Fri, Jan 16, 2009 at 6:33 PM, Shawn Rutledge
<shawn.t.rutledge at gmail.com> wrote:
> My goal is to use wpa_supplicant to take care of all wireless
> configuration, including both ad-hoc and AP modes, because it's very
> nice to have one config file and have wpa_supplicant maintain it, and
> use the socket to instruct wpa_supplicant about changes... I can build
> a nice embedded configuration UI without having to write conf files
> myself, and without ever having to fork a process just to run iwconfig
> or ifup or the like (which I currently have had to do).
> This page says there are some kernel patches that are necessary, which
> were to be merged into 2.6.26:
> http://lists.shmoo.com/pipermail/hostap/2008-July/018036.html
> On my laptop I run kernel 2.6.27 (Gentoo version) with rtl8187 for my
> Alfa AWUS036H adapter.  (That is because ath5k is not working quite
> well enough for the built-in Atheros chip, which lspci identifies as
> AR5006EG... and I've read elsewhere that the ability to identify which
> Atheros chip it is exactly, is not reliable.  With the ath5k driver,
> iwlist scan does not return any results, and wpa_supplicant also
> cannot scan.)  With the RTL driver, I cannot get wpa_supplicant to
> connect in ad-hoc mode.  I already added the line
> mode=1
> to the relevant section.  (And IMO it's a bug that wpa_supplicant does
> not do that itself.  It can tell that the ESSID is an ad-hoc one, when
> it does the scan, right?  If you can be sure that the essid is only
> ad-hoc, can't be an AP, then why not write that mode flag?  If not,
> then wpa_gui needs a setting for ad-hoc.)
> Yet, to fix it, all I need to do (while wpa_supplicant is still
> running - I don't even have to kill it!) is
> ifconfig wlan1 down
> iwconfig wlan1 mode ad-hoc essid my-essid
> and when I do that, via strace I can see that iwconfig only does 2
> ioctls - that's enough to get it working.
> ioctl(3, SIOCSIWMODE, 0xbfb52efc)       = 0
> ioctl(3, SIOCSIWESSID, 0xbfb52ef8)      = 0
> I'm having almost the same experience on the embedded system I'm
> working on (with different drivers).
> wpa_supplicant on the other hand does much more (when I watch it via
> strace as it's trying to configure the interface in ad-hoc mode) so my
> thought was all the excessive frobbing got the driver confused... so I
> commented out a lot of ioctls in the wpa_supplicant "driver" and got
> it down to just those same two ioctls.  Still no luck.  If it's so
> easy for iwconfig to get it working, wpa_supplicant could do the
> initialization more or less the same way, right?
> What are these kernel patches?  Did they make it into 2.6.27?  Anyway
> the embedded system is running 2.6.18, so if I need to apply the same
> patches to that kernel as well, anybody know where to get them?
> (BTW I have been doing most of the experiments with wpa_supplicant
> 0.6.7, and some with 0.5.7)

More information about the Hostap mailing list