diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/connections/ethernet | 11 | ||||
-rw-r--r-- | src/connections/wireless | 9 | ||||
-rw-r--r-- | src/network | 23 |
3 files changed, 27 insertions, 16 deletions
diff --git a/src/connections/ethernet b/src/connections/ethernet index 64a8513..71124d0 100644 --- a/src/connections/ethernet +++ b/src/connections/ethernet @@ -12,9 +12,10 @@ ethernet_up() { fi report_debug ethernet_up ifup - set_interface up "$INTERFACE" + set_interface up-old "$INTERFACE" - if ip link show $INTERFACE| fgrep -q "NO-CARRIER"; then + # don't think it's possible to detect carrier using ifconfig alone (at least, not without ifdown/ifupping the interface) + if [[ $(cat /sys/class/net/$INTERFACE/carrier 2>/dev/null) -ne 1 ]]; then # gives err if iface inactive (i.e. ifdown) report_fail "No connection" return 1 fi @@ -31,7 +32,7 @@ ethernet_up() { if ! wpa_check "$INTERFACE"; then # ignore quirk nodown---is that appropriate? # this adds a flush call as well---is that appropriate? - set_interface forcedown "$INTERFACE" + set_interface forcedown-old "$INTERFACE" report_fail "WPA Authentication/Association Failed" return 1 fi @@ -78,7 +79,7 @@ ethernet_up() { # JP: don't we want to add this to all the aborts? # ignore quirk nodown---is that appropriate? # this adds a flush call as well---is that appropriate? - set_interface forcedown "$INTERFACE" + set_interface forcedown-old "$INTERFACE" report_fail "Adding gateway $GATEWAY failed." return 1 fi @@ -144,7 +145,7 @@ ethernet_down() { report_debug ethernet_down ifdown # ignore quirk nodown---is that appropriate? # this adds a flush call as well---is that appropriate? - set_interface forcedown "$INTERFACE" + set_interface forcedown-old "$INTERFACE" } # Returns status of profile - is it still functional? diff --git a/src/connections/wireless b/src/connections/wireless index fffd048..c50acfa 100644 --- a/src/connections/wireless +++ b/src/connections/wireless @@ -52,8 +52,7 @@ wireless_up() { fi report_debug wireless_up ifup - set_interface up "$INTERFACE" || return 1 - ## wireless_control "$INTERFACE" up || return 1 + set_interface up-old "$INTERFACE" || return 1 quirk prescan && iwlist "$INTERFACE" scan &> /dev/null # bcm43xx if quirk preessid; then # ipw3945 @@ -110,7 +109,7 @@ wireless_up() { 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" + set_interface forcedown-old "$INTERFACE" fi report_debug wireless_up iwconfig "$INTERFACE" $WEP_OPTS @@ -120,7 +119,7 @@ wireless_up() { fi if quirk "predown"; then # madwifi FS#10585 - set_interface up "$INTERFACE" + set_interface up-old "$INTERFACE" fi report_debug ethernet_up wep_check @@ -211,7 +210,7 @@ wireless_down() { # 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" + set_interface down-old "$INTERFACE" # If rfkill is specified, disable device. if [[ -n "$RFKILL_NAME" ]]; then diff --git a/src/network b/src/network index d65c899..12920de 100644 --- a/src/network +++ b/src/network @@ -338,16 +338,27 @@ set_interface() { INTERFACE="$2" case "$1" in - up) + up|up-old) at_interface_up - ip link set dev "$INTERFACE" up + if [ "$1" = old ]; then + ifconfig "$INTERFACE" up + else + ip link set dev "$INTERFACE" up + fi sleep "${UP_SLEEP:-2}" ;; - down|forcedown) + down|forcedown|down-old|forcedown-old) at_interface_down - ip addr flush dev "$INTERFACE" &>/dev/null - if ! quirk nodown || [ "$1" = forcedown ]; then - ip link set dev "$INTERFACE" down &>/dev/null + if [ "${1%-old}" != "$1" ]; then + ## ? + if ! quirk nodown || [ "$1" = forcedown-old ]; then + ifconfig "$INTERFACE" down + fi + else + ip addr flush dev "$INTERFACE" &>/dev/null + if ! quirk nodown || [ "$1" = forcedown ]; then + ip link set dev "$INTERFACE" down &>/dev/null + fi fi ;; *) |