summaryrefslogtreecommitdiff
path: root/package/network/services/authsae/files/lib/wifi/authsae.sh
blob: daa43eb22a0d8a520b9bef8f98fa0387b6e468a0 (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
authsae_start_interface() {
	local device="$1" # to use the correct channel
	local vif="$2"
	local band

	cfgfile="/var/run/authsae-$vif.cfg"
	config_get channel "$device" channel
	config_get hwmode "$device" hwmode
	config_get htmode "$device" htmode
	config_get ifname "$vif" ifname
	config_get key "$vif" key
	config_get mesh_id "$vif" mesh_id
	config_get mcast_rate "$vif" mcast_rate "12"

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

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

	cat > "$cfgfile" <<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 = "$band";
    channel = $channel;
    htmode = "$htmode";
    mcast-rate = $mcast_rate;
  };
};
EOF
	ifconfig "$ifname" up
	meshd-nl80211 -i "$ifname" -s "$mesh_id" -c "$cfgfile" -B
}