diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-06-16 11:09:41 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-06-16 11:09:41 +0000 |
commit | 3a3f3f5b2a66fdcf27f621f80a6d0a6d22bfaace (patch) | |
tree | 173fe4df0244a96c60ce236617fe5b7c539ad2f1 /sys/net/bpf.c | |
parent | 913f86006f0c78d29161101d7aad233f8f4668df (diff) |
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/bpf.c')
-rw-r--r-- | sys/net/bpf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 5626c73fef0..ecf59a8f0af 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.119 2015/05/13 10:42:46 jsg Exp $ */ +/* $OpenBSD: bpf.c,v 1.120 2015/06/16 11:09:39 mpi Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -180,7 +180,7 @@ bpf_movein(struct uio *uio, u_int linktype, struct mbuf **mp, len = uio->uio_resid; MGETHDR(m, M_WAIT, MT_DATA); - m->m_pkthdr.rcvif = NULL; + m->m_pkthdr.ph_ifidx = 0; m->m_pkthdr.len = len - hlen; if (len > MHLEN) { |