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}\""
50 eval "static_route=\"\${${2}_static_route}\""
52 $DEBUG ifconfig
$if $ip ${netmask:+netmask $netmask} broadcast
+ up
53 [ -n "$ip6" ] && $DEBUG ifconfig
$if add
$ip6
55 [ -n "$static_route" ] && {
56 for route
in $static_route; do
57 if [ "$(echo $route | cut -d \/ -f2)" != "32" ];
59 route add
-net $
(echo $route | cut
-d \
/ -f1) netmask $
(echo $route | cut
-d \
/ -f1) dev
$if
61 route add
-host $
(echo $route | cut
-d \
/ -f1) dev
$if
66 ${gateway:+$DEBUG route add default gw $gateway}
68 [ -f /tmp
/resolv.conf
] ||
{
69 debug
"# --- creating /tmp/resolv.conf ---"
71 echo "nameserver $ns" >> /tmp
/resolv.conf
75 env
-i ACTION
="ifup" INTERFACE
="${2}" PROTO
=static
/sbin
/hotplug
"iface" &
78 eval "ip=\"\${${2}_ipaddr}\""
79 eval "netmask=\"\${${2}_netmask}\""
80 eval "hostname=\"\${${2}_hostname}\""
82 $DEBUG ifconfig
$if $ip ${netmask:+netmask $netmask} broadcast
+ up
84 args
="-i $if ${ip:+-r $ip} -b -p $pidfile"
85 hostname
="${hostname%%.*}"
86 args
="$args${hostname:+ -H $hostname}"
87 [ "$if_proto" = "pptp" ] && args
="$args -n -q" || args
="$args -R &"
88 ${DEBUG:-eval} "udhcpc $args"
89 # hotplug events are handled by /usr/share/udhcpc/default.script
92 if [ -x "/sbin/ifup.$1" ]; then
93 ( $DEBUG .
/sbin
/ifup.
$1 ${2} $3 )
101 [ -z "$IFTYPE" -o -z "$IFPROTO" ] && {
103 case "${INTERFACE%%[0-9]*}" in
105 for ifname
in lan wifi
; do
106 eval "if=\"\${${ifname}_ifname}\""
107 [ -z "$IFPROTO" ] && [ "$if" = "br0" ] && {
108 eval "IFPROTO=\"\${${2}_proto}\""
112 [ -z "$IFPROTO" ] && return 0
115 for tmp
in lan wan wifi
${ifnames}; do
116 eval "if_proto=\"\${${2}_proto}\""
117 [ "$if_proto" = "pppoa" ] && {
118 do_ifup
"pppoa" "$tmp" "$INTERFACE"
130 case "${INTERFACE%%[0-9]*}" in
133 eval "mac=\"\${${IFTYPE}_hwaddr}\""
134 ${mac:+$DEBUG ifconfig $INTERFACE down hw ether $mac}
138 eval "if=\"\${${IFTYPE}_ifname}\""
139 if [ "${if%%[0-9]}" = "br" ]; then
140 if_valid
"$INTERFACE" && {
141 ifconfig
"$if" 2>&- >&- ||
{
142 eval "stp=\"\${${IFTYPE}_stp}\""
143 $DEBUG brctl addbr
"$if"
144 $DEBUG brctl setfd
"$if" 0
145 $DEBUG brctl stp
"$if" "${stp:-0}"
148 if [ "$INTERFACE" != "$if" ]; then
149 $DEBUG ifconfig
"$INTERFACE" 0.0.0.0 up
150 $DEBUG brctl addif
"$if" "$INTERFACE"
151 $DEBUG ifconfig
"$INTERFACE" allmulti
153 do_ifup
"$IFPROTO" "$IFTYPE" "$if"
157 [ "${INTERFACE%%[0-9]*}" = "ppp" ] || do_ifup
"$IFPROTO" "$IFTYPE" "$if"
162 [ -z "$IFTYPE" -o -z "$IFPROTO" ] && {
163 find_name ||
return 0
166 [ "${IFACE%%[0-9]*}" = "br" ] && {
167 if [ "$INTERFACE" != "$IFACE" ]; then
168 brctl delif
"$IFACE" "$INTERFACE" 2>&- >&-
170 brctl delbr
"$IFACE" 2>&- >&-
176 killall pppd
2>&- >&-
179 [ -f /var
/run
/${INTERFACE}.pid
] && kill "$(cat /var/run/${INTERFACE}.pid)" 2>&- >&-
183 [ "${INTERFACE%%[0-9]*}" = "atm" ] || ifconfig
"$INTERFACE" 0.0.0.0 down
2>&-
187 add|register
) do_register
;;
188 remove|unregister
) do_unregister
;;
This page took 0.068331 seconds and 5 git commands to generate.