X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=package%2Fbase-files%2Ffiles%2Fsbin%2Fifdown;h=9eadad31e8cf47ac995903839b9016d502eba95e;hb=9fb77da4515a788a2de063801fcbfbe99d7475ec;hp=103309fa841e1a48a357790e14a5591506ec990d;hpb=7af01d4894b972bc4b40b85b87f0059e1d9ab1d7;p=10.03%2Fopenwrt.git diff --git a/package/base-files/files/sbin/ifdown b/package/base-files/files/sbin/ifdown index 103309fa8..9eadad31e 100755 --- a/package/base-files/files/sbin/ifdown +++ b/package/base-files/files/sbin/ifdown @@ -1,8 +1,16 @@ #!/bin/sh # Copyright (C) 2006 OpenWrt.org -[ $# = 0 ] && { echo " $0 "; exit; } . /etc/functions.sh +[ $# = 0 ] && { echo " $0 "; exit; } +[ "x$1" = "x-a" ] && { + config_cb() { + [ interface != "$1" -o -z "$2" ] || eval "$0 $2" + } + config_load network + exit +} + include /lib/network scan_interfaces @@ -13,8 +21,8 @@ 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" & +[ "static" = "$proto" ] && { + env -i ACTION="ifdown" INTERFACE="$cfg" DEVICE="$iface" PROTO=static /sbin/hotplug-call "iface" & } # call interface stop handler @@ -51,5 +59,13 @@ for dev in $ifname $device; do done config_get iftype "$cfg" type -[ "$iftype" = "bridge" ] && brctl delbr "$ifname" >/dev/null 2>/dev/null +[ "bridge" = "$iftype" ] && brctl delbr "$ifname" >/dev/null 2>/dev/null + +# remove the interface's network state +uci_revert_state network "$1" +# revert aliases state as well +config_get aliases "$1" aliases +for config in $aliases; do + uci_revert_state network "$config" +done