From dce7afd6a8d4bcd6adb7f1d1b330c21fcb8c9957 Mon Sep 17 00:00:00 2001 From: James Rayner Date: Sun, 27 Sep 2009 22:04:28 +1000 Subject: Only flush when disabling wireless interface, tidy up down/forcedown --- src/connections/ethernet | 13 ++++++------- src/connections/wireless | 8 +++----- src/network | 12 ++++++------ 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/connections/ethernet b/src/connections/ethernet index 20ee545..a0641d0 100644 --- a/src/connections/ethernet +++ b/src/connections/ethernet @@ -40,9 +40,7 @@ ethernet_up() { fi if ! wpa_check "$INTERFACE"; then - # ignore quirk nodown---is that appropriate? or should we just use report_iproute? - # this adds a flush call as well---is that appropriate? - bring_interface forcedown "$INTERFACE" + bring_interface down "$INTERFACE" report_fail "WPA Authentication/Association Failed" return 1 fi @@ -145,10 +143,11 @@ ethernet_down() { fi report_debug ethernet_iproute_down if_down - # ignore quirk nodown---is that appropriate? - # this adds a flush call as well---is that appropriate? - bring_interface forcedown "$INTERFACE" - + if [[ "$CONNECTION" == "wireless" ]]; then + bring_interface flush "$INTERFACE" + else + bring_interface down "$INTERFACE" + fi } # Returns status of profile - is it still functional? diff --git a/src/connections/wireless b/src/connections/wireless index 2d2463d..6de7379 100644 --- a/src/connections/wireless +++ b/src/connections/wireless @@ -43,7 +43,7 @@ iwconfig_up() { fi fi - quirk "predown" && bring_interface forcedown "$INTERFACE" # madwifi FS#10585 + quirk "predown" && bring_interface down "$INTERFACE" # madwifi FS#10585 report_debug wireless_up iwconfig "$INTERFACE" $WEP_OPTS @@ -165,12 +165,10 @@ wireless_up() { # wireless_down PROFILE [ LEAVE ifconfig up? default no ] wireless_down() { - local PROFILE="$1" NOETHERNETDOWN="$2" + local PROFILE="$1" load_profile "$PROFILE" - if ! checkyesno "$NOETHERNETDOWN"; then - "$CONN_DIR/ethernet" down "$PROFILE" - fi + "$CONN_DIR/ethernet" down "$PROFILE" if [[ ${SECURITY:(-4)} == "-old" ]]; then report_debug wireless_down iwconfig "$INTERFACE" essid off key off diff --git a/src/network b/src/network index 5c22a7b..b7cd19b 100644 --- a/src/network +++ b/src/network @@ -351,18 +351,17 @@ bring_interface() if ! ( eval $IFACE_UP ); then return 1 fi - ip link set dev "$INTERFACE" up &>/dev/null # man ip is inconsistent about whether to use "dev" + ip link set dev "$INTERFACE" up &>/dev/null sleep "${UP_SLEEP:-2}" ;; - down|forcedown) - # should this be placed elsewhere? + down|flush) if ! ( eval $IFACE_DOWN ); then return 1 fi ip addr flush dev "$INTERFACE" &>/dev/null - if ! quirk nodown || [ "$1" = forcedown ]; then - ip link set dev "$INTERFACE" down &>/dev/null # man ip is inconsistent about whether to use "dev" - fi + ;;& + down) + ip link set dev "$INTERFACE" down &>/dev/null ;; *) return 1 @@ -371,3 +370,4 @@ bring_interface() } # vim: ft=sh ts=4 et sw=4: + -- cgit v1.2.3-24-g4f1b