DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
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 v3 4/8] ip_frag: drop IPv6 fragments with per-fragment headers
Date: Wed, 1 Jul 2026 16:52:40 +0000	[thread overview]
Message-ID: <6583eb01f9ad4c7eb0dae1fca44f4e55@huawei.com> (raw)
In-Reply-To: <20260701162127.207318-5-stephen@networkplumber.org>


> IPv6 reassembly assumes the fragment header directly follows the IPv6
> header. ipv6_frag_reassemble() patches the next-header field and removes
> the fragment header at a fixed offset, so a fragment with per-fragment
> extension headers before the fragment header reassembles to a corrupt
> datagram.
> 
> Drop the fragment when its fragment header does not directly follow the
> IPv6 header. Headers after the fragment header are payload and are
> unaffected.
> 
> RFC 8200 permits discarding packets with extension headers out of the
> recommended order, and RFC 9099 recommends dropping non-conforming
> fragmented packets.
> 
> Fixes: 4f1a8f633862 ("ip_frag: add IPv6 reassembly")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/ip_frag/rte_ipv6_reassembly.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/lib/ip_frag/rte_ipv6_reassembly.c b/lib/ip_frag/rte_ipv6_reassembly.c
> index 0e809a01e5..b6f623d53b 100644
> --- a/lib/ip_frag/rte_ipv6_reassembly.c
> +++ b/lib/ip_frag/rte_ipv6_reassembly.c
> @@ -180,6 +180,28 @@ rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl
> *tbl,
>  		return NULL;
>  	}
> 
> +	/*
> +	 * Only a fragment header directly following the IPv6 header is
> supported.
> +	 * Per-fragment (unfragmentable) extension headers placed
> +	 * before the fragment header are not handled: ipv6_frag_reassemble()
> +	 * patches the IPv6 header's next-header field and removes the fragment
> +	 * header assuming it sits immediately after the IPv6 header, so such a
> +	 * fragment would be reassembled into a corrupt datagram. Drop it.
> +	 *
> +	 * Extension headers after the fragment header (destination options,
> +	 * AH, ESP, upper-layer) are part of the fragmentable payload and are
> +	 * reassembled as opaque bytes, so they are not affected. The test uses
> +	 * the fragment header's position rather than l3_len so that callers
> +	 * which include later headers in l3_len are not rejected.
> +	 */
> +	if ((uintptr_t)frag_hdr != (uintptr_t)(ip_hdr + 1)) {
> +		IP_FRAG_LOG(DEBUG,
> +			    "%s:%d: drop fragment with header before frag header,
> offset %zu\n",
> +			    __func__, __LINE__, (uintptr_t)frag_hdr -
> (uintptr_t)ip_hdr);
> +		IP_FRAG_MBUF2DR(dr, mb);
> +		return NULL;
> +	}
> +
>  	if (unlikely(trim > 0))
>  		rte_pktmbuf_trim(mb, trim);
> 
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>

> 2.53.0


  reply	other threads:[~2026-07-01 16:52 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
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 [this message]
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=6583eb01f9ad4c7eb0dae1fca44f4e55@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