]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
hostapd: initialize first BSS radio_mask during driver init
authorChad Monroe <chad@monroe.io>
Fri, 6 Feb 2026 17:21:44 +0000 (09:21 -0800)
committerFelix Fietkau <nbd@nbd.name>
Thu, 19 Feb 2026 15:08:12 +0000 (15:08 +0000)
Secondary BSSes inherit the alloc value which bypasses
NL80211_ATTR_VIF_RADIO_MASK in nl80211_create_iface() and causes the
kernel to default new interfaces to all radios.

The ucode bss_create fallback fails to correct this because
the interface is already UP.. the kernel rejects SET_INTERFACE with
-EBUSY.

Signed-off-by: Chad Monroe <chad@monroe.io>
package/network/services/hostapd/patches/370-preserve_radio_mask.patch
package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch
package/network/services/hostapd/patches/601-ucode_support.patch
package/network/services/hostapd/patches/740-snoop_iface.patch
package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch

index a4347c4750a8fd3058ee34c69f9f2923c827c659..bb5e7508f00da7f550eaf3b2fb8c5913327a9022 100644 (file)
  static int nl80211_register_beacons(struct wpa_driver_nl80211_data *drv,
                                    struct nl80211_wiphy_data *w)
  {
-@@ -6236,7 +6254,7 @@ const char * nl80211_iftype_str(enum nl8
+@@ -2427,6 +2445,8 @@ static void * wpa_driver_nl80211_drv_ini
+                                              p2p_mode))
+               goto failed;
++      bss->radio_mask = nl80211_get_radio_mask(bss);
++
+       if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_TX_STATUS) {
+               drv->control_port_ap = 1;
+               goto skip_wifi_status;
+@@ -6236,7 +6256,7 @@ const char * nl80211_iftype_str(enum nl8
  static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv,
                                     const char *ifname,
                                     enum nl80211_iftype iftype,
@@ -67,7 +76,7 @@
                                     int (*handler)(struct nl_msg *, void *),
                                     void *arg)
  {
-@@ -6256,6 +6274,10 @@ static int nl80211_create_iface_once(str
+@@ -6256,6 +6276,10 @@ static int nl80211_create_iface_once(str
        if (wds && nla_put_u8(msg, NL80211_ATTR_4ADDR, wds))
                goto fail;
  
@@ -78,7 +87,7 @@
        /*
         * Tell cfg80211 that the interface belongs to the socket that created
         * it, and the interface should be deleted when the socket is closed.
-@@ -6311,14 +6333,14 @@ static int nl80211_create_iface_once(str
+@@ -6311,14 +6335,14 @@ static int nl80211_create_iface_once(str
  
  int nl80211_create_iface(struct wpa_driver_nl80211_data *drv,
                         const char *ifname, enum nl80211_iftype iftype,
  
        /* if error occurred and interface exists already */
        if (ret < 0 && if_nametoindex(ifname)) {
-@@ -6344,7 +6366,7 @@ int nl80211_create_iface(struct wpa_driv
+@@ -6344,7 +6368,7 @@ int nl80211_create_iface(struct wpa_driv
  
                /* Try to create the interface again */
                ret = nl80211_create_iface_once(drv, ifname, iftype, addr,
        }
  
        if (ret >= 0 && is_p2p_net_interface(iftype)) {
-@@ -8688,8 +8710,8 @@ static int i802_set_wds_sta(void *priv,
+@@ -8688,8 +8712,8 @@ static int i802_set_wds_sta(void *priv,
                if (!if_nametoindex(name)) {
                        if (nl80211_create_iface(drv, name,
                                                 NL80211_IFTYPE_AP_VLAN,
                                return -1;
  
                        if (bridge_ifname)
-@@ -9060,7 +9082,8 @@ static int wpa_driver_nl80211_if_add(voi
+@@ -9060,7 +9084,8 @@ static int wpa_driver_nl80211_if_add(voi
  
                os_memset(&p2pdev_info, 0, sizeof(p2pdev_info));
                ifidx = nl80211_create_iface(drv, ifname, nlmode, addr,
                                             &p2pdev_info, use_existing);
                if (!p2pdev_info.wdev_id_set || ifidx != 0) {
                        wpa_printf(MSG_ERROR, "nl80211: Failed to create a P2P Device interface %s",
-@@ -9077,7 +9100,8 @@ static int wpa_driver_nl80211_if_add(voi
+@@ -9077,7 +9102,8 @@ static int wpa_driver_nl80211_if_add(voi
                           (long long unsigned int) p2pdev_info.wdev_id);
        } else {
                ifidx = nl80211_create_iface(drv, ifname, nlmode, addr,
                if (use_existing && ifidx == -ENFILE) {
                        added = 0;
                        ifidx = if_nametoindex(ifname);
-@@ -9147,6 +9171,8 @@ static int wpa_driver_nl80211_if_add(voi
+@@ -9147,6 +9173,8 @@ static int wpa_driver_nl80211_if_add(voi
                new_bss->ctx = bss_ctx;
                new_bss->added_if = added;
  
index 4dc107feba20471dbc3befcc884b9f0434742ffa..1811ce30c9350975e525c11b8ecbbc3b293a0567 100644 (file)
@@ -29,7 +29,7 @@ Tested-by: Simon Wunderlich <simon.wunderlich@openmesh.com>
  struct wpa_driver_set_key_params {
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -12376,6 +12376,18 @@ static int nl80211_put_mesh_id(struct nl
+@@ -12378,6 +12378,18 @@ static int nl80211_put_mesh_id(struct nl
  }
  
  
@@ -48,7 +48,7 @@ Tested-by: Simon Wunderlich <simon.wunderlich@openmesh.com>
  static int nl80211_put_mesh_config(struct nl_msg *msg,
                                   struct wpa_driver_mesh_bss_params *params)
  {
-@@ -12437,6 +12449,7 @@ static int nl80211_join_mesh(struct i802
+@@ -12439,6 +12451,7 @@ static int nl80211_join_mesh(struct i802
            nl80211_put_basic_rates(msg, params->basic_rates) ||
            nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) ||
            nl80211_put_beacon_int(msg, params->beacon_int) ||
index 669c3fa9b63b03334000276ac47d088fbbf8bf87..10493825bfbb9ae179defac364958b896d169b9e 100644 (file)
@@ -720,7 +720,7 @@ as adding/removing interfaces.
        nl_cb_set(bss->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM,
                  no_seq_check, NULL);
        nl_cb_set(bss->nl_cb, NL_CB_VALID, NL_CB_CUSTOM,
-@@ -8854,6 +8875,7 @@ static void *i802_init(struct hostapd_da
+@@ -8856,6 +8877,7 @@ static void *i802_init(struct hostapd_da
        char master_ifname[IFNAMSIZ];
        int ifindex, br_ifindex = 0;
        int br_added = 0;
@@ -728,7 +728,7 @@ as adding/removing interfaces.
  
        bss = wpa_driver_nl80211_drv_init(hapd, params->ifname,
                                          params->global_priv, 1,
-@@ -8914,21 +8936,17 @@ static void *i802_init(struct hostapd_da
+@@ -8916,21 +8938,17 @@ static void *i802_init(struct hostapd_da
            (params->num_bridge == 0 || !params->bridge[0]))
                add_ifidx(drv, br_ifindex, drv->ifindex);
  
@@ -760,7 +760,7 @@ as adding/removing interfaces.
        }
  
        if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) {
-@@ -9310,6 +9328,50 @@ static int wpa_driver_nl80211_if_remove(
+@@ -9312,6 +9330,50 @@ static int wpa_driver_nl80211_if_remove(
        return 0;
  }
  
@@ -811,7 +811,7 @@ as adding/removing interfaces.
  
  static int cookie_handler(struct nl_msg *msg, void *arg)
  {
-@@ -11195,6 +11257,37 @@ static bool nl80211_is_drv_shared(void *
+@@ -11197,6 +11259,37 @@ static bool nl80211_is_drv_shared(void *
  #endif /* CONFIG_IEEE80211BE */
  
  
@@ -849,7 +849,7 @@ as adding/removing interfaces.
  static int driver_nl80211_send_mlme(void *priv, const u8 *data,
                                    size_t data_len, int noack,
                                    unsigned int freq,
-@@ -15014,6 +15107,8 @@ const struct wpa_driver_ops wpa_driver_n
+@@ -15016,6 +15109,8 @@ const struct wpa_driver_ops wpa_driver_n
        .set_acl = wpa_driver_nl80211_set_acl,
        .if_add = wpa_driver_nl80211_if_add,
        .if_remove = driver_nl80211_if_remove,
index ec907ea838b987a8f00e414894d98c4553366756..440848b743dee0dd8fb1613090e20ecfef078297 100644 (file)
@@ -123,7 +123,7 @@ untagged DHCP packets
         * get_wowlan - Get wake-on-wireless status
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -12896,7 +12896,7 @@ static const char * drv_br_net_param_str
+@@ -12898,7 +12898,7 @@ static const char * drv_br_net_param_str
  
  
  static int wpa_driver_br_set_net_param(void *priv, enum drv_br_net_param param,
@@ -132,7 +132,7 @@ untagged DHCP packets
  {
        struct i802_bss *bss = priv;
        char path[128];
-@@ -12922,8 +12922,11 @@ static int wpa_driver_br_set_net_param(v
+@@ -12924,8 +12924,11 @@ static int wpa_driver_br_set_net_param(v
                        return -EINVAL;
        }
  
index c1ac9449573e167b265c29be662c6179fc5d6ab8..b819fea1494c18bede527dea000c9d14c455c81d 100644 (file)
@@ -429,7 +429,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6
         * send_action - Transmit an Action frame
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -8706,25 +8706,15 @@ static int have_ifidx(struct wpa_driver_
+@@ -8708,25 +8708,15 @@ static int have_ifidx(struct wpa_driver_
  
  
  static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,