Index | Thread | Search

From:
David Gwynne <david@gwynne.id.au>
Subject:
preserve mbuf flowid in if_input_local
To:
tech@openbsd.org
Cc:
bluhm@openbsd.org
Date:
Wed, 7 May 2025 11:03:12 +1000

Download raw body.

Thread
we're not changing the content of the packet, so the flowid is still
valid. m_resethdr() clears the field, so we need to preserve it ourselves
though.

ok?

Index: if.c
===================================================================
RCS file: /cvs/src/sys/net/if.c,v
diff -u -p -r1.731 if.c
--- if.c	1 May 2025 11:19:46 -0000	1.731
+++ if.c	7 May 2025 01:01:46 -0000
@@ -785,6 +785,7 @@ if_input_local(struct ifnet *ifp, struct
 {
 	int keepflags, keepcksum;
 	uint16_t keepmss;
+	uint16_t keepflowid;
 
 #if NBPFILTER > 0
 	/*
@@ -809,12 +810,14 @@ if_input_local(struct ifnet *ifp, struct
 	 */
 	keepcksum = m->m_pkthdr.csum_flags & (M_IPV4_CSUM_OUT |
 	    M_TCP_CSUM_OUT | M_UDP_CSUM_OUT | M_ICMP_CSUM_OUT |
-	    M_TCP_TSO);
+	    M_TCP_TSO | M_FLOWID);
 	keepmss = m->m_pkthdr.ph_mss;
+	keepflowid = m->m_pkthdr.ph_flowid;
 	m_resethdr(m);
 	m->m_flags |= M_LOOP | keepflags;
 	m->m_pkthdr.csum_flags = keepcksum;
 	m->m_pkthdr.ph_mss = keepmss;
+	m->m_pkthdr.ph_flowid = keepflowid;
 	m->m_pkthdr.ph_ifidx = ifp->if_index;
 	m->m_pkthdr.ph_rtableid = ifp->if_rdomain;