hostapd: fix OWE ssid update on configuration changes
authorFelix Fietkau <nbd@nbd.name>
Wed, 18 Sep 2024 16:26:45 +0000 (18:26 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 21 Sep 2024 18:37:41 +0000 (20:37 +0200)
Refresh OWE transition IEs on updating BSS interfaces

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/services/hostapd/patches/180-fix_owe_ssid_update.patch [new file with mode: 0644]
package/network/services/hostapd/patches/601-ucode_support.patch
package/network/services/hostapd/patches/720-iface_max_num_sta.patch
package/network/services/hostapd/patches/730-ft_iface.patch
package/network/services/hostapd/src/src/ap/ucode.c

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 (file)
index 0000000..5581922
--- /dev/null
@@ -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 ||
index 840711821933513bf4c068fb52b54ff8183531f0..4288e0f78984bc0e3e4e20404f36df577b5a05ce 100644 (file)
@@ -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 {
index f0e838bf2f3accc878f7aee1db8deecef3add790..e9d35de6be4d5ce4e57cb597c208753067856fed 100644 (file)
@@ -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);
  
index 648641e43a76399546f21b1df27139856bc86b49..ac7d3abd78af7c568114063aa3da84dd28f1bdb9 100644 (file)
@@ -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;
  
index 2c1e706804df56b6ef7cf7dfd40d7646ffa25049..c8a2b13a288d99127ab4be0fa5e1d77eba95c1cc 100644 (file)
@@ -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);