856d26b653b5b998659293b9535d634cac1144ea
[openwrt/svn-archive/archive.git] / openwrt / target / linux / package / base-files / files / brcm-2.4 / etc / hotplug.d / net / 09-net
1 #!/bin/sh
2 setup_eth()
3 {
4 [ -f /proc/net/wl0 ] && {
5 lsmod | grep wlcompat >&- || insmod wlcompat
6 }
7 iwconfig "$INTERFACE" 2>&- | grep -v 'no wireless' >&- && {
8 /sbin/wifi
9 }
10 [ -d /proc/switch ] || {
11 insmod switch-core
12 insmod switch-robo || insmod switch-adm
13 }
14 if="$(echo "$INTERFACE" | sed s,eth,et,)"
15 ifconfig "$INTERFACE" up 2>&- >&-
16 [ -d "/proc/switch/$INTERFACE" ] || return 0
17 echo "1" > "/proc/switch/$INTERFACE/reset"
18 echo "1" > "/proc/switch/$INTERFACE/enable_vlan"
19 for vlan in $(seq 0 15); do
20 eval "hwname=\"\${vlan${vlan}hwname}\""
21 [ "$hwname" = "$if" ] && {
22 eval "vports=\"\${vlan${vlan}ports}\""
23 [ -n "$vports" ] && echo "$vports" > "/proc/switch/$INTERFACE/vlan/$vlan/ports"
24 $DEBUG vconfig add "$INTERFACE" "$vlan"
25 }
26 done
27 }
28
29 do_register()
30 {
31 case "${INTERFACE%%[0-9]*}" in
32 eth) setup_eth;;
33 esac
34 }
35
36
37 case "$ACTION" in
38 add|register) do_register;;
39 esac