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 $DEBUG ifconfig
$if down
14 if [ "${if%%[0-9]}" = "br" ]; then
15 stp
=$
(nvram_get
${type}_stp
)
16 $DEBUG brctl delbr
$if
17 $DEBUG brctl addbr
$if
18 $DEBUG brctl setfd
$if 0
19 $DEBUG brctl stp
$if ${stp:-0}
20 for sif
in $
(nvram_get
${type}_ifnames
); do {
21 if_valid
$sif ||
continue
22 $DEBUG ifconfig
$sif 0.0.0.0 up
23 $DEBUG brctl addif
$if $sif
27 mac
=$
(nvram_get
${type}_hwaddr
)
28 ${mac:+$DEBUG ifconfig $if hw ether $mac}
30 if_proto
=$
(nvram_get
${type}_proto
)
33 ip
=$
(nvram_get
${type}_ipaddr
)
34 netmask
=$
(nvram_get
${type}_netmask
)
35 gateway
=$
(nvram_get
${type}_gateway
)
37 $DEBUG ifconfig
$if $ip ${netmask:+netmask $netmask} broadcast
+ up
38 ${gateway:+$DEBUG route add default gw $gateway}
40 [ -f /etc
/resolv.conf
] && return
42 debug
"# --- creating /etc/resolv.conf ---"
43 for dns
in $
(nvram_get
${type}_dns
); do {
44 echo "nameserver $dns" >> /etc
/resolv.conf
48 pidfile
=/tmp
/dhcp-
${type}.pid
49 if [ -f $pidfile ]; then
50 $DEBUG kill $
(cat $pidfile)
52 ${DEBUG:-eval} "udhcpc -i $if -b -p $pidfile &"
55 username
=$
(nvram_get ppp_username
)
56 password
=$
(nvram_get ppp_passwd
)
57 redial
=$
(nvram_get ppp_redialperiod
)
58 idletime
=$
(nvram_get ppp_idletime
)
59 mtu
=$
(nvram_get wan_mtu
)
61 $DEBUG ifconfig
$if 0.0.0.0 up
63 $DEBUG /sbin
/pppoecd
$if -u $username -p $password \
64 -i 0 -I $redial -T $idletime -t $mtu -k
69 echo "### WARNING $if: $if_proto is not supported"