aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services/authsae/files/lib/wifi/authsae.sh
blob: d8c5598ed5939c1d5db8dc3478e3c2484461cc75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
authsae_start_interface() {
	local mcast_rate
	local mesh_htmode
	local mesh_band
	local authsae_conf_file="/var/run/authsae-$ifname.cfg"
	local ret=1

	json_get_vars mcast_rate
	set_default mcast_rate "12"

	case "$htmode" in
		HT20|HT40+|HT40-) mesh_htmode="$htmode";;
		*) mesh_htmode="none";;
	esac

	case "$hwmode" in
		*g*) mesh_band=11g;;
		*a*) mesh_band=11a;;
	esac

	cat > "$authsae_conf_file" <<EOF
authsae:
{
 sae:
  {
    debug = 0;
    password = "$key";
    group = [19, 26, 21, 25, 20];
    blacklist = 5;
    thresh = 5;
    lifetime = 3600;
  };
 meshd:
  {
    meshid = "$mesh_id";
    interface = "$ifname";
    passive = 0;
    debug = 0;
    mediaopt = 1;
    band = "$mesh_band";
    channel = $channel;
    htmode = "$mesh_htmode";
    mcast-rate = $mcast_rate;
  };
};
EOF

	/usr/bin/meshd-nl80211 -i "$ifname" -s "$mesh_id" -c "$authsae_conf_file" </dev/null >/dev/null 2>/dev/null &
	authsae_pid="$!"
	ret="$?"

	echo $authsae_pid > /var/run/authsae-$ifname.pid
	wireless_add_process "$authsae_pid" "/usr/bin/meshd-nl80211" 1

	[ "$ret" != 0 ] && wireless_setup_vif_failed AUTHSAE_FAILED
	return $ret
}