From 1aa9be8cf533cb5b56f2f79ad26ed4fcffe6f824 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Mon, 23 Jul 2012 17:20:03 +0200 Subject: network: fix network_down when no interface is set Signed-off-by: Tom Gundersen --- network | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'network') 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() { -- cgit v1.2.3-54-g00ecf