Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

m_resethdr() in if_input_local()

0 views
Skip to first unread message

Alexander Bluhm

unread,
Oct 13, 2016, 9:30:10 AM10/13/16
to te...@openbsd.org
Hi,

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.

ok?

bluhm

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);
}
#endif
+ m_resethdr(m);
m->m_pkthdr.ph_ifidx = ifp->if_index;
+ m->m_pkthdr.ph_rtableid = ifp->if_rdomain;

ifp->if_opackets++;
ifp->if_obytes += m->m_pkthdr.len;

Alexandr Nedvedicky

unread,
Oct 13, 2016, 9:13:42 PM10/13/16
to Alexander Bluhm, te...@openbsd.org
Hello,

looks O.K. to me.

can you also do s/destinated/designated, when you are touching the
if_input_local() function already?

thanks and
regards
sasha
0 new messages