On Sun, Jun 19, 2011 at 10:03:38PM -0500, Dan McGee wrote:
When using the net-auto-wireless profile, it can be very helpful to prefer certain connections over others.
Signed-off-by: Dan McGee <dan@archlinux.org> ---
This seemed like an obvious addition to me when I was trying to replace a box with a static wpa_supplicant.conf configuration and couldn't reproduce it faithfully.
This also makes me wonder if the 'wpa-configsection' option is all too restrictive, or if we should always append a CONFIGSECTION variable if it is present in a profile. This would allow people to do the HIDDEN (existing) and PRIORITY option (introduced here) in a more ad-hoc fashion as well as allowing any other WPA options we don't currently support without having to special-case each one.
-Dan
docs/wireless | 4 +++- src/8021x | 4 ++++ src/network | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/docs/wireless b/docs/wireless index 2e466c7..bfe3c40 100644 --- a/docs/wireless +++ b/docs/wireless @@ -18,13 +18,15 @@ ESSID (this or AP is required) AP (this or ESSID is required) : AP (BSSID) of the network to connect to. HIDDEN (optional) -: Define this to connect to hidden ESSIDs. +: Assume the SSID of this network might not be broadcast and probe for it instead. Can be 'yes' or 'no', defaults to 'no'. ADHOC (optional) : Define this to use ad-hoc mode for wireless. TIMEOUT (optional) : Time to wait for association. Defaults to 15 seconds. SCAN (optional) : yes/no Scan for a wireless network rather than blindly attempting to connect. Hidden SSID networks do not appear in a scan. +PRIORITY (optional) +: Integer value to use as the wpa_supplicant priority value for this network. The default is '0'. IWCONFIG (optional, deprecated) : Run iwconfig with these options before attempting to configure the connection.
diff --git a/src/8021x b/src/8021x index 267a358..73a4ceb 100644 --- a/src/8021x +++ b/src/8021x @@ -222,6 +222,10 @@ make_wpa_config() { if checkyesno ${HIDDEN:-no}; then echo "scan_ssid=1" fi + + if [ ${PRIORITY:-0} -gt 0]; then
If you use proper bash syntax here, you don't have to worry about the default assigment: if (( PRIORITY > 0 )); then
+ echo "priority=$PRIORITY" + fi }
# vim: ft=sh ts=4 et sw=4 tw=0: diff --git a/src/network b/src/network index 316183e..953e502 100644 --- a/src/network +++ b/src/network @@ -10,7 +10,7 @@ load_profile() { unset ADDR AP AUTH8021X CONNECTION DESCRIPTION unset DHCP_OPTIONS DHCP_TIMEOUT DHCLIENT DNS DNS1 DNS2 DOMAIN - unset ESSID GATEWAY HIDDEN IFOPTS INTERFACE IP IPCFG + unset ESSID GATEWAY HIDDEN IFOPTS INTERFACE IP IPCFG PRIORITY unset IWCONFIG unset KEY NETMASK RFKILL RFKILL_NAME SCAN SEARCH TIMEOUT unset VLAN_ID VLAN_PHYS_DEV -- 1.7.5.2