summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2012-07-23 17:20:03 +0200
committerTom Gundersen <teg@jklm.no>2012-07-23 21:18:33 +0200
commit1aa9be8cf533cb5b56f2f79ad26ed4fcffe6f824 (patch)
treee30f7d330b967e18ef56b4b5a550323da57b29d8
parentc82d8bc881397bdde91081d2788e95a78e209d57 (diff)
network: fix network_down when no interface is set
Signed-off-by: Tom Gundersen <teg@jklm.no>
-rwxr-xr-xnetwork15
1 files changed, 10 insertions, 5 deletions
diff --git a/network b/network
index 9f8b0a3..b28c523 100755
--- a/network
+++ b/network
@@ -34,13 +34,18 @@ network_up() {
}
network_down() {
- if [[ ! -n $address ]] && [[ -f /run/dhcpcd-$interface.pid || -f /run/dhcpcd.pid ]]; then
- dhcpcd -qk $interface || return 1
+ if [[ ! -n $interface ]]; then
+ if [[ -f /run/dhcpcd.pid ]]; then
+ dhcpcd -qk || return 1
+ fi
else
- ip addr flush dev $interface || return 1
+ if [[ ! -n $address && -f /run/dhcpcd-$interface.pid ]]; then
+ dhcpcd -qk $interface || return 1
+ else
+ ip addr flush dev $interface || return 1
+ fi
+ ip link set dev $interface down || return 1
fi
-
- ip link set dev $interface down || return 1
}
ifup() {