2 # Copyright (C) 2006 OpenWrt.org
5 [ $# = 0 ] && { echo " $0 <group>"; exit; }
7 [ -e "/tmp/resolv.conf.auto" ] && rm /tmp
/resolv.conf.auto
9 [ interface
!= "$1" -o -z "$2" ] ||
eval "$0 $2"
19 debug
"### ifdown $cfg ###"
21 config_get proto
"$cfg" proto
22 [ -z "$proto" ] && { echo "interface not found."; exit; }
24 config_get iface
"$cfg" device
25 [ "static" = "$proto" ] && {
26 env
-i ACTION
="ifdown" INTERFACE
="$cfg" DEVICE
="$iface" PROTO
=static
/sbin
/hotplug-call
"iface" &
29 # call interface stop handler
30 ( type "stop_interface_$proto" ) >/dev
/null
2>/dev
/null
&& eval "stop_interface_$proto '$cfg'"
32 # make sure all locks are removed
33 for lock
in "/var/lock/dhcp-$iface" "/var/lock/ppp-$iface"; do
40 # kill active ppp daemon and other processes
41 config_get ifname
"$cfg" ifname
42 pids
="$(head -n1 -q /var/run/${ifname}.pid /var/run/ppp-${cfg}.pid 2>/dev/null)"
44 [ -d "/proc/$pid" ] && {
46 [ -d "/proc/$pid" ] && {
48 kill -9 $pid 2>/dev
/null
>/dev
/null
52 rm -f /var
/run
/${ifname}.pid
/var
/run
/ppp-
${cfg}.pid
54 config_get ifname
"$cfg" ifname
55 config_get device
"$cfg" device
57 [ .
"$device" != .
"$ifname" ] || device
=
58 for dev
in $ifname $device; do
59 ifconfig
"$dev" 0.0.0.0 down
>/dev
/null
2>/dev
/null
62 config_get iftype
"$cfg" type
63 [ "bridge" = "$iftype" ] && brctl delbr
"$ifname" >/dev
/null
2>/dev
/null
65 # remove the interface's network state
66 uci_revert_state network
"$1"
68 # revert aliases state as well
69 config_get aliases
"$1" aliases
70 for config
in $aliases; do
71 uci_revert_state network
"$config"
This page took 0.045007 seconds and 5 git commands to generate.