Skip to content

Commit e6df13d

Browse files
cotequeirozblocktrron
authored andcommitted
hostapd: fallback to psk when generating r0kh/r1kh
The 80211r r0kh and r1kh defaults are generated from the md5sum of "$mobility_domain/$auth_secret". auth_secret is only set when using EAP authentication, but the default key is used for SAE/PSK as well. In this case, auth_secret is empty, and the default value of the key can be computed from the SSID alone. Fallback to using $key when auth_secret is empty. While at it, rename the variable holding the generated key from 'key' to 'ft_key', to avoid clobbering the PSK. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com> [make ft_key local] Signed-off-by: David Bauer <mail@david-bauer.net>
1 parent 6f78723 commit e6df13d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

package/network/services/hostapd/files/hostapd.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ hostapd_set_bss_options() {
526526

527527
wireless_vif_parse_encryption
528528

529-
local bss_conf bss_md5sum
529+
local bss_conf bss_md5sum ft_key
530530
local wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey wpa_key_mgmt
531531

532532
json_get_vars \
@@ -876,10 +876,10 @@ hostapd_set_bss_options() {
876876
set_default pmk_r1_push 0
877877

878878
[ -n "$r0kh" -a -n "$r1kh" ] || {
879-
key=`echo -n "$mobility_domain/$auth_secret" | md5sum | awk '{print $1}'`
879+
ft_key=`echo -n "$mobility_domain/${auth_secret:-${key}}" | md5sum | awk '{print $1}'`
880880

881-
set_default r0kh "ff:ff:ff:ff:ff:ff,*,$key"
882-
set_default r1kh "00:00:00:00:00:00,00:00:00:00:00:00,$key"
881+
set_default r0kh "ff:ff:ff:ff:ff:ff,*,$ft_key"
882+
set_default r1kh "00:00:00:00:00:00,00:00:00:00:00:00,$ft_key"
883883
}
884884

885885
[ -n "$r1_key_holder" ] && append bss_conf "r1_key_holder=$r1_key_holder" "$N"

0 commit comments

Comments
 (0)