wds-wpa support
[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" = "$remote" ] && {
20                         local cfg="$CONFIG_SECTION"
21                         
22                         include /lib/network
23                         scan_interfaces
24
25                         setup_interface "$iface" "$network"
26                         
27                         config_get encryption "$cfg" encryption
28                         config_get key "$cfg" key
29                         config_get ssid "$cfg" ssid
30                 
31                         [ "$encryption" == "psk" ] && \
32                         nas4not lan "$iface" up auto aes "$encryption" "$key" "$ssid" 
33                 }
34         }
35
36         config_load wireless
37 }
38
39 case "$ACTION" in
40         add|register)
41                 [ "${INTERFACE%%0.*}" = wds ] && setup_broadcom_wds "$INTERFACE"
42         ;;
43 esac