tag rc6
[openwrt/svn-archive/openwrt.git] / package / base-files / default / sbin / ifup
1 #!/bin/ash
2 [ $# = 0 ] && { echo " $0 <group>"; exit; }
3 . /etc/functions.sh
4 type=$1
5 debug "### ifup $type ###"
6
7 if_proto=$(nvram get ${type}_proto)
8 case "$if_proto" in
9 none|"")exit;;
10 esac
11 if=$(nvram get ${type}_ifname)
12 if [ "${if%%[0-9]}" = "ppp" ]; then
13 if=$(nvram get ${type}_device)
14 if_valid "$if" || {
15 [ "$if_proto" = "pppoe" ] && exit
16 }
17 else
18 if_valid "$if" || exit
19 fi
20
21 mac=$(nvram get ${type}_hwaddr)
22 $DEBUG ifconfig $if down 2>&-
23
24 if [ "${if%%[0-9]}" = "br" ]; then
25 stp=$(nvram get ${type}_stp)
26 $DEBUG brctl delbr $if 2>&-
27 $DEBUG brctl addbr $if
28 $DEBUG brctl setfd $if 0
29 $DEBUG brctl stp $if ${stp:-0}
30
31 for sif in $(nvram get ${type}_ifnames); do
32 if_valid $sif || continue
33 #${mac:+$DEBUG ifconfig $sif down hw ether $mac}
34 $DEBUG ifconfig $sif 0.0.0.0 up
35 $DEBUG brctl addif $if $sif
36 $DEBUG ifconfig $sif allmulti
37 done
38 else
39 ${mac:+$DEBUG ifconfig $if down hw ether $mac}
40 fi
41
42 do_ifup $if_proto $type