Re: [PATCH net v2 4/4] selftests: net: Add exception cache tests
From: Ido Schimmel <idosch@nvidia.com>
Date: 2026-08-31 06:59:27
On Fri, Aug 28, 2026 at 10:23:44PM +0300, Ido Schimmel wrote:
Add a test for the IPv4 and IPv6 exception caches, covering the
exceptions that are created in response to ICMP errors quoting a UDP
packet.
The topology consists of a host (h1) that reaches a remote host (h2)
via a router (r1), with a second router (r2) attached to the segment
shared by h1 and r1. UDP packets are injected using a packet socket, so
that an ICMP error quoting them is only matched to a socket when one was
opened separately with the same source port. PMTU errors are provoked by
lowering the MTU of the far end of the path and redirects by pointing
r1's route towards h2 back over the segment it received the packet from.
The following is tested for both address families and for both PMTU and
redirect exceptions:
* An error that is not matched to a socket creates an exception that
carries the new MTU or gateway.
* An error that is matched to a socket creates the same exception.
The PMTU tests further verify that a lower PMTU replaces the one stored
in the exception whereas a higher one does not, and that a socket which
disabled PMTU discovery using IP{,V6}_PMTUDISC_OMIT gets the same
exception as the other cases.
Without "ipv4: udp: Create exceptions before socket matching" and "ipv6:
udp: Create exceptions before socket matching", the tests that do not
open a socket fail:Both of the comments from Sashiko are nits. The test passes when it should and fails otherwise, so it's doing its job. " This isn't a bug, but a question about what the "with a socket" cases assert. pmtu_socket(), pmtu_omit() and redirect_socket() only look at the route exception, and with the two accompanying kernel changes that exception is created before the socket lookup: " It asserts that an exception is created regardless of whether the ICMP error matched a socket or not. " Is the ICMP input counter a strong enough barrier for this check? " Yes.