From: Claudio Jeker Subject: Re: tun(4)/tap(4): run the network stack with shared net lock To: David Gwynne Cc: tech@openbsd.org Date: Tue, 25 Nov 2025 14:18:31 +0100 On Tue, Nov 25, 2025 at 10:01:02PM +1000, David Gwynne wrote: > pretty sure we can push packets through the stack with NET_LOCK_SHARED. > > ok? Are we really there yet? See rev 1.221. It mentions pfsync and socket layer as being affected. I don't remember the full story here so maybe it is safe now because a lot changed in the last 5.5 years. > Index: if_tun.c > =================================================================== > RCS file: /cvs/src/sys/net/if_tun.c,v > diff -u -p -r1.253 if_tun.c > --- if_tun.c 4 Nov 2025 12:02:39 -0000 1.253 > +++ if_tun.c 25 Nov 2025 11:59:33 -0000 > @@ -1034,9 +1034,9 @@ tun_dev_write(dev_t dev, struct uio *uio > m = n; > } > > - NET_LOCK(); > + NET_LOCK_SHARED(); > if_vinput(ifp, m0, NULL); > - NET_UNLOCK(); > + NET_UNLOCK_SHARED(); > > tun_put(sc); > return (0); > -- :wq Claudio