summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/connections/ethernet11
-rw-r--r--src/connections/ethernet-iproute6
-rw-r--r--src/connections/wireless2
-rw-r--r--src/network20
-rw-r--r--src/wireless1
5 files changed, 25 insertions, 15 deletions
diff --git a/src/connections/ethernet b/src/connections/ethernet
index 2105ec2..86d8b96 100644
--- a/src/connections/ethernet
+++ b/src/connections/ethernet
@@ -12,8 +12,7 @@ ethernet_up() {
fi
report_debug ethernet_up ifup
- ip link set $INTERFACE up
- sleep 2
+ set_interface up $INTERFACE
if ip link show $INTERFACE|grep -q "NO-CARRIER"; then
report_fail "No connection"
@@ -135,13 +134,7 @@ ethernet_down() {
esac
report_debug ethernet_down ifdown
- ifconfig $INTERFACE 0.0.0.0
-
- case "$CONNECTION" in # Keep interface up for wireless
- ethernet|ethernet-old)
- quirk "nodown" || ifconfig $INTERFACE down
- ;;
- esac
+ set_interface down $INTERFACE
}
# Returns status of profile - is it still functional?
diff --git a/src/connections/ethernet-iproute b/src/connections/ethernet-iproute
index 75c99f3..2f0c485 100644
--- a/src/connections/ethernet-iproute
+++ b/src/connections/ethernet-iproute
@@ -19,8 +19,7 @@ ethernet_up() {
fi
report_debug ethernet_iproute_up ifup
- ip link set $INTERFACE up
- sleep 2
+ set_interface up $INTERFACE
if ip link show $INTERFACE|grep -Fq "NO-CARRIER"; then
report_fail "No connection"
@@ -119,8 +118,7 @@ ethernet_down() {
fi
report_debug ethernet_iproute_down if_down
- ip addr flush $INTERFACE
- quirk "nodown" || ip link set $INTERFACE down
+ set_interface down $INTERFACE
}
diff --git a/src/connections/wireless b/src/connections/wireless
index f7b4b4c..10f751e 100644
--- a/src/connections/wireless
+++ b/src/connections/wireless
@@ -167,7 +167,7 @@ wireless_down() {
[[ "$SECURITY" == "wpa" ]] && rm -f "/tmp/wpa.${PROFILE// /}" # remove wpa config
report_debug wireless_down iwconfig "$INTERFACE" essid off key off
iwconfig $INTERFACE essid off key off &> /dev/null
- ifconfig $INTERFACE down
+ set_interface down $INTERFACE
# If rfkill is specified, disable device.
if [[ -n "$RFKILL_NAME" ]]; then
diff --git a/src/network b/src/network
index 1e37633..ccf0893 100644
--- a/src/network
+++ b/src/network
@@ -252,6 +252,26 @@ set_iface() {
fi
}
+set_interface()
+{
+ INTERFACE=$2
+ case $1 in
+ up)
+ at_interface_up
+ ip link set dev $INTERFACE up
+ sleep ${UP_SLEEP:-2}
+ ;;
+ down)
+ at_interface_down
+ ip addr flush dev "$INTERFACE"
+ quirk nodown || ip link set dev "$INTERFACE" down
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+}
+
### From FreeBSD's /etc/rc.subr
##
diff --git a/src/wireless b/src/wireless
index 1c12a32..f45028e 100644
--- a/src/wireless
+++ b/src/wireless
@@ -32,7 +32,6 @@ find_essid() {
if (( try < RETRIES-4 )); then try=$((RETRIES-4)); fi
}
if [[ -n "$found" ]]; then
- echo "$found" # JP: echo literal ESSID
return 0 # network found
fi
done