d60a3162946c3ae11ab565ee30ba15d018647434
[openwrt-10.03/.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         }
38
39         config_load wireless
40 }
41
42 case "$ACTION" in
43         add|register)
44                 [ "${INTERFACE%%0.*}" = wds ] && setup_broadcom_wds "$INTERFACE"
45         ;;
46 esac