]> git.baikalelectronics.ru Git - kernel.git/commit
selftests: nft_nat: add udp hole punch test case
authorFlorian Westphal <fw@strlen.de>
Thu, 23 Sep 2021 13:12:42 +0000 (15:12 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 11 Oct 2021 23:42:39 +0000 (01:42 +0200)
commita9eb5dc91964beb3dd0d442fa19e0be2837019a7
treeb7acae2182ce1f3f29a6b203f8d6e4033bdffe3a
parenteb44d48768b5a6b1daa166524625b4ee0825a6bb
selftests: nft_nat: add udp hole punch test case

Add a test case that demonstrates port shadowing via UDP.

ns2 sends packet to ns1, from source port used by a udp service on the
router, ns0.  Then, ns1 sends packet to ns0:service, but that ends up getting
forwarded to ns2.

Also add three test cases that demonstrate mitigations:
1. disable use of $port as source from 'unstrusted' origin
2. make the service untracked.  This prevents masquerade entries
   from having any effects.
3. add forced PAT via 'random' mode to translate the "wrong" sport
   into an acceptable range.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tools/testing/selftests/netfilter/nft_nat.sh