authsae.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. authsae_start_interface() {
  2. local mcast_rate
  3. local mesh_htmode
  4. local mesh_band
  5. local authsae_conf_file="/var/run/authsae-$ifname.cfg"
  6. local ret=1
  7. json_get_vars mcast_rate mesh_id
  8. set_default mcast_rate "12000"
  9. case "$htmode" in
  10. HT20|HT40+|HT40-) mesh_htmode="$htmode";;
  11. *) mesh_htmode="none";;
  12. esac
  13. case "$hwmode" in
  14. *g*) mesh_band=11g;;
  15. *a*) mesh_band=11a;;
  16. esac
  17. if [ "$mcast_rate" -gt 1000 ]; then
  18. # authsae only allows integers as rates and not things like 5.5
  19. mcval=$(($mcast_rate / 1000))
  20. else
  21. # compat: to still support mbit/s rates
  22. mcval="$mcast_rate"
  23. fi
  24. cat > "$authsae_conf_file" <<EOF
  25. authsae:
  26. {
  27. sae:
  28. {
  29. debug = 0;
  30. password = "$key";
  31. group = [19, 26, 21, 25, 20];
  32. blacklist = 5;
  33. thresh = 5;
  34. lifetime = 3600;
  35. };
  36. meshd:
  37. {
  38. meshid = "$mesh_id";
  39. interface = "$ifname";
  40. passive = 0;
  41. debug = 0;
  42. mediaopt = 1;
  43. band = "$mesh_band";
  44. channel = $channel;
  45. htmode = "$mesh_htmode";
  46. mcast-rate = $mcval;
  47. };
  48. };
  49. EOF
  50. /usr/bin/meshd-nl80211 -i "$ifname" -s "$mesh_id" -c "$authsae_conf_file" </dev/null >/dev/null 2>/dev/null &
  51. authsae_pid="$!"
  52. ret="$?"
  53. echo $authsae_pid > /var/run/authsae-$ifname.pid
  54. wireless_add_process "$authsae_pid" "/usr/bin/meshd-nl80211" 1
  55. [ "$ret" != 0 ] && wireless_setup_vif_failed AUTHSAE_FAILED
  56. return $ret
  57. }