tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: protect pmf from network drivers that don't provide if_stop



On Thu, Jul 01, 2021 at 06:47:08 -0300, Jared McNeill wrote:

> Not really a fan of this as it doesn't protect other potential if_stop users
> (and "temporary fix" rarely is..). How about something like this instead?

I agree.  If for whatever reason we really insist on if-specific stop,
then just use a different stub that would complain about "pure
virtual" method called, kassert, or whatever.


> --- sys/net/if.c	29 Jun 2021 21:19:58 -0000	1.486
> +++ sys/net/if.c	1 Jul 2021 09:46:10 -0000
> @@ -761,11 +761,13 @@ void
>  if_register(ifnet_t *ifp)
>  {
>  	/*
> -	 * If the driver has not supplied its own if_ioctl, then
> -	 * supply the default.
> +	 * If the driver has not supplied its own if_ioctl or if_stop,
> +	 * then supply the default.
>  	 */
>  	if (ifp->if_ioctl == NULL)
>  		ifp->if_ioctl = ifioctl_common;
> +	if (ifp->if_stop == NULL)
> +		ifp->if_stop = if_nullstop;
> 
>  	sysctl_sndq_setup(&ifp->if_sysctl_log, ifp->if_xname, &ifp->if_snd);

-uwe


Home | Main Index | Thread Index | Old Index