m_resethdr() exists to clear information attached to a mbuf that
has been accumulated during processing.  Especially pf(4) data is
removed.  This feature used by pair(4) when a new input is started.

patrick@ has seen a mbuf going though lo(4) with an old inp attached.
I think this should be fixed in a more general way.  When a packet
is reinserted to local input processing, start from scratch.

Also the packet has to be in the routing doamin of the interface
where it is insertet.  I think was the case anyway, as the callers
of if_input_local() do not change the interface.  But as m_resethdr()
clears the field, set the rtableid to the input interface.



Index: net/if.c
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if.c,v
retrieving revision 1.454
diff -u -p -r1.454 if.c
--- net/if.c    9 Oct 2016 20:05:10 -0000       1.454
+++ net/if.c    13 Oct 2016 12:29:30 -0000
@@ -665,7 +665,9 @@ if_input_local(struct ifnet *ifp, struct
                        bpf_mtap_af(if_bpf, af, m, BPF_DIRECTION_OUT);
+       m_resethdr(m);
        m->m_pkthdr.ph_ifidx = ifp->if_index;
+       m->m_pkthdr.ph_rtableid = ifp->if_rdomain;
        ifp->if_obytes += m->m_pkthdr.len;

Reply via email to