Subject: [alpine-devel] wpa_supplicant service and a replacement therof

From: Isaac Dunham <[email-masked]>
Date: Wed, 30 Jul 2014 13:42:03 -0700

Hello,
I've run into a few problems with the alpine wpa_supplicant service,
and so I ported a script I previously wrote to openrc.

The script:
github.com/idunham/wpanet
Relevant files:
README sbin/wpa_dhcp etc/init.d/wpanet etc/conf.d/wpanet

The issues:
1. service wpa_supplicant does not specify a driver.
For both devices I tested (modules ath5k and zd1211rw), this results in
wpa_supplicant failing to associate.
2. if wpa_supplicant takes a long time to connect, service networking will
take a long time to finish, before it gives up.
3. if wpa_supplicant completes connection after networking/ifup gives up,
no IP will be obtained.
Worse, you can't get one by running ifup again, since it's already
marked as 'up'.

With some drivers (madwifi) in the past, I have seen dhcp clients panic
the kernel if they are started too soon. This isn't an issue with any
drivers available in Alpine, as far as I know.

For issue 1, it would be easy to port the driver autodetection code.

Issues 2 and 3 are fundamental problems with the Alpine approach,
due to the limitations of ifup -a.

wpanet avoids them by removing all interfaces that wpa_supplicant controls
from /etc/network/interfaces and using wpa_cli with an "action script".
For those who need more than automatic dhcp, it is possible to configure
/etc/wpa/interfaces in the same way you would configure
/etc/network/interfaces; wpa_dhcp detects this and calls
ifup -i /etc/wpa/interfaces if0

Migrating from one approach to the other would be scriptable,
but not trivially so.
I can think of two alternatives to that: 
(a) a very invasive change to the networking service that relies on the
guts of wpa_supplicant, such that it does not call ifup on wireless
interfaces but instead starts an 'action script' that will call ifup when
it is ready.
This "should work" but would be ugly and brittle.
(b) make ifup not mark an interface as up when the dhcp client failed, and
from either service start wpa_cli with an action script that calls ifup.

I'm not eager to jump into any of the three options I mentioned.

But if there's interest, I can port the driver autodetection over;
additionally, I'd like to package wpanet.

Thanks,
Isaac Dunham

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---