- DHCP_ARGS="-i $if ${DHCP_IP:+-r $DHCP_IP} -b -p $pidfile"
- DHCP_HOSTNAME=$(nvram get ${2}_hostname)
- DHCP_HOSTNAME=${DHCP_HOSTNAME%%.*}
- [ -z $DHCP_HOSTNAME ] || DHCP_ARGS="$DHCP_ARGS -H $DHCP_HOSTNAME"
- [ "$if_proto" = "pptp" ] && DHCP_ARGS="$DHCP_ARGS -n -q" || DHCP_ARGS="$DHCP_ARGS -R &"
- oldpid=$(cat $pidfile)
- ${DEBUG:-eval} "udhcpc $DHCP_ARGS"
- pidof udhcpc | grep "$oldpid" >&- 2>&- && {
- sleep 1
- kill -9 $oldpid
- }
- # 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()
-{
- case "${INTERFACE%%[0-9]*}" in
- eth) setup_eth;;
- esac
-
- [ -z "$IFTYPE" -o -z "$IFPROTO" ] && {
- find_name || {
- case "${INTERFACE%%[0-9]*}" in
- wds)
- for tmp in lan wifi; do
- [ -z "$IFPROTO" ] && [ "$(nvram get ${tmp}_ifname)" = "br0" ] && {
- IFPROTO="$(nvram get ${tmp}_proto)"
- IFTYPE="${tmp}"
- }
- done
- [ -z "$IFPROTO" ] && return 0
- ;;
- atm)
- for tmp in lan wan wifi $(nvram get ifnames); do
- [ "$(nvram get ${tmp}_proto)" = "pppoa" ] && {
- do_ifup "pppoa" "$tmp" "$INTERFACE"
- return 0
- }
- done
- ;;
- *)
- return 0
- ;;
- esac
- }
- }
-
- case "${INTERFACE%%[0-9]*}" in
- ppp|atm);;
- *)
- mac=$(nvram get ${IFTYPE}_hwaddr)
- ${mac:+$DEBUG ifconfig $INTERFACE down hw ether $mac}
- ;;
- esac
-
- if="$(nvram get ${IFTYPE}_ifname)"
- if [ "${if%%[0-9]}" = "br" ]; then
- if_valid "$INTERFACE" && {
- ifconfig "$if" 2>&- >&- || {
- stp=$(nvram get ${IFTYPE}_stp)
- $DEBUG brctl addbr "$if"
- $DEBUG brctl setfd "$if" 0
- $DEBUG brctl stp "$if" "${stp:-0}"
+ # find all vlan configurations for this interface and set them up as well
+ for ifc in $interfaces; do
+ config_get iftype "$ifc" type
+ case "$iftype" in
+ bridge) config_get ifs "$ifc" ifnames;;
+ *) config_get ifs "$ifc" ifname;;
+ esac
+ for dev in $ifs; do
+ [ "${dev%%\.*}" = "$INTERFACE" -a "$dev" != "$INTERFACE" ] && {
+ add_vlan "$dev"