Root/package/broadcom-wl/files/etc/hotplug.d/net/20-broadcom_wds

1include /lib/wifi
2
3setup_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            for network in $network; do
27                setup_interface "$iface" "$network"
28            done
29            
30            config_get encryption "$cfg" encryption
31            config_get key "$cfg" key
32            config_get ssid "$cfg" ssid
33        
34            [ "$encryption" != "none" ] && {
35                sleep 5
36                case "$encryption" in
37                    psk|PSK)
38                        nas4not "$network" "$iface" up auto tkip psk "$key" "$ssid"
39                        ;;
40                    psk2|PSK2)
41                        nas4not "$network" "$iface" up auto aes psk "$key" "$ssid"
42                        ;;
43                    psk+psk2|psk2+psk|PSK+PSK2|PSK2+PSK)
44                        nas4not "$network" "$iface" up auto aes+tkip psk "$key" "$ssid"
45                        ;;
46                    *)
47                        nas4not lan "$iface" up auto aes "$encryption" "$key" "$ssid"
48                        ;;
49                    esac
50            }
51        }
52    }
53
54    config_load wireless
55}
56
57case "$ACTION" in
58    add|register)
59        [ "${INTERFACE%%0.*}" = wds ] && setup_broadcom_wds "$INTERFACE"
60    ;;
61esac
62

Archive Download this file



interactive