Subject: Re: [PATCH v1 net-next] tun: Ignore tun in netdev_lock_pos().

From: Willem de Bruijn <[email-masked]>
Date: Fri, 27 Mar 2026 19:16:19 -0400

Kuniyuki Iwashima wrote:
> On Fri, Mar 27, 2026 at 2:48 PM Eric Dumazet <[email-masked]> wrote:
> >
> > On Fri, Mar 27, 2026 at 2:34 PM Kuniyuki Iwashima <[email-masked]> wrote:
> > >
> > > dev->type could be any value on tun due to TUNSETLINK.
> > >
> > > Let's not warn about it in netdev_lock_pos().
> > >
> > > Signed-off-by: Kuniyuki Iwashima <[email-masked]>
> >
> > Hmmm... should we instead have a list of supported types ?
> >
> > And reject user space requests for unsupported ones ?
> 
> I chose a safer way but maybe we could reuse tun_get_addr_len()
> and define the default case there as unsupported ?
> 
> I guess it's okay even if it breaks userspace because we can
> just add a single line to restore the support.

We shouldn't risk breaking userspace, over such a sanity check.

Presumably any truly newly added type will have a non-zero addr_len.
While tun sets this to zero for weird inputs. Maybe just filter on
that in the WARN_ONCE?