🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5698

Re: [PATCH net] seg6: fix transport header for inner IPv4 with IP options

#5698
From: David Ahern
Date: Tue, 20 Oct 2026 20:27
51 lines
10633 bytes
On 10/19/26 8:33 PM, Andrea Mayer wrote:
> The End.DT4, End.DT46 (its IPv4 path only) and End.DX4 behaviors set the
> transport header of the decapsulated IPv4 packet at a fixed 20 bytes, the
> size of an IPv4 header without options. They do not validate the header
> length either. With options, the transport header points at the first
> option byte. The effects include:
> - ping -R sends an echo request with a 60-byte IPv4 header to a local
>   address through an End.DT4 or an End.DX4 SID. Since icmp_rcv()
>   computes the ICMP checksum from the first option byte, the request
>   fails the check and is counted in IcmpInCsumErrors.
> - A UDP datagram can reach a port that an iptables rule drops. The rule
>   checks the UDP header after the full IPv4 header, while the socket
>   lookup reads it at the fixed 20-byte offset.
> - With an inbound AH state, ah_input() reads the AH header at the fixed
>   20-byte offset, but copies the IPv4 header over it with the length in
>   the IHL field. A packet shorter than that length can make ah_input()
>   write past the end of the data, into skb_shared_info when the skb has
>   no tailroom.
> 
> Validate the inner IPv4 header length with the new helper
> seg6_validate_iphdr_len() and set the transport header at that length. A
> packet that is not IPv4, whose header length field is below 5, or whose
> header is truncated, is dropped with a drop reason. The fix is limited to
> the header length, which the transport header relies on. Other checks done
> on IPv4 input, such as the header checksum, the total length and the IP
> options, are not addressed here.
> 
> Found by code inspection while reviewing commit 44930446dde4 ("ipv6: seg6:
> clear IPv4 control block on IPIP decapsulation"), as a pre-existing issue
> that Sashiko also reported on v2 of that patch. Without this patch, a
> bpftrace probe on ah_input() shows the reporter's reproducer packet
> written into skb_shared_info. With it, that packet is dropped before
> ah_input(), ping -R no longer fails the ICMP checksum, the UDP datagram
> reaches its real port, and the SRv6 selftests still pass. These effects
> reproduce on an unmodified kernel, without error injection.
> 
> Fixes: 891ef8dd2a8d ("ipv6: sr: implement additional seg6local actions")
> Fixes: 664d6f86868b ("seg6: add support for the SRv6 End.DT4 behavior")
> Reported-by: Hazley Samsudin <hazleycryilis@gmail.com>
> Closes: https://lore.kernel.org/netdev/20260809221915.2ffc1ecd0f445fcb70270e31@uniroma2.it/
> Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
> ---
>  net/ipv6/seg6_local.c | 56 ++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 48 insertions(+), 8 deletions(-)
> 


LGTM.

Reviewed-by: David Ahern <dsahern@kernel.org>
Technical Details
Message-ID: <6b84d4b4-e040-40ed-8d60-c065fd02ad4d@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349553-linux-kernel-netdev=dewy.ru
References: <20261020023336.34-1-andrea.mayer@uniroma2.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349553-linux-kernel-netdev=dewy.ru
From: dsahern@kernel.org (David Ahern)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] seg6: fix transport header for inner IPv4 with IP
 options
Date: Tue, 20 Oct 2026 14:27:37 -0600
Organization: Usenet Network
Message-ID: <6b84d4b4-e040-40ed-8d60-c065fd02ad4d@kernel.org>
References: <20261020023336.34-1-andrea.mayer@uniroma2.it>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3951718"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:+0EBYQxiCztu1ARqs79FtU4n9uI= sha256:Q/WkrDTFjnzlLLDIVqBQFucTEKAfxn6azUEJABGqtEQ=
	sha1:/WUqYmJiffMD1uw6JYEV7yTUnEo= sha256:s7vVCcIuMg1YgaLog4LYGCaRjypwvcUjXhnf0YYL1t0=
Content-Language: en-US
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 16972110E37; Tue, 20 Oct 2026 23:30:55 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.729
X-Spam-Status: No, score=-3.729 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id HvlIk35JC_xg;
	Tue, 20 Oct 2026 23:30:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-349553-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 08B34110E36; Tue, 20 Oct 2026 23:30:42 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 4A79E37D55; Tue, 20 Oct 2026 20:27:46 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792528065;
	b=fxyYtxxZzC2tDZCJKtSM/sGDQTl1o6vdYgNOHV+4lYT4+OCpCB8QpoDzy74s5+lbmvK1
	 jTHaKH49mufh/yML5pf0cdquFs1kk6TXgfyG2csL6sTpwtEyifuljLG4pQXQhPjJHsdaB
	 O0qPQPeYiKMUC0KVTn+MGylo4RurFalJTg38HR4L3YnwtS1NZoawKzCDJq+Iwz1fU/GuO
	 nYzlQtOCnwiCuzU+T/XEjTviewyYRl4fFvURRIW15mqztPYKzJNeHap5dP8rJ07TvVl65
	 9JLKHI6epSzmex29cz+Xmia0mkppK4S5hApFzf0Wv4lRLWCZS58X6YO4Oq5N2EA0HgA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792528065;
	h=X-Original-To:Received:Received:DKIM-Signature:Message-ID:Date:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent:
	 Subject:Content-Language:To:Cc:References:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding;
	bh=Mm8j0XhfffO5W2SZHZPf3exKju/4xVfUOaT00ZyRTb0=;
	b=BzzFEg0qMM3ISw9DbcelqS/YfHA9E8S6bemj+AZWkA5Yp/Iz7XRFsMjWrK96dAyEz0Ky
	 w7bY/Qc0RMOtHUhnR75iYoY2XpZAGXJ8ivuuUH3+cjdBUbTPucNu5trGZK7UyWv/D3Qye
	 pBtGv4KKVDzT+GTDpAymPurtsC+APr3EsvIp+vl/fL4sDEmGisRxh+DR5cgJI3qUUwEMb
	 wRYlxhDWqgWZxf76up9+jqXE4QQkWatmKMK4d9NivTml3lcpwiUKtG/LqOTv3YwV6V7WY
	 zLcPb0xduV7tEQDJ1P2B1kMFNRTR+723W0ayQblnLkOxPpcix5ncm28nOSWvb3vQL0g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZgsPtdZg;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id AFF0F606A323;
	Tue, 20 Oct 2026 20:27:45 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZgsPtdZg
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792528059;
	b=yTJIU0X8ZhF5LHC5z1l4faktA31FXj1dKzQBbcbujtIL1tySIiePijxLENa/7cTuosTN
	 Ru1ZBFYcMLUe609NyQB9WhJ7gFqM4WBfuY8A5EDav1qXARd1Ey/8PJ7akDKCJsaiN1WGe
	 uzesNdRyrZhI/jMa1c3ftayo+XRyX+Cdst6oOREIM4EtiXS6+nzKNhcm+kBv7QjQ3r1yi
	 U0v/f+kXI603Ls7v8YiNHlgTncdAt/zK1MJ2xcJ3IhPvEoReexfTZYHDNpQTu8/nQTSPZ
	 /9Zh/aRj1qJBWRV+bylpdMhSpcCE3IH8cPfIfLkZbTFrF5fGYdCZdZ32cbTfRoPWSrQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792528059;
	h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent:
	 Subject:Content-Language:To:Cc:References:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding;
	bh=Mm8j0XhfffO5W2SZHZPf3exKju/4xVfUOaT00ZyRTb0=;
	b=WrG3S7NGm+OymThj1aNWijPvnlBXWluGk/xhLwZPGjgH+R9HyEQ5FJqUvDIrpB9K3YmF
	 uRdQGkX4Qpeh7+N7dhT89h9ER18sX+CRNJAdWnX2BRyTq2B2olV/OBdnGg2o1FCRmGHhx
	 6AE8d5A7BiwpnZAxfDv7uZEoMQ3NFYaY2clufdEE+jL+FWhPfwrkfZl9XTSWfdFwLBy1O
	 8RozQRZQGRRvBbSTaxkXDUUClzRIA7mFkpoBkhHGW1hLqusCxtEv7yg8DHtMQwuiA7lHy
	 oEeJNv9GdTQGLcWNeoHA94rNKoYiW3daFU3gSq1bwEw4hr8QEbRc8PGsN+f/OJcUhYA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZgsPtdZg;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8CABC606A31A;
	Tue, 20 Oct 2026 20:27:39 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B2E51F000CB;
	Tue, 20 Oct 2026 20:27:38 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792528059;
	bh=Mm8j0XhfffO5W2SZHZPf3exKju/4xVfUOaT00ZyRTb0=;
	h=Date:Subject:To:Cc:References:From:In-Reply-To;
	b=ZgsPtdZgYmMEJPt8BwA+JYdWGCcf4f5KZpfgQwnRcwQi7yjJ2US2+RMA/Q8Y5vOGr
	 IPJ6czIW9urBUN+QK/W/Xl1lE0mOvOxysa2pkmwzIe6TMpt/AJ8LOQpFYyyF6SEGqx
	 u7+QZ4xwlD5pciVvBExeDnv/xzu/yX3Sb6CixcZbUEq8nZDj/6a2CUxBvvREckxp/Y
	 Qb3ntthD5T1kS8kz+K1ck6xe3m41nDQJEdv4paPJ3ZENOLXauXXdcjb8VdaYdVODHt
	 J6WxetKi72+ZHhepA929E2Tdwe3JF2woEA8wGupi0brE2w5boPJW2OC9zdd0Ss9dQu
	 Y/XM+IP8yPsRg==
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
 David Lebrun <david.lebrun@uclouvain.be>,
 Steffen Klassert <steffen.klassert@secunet.com>,
 Herbert Xu <herbert@gondor.apana.org.au>,
 Hazley Samsudin <hazleycryilis@gmail.com>,
 Stefano Salsano <stefano.salsano@uniroma2.it>
X-In-Reply-To: <20261020023336.34-1-andrea.mayer@uniroma2.it>