Re: [PATCH batadv] batman-adv: gw: don't deselect gateway with active hardif

Sven Eckelmann <[email protected]> Wed, 10 Jun 2026 20:35:00 +0200
Newsgroups org.open-mesh.lists.batman
Message-ID <6276013.lOV4Wx5bFT@sven-desktop>
On Wednesday, 10 June 2026 19:50:12 CEST Nora Schiffer wrote:
[...]
> >   	/* 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);
> 
> The change looks correct, but this is the only remaining user of 
> batadv_hardif_cnt(), and it's only checking if there aren't any hardifs, so 
> this could avoid counting altogether and just use
> 
> 	if (list_empty(&hard_iface->mesh_iface->adj_list.lower))
> 
> and drop batadv_hardif_cnt().

Good point. Will submit a new version.

> We are holding RTNL here, right?

Yes, all callers are holding RTNL.

Regards,
	Sven
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQS81G/PswftH/OW8cVND3cr0xT1ywUCaimuVAAKCRBND3cr0xT1
y6wEAQC0HYuK67xOj13zQXC3+qxLppYywmxGILFbciSYtRt7EgEAqCIG5+mrhDab
0i0lGBq9MphDdttNm4l1ZmqGhUXPkQM=
=yHDg
-----END PGP SIGNATURE-----