fix ifup/down for ppp-based stuff
[openwrt.git] / package / base-files / default / sbin / ifup
1 #!/bin/sh
2 [ $# = 0 ] && { echo "  $0 <group>"; exit; }
3 . /etc/functions.sh
4 . /etc/network.overrides
5 [ "$FAILSAFE" != "true" -a -e /etc/config/network ] && . /etc/config/network
6
7 ifdown $1
8
9 debug "### ifup $type ###"
10 type=$1
11
12 if_proto=$(nvram get ${type}_proto)
13 if=$(nvram get ${type}_ifname)
14
15 case "$if_proto" in
16         pppoa) hotplug_dev register atm0; exit 0 ;;
17         pppoe)
18                 ifconfig nas0 2>&- >&- || {
19                         hotplug_dev register atm0
20                         exit 0
21                 }
22         ;;
23         none|"") exit 0;;
24 esac
25
26 if [ "${if%%[0-9]}" = "br" ]; then
27         for sif in $(nvram get ${type}_ifnames); do
28                 hotplug_dev register "$sif"
29         done
30 else
31         hotplug_dev register "$if"
32 fi