[PATCH batadv] batman-adv: gw: don't deselect gateway with active hardif
Sven Eckelmann <[email protected]> Sun, 07 Jun 2026 14:57:44 +0200
| Newsgroups | org.open-mesh.lists.batman |
|---|---|
| Message-ID | <[email protected]> |
The batadv_hardif_cnt() was previously checking if there is an
batadv_hard_iface->mesh_iface which is has the same mesh_iface. And since
batadv_hardif_disable_interface() was resetting the
batadv_hard_iface->mesh_iface after this check, it had to verify whether
*1* interface was still part of the mesh_iface before it started the
gateway deselection.
But after batadv_hardif_cnt() is now checking the lower interfaces of
mesh_iface and batadv_hardif_disable_interface() already removed the
interface via netdev_upper_dev_unlink() earlier in this function, the check
must now make sure that *0* interfaces can be found by batadv_hardif_cnt()
before selected gateway must be deselected. Otherwise the deselection would
already happen one batadv_hard_iface too early.
Fixes: 702c52a87eab ("batman-adv: store hard_iface as iflink private data")
Cc: Nora Schiffer <[email protected]>
Signed-off-by: Sven Eckelmann <[email protected]>
---
net/batman-adv/hard-interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 60cee2c2..ae19f144 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -879,7 +879,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface)
batadv_hardif_recalc_extra_skbroom(hard_iface->mesh_iface);
/* nobody uses this interface anymore */
- if (batadv_hardif_cnt(hard_iface->mesh_iface) <= 1)
+ if (batadv_hardif_cnt(hard_iface->mesh_iface) == 0)
batadv_gw_check_client_stop(bat_priv);
hard_iface->mesh_iface = NULL;
---
base-commit: 385b248dd4e46c4ce022adeb1b13e547d1954901
change-id: 20260607-gw-disable-check-f3393c3a4989
Best regards,
--
Sven Eckelmann <[email protected]>