Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Mar 2015 11:18:58 -0400
From:      Karim Fodil-Lemelin <fodillemlinkarim@gmail.com>
To:        freebsd-net <freebsd-net@freebsd.org>
Subject:   Another fragment question / patch
Message-ID:  <550C3A62.3080403@gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,

While reading through a previous comment on this list about fragments 
I've noticed that mbuf tags aren't being copied from the leading 
fragment (header) to the subsequent fragment packets. In other words, 
one would expect that all fragments of a packet are carrying the same 
tags that were set on the original packet. I have built a simple test 
were I use ipfw with ALTQ and sent large packet (bigger then MTU) off 
that BSD machine. I have observed that the leading fragment (m0) packet 
is going through the right class although the next fragments are hitting 
the default class for unclassified packets.

Here is a patch that makes things works as expected (all fragments carry 
the ALTQ tag):

diff --git a/freebsd/sys/netinet/ip_output.c 
b/freebsd/sys/netinet/ip_output.c
index d650949..7d8f041 100644
--- a/freebsd/sys/netinet/ip_output.c
+++ b/freebsd/sys/netinet/ip_output.c
@@ -1184,7 +1184,10 @@ smart_frag_failure:
                         ipstat.ips_odropped++;
                         goto done;
                 }
-               m->m_flags |= (m0->m_flags & M_MCAST) | M_FRAG;
+
+               m->m_flags |= (m0->m_flags & M_COPYFLAGS) | M_FRAG;
+               m_tag_copy_chain(m, m0, M_NOWAIT);
+
                 /*
                  * In the first mbuf, leave room for the link header, then
                  * copy the original IP header including options. The 
payload
diff --git a/freebsd/sys/sys/mbuf.h b/freebsd/sys/sys/mbuf.h
index 2efff38..6ad8439 100644
--- a/freebsd/sys/sys/mbuf.h


I hope this helps,

Karim.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?550C3A62.3080403>