hostapd: revert a broken upstream patch that was breaking multi-band operation
authorFelix Fietkau <nbd@nbd.name>
Sun, 6 Jul 2025 16:47:14 +0000 (18:47 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sun, 6 Jul 2025 16:47:41 +0000 (18:47 +0200)
nl80211 events were propagated to the wrong interfaces

Fixes: 2ac791e87d3d ("hostapd: update to version 2025-06-27")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/services/hostapd/patches/030-Revert-nl80211-Accept-a-global-nl80211-event-to-a-br.patch [new file with mode: 0644]
package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
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

diff --git a/package/network/services/hostapd/patches/030-Revert-nl80211-Accept-a-global-nl80211-event-to-a-br.patch b/package/network/services/hostapd/patches/030-Revert-nl80211-Accept-a-global-nl80211-event-to-a-br.patch
new file mode 100644 (file)
index 0000000..4d9574b
--- /dev/null
@@ -0,0 +1,77 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Sun, 6 Jul 2025 18:41:52 +0200
+Subject: [PATCH] Revert "nl80211: Accept a global nl80211 event to a bridged
+ interface"
+
+This reverts commit 1c994da117ad795766270cf04bc923971e27412f.
+---
+
+--- a/src/drivers/driver_nl80211_event.c
++++ b/src/drivers/driver_nl80211_event.c
+@@ -4482,8 +4482,6 @@ int process_global_event(struct nl_msg *
+                               wiphy_idx = nl80211_get_wiphy_index(bss);
+                       if ((ifidx == -1 && !wiphy_idx_set && !wdev_id_set) ||
+                           ifidx == bss->ifindex ||
+-                          (bss->br_ifindex > 0 &&
+-                           nl80211_has_ifidx(drv, bss->br_ifindex, ifidx)) ||
+                           (wiphy_idx_set && wiphy_idx == wiphy_idx_rx) ||
+                           (wdev_id_set && bss->wdev_id_set &&
+                            wdev_id == bss->wdev_id)) {
+--- a/src/drivers/driver_nl80211.c
++++ b/src/drivers/driver_nl80211.c
+@@ -182,6 +182,8 @@ static void add_ifidx(struct wpa_driver_
+                     int ifidx_reason);
+ static void del_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
+                     int ifidx_reason);
++static int have_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
++                    int ifidx_reason);
+ static int nl80211_set_channel(struct i802_bss *bss,
+                              struct hostapd_freq_params *freq, int set_chan);
+@@ -1270,7 +1272,7 @@ nl80211_find_drv(struct nl80211_global *
+                               *init_failed = 1;
+                       return drv;
+               }
+-              if (res > 0 || nl80211_has_ifidx(drv, idx, IFIDX_ANY))
++              if (res > 0 || have_ifidx(drv, idx, IFIDX_ANY))
+                       return drv;
+       }
+       return NULL;
+@@ -8583,7 +8585,7 @@ static void add_ifidx(struct wpa_driver_
+       wpa_printf(MSG_DEBUG,
+                  "nl80211: Add own interface ifindex %d (ifidx_reason %d)",
+                  ifidx, ifidx_reason);
+-      if (nl80211_has_ifidx(drv, ifidx, ifidx_reason)) {
++      if (have_ifidx(drv, ifidx, ifidx_reason)) {
+               wpa_printf(MSG_DEBUG, "nl80211: ifindex %d already in the list",
+                          ifidx);
+               return;
+@@ -8643,7 +8645,7 @@ static void del_ifidx(struct wpa_driver_
+ }
+-int nl80211_has_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
++static int have_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
+                     int ifidx_reason)
+ {
+       int i;
+@@ -8750,7 +8752,7 @@ static void handle_eapol(int sock, void
+               return;
+       }
+-      if (nl80211_has_ifidx(drv, lladdr.sll_ifindex, IFIDX_ANY)) {
++      if (have_ifidx(drv, lladdr.sll_ifindex, IFIDX_ANY)) {
+               for (bss = drv->first_bss; bss; bss = bss->next)
+                       drv_event_eapol_rx(bss->ctx, lladdr.sll_addr, buf, len);
+       }
+--- a/src/drivers/driver_nl80211.h
++++ b/src/drivers/driver_nl80211.h
+@@ -371,8 +371,6 @@ struct i802_link * nl80211_get_link(stru
+ u8 nl80211_get_link_id_from_link(struct i802_bss *bss, struct i802_link *link);
+ int nl80211_remove_link(struct i802_bss *bss, int link_id);
+ void nl80211_update_active_links(struct i802_bss *bss, int link_id);
+-int nl80211_has_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
+-                    int ifidx_reason);
+ static inline bool nl80211_link_valid(u16 links, s8 link_id)
+ {
index e3fd6c887ad32b335f890d85e9e175dd4d12da3b..d91aac2f3a3acca90cd3928741ecbc52070c698d 100644 (file)
@@ -4,7 +4,7 @@ Subject: [PATCH] nl80211_del_beacon_bss.patch
 
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -6403,8 +6403,7 @@ static void nl80211_teardown_ap(struct i
+@@ -6405,8 +6405,7 @@ static void nl80211_teardown_ap(struct i
        }
  
        nl80211_put_wiphy_data_ap(bss);
index d197b284aff8d1ec7321898c8615a64a8e166669..a60e9c4aa95e95e7c1530473298218e8767cdf99 100644 (file)
@@ -19,7 +19,7 @@
  void nl80211_remove_iface(struct wpa_driver_nl80211_data *drv, int ifidx);
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -753,6 +753,7 @@ struct wiphy_idx_data {
+@@ -755,6 +755,7 @@ struct wiphy_idx_data {
        enum nl80211_iftype nlmode;
        u8 *macaddr;
        u8 use_4addr;
@@ -27,7 +27,7 @@
  };
  
  
-@@ -778,6 +779,9 @@ static int netdev_info_handler(struct nl
+@@ -780,6 +781,9 @@ static int netdev_info_handler(struct nl
        if (tb[NL80211_ATTR_4ADDR])
                info->use_4addr = nla_get_u8(tb[NL80211_ATTR_4ADDR]);
  
@@ -37,7 +37,7 @@
        return NL_SKIP;
  }
  
-@@ -844,6 +848,20 @@ static int nl80211_get_4addr(struct i802
+@@ -846,6 +850,20 @@ static int nl80211_get_4addr(struct i802
  }
  
  
@@ -58,7 +58,7 @@
  static int nl80211_register_beacons(struct wpa_driver_nl80211_data *drv,
                                    struct nl80211_wiphy_data *w)
  {
-@@ -6234,7 +6252,7 @@ const char * nl80211_iftype_str(enum nl8
+@@ -6236,7 +6254,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 +67,7 @@
                                     int (*handler)(struct nl_msg *, void *),
                                     void *arg)
  {
-@@ -6254,6 +6272,10 @@ static int nl80211_create_iface_once(str
+@@ -6256,6 +6274,10 @@ static int nl80211_create_iface_once(str
        if (wds && nla_put_u8(msg, NL80211_ATTR_4ADDR, wds))
                goto fail;
  
@@ -78,7 +78,7 @@
        /*
         * Tell cfg80211 that the interface belongs to the socket that created
         * it, and the interface should be deleted when the socket is closed.
-@@ -6309,14 +6331,14 @@ static int nl80211_create_iface_once(str
+@@ -6311,14 +6333,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,
@@ -96,7 +96,7 @@
  
        /* if error occurred and interface exists already */
        if (ret < 0 && if_nametoindex(ifname)) {
-@@ -6342,7 +6364,7 @@ int nl80211_create_iface(struct wpa_driv
+@@ -6344,7 +6366,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)) {
-@@ -8683,8 +8705,8 @@ static int i802_set_wds_sta(void *priv,
+@@ -8685,8 +8707,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)
-@@ -9055,7 +9077,8 @@ static int wpa_driver_nl80211_if_add(voi
+@@ -9057,7 +9079,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",
-@@ -9072,7 +9095,8 @@ static int wpa_driver_nl80211_if_add(voi
+@@ -9074,7 +9097,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);
-@@ -9142,6 +9166,8 @@ static int wpa_driver_nl80211_if_add(voi
+@@ -9144,6 +9168,8 @@ static int wpa_driver_nl80211_if_add(voi
                new_bss->ctx = bss_ctx;
                new_bss->added_if = added;
  
index 3a966a561953a4ca72a47215e9fc194bff506d92..0bcb75187af9a6c8126191abf9bc8fe2d210afe2 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
-@@ -12361,6 +12361,18 @@ static int nl80211_put_mesh_id(struct nl
+@@ -12363,6 +12363,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)
  {
-@@ -12422,6 +12434,7 @@ static int nl80211_join_mesh(struct i802
+@@ -12424,6 +12436,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 db68772f6f13cf379dfa30a747d9a8577b38f5d7..ec25cd4084b9508cc485030b7af3390c77402232 100644 (file)
@@ -293,7 +293,7 @@ as adding/removing interfaces.
  
  static struct nl_sock * nl_create_handle(struct nl_cb *cb, const char *dbg)
  {
-@@ -435,6 +445,11 @@ static int no_seq_check(struct nl_msg *m
+@@ -437,6 +447,11 @@ static int no_seq_check(struct nl_msg *m
        return NL_OK;
  }
  
@@ -305,7 +305,7 @@ as adding/removing interfaces.
  
  static void nl80211_nlmsg_clear(struct nl_msg *msg)
  {
-@@ -509,6 +524,8 @@ int send_and_recv_glb(struct nl80211_glo
+@@ -511,6 +526,8 @@ int send_and_recv_glb(struct nl80211_glo
        if (!msg)
                return -ENOMEM;
  
@@ -314,7 +314,7 @@ as adding/removing interfaces.
        err.err = -ENOMEM;
  
        s_nl_cb = nl_socket_get_cb(nl_handle);
-@@ -550,6 +567,7 @@ int send_and_recv_glb(struct nl80211_glo
+@@ -552,6 +569,7 @@ int send_and_recv_glb(struct nl80211_glo
        err.err_info = err_info;
        err.drv = drv;
  
@@ -322,7 +322,7 @@ as adding/removing interfaces.
        nl_cb_err(cb, NL_CB_CUSTOM, error_handler, &err);
        nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, &err.err);
        if (ack_handler_custom) {
-@@ -971,6 +989,7 @@ nl80211_get_wiphy_data_ap(struct i802_bs
+@@ -973,6 +991,7 @@ nl80211_get_wiphy_data_ap(struct i802_bs
                        os_free(w);
                        return NULL;
                }
@@ -330,7 +330,7 @@ as adding/removing interfaces.
                nl_cb_set(w->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM,
                          no_seq_check, NULL);
                nl_cb_set(w->nl_cb, NL_CB_VALID, NL_CB_CUSTOM,
-@@ -1399,7 +1418,7 @@ static void wpa_driver_nl80211_event_rtm
+@@ -1401,7 +1420,7 @@ static void wpa_driver_nl80211_event_rtm
                }
                wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)",
                           namebuf, ifname);
@@ -339,7 +339,7 @@ as adding/removing interfaces.
                        wpa_printf(MSG_DEBUG,
                                   "nl80211: Not the main interface (%s) - do not indicate interface down",
                                   drv->first_bss->ifname);
-@@ -1435,7 +1454,7 @@ static void wpa_driver_nl80211_event_rtm
+@@ -1437,7 +1456,7 @@ static void wpa_driver_nl80211_event_rtm
                }
                wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)",
                           namebuf, ifname);
@@ -348,7 +348,7 @@ as adding/removing interfaces.
                        wpa_printf(MSG_DEBUG,
                                   "nl80211: Not the main interface (%s) - do not indicate interface up",
                                   drv->first_bss->ifname);
-@@ -2128,6 +2147,7 @@ static int wpa_driver_nl80211_init_nl_gl
+@@ -2130,6 +2149,7 @@ static int wpa_driver_nl80211_init_nl_gl
        genl_family_put(family);
        nl_cache_free(cache);
  
@@ -356,7 +356,7 @@ as adding/removing interfaces.
        nl_cb_set(global->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM,
                  no_seq_check, NULL);
        nl_cb_set(global->nl_cb, NL_CB_VALID, NL_CB_CUSTOM,
-@@ -2298,6 +2318,7 @@ static int nl80211_init_bss(struct i802_
+@@ -2300,6 +2320,7 @@ static int nl80211_init_bss(struct i802_
        if (!bss->nl_cb)
                return -1;
  
@@ -364,7 +364,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,
-@@ -8849,6 +8870,7 @@ static void *i802_init(struct hostapd_da
+@@ -8851,6 +8872,7 @@ static void *i802_init(struct hostapd_da
        char master_ifname[IFNAMSIZ];
        int ifindex, br_ifindex = 0;
        int br_added = 0;
@@ -372,7 +372,7 @@ as adding/removing interfaces.
  
        bss = wpa_driver_nl80211_drv_init(hapd, params->ifname,
                                          params->global_priv, 1,
-@@ -8909,21 +8931,17 @@ static void *i802_init(struct hostapd_da
+@@ -8911,21 +8933,17 @@ static void *i802_init(struct hostapd_da
            (params->num_bridge == 0 || !params->bridge[0]))
                add_ifidx(drv, br_ifindex, drv->ifindex);
  
@@ -404,7 +404,7 @@ as adding/removing interfaces.
        }
  
        if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) {
-@@ -9302,6 +9320,50 @@ static int wpa_driver_nl80211_if_remove(
+@@ -9304,6 +9322,50 @@ static int wpa_driver_nl80211_if_remove(
        return 0;
  }
  
@@ -455,7 +455,7 @@ as adding/removing interfaces.
  
  static int cookie_handler(struct nl_msg *msg, void *arg)
  {
-@@ -11180,6 +11242,37 @@ static bool nl80211_is_drv_shared(void *
+@@ -11182,6 +11244,37 @@ static bool nl80211_is_drv_shared(void *
  #endif /* CONFIG_IEEE80211BE */
  
  
@@ -493,7 +493,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,
-@@ -14999,6 +15092,8 @@ const struct wpa_driver_ops wpa_driver_n
+@@ -15001,6 +15094,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 7eeb1aa193d397ffb886c05f392b9ce51a43bb3f..105f99e311de33cb08545d2572d988e10724c659 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
-@@ -12881,7 +12881,7 @@ static const char * drv_br_net_param_str
+@@ -12883,7 +12883,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];
-@@ -12907,8 +12907,11 @@ static int wpa_driver_br_set_net_param(v
+@@ -12909,8 +12909,11 @@ static int wpa_driver_br_set_net_param(v
                        return -EINVAL;
        }
  
index 8ad1c8a80859130bc3da6529c768ebbfc450bbb6..9528900e463d50b9e92246020f8e72869cced0d8 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
-@@ -8701,25 +8701,15 @@ int nl80211_has_ifidx(struct wpa_driver_
+@@ -8703,25 +8703,15 @@ static int have_ifidx(struct wpa_driver_
  
  
  static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,