2016-02-16 00:09:13 |
Paul Donohue |
description |
There are situations where I have multiple APs (living on separate networks) in range simultaneously and I need to be able to manually choose between them (to manually move between those separate networks).
To handle this, I have multiple wpa_supplicant config files for each of the APs, and I use logical interfaces in /etc/network/interfaces to select the appropriate config file. For example:
iface public inet manual
wpa-conf /etc/wpa_supplicant/public.conf
iface private inet manual
wpa-conf /etc/wpa_supplicant/private.conf
To select the appropriate AP, I simply run `ifup wlan0=public` or `ifup wlan0=private`. This part works fine.
However, I would like to change the "wpa-conf" lines in the above example to use "wpa-roam" instead, so I can also handle roaming in conjunction with multiple wpa_supplicant config files. Unfortunately this doesn't work. When the "master" interface is already using a logical interface in /etc/network/interfaces, wpa-roam fails to load the logical interface specified by id_str.
The problem is that the ifup() function in functions.sh runs `grep -q "^$WPA_IFACE=$WPA_IFACE" "$IFSTATE_FILE"` to determine if the interface is already up, then runs /sbin/ifup either with or without '--force' depending on whether the interface is "up". If the "master" interface is defined in /etc/network/interfaces as a logical interface rather than a physical interface, then grep will not match, '--force' will not be used, and /sbin/ifup will fail because the interface is already configured and '--force' was not used.
The attached patch fixes this issue by running `ifquery` to determine whether the physical interface is currently up and configured as a wpasupplicant "master" interface, and will run /sbin/ifup with '--force' even if the "master" interface is a logical interface in /etc/network/interfaces. If the physical interface is already up but is not configured as a "master" interface, then it is likely we received two "CONNECT" events without a "DISCONNECT" between them, so `ifdown` is run on the old logical interface before `ifup` is run on the new one. |
There are situations where I have multiple APs (living on separate networks) in range simultaneously and I need to be able to manually choose between them (to manually move between those separate networks).
To handle this, I have multiple wpa_supplicant config files for each of the APs, and I use logical interfaces in /etc/network/interfaces to select the appropriate config file. For example:
iface public inet manual
wpa-conf /etc/wpa_supplicant/public.conf
iface private inet manual
wpa-conf /etc/wpa_supplicant/private.conf
To select the appropriate AP, I simply run `ifup wlan0=public` or `ifup wlan0=private`. This part works fine.
However, I would like to change the "wpa-conf" lines in the above example to use "wpa-roam" instead, so I can also handle roaming in conjunction with multiple wpa_supplicant config files. Unfortunately this doesn't work. When the "master" interface is already using a logical interface in /etc/network/interfaces, wpa-roam fails to load the logical interface specified by id_str.
The problem is that the ifup() function in functions.sh runs `grep -q "^$WPA_IFACE=$WPA_IFACE" "$IFSTATE_FILE"` to determine if the interface is already up, then runs /sbin/ifup either with or without '--force' depending on whether the interface is "up". If the "master" interface is defined in /etc/network/interfaces as a logical interface rather than a physical interface, then grep will not match, '--force' will not be used, and /sbin/ifup will fail because the interface is already configured and '--force' was not used.
The attached patch fixes this issue by running `ifquery` to determine whether the physical interface is currently configured as a wpasupplicant "master" interface and needs the '--force' argument to /sbin/ifup. |
|