summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/connections/ethernet14
-rw-r--r--src/connections/ethernet-iproute15
-rw-r--r--src/connections/wireless17
-rw-r--r--src/network16
4 files changed, 42 insertions, 20 deletions
diff --git a/src/connections/ethernet b/src/connections/ethernet
index 935bf8b..64a8513 100644
--- a/src/connections/ethernet
+++ b/src/connections/ethernet
@@ -12,7 +12,7 @@ ethernet_up() {
fi
report_debug ethernet_up ifup
- set_interface up $INTERFACE
+ set_interface up "$INTERFACE"
if ip link show $INTERFACE| fgrep -q "NO-CARRIER"; then
report_fail "No connection"
@@ -29,7 +29,9 @@ ethernet_up() {
return 1
fi
if ! wpa_check "$INTERFACE"; then
- ifconfig "$INTERFACE" down
+ # ignore quirk nodown---is that appropriate?
+ # this adds a flush call as well---is that appropriate?
+ set_interface forcedown "$INTERFACE"
report_fail "WPA Authentication/Association Failed"
return 1
fi
@@ -73,6 +75,10 @@ ethernet_up() {
if [[ -n "$GATEWAY" ]]; then
report_debug ethernet_up route add default gw "$GATEWAY"
if ! route add default gw $GATEWAY; then
+ # 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"
report_fail "Adding gateway $GATEWAY failed."
return 1
fi
@@ -136,7 +142,9 @@ ethernet_down() {
esac
report_debug ethernet_down ifdown
- set_interface down $INTERFACE
+ # ignore quirk nodown---is that appropriate?
+ # this adds a flush call as well---is that appropriate?
+ set_interface forcedown "$INTERFACE"
}
# Returns status of profile - is it still functional?
diff --git a/src/connections/ethernet-iproute b/src/connections/ethernet-iproute
index 046b9a0..c50fd7d 100644
--- a/src/connections/ethernet-iproute
+++ b/src/connections/ethernet-iproute
@@ -4,8 +4,7 @@
report_iproute()
{
report_fail "$*"
- ip addr flush $INTERFACE &>/dev/null
- quirk "nodown" || ip link set $INTERFACE down &>/dev/null
+ set_interface down "$INTERFACE"
exit 1
}
@@ -19,9 +18,9 @@ ethernet_up() {
fi
report_debug ethernet_iproute_up ifup
- set_interface up $INTERFACE
+ set_interface up "$INTERFACE"
- if ip link show $INTERFACE | fgrep -q "NO-CARRIER"; then
+ if ip link show dev "$INTERFACE" | fgrep -q "NO-CARRIER"; then
report_iproute "No connection"
fi
@@ -37,7 +36,9 @@ ethernet_up() {
fi
if ! wpa_check "$INTERFACE"; then
- ip link set $INTERFACE down
+ # ignore quirk nodown---is that appropriate? or should we just use report_iproute?
+ # this adds a flush call as well---is that appropriate?
+ set_interface forcedown "$INTERFACE"
report_fail "WPA Authentication/Association Failed"
return 1
fi
@@ -120,7 +121,9 @@ ethernet_down() {
fi
report_debug ethernet_iproute_down if_down
- set_interface down $INTERFACE
+ # ignore quirk nodown---is that appropriate?
+ # this adds a flush call as well---is that appropriate?
+ set_interface forcedown "$INTERFACE"
}
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
diff --git a/src/network b/src/network
index ae74837..d65c899 100644
--- a/src/network
+++ b/src/network
@@ -336,17 +336,19 @@ set_iface() {
set_interface()
{
- INTERFACE=$2
- case $1 in
+ INTERFACE="$2"
+ case "$1" in
up)
at_interface_up
- ip link set dev $INTERFACE up
- sleep ${UP_SLEEP:-2}
+ ip link set dev "$INTERFACE" up
+ sleep "${UP_SLEEP:-2}"
;;
- down)
+ down|forcedown)
at_interface_down
- ip addr flush dev "$INTERFACE"
- quirk nodown || ip link set dev "$INTERFACE" down
+ ip addr flush dev "$INTERFACE" &>/dev/null
+ if ! quirk nodown || [ "$1" = forcedown ]; then
+ ip link set dev "$INTERFACE" down &>/dev/null
+ fi
;;
*)
return 1