Skip to contentSkip to conversation

test: Add networking selftest for eh limits

PATCH New Tom Herbert 1 participant 1 message Feb 10

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

PATCH v7 10/10 test: Add networking selftest for eh limits

Add a networking selftest for Extension Header limits. The limits to test are in systcls:

net.ipv6.enforce_ext_hdr_order
net.ipv6.max_dst_opts_number
net.ipv6.max_hbh_opts_number
net.ipv6.max_hbh_length
net.ipv6.max_dst_opts_length

The basic idea of the test is to fabricate ICMPv6 Echo Request packets with various combinations of Extension Headers. The packets are sent to a host in another namespace. If a an ICMPv6 Echo Reply is received then the packet wasn't dropped due to a limit being exceeded, and if it was dropped then we assume that a limit was exceeded. For each test packet we derive an expectation as to whether the packet will be dropped or not. Test success depends on whether our expectation is matched. i.e. if we expect a reply then the test succeeds if we see a reply, and if we don't expect a reply then the test succeeds if we don't see a reply.

The test is divided into a frontend bash script (eh_limits.sh) and a backend Python script (eh_limits.py).

The frontend sets up two network namespaces with IPv6 addresses configured on veth's. We then invoke the backend to send the test packets. This first pass is done with default sysctl settings. On a second pass we change the various sysctl settings and run again.

The backend runs through the various test cases described in the Make_Test_Packets function. This function calls Make_Packet for a test case where arguments provide the Extension Header chain to be tested. The Run_Test function loops through the various packets and tests if a reply is received versus the expectation. If a test case fails then an error status is returned by the backend.

The backend script can also be run with the "-w <pcap_file>" to write the created packets to a pcap file instead of running the test.

---
 tools/testing/selftests/net/Makefile     |   1 +
 tools/testing/selftests/net/eh_limits.py | 349 +++++++++++++++++++++++
 tools/testing/selftests/net/eh_limits.sh | 205 +++++++++++++
 3 files changed, 555 insertions(+)
 create mode 100755 tools/testing/selftests/net/eh_limits.py
 create mode 100755 tools/testing/selftests/net/eh_limits.sh
tools/testing/selftests/net/Makefile +1 -0
index afdea6d95bde..73195a2e8f1e 100644
@@ -24,6 +24,7 @@ TEST_PROGS := \
 	cmsg_time.sh \
 	double_udp_encap.sh \
 	drop_monitor_tests.sh \
+	eh_limits.sh \
 	fcnal-ipv4.sh \
 	fcnal-ipv6.sh \
 	fcnal-other.sh \
tools/testing/selftests/net/eh_limits.py new file +349 -0

349 lines not on this page · raw message

tools/testing/selftests/net/eh_limits.sh new file +205 -0

205 lines not on this page · raw message

Signature · 1 line
2.43.0