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 # make sure all locks are removed
16 for lock in "/var/lock/dhcp-$iface" "/var/lock/ppp-$iface"; do
23 # kill active ppp daemon and other processes
24 config_get ifname "$cfg" ifname
25 pids="$(cat /var/run/${ifname}.pid /var/run/ppp-${cfg}.pid 2>/dev/null)"
27 [ -d "/proc/$pid" ] && {
29 [ -d "/proc/$pid" ] && {
31 kill -9 $pid 2>/dev/null >/dev/null
35 rm -f /var/run/${ifname}.pid /var/run/ppp-${cfg}.pid
37 config_get ifname "$cfg" ifname
38 config_get device "$cfg" ifname
40 [ ."$device" != ."$ifname" ] || device=
41 for dev in $ifname $device; do
42 ifconfig "$ifname" 0.0.0.0 down >/dev/null 2>/dev/null
45 config_get iftype "$cfg" type
46 [ "$iftype" = "bridge" ] && brctl delbr "$ifname" >/dev/null 2>/dev/null