From e27d094577f874613c49cc3d93796162230ca2c8 Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Tue, 11 Aug 2009 08:05:13 -0400 Subject: start consolidation of ifconfig/ip/set_interface * try to factor all the ifconfig/ip set dev code to single location (currently networks/set_interface, though I recommend a different name for this function because it's too close in name and different in functionality from set_iface, set_profile). * added "forcedown" option to set_interface, meaning "just go down don't worry about 'nodown' quirks" * even with "forcedown", this factoring would introduce "ip addr flush dev $INTERFACE" calls to existing code. I assume that's harmless? or even beneficial? * one code block (in ethernet_iproute) had stdout,stderr of the down calls redirected to /dev/null. I've moved that to set_interface, so now everyone's getting that behavior. I assume that's appropriate... * now no more calls to "ip" or "ifconfig" outside of set_interface, except the checks for NO-CARRIER after ethernet*/set_interface up. They might also be moved to network/set_interface? * as of this commit, all the set_interface calls are now using ip instead of ifconfig. A subsequent commit will isolate the ip-use to ethernet-iproute and the ifconfig-use to ethernet. * ALERT: attend to wireless_down, it seems to be calling set_interface down twice (once in ethernet_down, once in itself). And neither this commit nor the code it's patching respects quirk nodown in the ethernet_down block. Signed-off-by: Jim Pryor --- src/connections/wireless | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/connections/wireless') diff --git a/src/connections/wireless b/src/connections/wireless index 430f0ab..fffd048 100644 --- a/src/connections/wireless +++ b/src/connections/wireless @@ -52,7 +52,7 @@ wireless_up() { fi report_debug wireless_up ifup - set_interface up $INTERFACE || return 1 + set_interface up "$INTERFACE" || return 1 ## wireless_control "$INTERFACE" up || return 1 quirk prescan && iwlist "$INTERFACE" scan &> /dev/null # bcm43xx @@ -107,7 +107,11 @@ wireless_up() { fi fi - quirk "predown" && ifconfig $INTERFACE down # madwifi FS#10585 + if quirk "predown"; then # madwifi FS#10585 + # ignore quirk nodown---is that appropriate? + # this adds a flush call as well---is that appropriate? + set_interface forcedown "$INTERFACE" + fi report_debug wireless_up iwconfig "$INTERFACE" $WEP_OPTS if ! eval iwconfig $INTERFACE $WEP_OPTS; then @@ -115,7 +119,9 @@ wireless_up() { return 1 fi - quirk "predown" && ifconfig $INTERFACE up # madwifi FS#10585 + if quirk "predown"; then # madwifi FS#10585 + set_interface up "$INTERFACE" + fi report_debug ethernet_up wep_check if ! wep_check $INTERFACE $TIMEOUT; then @@ -202,7 +208,10 @@ wireless_down() { [[ "$SECURITY" == "wpa" ]] && rm -rf "/tmp/wpa.${PROFILE// /}" # remove tmp wpa config report_debug wireless_down iwconfig "$INTERFACE" essid off key off iwconfig $INTERFACE essid off key off &> /dev/null - set_interface down $INTERFACE + # respects quirk nodown---is that appropriate? + # wasn't this already called in ethernet_down? but does the call there respect quirk nodown? + # this adds a flush call as well---is that appropriate? + set_interface down "$INTERFACE" # If rfkill is specified, disable device. if [[ -n "$RFKILL_NAME" ]]; then -- cgit v1.2.3-24-g4f1b