Skip to content

Commit

Permalink
hostapd: add ft_key easy button
Browse files Browse the repository at this point in the history
Signed-off-by: John Crispin <[email protected]>
  • Loading branch information
blogic committed Jul 18, 2024
1 parent a7a2879 commit 2904a17
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions feeds/ipq807x_v5.4/hostapd/patches/zzz-roaming-key.patch
Original file line number Diff line number Diff line change
@@ -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 */

0 comments on commit 2904a17

Please sign in to comment.