move platform specific base-files into target/linux/<targetname>
[openwrt/openwrt.git] / package / base-files / default / sbin / ifdown
index 4f5be8c8c01d1b324a8669e84f6f3e52581171e9..26d0e626d2dde9bb02e076efafa53b769ad41a89 100755 (executable)
@@ -12,6 +12,11 @@ debug "### ifdown $cfg ###"
 config_get proto "$cfg" proto
 [ -z "$proto" ] && { echo "interface not found."; exit; }
 
+config_get iface "$cfg" device
+[ "$proto" = "static" ] && {
+       env -i ACTION="ifdown" INTERFACE="$config" DEVICE="$iface" PROTO=static /sbin/hotplug "iface" &
+}
+
 # call interface stop handler
 ( type "stop_interface_$proto" ) >/dev/null 2>/dev/null && eval "stop_interface_$proto '$cfg'"
 
@@ -25,7 +30,7 @@ done
 
 # kill active ppp daemon and other processes
 config_get ifname "$cfg" ifname
-pids="$(cat /var/run/${ifname}.pid /var/run/ppp-${cfg}.pid 2>/dev/null)"
+pids="$(head -n1 -q /var/run/${ifname}.pid /var/run/ppp-${cfg}.pid 2>/dev/null)"
 for pid in $pids; do 
        [ -d "/proc/$pid" ] && {
                kill $pid