Re: [PATCH net-next v2 4/4] selftests: net: getsockopt_iter: add raw ICMP_FILTER coverage

From: Willem de Bruijn

Date: Wed Jul 01 2026 - 17:55:44 EST


Breno Leitao wrote:
> Exercise the raw getsockopt path now backed by sockopt_t. ICMP_FILTER
> returns a fixed-size struct and, unlike the int/u64 options already
> covered, clamps the length down to the user buffer on a short read
> instead of failing, so check that semantic explicitly along with the
> exact and oversized cases, the -EOPNOTSUPP path on a non-ICMP raw
> socket, and an unknown optname.
>
> Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>

Reviewed-by: Willem de Bruijn <willemb@xxxxxxxxxx>

> +TEST_F(raw, icmpfilter_oversize_clamped)
> +{
> + char buf[16] = {};

Not a reason to respin, but instead of a raw constant, something like
sizeof(struct icmp_filter) + 1 is more robust and descriptive.