Subject: Re: [PATCH net-next v9 10/10] test: Add networking selftest for eh limits

From: Simon Horman <[email-masked]>
Date: Tue, 17 Mar 2026 15:32:22 +0000

On Sat, Mar 14, 2026 at 10:51:24AM -0700, Tom Herbert wrote:
> 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.
> 
> Signed-off-by: Tom Herbert <[email-masked]>
> ---
>  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

Hi Tom,

Shellcheck flags several instances of the following:

- https://www.shellcheck.net/wiki/SC2154 -- ns1 is referenced but not assigned.
- https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...

In the case of SC2086 I think this can be trivially addressed by adding
double quotes.

While I think SC2154 should probably be ignored using

# shellcheck disable=SC2154

We're trying to make new scripts shellcheck clean, so I'd appreciate it if
you could look into this.

Also, pylint has also something to say about this patch.

...