From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E411C43327 for ; Tue, 30 Jun 2026 08:18:36 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4817B4025E; Tue, 30 Jun 2026 10:18:35 +0200 (CEST) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id 1517F4021E; Tue, 30 Jun 2026 10:18:34 +0200 (CEST) Received: from mail.maildlp.com (unknown [172.18.224.150]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4gqGGv1H7jzJ46dv; Tue, 30 Jun 2026 16:17:43 +0800 (CST) Received: from dubpeml500002.china.huawei.com (unknown [7.214.145.83]) by mail.maildlp.com (Postfix) with ESMTPS id 66E8240570; Tue, 30 Jun 2026 16:18:29 +0800 (CST) Received: from dubpeml500001.china.huawei.com (7.214.147.241) by dubpeml500002.china.huawei.com (7.214.145.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 30 Jun 2026 09:17:56 +0100 Received: from dubpeml500001.china.huawei.com ([7.214.147.241]) by dubpeml500001.china.huawei.com ([7.214.147.241]) with mapi id 15.02.1544.011; Tue, 30 Jun 2026 09:17:56 +0100 From: Konstantin Ananyev To: Stephen Hemminger , "dev@dpdk.org" CC: "stable@dpdk.org" Subject: RE: [PATCH 3/6] ip_frag: include protocol in IPv4 reassembly key Thread-Topic: [PATCH 3/6] ip_frag: include protocol in IPv4 reassembly key Thread-Index: AQHc/dQYJm4rahMaKE+nhHUzfjcho7ZW1iHQ Date: Tue, 30 Jun 2026 08:17:56 +0000 Message-ID: References: <20260616210656.464062-1-stephen@networkplumber.org> <20260616210656.464062-4-stephen@networkplumber.org> In-Reply-To: <20260616210656.464062-4-stephen@networkplumber.org> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.81.205.173] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > DPDK IPv4 reassembly code was not following RFC 791 section 3.2 > which says: > The internet identification field (ID) is used together with the > source and destination address, and the protocol fields, to identify > datagram fragments for reassembly. >=20 > Omitting the protocol means two datagrams between the > same pair of hosts that share an IP id but carry different protocols > (for example UDP and ICMP) are merged into a single reassembly context, > producing a corrupted datagram. >=20 > Fold the protocol into the unused upper bits of the 32-bit id field > of the key. The IPv4 identification is 16 bits and occupies the low > half, so the protocol can be carried in the upper bits without changing > the key layout, the key comparison or the hash. >=20 > Fixes: cc8f4d020c0b ("examples/ip_reassembly: initial import") > Cc: stable@dpdk.org >=20 > Signed-off-by: Stephen Hemminger > --- > lib/ip_frag/rte_ipv4_reassembly.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/ip_frag/rte_ipv4_reassembly.c b/lib/ip_frag/rte_ipv4_rea= ssembly.c > index 3c8ae113ba..980f7a3b77 100644 > --- a/lib/ip_frag/rte_ipv4_reassembly.c > +++ b/lib/ip_frag/rte_ipv4_reassembly.c > @@ -111,9 +111,15 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_t= bl > *tbl, > ip_ofs =3D (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); > ip_flag =3D (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); >=20 > + /* > + * RFC 791 requires using: source, destination, identifier field and > protocol > + */ > + > /* use first 8 bytes only */ > memcpy(&key.src_dst[0], &ip_hdr->src_addr, 8); > - key.id =3D ip_hdr->packet_id; > + > + /* packet_id is 16 bits and proto id is 8 bits */ > + key.id =3D ((uint32_t) ip_hdr->next_proto_id << 16) | ip_hdr->packet_id= ; > key.key_len =3D IPV4_KEYLEN; >=20 > ip_ofs *=3D RTE_IPV4_HDR_OFFSET_UNITS; > -- Acked-by: Konstantin Ananyev > 2.53.0