From owner-freebsd-net@FreeBSD.ORG Fri Mar 20 15:19:10 2015 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 33BE797E for ; Fri, 20 Mar 2015 15:19:10 +0000 (UTC) Received: from mail-ie0-x22c.google.com (mail-ie0-x22c.google.com [IPv6:2607:f8b0:4001:c03::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 006C2AA2 for ; Fri, 20 Mar 2015 15:19:09 +0000 (UTC) Received: by iedm5 with SMTP id m5so30863371ied.3 for ; Fri, 20 Mar 2015 08:19:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=mMJAoS90RHy/UA1gGRHXFSv/fn6jtMQoXO7cVmKVk5E=; b=uiqyWRjPz5G4jzgPgNvF69v6ApXWaSCn2hf4be+V5scvab3Bqcrq7IgpajqwPXuZ4U OidIfm3J/slhwdpNN3osOlLilUaK8rTec7An+EnTGueY+U+qqVfuBIinHPiOgadheVir 0bVl7G45BVn2PcWAXm7lCBDrG+lz1NFd14kVWrrJD1bDmUXuBw4Prx5cDmnH0Xc6iCGE N6qMuI0taDEg9inI97/ff65nJSgWHrHIeobad6qq0ilN2oL6ULbCrZjUU/yWmjipKyJx APPm0PO7jTY2AObiTrAMpAdLsRqoUhB0fOLHUQmMPb8vz9MOrSjW96dBb4w/iP2FegkB 3zBw== X-Received: by 10.107.32.73 with SMTP id g70mr109686681iog.55.1426864749243; Fri, 20 Mar 2015 08:19:09 -0700 (PDT) Received: from [10.10.1.5] ([192.252.130.194]) by mx.google.com with ESMTPSA id t1sm3593829igs.0.2015.03.20.08.19.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Mar 2015 08:19:08 -0700 (PDT) Message-ID: <550C3A62.3080403@gmail.com> Date: Fri, 20 Mar 2015 11:18:58 -0400 From: Karim Fodil-Lemelin User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: freebsd-net Subject: Another fragment question / patch Content-Type: text/plain; charset=utf-8; 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 15:19:10 -0000 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.