Now specifying "mesh_key" in the vif config will start authsae.
---
 package/mac80211/files/lib/wifi/mac80211.sh |   75 ++++++++++++++++++++++++++-
 1 file changed, 74 insertions(+), 1 deletion(-)

diff --git a/package/mac80211/files/lib/wifi/mac80211.sh 
b/package/mac80211/files/lib/wifi/mac80211.sh
index 461b248..eefd74d 100644
--- a/package/mac80211/files/lib/wifi/mac80211.sh
+++ b/package/mac80211/files/lib/wifi/mac80211.sh
@@ -1,6 +1,66 @@
 #!/bin/sh
 append DRIVERS "mac80211"
 
+mac80211_authsae_setup_base() {
+       local vif="$1"
+       local cfgfile="$2"
+
+       config_get ifname "$vif" ifname
+       config_get meshid "$vif" mesh_id
+       config_get mesh_key "$vif" mesh_key
+       config_get device "$vif" device
+       config_get hwmode "$device" hwmode
+       config_get channel "$device" channel
+       config_get htmode "$device" htmode
+
+       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 = 480;
+    password = "$mesh_key";
+    group = [19, 26, 21, 25, 20];
+    blacklist = 5;
+    thresh = 5;
+    lifetime = 3600;
+  };
+ meshd:
+  {
+    meshid = "$meshid";
+    interface = "$ifname";
+    passive = 0;
+    debug = 1;
+    mediaopt = 1;
+    band = "$band";
+    channel = $channel;
+    htmode = "$htmode";
+  };
+};
+
+EOF
+}
+
+mac80211_authsae_setup_mbss() {
+       local vif="$1"
+
+       cfgfile="/var/run/authsae-$vif.conf"
+       config_get ifname "$vif" ifname
+
+       mac80211_authsae_setup_base "$vif" "$cfgfile"
+       meshd-nl80211 -c "$cfgfile" &
+}
+
 mac80211_hostapd_setup_base() {
        local phy="$1"
        local ifname="$2"
@@ -258,6 +318,9 @@ disable_mac80211() (
                        grep "$wdev" /proc/$pid/cmdline >/dev/null && \
                                kill $pid
                done
+               for pid in `pidof meshd-nl80211`; do
+                       kill $pid
+               done
                ifconfig "$wdev" down 2>/dev/null
                unbridge "$dev"
                iw dev "$wdev" del
@@ -353,8 +416,12 @@ enable_mac80211() {
                                [ "$apidx" -gt 1 ] || iw phy "$phy" interface 
add "$ifname" type managed
                        ;;
                        mesh)
+                               local start_mesh
                                config_get mesh_id "$vif" mesh_id
-                               iw phy "$phy" interface add "$ifname" type mp 
mesh_id "$mesh_id"
+                               config_get mesh_key "$vif" mesh_key
+                               # authsae starts the mesh otherwise
+                               [ -z "$mesh_key" ] && start_mesh="mesh_id 
$mesh_id"
+                               iw phy "$phy" interface add "$ifname" type mp 
$start_mesh
                        ;;
                        monitor)
                                iw phy "$phy" interface add "$ifname" type 
monitor
@@ -518,6 +585,12 @@ enable_mac80211() {
                                        }
                                fi
                        ;;
+                       mesh)
+                               config_get mesh_key "$vif" mesh_key
+                               if [ ! -z "$mesh_key" ]; then
+                                       mac80211_authsae_setup_mbss "$vif"
+                               fi
+                       ;;
                esac
                [ "$mode" = "ap" ] || mac80211_start_vif "$vif" "$ifname"
        done
-- 
1.7.10.4

_______________________________________________
Devel mailing list
[email protected]
http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel

Reply via email to