4 debug "### ifup $type ###"
6 if=$(nvram get ${type}_ifname)
7 if [ "${if%%[0-9]}" = "ppp" ]; then
8 if=$(nvram get pppoe_ifname)
11 if_valid $if || return
13 mac=$(nvram get ${type}_hwaddr)
14 $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}
21 for sif in $(nvram get ${type}_ifnames); do {
22 if_valid $sif || continue
23 ${mac:+$DEBUG ifconfig $sif down hw ether $mac}
24 $DEBUG ifconfig $sif 0.0.0.0 up
25 $DEBUG brctl addif $if $sif
28 ${mac:+$DEBUG ifconfig $if down hw ether $mac}
32 if_proto=$(nvram get ${type}_proto)
35 ip=$(nvram get ${type}_ipaddr)
36 netmask=$(nvram get ${type}_netmask)
37 gateway=$(nvram get ${type}_gateway)
39 $DEBUG ifconfig $if $ip ${netmask:+netmask $netmask} broadcast + up
40 ${gateway:+$DEBUG route add default gw $gateway}
42 [ -f /etc/resolv.conf ] && return
44 debug "# --- creating /etc/resolv.conf ---"
45 for dns in $(nvram get ${type}_dns); do {
46 echo "nameserver $dns" >> /etc/resolv.conf
50 ip=$(nvram get ${type}_ipaddr)
51 pidfile=/tmp/dhcp-${type}.pid
52 if [ -f $pidfile ]; then
53 $DEBUG kill $(cat $pidfile)
55 ${DEBUG:-eval} "udhcpc -R -i $if ${ip:+-r $ip} -b -p $pidfile &"
60 [ -x "/sbin/ifup.${if_proto}" ] && { $DEBUG /sbin/ifup.${if_proto} $*; exit; }
61 echo "### ifup $type: ignored ${type}_proto=\"$if_proto\" (not supported)"