390f96039502382887fc73453e4af5f4b5728f5d
[openwrt/openwrt.git] / openwrt / package / base-files / default / sbin / ifup
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3
4 [ $# = 0 ] && { echo " $0 <group>"; exit; }
5 . /etc/functions.sh
6 . /etc/config/network
7
8 ifdown $1
9
10 debug "### ifup $type ###"
11 type=$1
12
13 eval "if_proto=\"\${${type}_proto}\""
14 eval "if=\"\${${type}_ifname}\""
15 [ "${if%%[0-9]}" = "ppp" ] && eval "if=\"\${${type}_device}\""
16
17 case "$if_proto" in
18 pppoa) hotplug_dev register atm0; exit 0 ;;
19 pppoe)
20 # PPPoE over ATM
21 [ "$if" = "nas0" ] && {
22 ifconfig nas0 2>&- >&- || {
23 hotplug_dev register atm0
24 exit 0
25 }
26 }
27 ;;
28 none|"") exit 0;;
29 esac
30
31 if [ "${if%%[0-9]}" = "br" ]; then
32 eval "ifnames=\"\${${type}_ifnames}\""
33 for sif in $ifnames; do
34 hotplug_dev register "$sif"
35 done
36 else
37 hotplug_dev register "$if"
38 fi