You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.3 KiB
58 lines
1.3 KiB
19 years ago
|
#!/bin/sh
|
||
14 years ago
|
# Copyright (C) 2006-2011 OpenWrt.org
|
||
19 years ago
|
|
||
20 years ago
|
. /etc/functions.sh
|
||
18 years ago
|
[ $# = 0 ] && { echo " $0 <group>"; exit; }
|
||
14 years ago
|
|
||
|
case "$1" in
|
||
|
"-a")
|
||
|
[ -e "/tmp/resolv.conf.auto" ] && rm /tmp/resolv.conf.auto
|
||
|
config_cb() {
|
||
|
[ interface != "$1" -o -z "$2" ] || eval "$0 -w $2"
|
||
|
}
|
||
|
config_load network
|
||
|
exit 0
|
||
|
;;
|
||
|
"-w") shift ;;
|
||
|
esac
|
||
18 years ago
|
|
||
18 years ago
|
include /lib/network
|
||
19 years ago
|
scan_interfaces
|
||
19 years ago
|
|
||
19 years ago
|
cfg=$1
|
||
|
debug "### ifdown $cfg ###"
|
||
19 years ago
|
|
||
19 years ago
|
config_get proto "$cfg" proto
|
||
19 years ago
|
[ -z "$proto" ] && { echo "interface not found."; exit; }
|
||
19 years ago
|
|
||
18 years ago
|
config_get iface "$cfg" device
|
||
15 years ago
|
[ "static" = "$proto" -o "none" = "$proto" ] && {
|
||
|
env -i ACTION="ifdown" INTERFACE="$cfg" DEVICE="$iface" PROTO="$proto" /sbin/hotplug-call "iface"
|
||
18 years ago
|
}
|
||
|
|
||
18 years ago
|
# call interface stop handler
|
||
|
( type "stop_interface_$proto" ) >/dev/null 2>/dev/null && eval "stop_interface_$proto '$cfg'"
|
||
|
|
||
19 years ago
|
config_get ifname "$cfg" ifname
|
||
18 years ago
|
config_get device "$cfg" device
|
||
18 years ago
|
|
||
|
[ ."$device" != ."$ifname" ] || device=
|
||
|
for dev in $ifname $device; do
|
||
18 years ago
|
ifconfig "$dev" 0.0.0.0 down >/dev/null 2>/dev/null
|
||
18 years ago
|
done
|
||
|
|
||
|
config_get iftype "$cfg" type
|
||
18 years ago
|
[ "bridge" = "$iftype" ] && brctl delbr "$ifname" >/dev/null 2>/dev/null
|
||
19 years ago
|
|
||
15 years ago
|
# remove the interface's dns entries
|
||
|
remove_dns "$cfg"
|
||
|
|
||
17 years ago
|
# remove the interface's network state
|
||
|
uci_revert_state network "$1"
|
||
|
|
||
17 years ago
|
# revert aliases state as well
|
||
|
config_get aliases "$1" aliases
|
||
|
for config in $aliases; do
|
||
|
uci_revert_state network "$config"
|
||
|
done
|