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