From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yx1-f49.google.com (mail-yx1-f49.google.com [74.125.224.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E5CA494A09 for ; Wed, 21 Jan 2026 14:41:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006471; cv=none; b=mxFAhmJFeXiE1CqUBA8uYfqJN3FtMDjEUV2QNhO9h1D2gpep09k3qYN022tsP2wPNn6OJF3xjBWwtH3p0F/am+O9JGy9fvNVRm2GelEgOjPpnEMw4L7Gj7up+bqi91QPIH1SiBuDIiBAnlGIKxNzf5fY2mM5SG6ZR6GCaORZ/fM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006471; c=relaxed/simple; bh=rwTBfOmv3TsyqCAMfxc10gpQoi3l0ILMzmyE1jv8NcA=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: Mime-Version:Content-Type; b=l58Nq+C3TU++5wc/c8JRoz9G8QLE13FfSFsFpYd81717GDPI+F1Il5rs7uJalTqHkNyHiHqecKsE+KyKpB+r46QmK+Mcx0GbaWL+0ZpDyDf+wDFV4IWKgNKwyz8vafvSYPh2wipCFhy5zXIyZS9cl9PWW3yVC6PkUxL7iAzmHXg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=liYHgqFu; arc=none smtp.client-ip=74.125.224.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="liYHgqFu" Received: by mail-yx1-f49.google.com with SMTP id 956f58d0204a3-6467b7c3853so4848590d50.0 for ; Wed, 21 Jan 2026 06:41:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769006467; x=1769611267; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=1QhEJeO6VAAT1PZbRU+MPc9wELPLdoIH0o3vvoREGUw=; b=liYHgqFu6zaVrOed8Wo4gzeVMyqhgh2ou/lXkm442srFwPTMqj/JIoQ+Gc73z4Y4lI nt93NC/z8CPozL65UpGcP0vxJmMr4u9L5PuDQLM6QzIzCO91ELwjLqYHCa3/IgzEUTUe mR0uT8YxscFe1cgugWbfny2DAMDbucLPFPrnlC0qXpKS/J9X3vC+n+bFT6t412RVNVfp dTa9cqGKUnmTSfJ6sPCKb/fO3If+i5W8ZTsUxs/j1p7hnRpEZoRPoNoLkcmjEpmvm1GF T/o/zBD4KkZG38AXMboeXbk3m5YwuzWNd4Y1kpJxtAVHj3vTw0jjzFr4XQPUwq7bltt7 YnWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769006467; x=1769611267; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=1QhEJeO6VAAT1PZbRU+MPc9wELPLdoIH0o3vvoREGUw=; b=OaPavhO4JqQxrPeLrgcfsu5pDXySooS/3+NptcZ6R+rKRgO4eQYPzfHEvGE/YBUfsy z0R6D2b/hrkv+MfoIwdUxEc2xHW27VDKlZ8j50Wit1WhXoc4CB6UKUAYReT1HCvzO/T2 LfUDotfLbJUPadJ7tfC+6X07XDw85qN/nnDyB9tLIkesigQkPwhNwuLEtZ8Z5Uvz/Ijk rCN7bUF1KWEVYsuq4WJqsg0spx9E4FSYRxSGCKVAz+5fXHApoXJ+IMk7x5YpyF8o1fPW Mor+Rx/0IAOcf2HPPlCOckGyFCeWAbZplUj+qR2oFSaRaY7sRqDotmoTnEho4tv2HdRi 67RQ== X-Forwarded-Encrypted: i=1; AJvYcCUYNwUwHpvRhomjy787eRedIyHT7P+DRsO5Vit+k0d4q+yywkelvf/YKG/t4Xp5x9Tmfn9B1GNTu5Z8ZJA=@vger.kernel.org X-Gm-Message-State: AOJu0YxAZGh4R9NuAJsMdtGvebvepsrmOPVDBSRKwun92vPP+Tm3srVo jHWzzIiG9fppSd58nizGi8JuY6OKKvgkZUWg2BnadZJrmwZbsdGakbWl X-Gm-Gg: AZuq6aJ/fhnljssF9zvuvESAiTCK2pJqUWnle7sD1jyxaQI39m3gjroTxc1MnLW+pwr vqmpTM9KjMtiynYtONiQRfoUVuldszyTBzEd87XMF8fhHh6RmSyd2YJ9TiL6m2Y3P++jqjneN8h 6e0/qxPp42gNZSGdNsyut/8f9FCFCc9Xjne0rMxpK+AR2fz11NagDEYOyHbXSH3UlaVj+myQwEU 9m4lh390H6Hmbzm06q4YaqL/KnJXFMPSG7gWqH9tl3hLaS8D59PMfW7/1MZafL9qeSNRKWhHLWU h0TD4T/LXLioG4wznQAUFD40j0R+L2mwRDpRNqQVtMDqya6M6H3SvwBISJ/1PlW9rHlHRnzWhUT L00SFk7W7a4I6bNUWKgPbu3QV7uWnmO0Lvq7cYJPBrZ36PvtA0SMTvJQjOl/+0aixoWtIjLXMnw 4ZUyYvE9n7OIDr/scTjP8FyJoXp7PM3nJwLEw8V8fSGnitHud4lPF8IzElgVKXwTLu/YD1Kg== X-Received: by 2002:a05:690e:4104:b0:649:393c:86cc with SMTP id 956f58d0204a3-649393c8e91mr5799523d50.4.1769006467401; Wed, 21 Jan 2026 06:41:07 -0800 (PST) Received: from gmail.com (250.4.48.34.bc.googleusercontent.com. [34.48.4.250]) by smtp.gmail.com with UTF8SMTPSA id 956f58d0204a3-64916ffc035sm8029614d50.3.2026.01.21.06.41.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 06:41:06 -0800 (PST) Date: Wed, 21 Jan 2026 09:41:06 -0500 From: Willem de Bruijn To: Danielle Ratson , netdev@vger.kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, shuah@kernel.org, willemdebruijn.kernel@gmail.com, idosch@nvidia.com, mlxsw@nvidia.com, Danielle Ratson Message-ID: In-Reply-To: <20260121114644.2863640-1-danieller@nvidia.com> References: <20260121114644.2863640-1-danieller@nvidia.com> Subject: Re: [PATCH net-next v2] selftests: net: Add kernel selftest for RFC 4884 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Danielle Ratson wrote: > RFC 4884 extended certain ICMP messages with a length attribute that > encodes the length of the "original datagram" field. This is needed so > that new information could be appended to these messages without > applications thinking that it is part of the "original datagram" field. > > In version 5.9, the kernel was extended with two new socket options > (SOL_IP/IP_RECVERR_4884 and SOL_IPV6/IPV6_RECVERR_RFC4884) that allow > user space to retrieve this length which is basically the offset to the > ICMP Extension Structure at the end of the ICMP message. This is > required by user space applications that need to parse the information > contained in the ICMP Extension Structure. For example, the RFC 5837 > extension for tracepath. > > Add a selftest that verifies correct handling of the RFC 4884 length > field for both IPv4 and IPv6, with and without extension structures, > and validates that malformed extensions are correctly reported as invalid. > > For each address family, the test creates: > - a raw socket used to send locally crafted ICMP error packets to the > loopback address, and > - a datagram socket used to receive the encapsulated original datagram > and associated error metadata from the kernel error queue. > > ICMP packets are constructed entirely in user space rather than relying > on kernel-generated errors. This allows the test to exercise invalid > scenarios (such as corrupted checksums and incorrect length fields) and > verify that the SO_EE_RFC4884_FLAG_INVALID flag is set as expected. > > Output Example: > > $ ./icmp_rfc4884 > Starting 18 tests from 18 test cases. > RUN rfc4884.ipv4_ext_small_payload.rfc4884 ... > OK rfc4884.ipv4_ext_small_payload.rfc4884 > ok 1 rfc4884.ipv4_ext_small_payload.rfc4884 > RUN rfc4884.ipv4_ext.rfc4884 ... > OK rfc4884.ipv4_ext.rfc4884 > ok 2 rfc4884.ipv4_ext.rfc4884 > RUN rfc4884.ipv4_ext_large_payload.rfc4884 ... > OK rfc4884.ipv4_ext_large_payload.rfc4884 > ok 3 rfc4884.ipv4_ext_large_payload.rfc4884 > RUN rfc4884.ipv4_no_ext_small_payload.rfc4884 ... > OK rfc4884.ipv4_no_ext_small_payload.rfc4884 > ok 4 rfc4884.ipv4_no_ext_small_payload.rfc4884 > RUN rfc4884.ipv4_no_ext_min_payload.rfc4884 ... > OK rfc4884.ipv4_no_ext_min_payload.rfc4884 > ok 5 rfc4884.ipv4_no_ext_min_payload.rfc4884 > RUN rfc4884.ipv4_no_ext_large_payload.rfc4884 ... > OK rfc4884.ipv4_no_ext_large_payload.rfc4884 > ok 6 rfc4884.ipv4_no_ext_large_payload.rfc4884 > RUN rfc4884.ipv4_invalid_ext_checksum.rfc4884 ... > OK rfc4884.ipv4_invalid_ext_checksum.rfc4884 > ok 7 rfc4884.ipv4_invalid_ext_checksum.rfc4884 > RUN rfc4884.ipv4_invalid_ext_length_small.rfc4884 ... > OK rfc4884.ipv4_invalid_ext_length_small.rfc4884 > ok 8 rfc4884.ipv4_invalid_ext_length_small.rfc4884 > RUN rfc4884.ipv4_invalid_ext_length_large.rfc4884 ... > OK rfc4884.ipv4_invalid_ext_length_large.rfc4884 > ok 9 rfc4884.ipv4_invalid_ext_length_large.rfc4884 > RUN rfc4884.ipv6_ext_small_payload.rfc4884 ... > OK rfc4884.ipv6_ext_small_payload.rfc4884 > ok 10 rfc4884.ipv6_ext_small_payload.rfc4884 > RUN rfc4884.ipv6_ext.rfc4884 ... > OK rfc4884.ipv6_ext.rfc4884 > ok 11 rfc4884.ipv6_ext.rfc4884 > RUN rfc4884.ipv6_ext_large_payload.rfc4884 ... > OK rfc4884.ipv6_ext_large_payload.rfc4884 > ok 12 rfc4884.ipv6_ext_large_payload.rfc4884 > RUN rfc4884.ipv6_no_ext_small_payload.rfc4884 ... > OK rfc4884.ipv6_no_ext_small_payload.rfc4884 > ok 13 rfc4884.ipv6_no_ext_small_payload.rfc4884 > RUN rfc4884.ipv6_no_ext_min_payload.rfc4884 ... > OK rfc4884.ipv6_no_ext_min_payload.rfc4884 > ok 14 rfc4884.ipv6_no_ext_min_payload.rfc4884 > RUN rfc4884.ipv6_no_ext_large_payload.rfc4884 ... > OK rfc4884.ipv6_no_ext_large_payload.rfc4884 > ok 15 rfc4884.ipv6_no_ext_large_payload.rfc4884 > RUN rfc4884.ipv6_invalid_ext_checksum.rfc4884 ... > OK rfc4884.ipv6_invalid_ext_checksum.rfc4884 > ok 16 rfc4884.ipv6_invalid_ext_checksum.rfc4884 > RUN rfc4884.ipv6_invalid_ext_length_small.rfc4884 ... > OK rfc4884.ipv6_invalid_ext_length_small.rfc4884 > ok 17 rfc4884.ipv6_invalid_ext_length_small.rfc4884 > RUN rfc4884.ipv6_invalid_ext_length_large.rfc4884 ... > OK rfc4884.ipv6_invalid_ext_length_large.rfc4884 > ok 18 rfc4884.ipv6_invalid_ext_length_large.rfc4884 > PASSED: 18 / 18 tests passed. > Totals: pass:18 fail:0 xfail:0 xpass:0 skip:0 error:0 > > Signed-off-by: Danielle Ratson > Reviewed-by: Ido Schimmel Reviewed-by: Willem de Bruijn Thanks!