diff options
author | 2015-06-16 11:09:39 +0000 | |
---|---|---|
committer | 2015-06-16 11:09:39 +0000 | |
commit | fb492c3701798fad8024e2bd164905788c83671b (patch) | |
tree | c6607492c9afd90379dbfbaae78d4ee451192462 /sys/net/if_tun.c | |
parent | Be more strict about BER and DER terminology. (diff) | |
download | wireguard-openbsd-fb492c3701798fad8024e2bd164905788c83671b.tar.xz wireguard-openbsd-fb492c3701798fad8024e2bd164905788c83671b.zip |
Store a unique ID, an interface index, rather than a pointer to the
receiving interface in the packet header of every mbuf.
The interface pointer should now be retrieved when necessary with
if_get(). If a NULL pointer is returned by if_get(), the interface
has probably been destroy/removed and the mbuf should be freed.
Such mechanism will simplify garbage collection of mbufs and limit
problems with dangling ifp pointers.
Tested by jmatthew@ and krw@, discussed with many.
ok mikeb@, bluhm@, dlg@
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r-- | sys/net/if_tun.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 4600a8cfa6c..41ef1053770 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.145 2015/06/01 07:48:04 mpi Exp $ */ +/* $OpenBSD: if_tun.c,v 1.146 2015/06/16 11:09:39 mpi Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -898,7 +898,7 @@ tunwrite(dev_t dev, struct uio *uio, int ioflag) top->m_len -= sizeof(*th); top->m_pkthdr.len -= sizeof(*th); top->m_pkthdr.ph_rtableid = ifp->if_rdomain; - top->m_pkthdr.rcvif = ifp; + top->m_pkthdr.ph_ifidx = ifp->if_index; switch (ntohl(*th)) { case AF_INET: |