Skip to contentSkip to conversation

selftests: netfilter: tproxy tcp and udp tests

PATCH In review Antonio Ojea 2 participants 2 messages Sep 11, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 selftests: netfilter: tproxy tcp and udp tests

The TPROXY functionality is widely used, however, there are only mptcp selftests covering this feature.

The selftests represent the most common scenarios and can also be used as selfdocumentation of the feature.

UDP and TCP testcases are split in different files because of the different nature of the protocols, specially due to the challenges that present to reliable test UDP due to the connectionless nature of the protocol. UDP only covers the scenarios involving the prerouting hook.

The UDP tests are signfinicantly slower than the TCP ones, hence they use a larger timeout, 20 seconds on a 48 vCPU Intel(R) Xeon(R) CPU @ 2.60GHz

---
Changelog since v1:
- indentantion fixes, replace spaces by tabs
- add UDP tests spliting each transport protocol in its own file

 .../testing/selftests/net/netfilter/Makefile  |   2 +
 .../selftests/net/netfilter/nft_tproxy_tcp.sh | 358 ++++++++++++++++++
 .../selftests/net/netfilter/nft_tproxy_udp.sh | 262 +++++++++++++
 3 files changed, 622 insertions(+)
 create mode 100755 tools/testing/selftests/net/netfilter/nft_tproxy_tcp.sh
 create mode 100755 tools/testing/selftests/net/netfilter/nft_tproxy_udp.sh
tools/testing/selftests/net/netfilter/Makefile +2 -0
index d13fb5ea3e89..b9b79bbee179 100644
@@ -26,6 +26,8 @@ TEST_PROGS += nft_nat.sh
 TEST_PROGS += nft_nat_zones.sh
 TEST_PROGS += nft_queue.sh
 TEST_PROGS += nft_synproxy.sh
+TEST_PROGS += nft_tproxy_tcp.sh
+TEST_PROGS += nft_tproxy_udp.sh
 TEST_PROGS += nft_zones_many.sh
 TEST_PROGS += rpath.sh
 TEST_PROGS += xt_string.sh
tools/testing/selftests/net/netfilter/nft_tproxy_tcp.sh new file +358 -0

358 lines not on this page · raw message

tools/testing/selftests/net/netfilter/nft_tproxy_udp.sh new file +262 -0

262 lines not on this page · raw message

Signature · 1 line
2.46.0.598.g6f2099f65c-goog
#1 lore raw
Quoted 12 lines · Antonio Ojea

The TPROXY functionality is widely used, however, there are only mptcp selftests covering this feature.

The selftests represent the most common scenarios and can also be used as selfdocumentation of the feature.

UDP and TCP testcases are split in different files because of the different nature of the protocols, specially due to the challenges that present to reliable test UDP due to the connectionless nature of the protocol. UDP only covers the scenarios involving the prerouting hook.

Quoted 6 lines

The UDP tests are signfinicantly slower than the TCP ones, hence they use a larger timeout, 20 seconds on a 48 vCPU Intel(R) Xeon(R) CPU @ 2.60GHz

You probably want to add this change :

(quoted diff) +0 -0

b/tools/testing/selftests/net/netfilter/config
index b2dd4db45215013df98756be09b5e45759c87415..c5fe7b34eaf19a39777a161ccb58400d446ab585 100644

tools/testing/selftests/net/netfilter/config +1 -0
@@ -81,6 +81,7 @@ CONFIG_NFT_QUEUE=m
 CONFIG_NFT_QUOTA=m
 CONFIG_NFT_REDIR=m
 CONFIG_NFT_SYNPROXY=m
+CONFIG_NFT_TPROXY=m
 CONFIG_VETH=m
 CONFIG_VLAN_8021Q=m
 CONFIG_XFRM_USER=m