4 for ifname
in lan wan wifi
${ifnames}; do
6 eval "IFPROTO=\"\${${IFTYPE}_proto}\""
7 eval "IFACE=\"\${${IFTYPE}_ifname}\""
11 [ "${IFACE}" = "$INTERFACE" ] && return 0
12 [ "${IFACE%%[0-9]*}" = "br" ] && {
13 eval "ifs=\"\${${IFTYPE}_ifnames}\""
15 [ "$part" = "$INTERFACE" ] && return 0
20 [ "$INTERFACE" = "atm0" \
21 -a -x /sbin
/ifup.
${IFPROTO} ] && return 0
24 eval "device=\"\${${IFTYPE}_device}\""
25 [ "$device" = "$INTERFACE" \
26 -a -x /sbin
/ifup.
${IFPROTO} ] && return 0
38 eval "if_proto=\"\${${2}_proto}\""
40 pidfile
=/var
/run
/${if}.pid
41 [ -f $pidfile ] && $DEBUG kill $
(cat $pidfile)
45 eval "ip=\"\${${2}_ipaddr}\""
46 eval "ip6=\"\${${2}_ip6addr}\""
47 eval "netmask=\"\${${2}_netmask}\""
48 eval "gateway=\"\${${2}_gateway}\""
49 eval "dns=\"\${${2}_dns}\""
51 $DEBUG ifconfig
$if $ip ${netmask:+netmask $netmask} broadcast
+ up
52 [ -n "$ip6" ] && $DEBUG ifconfig
$if add
$ip6
54 ${gateway:+$DEBUG route add default gw $gateway}
56 [ -f /tmp
/resolv.conf
] ||
{
57 debug
"# --- creating /tmp/resolv.conf ---"
59 echo "nameserver $ns" >> /tmp
/resolv.conf
63 env
-i ACTION
="ifup" INTERFACE
="${2}" PROTO
=static
/sbin
/hotplug
"iface" &
66 eval "ip=\"\${${2}_ipaddr}\""
67 eval "netmask=\"\${${2}_netmask}\""
68 eval "hostname=\"\${${2}_hostname}\""
70 $DEBUG ifconfig
$if $ip ${netmask:+netmask $netmask} broadcast
+ up
72 args
="-i $if ${ip:+-r $ip} -b -p $pidfile"
73 hostname
="${hostname%%.*}"
74 args
="$args${hostname:+ -H $hostname}"
75 [ "$if_proto" = "pptp" ] && args
="$args -n -q" || args
="$args -R &"
76 ${DEBUG:-eval} "udhcpc $args"
77 # hotplug events are handled by /usr/share/udhcpc/default.script
80 if [ -x "/sbin/ifup.$1" ]; then
81 ( $DEBUG .
/sbin
/ifup.
$1 ${2} $3 )
89 [ -z "$IFTYPE" -o -z "$IFPROTO" ] && {
91 case "${INTERFACE%%[0-9]*}" in
93 for ifname
in lan wifi
; do
94 eval "if=\"\${${ifname}_ifname}\""
95 [ -z "$IFPROTO" ] && [ "$if" = "br0" ] && {
96 eval "IFPROTO=\"\${${2}_proto}\""
100 [ -z "$IFPROTO" ] && return 0
103 for tmp
in lan wan wifi
${ifnames}; do
104 eval "if_proto=\"\${${2}_proto}\""
105 [ "$if_proto" = "pppoa" ] && {
106 do_ifup
"pppoa" "$tmp" "$INTERFACE"
118 case "${INTERFACE%%[0-9]*}" in
121 eval "mac=\"\${${IFTYPE}_hwaddr}\""
122 ${mac:+$DEBUG ifconfig $INTERFACE down hw ether $mac}
126 eval "if=\"\${${IFTYPE}_ifname}\""
127 if [ "${if%%[0-9]}" = "br" ]; then
128 if_valid
"$INTERFACE" && {
129 ifconfig
"$if" 2>&- >&- ||
{
130 eval "stp=\"\${${IFTYPE}_stp}\""
131 $DEBUG brctl addbr
"$if"
132 $DEBUG brctl setfd
"$if" 0
133 $DEBUG brctl stp
"$if" "${stp:-0}"
136 if [ "$INTERFACE" != "$if" ]; then
137 $DEBUG ifconfig
"$INTERFACE" 0.0.0.0 up
138 $DEBUG brctl addif
"$if" "$INTERFACE"
139 $DEBUG ifconfig
"$INTERFACE" allmulti
141 do_ifup
"$IFPROTO" "$IFTYPE" "$if"
145 [ "${INTERFACE%%[0-9]*}" = "ppp" ] || do_ifup
"$IFPROTO" "$IFTYPE" "$if"
150 [ -z "$IFTYPE" -o -z "$IFPROTO" ] && {
151 find_name ||
return 0
154 [ "${IFACE%%[0-9]*}" = "br" ] && {
155 if [ "$INTERFACE" != "$IFACE" ]; then
156 brctl delif
"$IFACE" "$INTERFACE" 2>&- >&-
158 brctl delbr
"$IFACE" 2>&- >&-
164 killall pppd
2>&- >&-
167 [ -f /var
/run
/${INTERFACE}.pid
] && kill "$(cat /var/run/${INTERFACE}.pid)" 2>&- >&-
171 [ "${INTERFACE%%[0-9]*}" = "atm" ] || ifconfig
"$INTERFACE" 0.0.0.0 down
2>&-
175 add|register
) do_register
;;
176 remove|unregister
) do_unregister
;;
This page took 0.057549 seconds and 5 git commands to generate.