move vlan and wifi setup into arch-specific base-files
[openwrt.git] / openwrt / target / linux / package / base-files / files / brcm-2.6 / etc / hotplug.d / 09-net
1 #!/bin/sh
2 setup_eth()
3 {
4         for part in $(nvram get unused_ifnames); do
5                 [ "$part" = "$INTERFACE" ] && exit 0
6         done
7         [ -d /proc/switch ] || {
8                 insmod switch-core
9                 insmod switch-robo || insmod switch-adm
10         }
11         if="$(echo "$INTERFACE" | sed s,eth,et,)"
12         ifconfig "$INTERFACE" up 2>&- >&-
13         [ -d "/proc/switch/$INTERFACE" ] || return 0
14         echo "1" > "/proc/switch/$INTERFACE/enable_vlan"
15         for vlan in $(seq 0 15); do
16                 [ "$(nvram get vlan${vlan}hwname)" = "$if" ] && {
17                         vports="$(nvram get vlan${vlan}ports)"
18                         [ -n "$vports" ] && echo "$vports" > "/proc/switch/$INTERFACE/vlan/$vlan/ports"
19                         $DEBUG vconfig add "$INTERFACE" "$vlan"
20                 }
21         done
22 }
23
24 do_register()
25 {
26         case "${INTERFACE%%[0-9]*}" in
27                 eth) setup_eth;;
28         esac
29 }
30
31
32 case "$ACTION" in
33         add|register) do_register;;
34 esac