e4b537cc0775dd76f45c7639814a9ce539687d21
[openwrt/svn-archive/archive.git] / package / broadcom-wl / files / etc / hotplug.d / net / 20-broadcom_wds
1 include /lib/wifi
2
3 setup_broadcom_wds() {
4 local iface="$1"
5 local remote="$(wlc ifname "$iface" wdsmac)"
6
7 [ -z "$remote" ] && return
8
9 config_cb() {
10 [ -z "$CONFIG_SECTION" ] && return
11
12 config_get type "$CONFIG_SECTION" TYPE
13 [ "$type" = "wifi-iface" ] || return
14
15 config_get network "$CONFIG_SECTION" network
16 [ -z "$network" ] && return
17
18 config_get addr "$CONFIG_SECTION" bssid
19 addr=$(echo "$addr" | tr 'A-F' 'a-f')
20 [ "$addr" = "$remote" ] && {
21 local cfg="$CONFIG_SECTION"
22
23 include /lib/network
24 scan_interfaces
25
26 setup_interface "$iface" "$network"
27
28 config_get encryption "$cfg" encryption
29 config_get key "$cfg" key
30 config_get ssid "$cfg" ssid
31
32 [ "$encryption" != "none" ] && {
33 sleep 1
34 nas4not lan "$iface" up auto aes "$encryption" "$key" "$ssid"
35 }
36
37 brctl stp br-lan on
38
39 }
40 }
41
42 config_load wireless
43 }
44
45 case "$ACTION" in
46 add|register)
47 [ "${INTERFACE%%0.*}" = wds ] && setup_broadcom_wds "$INTERFACE"
48 ;;
49 esac