From: Konstantin Ananyev <konstantin.ananyev@huawei.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [PATCH 3/6] ip_frag: include protocol in IPv4 reassembly key
Date: Tue, 30 Jun 2026 08:17:56 +0000 [thread overview]
Message-ID: <f931b9c7a9c44ceba87aa3b6a6916dd5@huawei.com> (raw)
In-Reply-To: <20260616210656.464062-4-stephen@networkplumber.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.
>
> 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.
>
> 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.
>
> Fixes: cc8f4d020c0b ("examples/ip_reassembly: initial import")
> Cc: stable@dpdk.org
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> lib/ip_frag/rte_ipv4_reassembly.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/lib/ip_frag/rte_ipv4_reassembly.c b/lib/ip_frag/rte_ipv4_reassembly.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_tbl
> *tbl,
> ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK);
> ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG);
>
> + /*
> + * 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 = ip_hdr->packet_id;
> +
> + /* packet_id is 16 bits and proto id is 8 bits */
> + key.id = ((uint32_t) ip_hdr->next_proto_id << 16) | ip_hdr->packet_id;
> key.key_len = IPV4_KEYLEN;
>
> ip_ofs *= RTE_IPV4_HDR_OFFSET_UNITS;
> --
Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> 2.53.0
next prev parent reply other threads:[~2026-06-30 8:18 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 21:05 [PATCH 0/6] ip_frag: fix reassembly defects and add test Stephen Hemminger
2026-06-16 21:05 ` [PATCH 1/6] ip_frag: tolerate duplicate fragments Stephen Hemminger
2026-06-30 8:08 ` Konstantin Ananyev
2026-06-30 13:32 ` Stephen Hemminger
2026-06-16 21:05 ` [PATCH 2/6] ip_frag: discard datagrams with overlapping fragments Stephen Hemminger
2026-06-19 13:12 ` Morten Brørup
2026-06-19 17:01 ` Stephen Hemminger
2026-06-22 15:01 ` Morten Brørup
2026-06-22 15:03 ` Stephen Hemminger
2026-06-30 8:16 ` Konstantin Ananyev
2026-06-16 21:05 ` [PATCH 3/6] ip_frag: include protocol in IPv4 reassembly key Stephen Hemminger
2026-06-30 8:17 ` Konstantin Ananyev [this message]
2026-06-16 21:05 ` [PATCH 4/6] ip_frag: drop IPv6 fragments with unexpected headers Stephen Hemminger
2026-06-30 9:21 ` Konstantin Ananyev
2026-06-16 21:05 ` [PATCH 5/6] ip_frag: reject oversized reassembled datagrams Stephen Hemminger
2026-06-30 9:32 ` Konstantin Ananyev
2026-06-16 21:05 ` [PATCH 6/6] app/test: add test for IP reassembly Stephen Hemminger
2026-06-19 13:24 ` [PATCH 0/6] ip_frag: fix reassembly defects and add test Morten Brørup
2026-06-22 15:03 ` Morten Brørup
2026-06-30 15:36 ` [PATCH v2 0/8] " Stephen Hemminger
2026-06-30 15:36 ` [PATCH v2 1/8] ip_frag: tolerate duplicate fragments Stephen Hemminger
2026-06-30 15:36 ` [PATCH v2 2/8] ip_frag: discard datagrams with overlapping fragments Stephen Hemminger
2026-07-01 8:13 ` Konstantin Ananyev
2026-06-30 15:36 ` [PATCH v2 3/8] ip_frag: include protocol in IPv4 reassembly key Stephen Hemminger
2026-06-30 15:36 ` [PATCH v2 4/8] ip_frag: drop IPv6 fragments with per-fragment headers Stephen Hemminger
2026-06-30 15:36 ` [PATCH v2 5/8] ip_frag: reject oversized reassembled datagrams Stephen Hemminger
2026-06-30 15:36 ` [PATCH v2 6/8] app/test: add test for IP reassembly Stephen Hemminger
2026-06-30 15:36 ` [PATCH v2 7/8] ip_frag: remove use of rte_memcpy Stephen Hemminger
2026-06-30 15:36 ` [PATCH v2 8/8] doc: add release note about ip_frag changes Stephen Hemminger
2026-06-30 19:19 ` Stephen Hemminger
2026-07-01 8:22 ` Konstantin Ananyev
2026-07-01 16:20 ` [PATCH v3 0/8] ip_frag: fix reassembly defects and add test Stephen Hemminger
2026-07-01 16:20 ` [PATCH v3 1/8] ip_frag: tolerate duplicate fragments Stephen Hemminger
2026-07-01 16:20 ` [PATCH v3 2/8] ip_frag: discard datagrams with overlapping fragments Stephen Hemminger
2026-07-01 16:20 ` [PATCH v3 3/8] ip_frag: include protocol in IPv4 reassembly key Stephen Hemminger
2026-07-01 16:20 ` [PATCH v3 4/8] ip_frag: drop IPv6 fragments with per-fragment headers Stephen Hemminger
2026-07-01 16:52 ` Konstantin Ananyev
2026-07-01 16:20 ` [PATCH v3 5/8] ip_frag: reject oversized reassembled datagrams Stephen Hemminger
2026-07-01 16:20 ` [PATCH v3 6/8] app/test: add test for IP reassembly Stephen Hemminger
2026-07-01 16:20 ` [PATCH v3 7/8] ip_frag: remove use of rte_memcpy Stephen Hemminger
2026-07-01 16:53 ` Konstantin Ananyev
2026-07-01 16:20 ` [PATCH v3 8/8] doc: add release note about ip_frag changes Stephen Hemminger
2026-07-01 16:42 ` Konstantin Ananyev
2026-07-02 20:55 ` [PATCH v3 0/8] ip_frag: fix reassembly defects and add test Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f931b9c7a9c44ceba87aa3b6a6916dd5@huawei.com \
--to=konstantin.ananyev@huawei.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox