add chaos_calmer branch
[15.05/openwrt.git] / package / network / services / authsae / files / lib / wifi / authsae.sh
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
8         json_get_vars mcast_rate
9         set_default mcast_rate "12"
10
11         case "$htmode" in
12                 HT20|HT40+|HT40-) mesh_htmode="$htmode";;
13                 *) mesh_htmode="none";;
14         esac
15
16         case "$hwmode" in
17                 *g*) mesh_band=11g;;
18                 *a*) mesh_band=11a;;
19         esac
20
21         cat > "$authsae_conf_file" <<EOF
22 authsae:
23 {
24  sae:
25   {
26     debug = 0;
27     password = "$key";
28     group = [19, 26, 21, 25, 20];
29     blacklist = 5;
30     thresh = 5;
31     lifetime = 3600;
32   };
33  meshd:
34   {
35     meshid = "$mesh_id";
36     interface = "$ifname";
37     passive = 0;
38     debug = 0;
39     mediaopt = 1;
40     band = "$mesh_band";
41     channel = $channel;
42     htmode = "$mesh_htmode";
43     mcast-rate = $mcast_rate;
44   };
45 };
46 EOF
47
48         /usr/bin/meshd-nl80211 -i "$ifname" -s "$mesh_id" -c "$authsae_conf_file" </dev/null >/dev/null 2>/dev/null &
49         authsae_pid="$!"
50         ret="$?"
51
52         echo $authsae_pid > /var/run/authsae-$ifname.pid
53         wireless_add_process "$authsae_pid" "/usr/bin/meshd-nl80211" 1
54
55         [ "$ret" != 0 ] && wireless_setup_vif_failed AUTHSAE_FAILED
56         return $ret
57 }