[openwrt/openwrt] hostapd: use wpa_supplicant for unencrypted mesh connections

LEDE Commits lede-commits at lists.infradead.org
Sat Dec 10 03:39:15 PST 2022


nbd pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/a797f0e82a075fd78180c27692a1b404bedd38a8

commit a797f0e82a075fd78180c27692a1b404bedd38a8
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Sun Dec 4 19:35:36 2022 +0100

    hostapd: use wpa_supplicant for unencrypted mesh connections
    
    It's more reliable than using iw
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh   | 2 +-
 package/network/services/hostapd/files/hostapd.sh               | 4 ++--
 package/network/services/hostapd/src/src/utils/build_features.h | 4 ++++
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index ed2805213e..0a7f787cff 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -1033,7 +1033,7 @@ mac80211_setup_vif() {
 		mesh)
 			wireless_vif_parse_encryption
 			[ -z "$htmode" ] && htmode="NOHT";
-			if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ] || chan_is_dfs "$phy" "$channel"; then
+			if wpa_supplicant -vmesh || [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ] || chan_is_dfs "$phy" "$channel"; then
 				mac80211_setup_supplicant $vif_enable || failed=1
 			else
 				mac80211_setup_mesh $vif_enable
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index 79daa915ad..55cc766b58 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -1322,7 +1322,7 @@ wpa_supplicant_add_network() {
 	}
 
 	[ "$_w_mode" = "mesh" ] && {
-		json_get_vars mesh_id mesh_fwding mesh_rssi_threshold
+		json_get_vars mesh_id mesh_fwding mesh_rssi_threshold encryption
 		[ -n "$mesh_id" ] && ssid="${mesh_id}"
 
 		append network_data "mode=5" "$N$T"
@@ -1330,7 +1330,7 @@ wpa_supplicant_add_network() {
 		[ -n "$mesh_rssi_threshold" ] && append network_data "mesh_rssi_threshold=${mesh_rssi_threshold}" "$N$T"
 		[ -n "$freq" ] && wpa_supplicant_set_fixed_freq "$freq" "$htmode"
 		[ "$noscan" = "1" ] && append network_data "noscan=1" "$N$T"
-		append wpa_key_mgmt "SAE"
+		[ "$encryption" = "none" -o -z "$encryption" ] || append wpa_key_mgmt "SAE"
 		scan_ssid=""
 	}
 
diff --git a/package/network/services/hostapd/src/src/utils/build_features.h b/package/network/services/hostapd/src/src/utils/build_features.h
index 642a35836e..138a799e75 100644
--- a/package/network/services/hostapd/src/src/utils/build_features.h
+++ b/package/network/services/hostapd/src/src/utils/build_features.h
@@ -58,6 +58,10 @@ static inline int has_feature(const char *feat)
 #ifdef CONFIG_OCV
 	if (!strcmp(feat, "ocv"))
 		return 1;
+#endif
+#ifdef CONFIG_MESH
+	if (!strcmp(feat, "mesh"))
+		return 1;
 #endif
 	return 0;
 }




More information about the lede-commits mailing list