From 2904a17d91b61ded38f877ea230fc60ca96a5e0f Mon Sep 17 00:00:00 2001 From: John Crispin Date: Thu, 18 Jul 2024 07:18:03 +0200 Subject: [PATCH] hostapd: add ft_key easy button Signed-off-by: John Crispin --- .../hostapd/patches/zzz-roaming-key.patch | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 feeds/ipq807x_v5.4/hostapd/patches/zzz-roaming-key.patch diff --git a/feeds/ipq807x_v5.4/hostapd/patches/zzz-roaming-key.patch b/feeds/ipq807x_v5.4/hostapd/patches/zzz-roaming-key.patch new file mode 100644 index 000000000..67f67fa47 --- /dev/null +++ b/feeds/ipq807x_v5.4/hostapd/patches/zzz-roaming-key.patch @@ -0,0 +1,55 @@ +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -3154,6 +3154,8 @@ static int hostapd_config_fill(struct ho + bss->ft_psk_generate_local = atoi(pos); + } else if (os_strcmp(buf, "ft_l2_refresh") == 0) { + bss->ft_l2_refresh = atoi(pos); ++ } else if (os_strcmp(buf, "ft_key") == 0) { ++ strncpy(bss->ft_key, pos, sizeof(bss->ft_key)); + #endif /* CONFIG_IEEE80211R_AP */ + #ifndef CONFIG_NO_CTRL_IFACE + } else if (os_strcmp(buf, "ctrl_interface") == 0) { +@@ -4996,8 +4998,22 @@ struct hostapd_config * hostapd_config_r + + fclose(f); + +- for (i = 0; i < conf->num_bss; i++) ++#define _MACSTR "%02x%02x%02x%02x%02x%02x" ++ for (i = 0; i < conf->num_bss; i++) { + hostapd_set_security_params(conf->bss[i], 1); ++ if (*conf->bss[i]->ft_key) { ++ u8 buffer[128]; ++ sprintf(buffer, MACSTR " " _MACSTR " %s", MAC2STR(conf->bss[i]->bssid), MAC2STR(conf->bss[i]->bssid), conf->bss[i]->ft_key); ++ add_r0kh(conf->bss[i], buffer); ++ sprintf(buffer, "ff:ff:ff:ff:ff:ff * %s", conf->bss[i]->ft_key); ++ add_r0kh(conf->bss[i], buffer); ++ sprintf(buffer, MACSTR " " MACSTR " %s", MAC2STR(conf->bss[i]->bssid), MAC2STR(conf->bss[i]->bssid), conf->bss[i]->ft_key); ++ add_r1kh(conf->bss[i], buffer); ++ sprintf(buffer, "00:00:00:00:00:00 00:00:00:00:00:00 %s", conf->bss[i]->ft_key); ++ add_r1kh(conf->bss[i], buffer); ++ os_memcpy(conf->bss[i]->r1_key_holder, conf->bss[i]->bssid, 6); ++ } ++ } + + if (hostapd_config_check(conf, 1)) + errors++; +--- a/src/ap/wpa_auth.h ++++ b/src/ap/wpa_auth.h +@@ -221,6 +221,7 @@ struct wpa_auth_config { + int pmk_r1_push; + int ft_over_ds; + int ft_psk_generate_local; ++ u8 ft_key[33]; + #endif /* CONFIG_IEEE80211R_AP */ + int disable_gtk; + int ap_mlme; +--- a/src/ap/ap_config.h ++++ b/src/ap/ap_config.h +@@ -403,6 +403,7 @@ struct hostapd_bss_config { + int ft_psk_generate_local; + int ft_l2_refresh; + int r1_max_key_lifetime; ++ u8 ft_key[33]; + #endif /* CONFIG_IEEE80211R_AP */ + + char *ctrl_interface; /* directory for UNIX domain sockets */