2 [ $# = 0 ] && { echo " $0 <group>"; exit; }
5 debug "### ifup $type ###"
7 if_proto=$(nvram get ${type}_proto)
8 if=$(nvram get ${type}_ifname)
9 [ "${if%%[0-9]}" = "ppp" ] && if=$(nvram get ${if_proto}_ifname)
12 mac=$(nvram get ${type}_hwaddr)
13 $DEBUG ifconfig $if down 2>&-
15 if [ "${if%%[0-9]}" = "br" ]; then
16 stp=$(nvram get ${type}_stp)
17 $DEBUG brctl delbr $if 2>&-
18 $DEBUG brctl addbr $if
19 $DEBUG brctl setfd $if 0
20 $DEBUG brctl stp $if ${stp:-0}
22 for sif in $(nvram get ${type}_ifnames); do
23 if_valid $sif || continue
24 ${mac:+$DEBUG ifconfig $sif down hw ether $mac}
25 $DEBUG ifconfig $sif 0.0.0.0 up
26 $DEBUG brctl addif $if $sif
29 ${mac:+$DEBUG ifconfig $if down hw ether $mac}
34 ip=$(nvram get ${type}_ipaddr)
35 netmask=$(nvram get ${type}_netmask)
36 gateway=$(nvram get ${type}_gateway)
38 $DEBUG ifconfig $if $ip ${netmask:+netmask $netmask} broadcast + up
39 ${gateway:+$DEBUG route add default gw $gateway}
41 [ -f /etc/resolv.conf ] && return
43 debug "# --- creating /etc/resolv.conf ---"
44 for dns in $(nvram get ${type}_dns); do
45 echo "nameserver $dns" >> /etc/resolv.conf
49 ip=$(nvram get ${type}_ipaddr)
50 [ -f $pidfile ] && $DEBUG kill $(cat $pidfile)
51 ${DEBUG:-eval} "udhcpc -R -i $if ${ip:+-r $ip} -b -p $pidfile &"
56 [ -x "/sbin/ifup.${if_proto}" ] && { $DEBUG /sbin/ifup.${if_proto} $*; exit; }
57 echo "### ifup $type: ignored ${type}_proto=\"$if_proto\" (not supported)"