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 # call interface stop handler
16 ( type "stop_interface_$proto" ) >/dev/null 2>/dev/null && eval "stop_interface_$proto '$cfg'"
18 # make sure all locks are removed
19 for lock in "/var/lock/dhcp-$iface" "/var/lock/ppp-$iface"; do
26 # kill active ppp daemon and other processes
27 config_get ifname "$cfg" ifname
28 pids="$(cat /var/run/${ifname}.pid /var/run/ppp-${cfg}.pid 2>/dev/null)"
30 [ -d "/proc/$pid" ] && {
32 [ -d "/proc/$pid" ] && {
34 kill -9 $pid 2>/dev/null >/dev/null
38 rm -f /var/run/${ifname}.pid /var/run/ppp-${cfg}.pid
40 config_get ifname "$cfg" ifname
41 config_get device "$cfg" ifname
43 [ ."$device" != ."$ifname" ] || device=
44 for dev in $ifname $device; do
45 ifconfig "$ifname" 0.0.0.0 down >/dev/null 2>/dev/null
48 config_get iftype "$cfg" type
49 [ "$iftype" = "bridge" ] && brctl delbr "$ifname" >/dev/null 2>/dev/null