2 # Copyright (C) 2006 OpenWrt.org
5 [ $# = 0 ] && { echo " $0 <group>"; exit; }
8 [ interface
!= "$1" -o -z "$2" ] ||
eval "$0 $2"
14 # remove the interface's network state
15 FILE
=/var
/state
/network.$$
16 grep -v "^config_set '$1' " /var
/state
/network
> "$FILE"
17 mv "$FILE" /var
/state
/network
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" ] && {
30 env
-i ACTION
="ifdown" INTERFACE
="$cfg" DEVICE
="$iface" PROTO
=static
/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 # make sure all locks are removed
37 for lock
in "/var/lock/dhcp-$iface" "/var/lock/ppp-$iface"; do
44 # kill active ppp daemon and other processes
45 config_get ifname
"$cfg" ifname
46 pids
="$(head -n1 -q /var/run/${ifname}.pid /var/run/ppp-${cfg}.pid 2>/dev/null)"
48 [ -d "/proc/$pid" ] && {
50 [ -d "/proc/$pid" ] && {
52 kill -9 $pid 2>/dev
/null
>/dev
/null
56 rm -f /var
/run
/${ifname}.pid
/var
/run
/ppp-
${cfg}.pid
58 config_get ifname
"$cfg" ifname
59 config_get device
"$cfg" device
61 [ .
"$device" != .
"$ifname" ] || device
=
62 for dev
in $ifname $device; do
63 ifconfig
"$dev" 0.0.0.0 down
>/dev
/null
2>/dev
/null
66 config_get iftype
"$cfg" type
67 [ "bridge" = "$iftype" ] && brctl delbr
"$ifname" >/dev
/null
2>/dev
/null
This page took 0.050119 seconds and 5 git commands to generate.