- $DEBUG ifconfig $if $ip ${netmask:+netmask $netmask} broadcast + up
- [ -n "$ip6" ] && $DEBUG ifconfig $if add $ip6
-
- [ -n "$static_route" ] && {
- for route in $static_route; do
- if [ "$(echo $route | cut -d \/ -f2)" != "32" ];
- then
- route add -net $(echo $route | cut -d \/ -f1) netmask $(echo $route | cut -d \/ -f1) dev $if
- else
- route add -host $(echo $route | cut -d \/ -f1) dev $if
- fi
- done
- }
-
- ${gateway:+$DEBUG route add default gw $gateway}
-
- [ -f /tmp/resolv.conf ] || {
- debug "# --- creating /tmp/resolv.conf ---"
- for ns in $dns; do
- echo "nameserver $ns" >> /tmp/resolv.conf
- done
- }
-
- env -i ACTION="ifup" INTERFACE="${2}" PROTO=static /sbin/hotplug "iface" &
- ;;
- dhcp)
- eval "ip=\"\${${2}_ipaddr}\""
- eval "netmask=\"\${${2}_netmask}\""
- eval "hostname=\"\${${2}_hostname}\""
-
- $DEBUG ifconfig $if $ip ${netmask:+netmask $netmask} broadcast + up
-
- args="-i $if ${ip:+-r $ip} -b -p $pidfile"
- hostname="${hostname%%.*}"
- args="$args${hostname:+ -H $hostname}"
- [ "$if_proto" = "pptp" ] && args="$args -n -q" || args="$args -R &"
- ${DEBUG:-eval} "udhcpc $args"
- # hotplug events are handled by /usr/share/udhcpc/default.script
- ;;
- *)
- if [ -x "/sbin/ifup.$1" ]; then
- ( $DEBUG . /sbin/ifup.$1 ${2} $3 )
- fi
- ;;
- esac
-}
-
-do_register()
-{
- [ -z "$IFTYPE" -o -z "$IFPROTO" ] && {
- find_name || {
- case "${INTERFACE%%[0-9]*}" in
- wds)
- for ifname in lan wifi; do
- eval "if=\"\${${ifname}_ifname}\""
- [ -z "$IFPROTO" ] && [ "$if" = "br0" ] && {
- eval "IFPROTO=\"\${${2}_proto}\""
- IFTYPE="${tmp}"
- }
- done
- [ -z "$IFPROTO" ] && return 0
- ;;
- atm)
- for tmp in lan wan wifi ${ifnames}; do
- eval "if_proto=\"\${${2}_proto}\""
- [ "$if_proto" = "pppoa" ] && {
- do_ifup "pppoa" "$tmp" "$INTERFACE"
- return 0
- }
- done
- ;;
- *)
- return 0
- ;;
- esac
- }
- }
-
- case "${INTERFACE%%[0-9]*}" in
- ppp|atm);;
- *)
- eval "mac=\"\${${IFTYPE}_hwaddr}\""
- ${mac:+$DEBUG ifconfig $INTERFACE down hw ether $mac}
- ;;
- esac
-
- eval "if=\"\${${IFTYPE}_ifname}\""
- if [ "${if%%[0-9]}" = "br" ]; then
- if_valid "$INTERFACE" && {
- ifconfig "$if" 2>&- >&- || {
- eval "stp=\"\${${IFTYPE}_stp}\""
- $DEBUG brctl addbr "$if"
- $DEBUG brctl setfd "$if" 0
- $DEBUG brctl stp "$if" "${stp:-0}"