Comment 0 for bug 1262874

Revision history for this message
Steve Dodd (anarchetic) wrote :

I'm running 12.10 on a mostly headless MK808 stick - but I believe this bug will exist on later versions as well as the code in question hasn't changed. Originally I had my /etc/network/interfaces configured to use wpa_supplicant in roaming mode, and this worked correctly. Then I needed to add an option to boot into hotspot mode, which I implemented using a flag file and a custom mapping script. After doing this, however, my roaming interfaces were not configured. Here is /etc/network/interfaces:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
mapping eth0
 script /usr/local/bin/hotspot-req.sh
 map true host
 map false wpa

iface host inet static
 pre-up /sbin/iwconfig eth0 power off
 pre-up /sbin/iwconfig eth0 mode Master || true
 pre-up /sbin/iwconfig eth0 essid KITCHEN1
 address 192.168.150.1
 netmask 255.255.255.0

iface wpa inet manual
 wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
 wpa-debug-level 3
 pre-up /sbin/iwconfig eth0 power off

iface kitchen inet dhcp
 pre-up /sbin/iwconfig eth0 power off

iface home inet dhcp
 pre-up /sbin/iwconfig eth0 power off

The problem seems to be that ifup is not invoked with --force, although it apparently needs to be. The test is performed in this line of /etc/wpa_supplicant/functions.sh:

               if [ -n "$IFSTATE_FILE" ] && grep -q "^$WPA_IFACE=$WPA_IFACE" "$IFSTATE_FILE"; then

Changing it to:

              if [ -n "$IFSTATE_FILE" ] && grep -q "^$WPA_IFACE=" "$IFSTATE_FILE" && ! grep -q "^$WPA_IFACE=$WPA_LOGICAL_IFACE";
then

fixes my problem but I would like some thoughts on whether this is correct. The idea is if that physical interface is already configured, but not using the current logical interface name, then it needs to be forcibly reconfigured...