From owner-freebsd-net@freebsd.org Mon Oct 16 17:57:46 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1700BE40B02 for ; Mon, 16 Oct 2017 17:57:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id F02AE662A3 for ; Mon, 16 Oct 2017 17:57:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v9GHvcRY024695 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 16 Oct 2017 10:57:39 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v9GHvcZ5024694; Mon, 16 Oct 2017 10:57:38 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 16 Oct 2017 10:57:38 -0700 From: Gleb Smirnoff To: Karim Fodil-Lemelin Cc: Adrian Chadd , FreeBSD Net , "Andrey V. Elsukov" Subject: Re: m_move_pkthdr leaves m_nextpkt 'dangling' Message-ID: <20171016175738.GA1100@FreeBSD.org> References: <59567148.1020902@xiplink.com> <31535133-f95a-5db6-a04c-acc0175fa287@yandex.ru> <59DFD3CC.2000401@xiplink.com> <20171013211026.GB1055@FreeBSD.org> <59E4C40E.9060103@xiplink.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <59E4C40E.9060103@xiplink.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Oct 2017 17:57:46 -0000 Karim, On Mon, Oct 16, 2017 at 10:37:02AM -0400, Karim Fodil-Lemelin wrote: K> > Not only mbufs of M_PKTHDR may have m_nextpkt set. However, I tend to agree K> > with the patch. But shouldn't we first copy the m_nextpkt to the new mbuf: K> > K> > + to->m_nextpkt = from->m_nextpkt; K> > + from->m_nextpkt = NULL; K> > K> > Same way as we deal with tags. K> > K> > K> K> I think you are correct. If we look at the 'spirit' of m_move_pkthdr(); K> In my mind, it is to deep copy all fields related to a packet header and K> since m_nextpkt should only be carried by packet headers, it makes sense K> to copy it within m_move_pkthdr(). K> K> This also raises the question (my apologies in advance from bringing K> this up...) of weather or not m_nextpkt belongs in struct m_hdr and not K> in struct pkthdr. K> K> In our case we are copying it explicitly outside the function as most of K> users of m_move_pkthdr() do. Moving m_nextpkt from m_hdr to m_pkthdr would be much more intrusive change, we can't handle that. I think an mbuf with m_nextpkt and no M_PKTRHDR is a valid one. In a datagram socket buffer that could hold a record. (didn't check that, just guessing). So, any objections on commiting this addition to m_move_pkthdr? + to->m_nextpkt = from->m_nextpkt; + from->m_nextpkt = NULL; -- Gleb Smirnoff