20-broadcom_wds 1.3 KB

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