]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
selftests: netfilter: add selftest for directional zone support
authorFlorian Westphal <fw@strlen.de>
Wed, 8 Sep 2021 12:28:38 +0000 (14:28 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 21 Sep 2021 01:46:55 +0000 (03:46 +0200)
commit0f1148abb226f3639845738cdf3d2534ceb1d059
treec8fac922a8d0cc231f51501cfe85fd997580969c
parentd2966dc77ba7b2678f7aee97bf9a65702ec8e2b6
selftests: netfilter: add selftest for directional zone support

Add a script to exercise NAT port clash resolution with directional zones.

Add net namespaces that use the same IP address and connect them to a
gateway.

Gateway uses policy routing based on iif/mark and conntrack zones to
isolate the client namespaces.  In server direction, same zone with NAT
to single address is used.

Then, connect to a server from each client netns, using identical
connection id, i.e.  saddr:sport -> daddr:dport.

Expectation is for all connections to succeeed: NAT gatway is
supposed to do port reallocation for each of the (clashing) connections.

This is based on the description/use case provided in the commit message of
deedb59039f111 ("netfilter: nf_conntrack: add direction support for zones").

Cc: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tools/testing/selftests/netfilter/nft_nat_zones.sh [new file with mode: 0755]