Enabled random per-device PSK generation for WPS clients

Signed-off-by: Lorenzo Cappelletti <lorenzo.cappelle...@gmail.com>

---

diff --git a/hostapd/files/hostapd.sh b/hostapd/files/hostapd.sh
--- a/hostapd/files/hostapd.sh
+++ b/hostapd/files/hostapd.sh
@@ -1,5 +1,6 @@
 hostapd_set_wps_options() {
-       local config_methods device_name device_type manufacturer
+       local config_methods device_name device_type manufacturer\
+             wpa_psk_file

        config_get config_methods "$vif" wps_config_methods
        
@@ -13,6 +14,7 @@
        [ -z "$config_methods" ] && return

        # common options
+       config_get ifname "$vif" ifname
        config_get device_type "$vif" wps_device_type "6-0050F204-1"
        config_get device_name "$vif" wps_device_name "OpenWrt AP"
        config_get manufacturer "$vif" wps_manufacturer "openwrt.org"
@@ -25,6 +27,12 @@
        append "$var" "manufacturer=$manufacturer" "$N"
        append "$var" "config_methods=$config_methods" "$N"

+       # enable random per-device PSK generation for WPS clients
+       # (file has to exists for hostapd to start)
+       wpa_psk_file=/var/run/hostapd-$ifname.psk
+       append "$var" "wpa_psk_file=$wpa_psk_file" "$N"
+       [ ! -e $wpa_psk_file ] && :> $wpa_psk_file
+
        # per-method options
        list_contains config_methods label && {
                list_remove config_methods label
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to