[PATCH] nl80211: re-add interface into bridge on interface re-creation

Dominique Martinet dominique.martinet at atmark-techno.com
Sun Feb 8 16:20:16 PST 2026


When using the nl80211 driver with a bridge, the driver properly detects
when the interface is re-created ("nl80211: Update ifindex for a removed
interface") and wpa_driver_nl80211_finish_drv_init() reinits it, but if
the interface was part of a bridge nothing adds it back there.

This adds the interface to the bridge in this function if the initial
init setup a bridge in the first place:
- the first time wpa_driver_nl80211_finish_drv_init() is called,
i802_init() has not yet setup the bridge (i802_check_bridge()), so
this flag is false and nothing changes
- when the interface is re-added the flag is only set if
i802_check_bridge() went to the end, which also ensures the bss->bridge
variable is sensible.

Signed-off-by: Dominique Martinet <dominique.martinet at atmark-techno.com>
---

This is a resend of [1] without the RFC tag.
[1] https://lists.infradead.org/pipermail/hostap/2025-December/044121.html

As it didn't get any comment feel free to bring up any concern and I'll
be happy to oblige.

 src/drivers/driver_nl80211.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index d2be2b77bdf0..863dad4ec529 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -3459,6 +3459,15 @@ wpa_driver_nl80211_finish_drv_init(struct i802_bss *bss, const u8 *set_addr,
 	if (drv->vendor_cmd_test_avail)
 		qca_vendor_test(drv);
 
+	if (bss->added_if_into_bridge) {
+		if (linux_br_add_if(drv->global->ioctl_sock, bss->brname,
+				    bss->ifname) < 0) {
+			wpa_printf(MSG_WARNING,
+				   "nl80211: Failed to add interface %s into bridge %s: %s",
+				   bss->ifname, bss->brname, strerror(errno));
+		}
+	}
+
 	return 0;
 }
 
-- 
2.47.3





More information about the Hostap mailing list