[OpenWrt-Devel] [PATCH] Set auth_algs in hostapd.conf, make it configurable for WEP

Mark Mentovai mark at moxienet.com
Sat Oct 23 04:28:56 CEST 2010


Always set auth_algs in hostapd.conf. For WEP, auth_algs is configurable
using a new UCI parameter, auth_algs, which may contain "open",
"shared", or both. For other encryption types, auth_algs is always set
to 1 (open).

https://dev.openwrt.org/ticket/8120

Signed-off-by: Mark Mentovai <mark at moxienet.com>

---
Index: package/hostapd/files/hostapd.sh
===================================================================
--- package/hostapd/files/hostapd.sh	(revision 23587)
+++ package/hostapd/files/hostapd.sh	(working copy)
@@ -77,7 +77,6 @@
 			append "$var" "eapol_key_index_workaround=1" "$N"
 			append "$var" "radius_acct_interim_interval=300" "$N"
 			append "$var" "ieee8021x=1" "$N"
-			append "$var" "auth_algs=1" "$N"
 			append "$var" "wpa_key_mgmt=WPA-EAP" "$N"
 			append "$var" "wpa_group_rekey=300" "$N"
 			append "$var" "wpa_gmk_rekey=640" "$N"
@@ -110,6 +109,34 @@
 		;;
 	esac
 	append "$var" "wpa=$wpa" "$N"
+
+	case "$enc" in
+		*wep*)
+			config_get auth_algs "$vif" auth_algs
+			auth_alg_open=
+			auth_alg_shared=
+			for auth_alg in ${auth_algs:-open}; do
+				case "$auth_alg" in
+					open)
+						auth_alg_open=1
+					;;
+					shared)
+						auth_alg_shared=1
+					;;
+				esac
+			done
+			auth_alg_val=0
+			[ -n "$auth_alg_open" ] && \
+				auth_alg_val=1
+			[ -n "$auth_alg_shared" ] && \
+				auth_alg_val=$(expr "$auth_alg_val" + 2)
+		;;
+		*)
+			auth_alg_val=1
+		;;
+	esac
+	append "$var" "auth_algs=$auth_alg_val" "$N"
+
 	[ -n "$crypto" ] && append "$var" "wpa_pairwise=$crypto" "$N"
 	[ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
 



More information about the openwrt-devel mailing list