Re: if_bridge: unused 'disable' parameter in bridge_stop()

Zhenlei Huang <[email protected]> Sat, 20 Jun 2026 14:41:33 +0800
Newsgroups gmane.os.freebsd.devel.net
Message-ID <[email protected]>

> On Jun 12, 2026, at 5:05 AM, Aaron Espinoza <[email protected]> wrote:
> 
> Hello,
> 
> I was tracing the if_bridge driver on the current main branch and noticed that the bridge_stop method takes in an 'int disable' parameter that doesn't seem to be used in the function itself.
> 
> Currently, there are two calls to bridge_stop() in the driver: 
> 1. In bridge_clone_destroy() - Line 940
> 2. In bridge_ioctl() - Line 1073
> In both of these calls, the disable parameter is hard-coded to 1.
> There doesn't seem to be any case where 0 is used for the parameter.
> 
> Since the ifnet structure doesn't require a stop function, I assume this is purely for the bridge itself.
> 
> Is this parameter still relevant/needed in the driver architecture? If not, I'd be happy to make a small pr to update this.

I think that parameter is not relevant.

> 
> I'm still finding my footing around the FreeBSD network stack so please let me know if this parameter has a purpose I overlooked.

From git history, the parameter was introduced while importing from NetBSD.

The purpose of that parameter is to match the requirement of NetBSD's ifnet protocol `ifp->if_stop` ,
```
ifp->if_stop = bridge_stop;
```

That parameter is not even used in NetBSD, see https://github.com/NetBSD/src/blob/trunk/sys/net/if_bridge.c .

The FreeBSD does not have `ifp->if_stop` so I think that parameter can be removed.

> 
> Best,
> Aaron
> 
> 

Best regards,
Zhenlei