Download raw body.
tun(4)/tap(4): run the network stack with shared net lock
On Tue, Nov 25, 2025 at 02:18:31PM +0100, Claudio Jeker wrote: > 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. Nothing in this commit message is true anymore. Everything within if_vinput() looks MP safe. Tested with vmd(8) passing packets between VMs via tap(4) interfaces in veb(4). OK bluhm@ > > 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
tun(4)/tap(4): run the network stack with shared net lock