From owner-freebsd-net@FreeBSD.ORG Fri Mar 20 17:56:18 2015 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1C3D8F87 for ; Fri, 20 Mar 2015 17:56:18 +0000 (UTC) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D03D1F0D for ; Fri, 20 Mar 2015 17:56:17 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 2BB331FE022; Fri, 20 Mar 2015 18:56:15 +0100 (CET) Message-ID: <550C5F6C.3080302@selasky.org> Date: Fri, 20 Mar 2015 18:57:00 +0100 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Karim Fodil-Lemelin , freebsd-net Subject: Re: Another fragment question / patch References: <550C3A62.3080403@gmail.com> In-Reply-To: <550C3A62.3080403@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Mar 2015 17:56:18 -0000 On 03/20/15 16:18, Karim Fodil-Lemelin wrote: > 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 > Hi, I see your point about copying the tags. I'm not sure however that M_COPYFLAGS is correct, because it also copies M_RDONLY, which is not relevant for this case. Can you explain what flags need copying in addition to M_MCAST ? Maybe we need to define these flags separately. Thank you! --HPS