2 # Copyright (C) 2006 OpenWrt.org
4 [ $# = 0 ] && { echo " $0 <group>"; exit; }
10 debug "### ifdown $cfg ###"
12 config_get proto "$cfg" proto
13 [ -z "$proto" ] && { echo "interface not found."; exit; }
15 config_get iface "$cfg" device
16 [ "$proto" = "static" ] && {
17 env -i ACTION="ifdown" INTERFACE="$config" DEVICE="$iface" PROTO=static /sbin/hotplug "iface" &
20 # call interface stop handler
21 ( type "stop_interface_$proto" ) >/dev/null 2>/dev/null && eval "stop_interface_$proto '$cfg'"
23 # make sure all locks are removed
24 for lock in "/var/lock/dhcp-$iface" "/var/lock/ppp-$iface"; do
31 # kill active ppp daemon and other processes
32 config_get ifname "$cfg" ifname
33 pids="$(head -n1 -q /var/run/${ifname}.pid /var/run/ppp-${cfg}.pid 2>/dev/null)"
35 [ -d "/proc/$pid" ] && {
37 [ -d "/proc/$pid" ] && {
39 kill -9 $pid 2>/dev/null >/dev/null
43 rm -f /var/run/${ifname}.pid /var/run/ppp-${cfg}.pid
45 config_get ifname "$cfg" ifname
46 config_get device "$cfg" device
48 [ ."$device" != ."$ifname" ] || device=
49 for dev in $ifname $device; do
50 ifconfig "$dev" 0.0.0.0 down >/dev/null 2>/dev/null
53 config_get iftype "$cfg" type
54 [ "$iftype" = "bridge" ] && brctl delbr "$ifname" >/dev/null 2>/dev/null