From owner-freebsd-net@freebsd.org Mon Oct 23 19:41:49 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 C9477E537A4 for ; Mon, 23 Oct 2017 19:41:49 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com [IPv6:2a00:1450:400c:c09::22e]) (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 5B18481A00; Mon, 23 Oct 2017 19:41:49 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wm0-x22e.google.com with SMTP id b189so11542393wmd.4; Mon, 23 Oct 2017 12:41:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=6hIWuQwW4ey5iWn3SCoeUlZDt88BNooWjzNH41rDtzA=; b=KrWD2Y62KSWLM91yrh8Dl4XNgHlNYR5SoSAMb+Z+9gLMN7oHZRjewABHpxXjYLDu+7 lcrtgsYZ6PkGNzBfJOgwI1BGRY6ggHIptb02e+GICBlpcDWfGhVjYCAkWOKi/oeanejn J6AI80DWzYWf6uVQPJqw5OpMeYSIgZZlfs+M63YYfrRp02pU8EAZaMfz4Jxx2U2gyH/g p/cu3Wv8IwvXKg2QD7RuxLm/llfCdDLVHaMOU4cFfIBRP7CbNvUIzfG41YsS4zLJaH/o udgL9RmXgqTay9M/QY2mC8ohhfHfC7o5Sys0o7F5aSBeDzJ0kszLjcsQyk6bvYh1EbgA 2oqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=6hIWuQwW4ey5iWn3SCoeUlZDt88BNooWjzNH41rDtzA=; b=eh+rg2CsrTz3A11+jDMstiSu3cxM8YIbZuZibmP7iv8Go91Gljwk8xIN/XUb4NsALN l4Ee4Bzq7+Q1Add3IkIkgrKGiBjIkS/hDjcCbWqdFy8uFjhdjdPUm+0Rev/QyWcnj/WJ jdzvGfGRhUK6POSBsEGXhHlKsbBLy+vjkPZMdDlSQFmgZeYYbM3SkZN6lo9xbah94MJ1 tYjeB8u1PtU1zE85zC9MKsxattL7n9ky981yM3zTvUiloy4LQvXQVM4H1RgTdeuRwKgh AZXL4ToPWgIJ/1GSQZjoCEtmftbf79R6yPcQcnx4yyuasHEqVntz+wtRW1KAdqG9XFs8 8y7Q== X-Gm-Message-State: AMCzsaW5o/9D/DIVorpwu3tH/+eLspB+Tt2GMBtVYCJw6EvhMiNh5v1l nu6Rx5UR9HPVw8p5qD/SJsVKcah94BwuXeVRPTv75A== X-Google-Smtp-Source: ABhQp+Sw/H6RfC5tn3hDQaenfI7EDvVKWbXFS3yH+k1vLqOnCFwWu4eVoUqwevgH/6MC5qsCUZWb6v4YLUwe2aZ7BLs= X-Received: by 10.28.175.73 with SMTP id y70mr5997706wme.21.1508787707595; Mon, 23 Oct 2017 12:41:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.86.70 with HTTP; Mon, 23 Oct 2017 12:41:46 -0700 (PDT) In-Reply-To: <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> <20171016175738.GA1100@FreeBSD.org> From: Adrian Chadd Date: Mon, 23 Oct 2017 12:41:46 -0700 Message-ID: Subject: Re: m_move_pkthdr leaves m_nextpkt 'dangling' To: Gleb Smirnoff Cc: Karim Fodil-Lemelin , FreeBSD Net , "Andrey V. Elsukov" Content-Type: text/plain; charset="UTF-8" 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, 23 Oct 2017 19:41:49 -0000 On 16 October 2017 at 10:57, Gleb Smirnoff wrote: > 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; None from me. (I haven't checked to see if you've done it yet or not.) -adrian > -- > Gleb Smirnoff