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 pidfile
=/var
/run
/${if}.pid
16 [ -f $pidfile ] && $DEBUG kill $
(cat $pidfile)
18 if [ "${if%%[0-9]}" = "br" ]; then
19 stp
=$
(nvram get
${type}_stp
)
20 $DEBUG brctl delbr
$if 2>&-
21 $DEBUG brctl addbr
$if
22 $DEBUG brctl setfd
$if 0
23 $DEBUG brctl stp
$if ${stp:-0}
25 for sif
in $
(nvram get
${type}_ifnames
); do
26 if_valid
$sif ||
continue
27 ${mac:+$DEBUG ifconfig $sif down hw ether $mac}
28 $DEBUG ifconfig
$sif 0.0.0.0 up
29 $DEBUG brctl addif
$if $sif
32 ${mac:+$DEBUG ifconfig $if down hw ether $mac}
37 ip
=$
(nvram get
${type}_ipaddr
)
38 netmask
=$
(nvram get
${type}_netmask
)
39 gateway
=$
(nvram get
${type}_gateway
)
41 $DEBUG ifconfig
$if $ip ${netmask:+netmask $netmask} broadcast
+ up
42 ${gateway:+$DEBUG route add default gw $gateway}
44 [ -f /etc
/resolv.conf
] && return
46 debug
"# --- creating /etc/resolv.conf ---"
47 for dns
in $
(nvram get
${type}_dns
); do
48 echo "nameserver $dns" >> /etc
/resolv.conf
52 ip
=$
(nvram get
${type}_ipaddr
)
53 ${DEBUG:-eval} "udhcpc -R -i $if ${ip:+-r $ip} -b -p $pidfile &"
58 [ -x "/sbin/ifup.${if_proto}" ] && { $DEBUG /sbin/ifup.${if_proto} $*; exit; }
59 echo "### ifup $type: ignored ${type}_proto=\"$if_proto\" (not supported)"
This page took 0.050732 seconds and 5 git commands to generate.