Re: [PATCH nf] selftests: nft_concat_range: add test for reload with no element add/del

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 26 Jan 2022 12:54:54 +0100
Florian Westphal <fw@xxxxxxxxx> wrote:

> Add a specific test for the reload issue fixed with
> commit 23c54263efd7cb ("netfilter: nft_set_pipapo: allocate pcpu scratch maps on clone").
> 
> Add to set, then flush set content + restore without other add/remove in
> the transaction.
> 
> On kernels before the fix, this test case fails:
>   net,mac with reload    [FAIL]
> 
> Cc: Stefano Brivio <sbrivio@xxxxxxxxxx>
> Signed-off-by: Florian Westphal <fw@xxxxxxxxx>
> ---
>
> [...]
>
> +test_bug_reload() {
> +	setup veth send_"${proto}" set || return ${KSELFTEST_SKIP}
> +	rstart=${start}
> +
> +	range_size=1
> +	for i in $(seq "${start}" $((start + count))); do
> +		end=$((start + range_size))
> +
> +		# Avoid negative or zero-sized port ranges
> +		if [ $((end / 65534)) -gt $((start / 65534)) ]; then
> +			start=${end}
> +			end=$((end + 1))
> +		fi
> +		srcstart=$((start + src_delta))
> +		srcend=$((end + src_delta))
> +
> +		add "$(format)" || return 1
> +		range_size=$((range_size + 1))
> +		start=$((end + range_size))
> +	done
> +
> +	# check kernel does allocate pcpu sctrach map
> +	# for reload with no elemet add/delete
> +	( echo flush set inet filter test ;
> +	  nft list set inet filter test ) | nft -f -

Nice trick :) ...thanks for adding this case!

Reviewed-by: Stefano Brivio <sbrivio@xxxxxxxxxx>

-- 
Stefano




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux