From df1011e0b7c0c2497d40d57eff0cd604b8aece48 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 18 Sep 2024 18:26:45 +0200 Subject: [PATCH] hostapd: fix OWE ssid update on configuration changes Refresh OWE transition IEs on updating BSS interfaces Signed-off-by: Felix Fietkau --- .../patches/180-fix_owe_ssid_update.patch | 26 +++++++++++++++++++ .../hostapd/patches/601-ucode_support.patch | 17 ++++++++++++ .../patches/720-iface_max_num_sta.patch | 4 +-- .../hostapd/patches/730-ft_iface.patch | 2 +- .../services/hostapd/src/src/ap/ucode.c | 4 +++ 5 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 package/network/services/hostapd/patches/180-fix_owe_ssid_update.patch diff --git a/package/network/services/hostapd/patches/180-fix_owe_ssid_update.patch b/package/network/services/hostapd/patches/180-fix_owe_ssid_update.patch new file mode 100644 index 0000000000..5581922b27 --- /dev/null +++ b/package/network/services/hostapd/patches/180-fix_owe_ssid_update.patch @@ -0,0 +1,26 @@ +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -2420,7 +2420,11 @@ static int hostapd_owe_iface_iter(struct + if (!bss->conf->ssid.ssid_set || !bss->conf->ssid.ssid_len || + is_zero_ether_addr(bss->own_addr)) + continue; +- ++ if (!os_memcmp(hapd->conf->owe_transition_bssid, bss->own_addr, ETH_ALEN) && ++ hapd->conf->owe_transition_ssid_len == bss->conf->ssid.ssid_len && ++ !os_memcmp(hapd->conf->owe_transition_ssid, bss->conf->ssid.ssid, ++ bss->conf->ssid.ssid_len)) ++ return 0; + os_memcpy(hapd->conf->owe_transition_bssid, bss->own_addr, + ETH_ALEN); + os_memcpy(hapd->conf->owe_transition_ssid, +@@ -2437,10 +2441,6 @@ static int hostapd_owe_iface_iter(struct + + int hostapd_owe_trans_get_info(struct hostapd_data *hapd) + { +- if (hapd->conf->owe_transition_ssid_len > 0 && +- !is_zero_ether_addr(hapd->conf->owe_transition_bssid)) +- return 0; +- + /* Find transition mode SSID/BSSID information from a BSS operated by + * this hostapd instance. */ + if (!hapd->iface->interfaces || diff --git a/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch index 8407118219..4288e0f789 100644 --- a/package/network/services/hostapd/patches/601-ucode_support.patch +++ b/package/network/services/hostapd/patches/601-ucode_support.patch @@ -148,6 +148,15 @@ as adding/removing interfaces. if (conf->wmm_enabled < 0) conf->wmm_enabled = hapd->iconf->ieee80211n | hapd->iconf->ieee80211ax; +@@ -2487,7 +2493,7 @@ static int hostapd_owe_iface_iter2(struc + #endif /* CONFIG_OWE */ + + +-static void hostapd_owe_update_trans(struct hostapd_iface *iface) ++void hostapd_owe_update_trans(struct hostapd_iface *iface) + { + #ifdef CONFIG_OWE + /* Check whether the enabled BSS can complete OWE transition mode @@ -2954,7 +2960,7 @@ hostapd_alloc_bss_data(struct hostapd_if } @@ -213,6 +222,14 @@ as adding/removing interfaces. void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, int reassoc); void hostapd_interface_deinit_free(struct hostapd_iface *iface); +@@ -815,6 +824,7 @@ hostapd_switch_channel_fallback(struct h + void hostapd_cleanup_cs_params(struct hostapd_data *hapd); + void hostapd_periodic_iface(struct hostapd_iface *iface); + int hostapd_owe_trans_get_info(struct hostapd_data *hapd); ++void hostapd_owe_update_trans(struct hostapd_iface *iface);; + void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx); + + void hostapd_switch_color(struct hostapd_data *hapd, u64 bitmap); --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -3928,6 +3928,25 @@ struct wpa_driver_ops { diff --git a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch index f0e838bf2f..e9d35de6be 100644 --- a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch +++ b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch @@ -79,9 +79,9 @@ full device, e.g. in order to deal with hardware/driver limitations { --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -825,6 +825,7 @@ void hostapd_cleanup_cs_params(struct ho - void hostapd_periodic_iface(struct hostapd_iface *iface); +@@ -826,6 +826,7 @@ void hostapd_periodic_iface(struct hosta int hostapd_owe_trans_get_info(struct hostapd_data *hapd); + void hostapd_owe_update_trans(struct hostapd_iface *iface);; void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx); +int hostapd_check_max_sta(struct hostapd_data *hapd); diff --git a/package/network/services/hostapd/patches/730-ft_iface.patch b/package/network/services/hostapd/patches/730-ft_iface.patch index 648641e43a..ac7d3abd78 100644 --- a/package/network/services/hostapd/patches/730-ft_iface.patch +++ b/package/network/services/hostapd/patches/730-ft_iface.patch @@ -29,7 +29,7 @@ a VLAN interface on top of the bridge, instead of using the bridge directly int bridge_hairpin; /* hairpin_mode on bridge members */ --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c -@@ -1815,8 +1815,12 @@ int hostapd_setup_wpa(struct hostapd_dat +@@ -1821,8 +1821,12 @@ int hostapd_setup_wpa(struct hostapd_dat wpa_key_mgmt_ft(hapd->conf->wpa_key_mgmt)) { const char *ft_iface; diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index 2c1e706804..c8a2b13a28 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -259,6 +259,7 @@ uc_hostapd_bss_set_config(uc_vm_t *vm, size_t nargs) hostapd_setup_bss(hapd, hapd == iface->bss[0], true); hostapd_ucode_update_interfaces(); + hostapd_owe_update_trans(iface); done: ret = 0; @@ -379,6 +380,7 @@ uc_hostapd_iface_add_bss(uc_vm_t *vm, size_t nargs) conf->bss[idx] = NULL; ret = hostapd_ucode_bss_get_uval(hapd); hostapd_ucode_update_interfaces(); + hostapd_owe_update_trans(iface); goto out; deinit_ctrl: @@ -607,6 +609,7 @@ out: ieee802_11_set_beacon(hapd); } + hostapd_owe_update_trans(iface); return ucv_boolean_new(true); } @@ -698,6 +701,7 @@ uc_hostapd_bss_rename(uc_vm_t *vm, size_t nargs) hostapd_ubus_add_bss(hapd); hostapd_ucode_update_interfaces(); + hostapd_owe_update_trans(hapd->iface); out: if (interfaces->ctrl_iface_init) interfaces->ctrl_iface_init(hapd); -- 2.30.2