2 # Copyright (C) 2006-2011 OpenWrt.org
5 [ $# = 0 ] && { echo " $0 <group>"; exit; }
9 [ -e "/tmp/resolv.conf.auto" ] && rm /tmp/resolv.conf.auto
11 [ interface != "$1" -o -z "$2" ] || eval "$0 -w $2"
23 debug "### ifdown $cfg ###"
25 config_get proto "$cfg" proto
26 [ -z "$proto" ] && { echo "interface not found."; exit; }
28 config_get iface "$cfg" device
29 [ "static" = "$proto" -o "none" = "$proto" ] && {
30 env -i ACTION="ifdown" INTERFACE="$cfg" DEVICE="$iface" PROTO="$proto" /sbin/hotplug-call "iface"
33 # call interface stop handler
34 ( type "stop_interface_$proto" ) >/dev/null 2>/dev/null && eval "stop_interface_$proto '$cfg'"
36 config_get ifname "$cfg" ifname
37 config_get device "$cfg" device
39 [ ."$device" != ."$ifname" ] || device=
40 for dev in $ifname $device; do
41 ifconfig "$dev" 0.0.0.0 down >/dev/null 2>/dev/null
44 config_get iftype "$cfg" type
45 [ "bridge" = "$iftype" ] && brctl delbr "$ifname" >/dev/null 2>/dev/null
47 # remove the interface's dns entries
50 # remove the interface's network state
51 uci_revert_state network "$1"
53 # revert aliases state as well
54 config_get aliases "$1" aliases
55 for config in $aliases; do
56 uci_revert_state network "$config"