summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/net
AgeCommit message (Collapse)Author
21 hoursselftests: net: add ctl_file_write() helperJakub Kicinski
Setting a sysctl or a sysfs attribute for the duration of a test and putting the old value back has been open coded multiple times. We generally avoid creating library helpers but this one is very common, and the defer is a little tricky as using the same function for defer as the initial write leads to an infinite loop (not that I would ever make such mistake!) Some of the conversions are not identical, but arguably ctl_file_write() semantics are more correct. Reviewed-by: Nimrod Oren <noren@nvidia.com> Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260909180009.1894019-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
25 hoursMerge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Cross-merge networking fixes after downstream PR (net-7.3-rc3). Conflicts: drivers/net/dsa/mt7530.c 3c18e3c9a54e ("net: dsa: mt7530: populate lpi_interfaces to fix EEE support") 10d9d8328e8a ("net: dsa: mt7530: replace mt7530_read with regmap_read") Adjacent changes: drivers/net/bonding/bond_alb.c 1746ef2e2df2 ("bonding: use skb_cow_head() in bond_do_alb_xmit() and rlb_arp_xmit()") 4cef95f72bbd ("bonding: fix u32 overflow in compute_gap()") Signed-off-by: Jakub Kicinski <kuba@kernel.org>
31 hoursselftests: net: fix repeated word 'use' in commentHemanth Selam
Drop the second 'use', reported by checkpatch.pl as a possible repeated word. Only touches a comment, no code changes. Signed-off-by: Hemanth Selam <hemanth.selam@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://patch.msgid.link/20260908052602.27497-3-hemanth.selam@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
45 hoursselftests: icmp_redirect: remove xfail supportEric Dumazet
Commit 0a36a75c6818 ("selftests: icmp_redirect: support expected failures") added xfail support to icmp_redirect.sh because the test "IPv6: mtu exception plus redirect" was failing at the time due to a perceived kernel bug described in commit 99513cfa16c6 ("selftest: Fixes for icmp_redirect test"). However, commit 0e02bf5de46a ("selftests: icmp_redirect: IPv6 PMTU info should be cleared after redirect") subsequently fixed the test logic: after redirecting to a new path, the old PMTU information should indeed be cleared, so the test was adjusted to verify the redirect without the old PMTU. Since that fix, the test has been passing and is no longer expected to fail. Leaving xfail=1 in log_test() for all IPv6 tests was not only obsolete, but had the undesirable side effect of masking any future IPv6 failure as XFAIL instead of FAIL. Furthermore, commit 3748939bce3f ("selftests: icmp_redirect: pass xfail=0 to log_test()") had to work around a bash syntax error caused by the empty xfail argument on IPv4 tests. Remove the obsolete xfail support from log_test() and restore standard pass/fail reporting across all tests. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260908091327.349091-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
46 hoursselftests/net: skip srv6_end_dt[4/6]_l3vpn_test.sh if vrftable not availableAlessio Faina
In case iproute2 is older than version 5.11.0, released ~Feb 23, 2021, the vrftable support is not available and the tests contained in the following 2 test files - srv6_end_dt4_l3vpn_test.sh - srv6_end_dt6_l3vpn_test.sh are failing in some kernel backports. This is the result of one of those tests in an unsupported environment: ########################################################################## TEST SECTION: SRv6 VPN connectivity test among hosts in the same tenant ########################################################################## TEST: Hosts connectivity: hs-t100-1 -> hs-t100-2 (tenant 100) [FAIL] TEST: Hosts connectivity: hs-t100-2 -> hs-t100-1 (tenant 100) [FAIL] TEST: Hosts connectivity: hs-t200-3 -> hs-t200-4 (tenant 200) [FAIL] TEST: Hosts connectivity: hs-t200-4 -> hs-t200-3 (tenant 200) [FAIL] The test installs a route with the vrftable feature; if this feature is not available, the approach taken is to skip the test rather than failing it. Signed-off-by: Alessio Faina <alessio.faina@canonical.com> Reviewed-by: Andrea Mayer <andrea.mayer@uniroma2.it> Link: https://patch.msgid.link/20260907100631.1923148-1-alessio.faina@canonical.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 daysselftests: forwarding: use KHDR_INCLUDES in CFLAGSMatthieu Baerts (NGI0)
KHDR_INCLUDES is typically used to include headers from the kernel source directory instead of only relying on the ones from the host: they can be missing or outdated. The kselftest doc recommends assigning KHDR_INCLUDES to CFLAGS in a target Makefile. lib.mk will set KHDR_INCLUDES to "-isystem $(top_srcdir)/usr/include" if the user didn't set it, e.g. if the kernel was built in a different build directory. Other net targets have KHDR_INCLUDES added to their CFLAGS. Link: https://docs.kernel.org/dev-tools/kselftest.html#contributing-new-tests-details Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Ilya Maximets <i.maximets@ovn.org> Link: https://patch.msgid.link/20260904-net-sft-nf-khdr_includes-v1-2-92455af428e9@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 daysselftests: netfilter: use KHDR_INCLUDES in CFLAGSMatthieu Baerts (NGI0)
KHDR_INCLUDES is typically used to include headers from the kernel source directory instead of only relying on the ones from the host: they can be missing or outdated. The kselftest doc recommends assigning KHDR_INCLUDES to CFLAGS in a target Makefile. lib.mk will set KHDR_INCLUDES to "-isystem $(top_srcdir)/usr/include" if the user didn't set it, e.g. if the kernel was built in a different build directory. Other net targets have KHDR_INCLUDES added to their CFLAGS. Link: https://docs.kernel.org/dev-tools/kselftest.html#contributing-new-tests-details Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Ilya Maximets <i.maximets@ovn.org> Link: https://patch.msgid.link/20260904-net-sft-nf-khdr_includes-v1-1-92455af428e9@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 daysselftests: net: Skip so_incoming_cpu on single-CPU systemsKuba Pawlak
The test requires at least two CPUs to exercise the distribution of connections between per-CPU listeners. It currently enforces this prerequisite with an assertion, causing all test cases to fail on single-vCPU systems even though no kernel functionality was tested. Report the unsupported environment as a skip instead. Check the prerequisite before setting up the network namespace so skipped tests do not make unnecessary system changes. Link: https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/2023546 Signed-off-by: Kuba Pawlak <kuba.pawlak@canonical.com> Link: https://patch.msgid.link/20260904140334.562593-1-kuba.pawlak@canonical.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 daysselftests: rtnetlink: update ipsec_offload expected outputAndrei Gherzan
The previous patch ("netdevsim: print IPsec salt/key in network byte order") makes the netdevsim IPsec debugfs file print salt/key in network byte order on every host, instead of host CPU byte order. Update the expected output of kci_test_ipsec_offload() to match: the values change from the little-endian-only representation to the new, endianness-independent one. No other changes are needed since the output is now the same on every architecture. This depends on the previous driver patch: applied on its own, this change would regress the test on little-endian hosts (which still print the old host-order value), though it happens to have no effect on big-endian hosts (whose old host-order output already matched). Reported-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> Link: https://lore.kernel.org/netdev/20220308135106.890270-1-kleber.souza@canonical.com/ Signed-off-by: Andrei Gherzan <andrei.gherzan@canonical.com> Link: https://patch.msgid.link/20260908140325.13367-3-andrei.gherzan@canonical.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 daysselftests: mptcp: lib: get counters for the right testMatthieu Baerts (NGI0)
When the value for a MIB counter is required, mptcp_lib_get_counter is called. It tries to use the cache, if available. If not it falls back to calling 'nstat' directly by looking at the absolute counters. That's an issue for tests that don't recreate the netns for each subtest. In this case, 'nstat -a' will look at the counters for the netns. Instead, it should look at the increment for the current test, by using the history recorded in /tmp/<ns>.nstat, if available, and not using '-a' which was dumping the absolute values. While at it, rename the previous 'hist' variable to 'cache' as it was used to look at the cache, not the nstat history. Fixes: 71388a9f331d ("selftests: mptcp: lib: get counters from nstat history") Cc: stable@vger.kernel.org Reviewed-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260908-net-mptcp-misc-fixes-7-3-rc1-v2-12-df1de70348b6@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 daysselftests: mptcp: lib: dump nstat for the right testMatthieu Baerts (NGI0)
In case of errors, mptcp_lib_pr_nstat is called to dump the nstat counters, but for some tests, it was dumping the counters for all subtests, not just the current one. That's an issue for tests that don't recreate the netns for each subtest, e.g. mptcp_connect.sh. In this case, 'nstat -a' will look at the absolute counters since the creation of the netns, making debugging harder. Instead, it should dump the counters for the current test, by using the history recorded in /tmp/<ns>.nstat if available, and not using '-a' which was dumping the absolute values instead of calculating increments. While at it, rename the previous 'hist' variable to 'cache' as it was used to look at the cache, not the nstat history. Fixes: 658e53141780 ("selftests: mptcp: join: dump stats from history") Cc: stable@vger.kernel.org Reviewed-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260908-net-mptcp-misc-fixes-7-3-rc1-v2-11-df1de70348b6@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 daysselftests: mptcp: fix an UAF in mptcp_connect.cGang Yan
At the end of 'sock_connect_mptcp()', it calls 'freeaddrinfo(addr)', the 'peer' pointer (which points into 'addr') remains. Later, the main loop uses this peer pointer for reconnection attempts. If the memory has been freed and reused, the address data could be overwritten, resulting in an invalid remote address. This patch keeps the addrinfo list allocated for the whole process lifetime so "peer" remains valid across reconnects; the memory will be released at exit() time. Fixes: 05be5e273c84 ("selftests: mptcp: add disconnect tests") Cc: stable@vger.kernel.org Suggested-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Gang Yan <yangang@kylinos.cn> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260908-net-mptcp-misc-fixes-7-3-rc1-v2-7-df1de70348b6@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 daysselftests: net: csum: filter packets by source address and portWillem de Bruijn
Add source address and port verification in recv_verify_packet_* and recv_udp: non-matching packets are skipped. The receiver reads from PF_PACKET and UDP sockets to verify incoming packets to test hardware checksum offload. It did not validate the packet source address or source port. During tests expecting an invalid checksum (-E) or zero checksum (-Z), background packets can fail the test. For -Z, build_packet_udp chooses a specific source port that causes the checksum to sum to zero. When running in receive-only mode (-R), call build_packet in do_rx to compute the expected source port so that source port filtering can be applied to -Z as well. Also - add an inter-packet delay to avoid drops from bursts. - remove a comment that is no longer correct. Fixes: 91a7de85600d ("selftests/net: add csum offload test") Signed-off-by: Willem de Bruijn <willemb@google.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260908155537.813889-1-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 daysselftests: net: Test UDP length overflow with PMTU discover and big MTUAlice Mikityanska
Two previous commits fixed overflow of UDP length when setsockopt IP(V6)_MTU_DISCOVER is set to IPV6_PMTUDISC_DO or IP(V6)_PMTUDISC_PROBE, and a large packet is sent over a netdev with an unusually large MTU. This commit adds the selftests that replicate the described steps to reproduce for IPv6 and IPv4, and also one more test that ensures that sending UDP jumbograms over a raw socket is still possible after the fix. Signed-off-by: Alice Mikityanska <alice@isovalent.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260901195714.673548-4-alice.kernel@fastmail.im Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 daysselftest: af_unix: Add zero-buffer test for msg_oob.cKuniyuki Iwashima
The previous patches fixed two issues related to zero-length buffer with MSG_PEEK for MSG_OOB skb. Let's add corresponding tests in msg_oob.c. Without this series: # FAILED: 50 / 60 tests passed. # Totals: pass:50 fail:10 xfail:0 xpass:0 skip:0 error:0 With this series: # PASSED: 60 / 60 tests passed. # Totals: pass:60 fail:0 xfail:0 xpass:0 skip:0 error:0 Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260902202202.892676-4-kuniyu@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
7 daysselftests/net: Fix flaky bind_wildcard due to ephemeral port raceRicardo B. Marlière (SUSE)
bind_wildcard picks an ephemeral port by binding fd[0] with port 0, reads it back with getsockname(), and then reuses that exact port number for the other addresses/families in fd[1..7]. This all happens in the default network namespace, so unrelated processes on the same host are drawing from the very same ephemeral port range (net.ipv4.ip_local_port_range) at the same time. Such a process can independently get assigned that exact port number on a different, non-conflicting address in the short window between fd[0]'s bind() and fd[1]'s, making fd[1]'s bind() fail with EADDRINUSE for reasons that have nothing to do with the wildcard-bind behavior under test, e.g.: # bind_wildcard.c:775:plain:Expected ret (-1) == 0 (0) # plain: Test terminated by assertion not ok N bind_wildcard.v6_local_v4_local.plain Fix it the same way so_incoming_cpu.c, tcp_port_share.c and reuseport_dualstack.c already do: unshare into a fresh network namespace and bring lo up, so there is nobody else to race with for the port. Signed-off-by: Ricardo B. Marlière (SUSE) <ricardo@marliere.net> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
7 daysvxlan: reject dynamic fdb entries that reference a nexthop idSeungwon Bae
The commit cited in the Fixes tag allowed VXLAN FDB entries to point to FDB nexthops so that overlay traffic could be load balanced across multiple VTEPs. Such entries can only be configured from user space, cannot be learned and cannot roam. They only make sense with a user space control plane such as E-VPN where data plane learning is disabled. Despite that, the VXLAN driver does not currently prevent such entries from being configured with the "dynamic" flag. The per-nexthop FDB list is only protected by the per-device hash lock, which is not sufficient when two VXLAN devices point to the same FDB nexthop and therefore share the list. Aging runs in softirq context without RTNL, so an entry deleted by one device can race with an addition or deletion from the other, leading to list corruption: list_del corruption. next->prev should be ffff8881069d9548, but was dead000000000122. (next=ffff8881069d9448) WARNING: CPU: 0 PID: 90 at lib/list_debug.c:65 __list_del_entry_valid_or_report+0x1aa/0x210 ... vxlan_fdb_destroy+0x5b8/0xad0 vxlan_cleanup+0x328/0x450 call_timer_fn+0x2a/0x1c0 run_timer_softirq+0x18c/0x210 BUG: KASAN: slab-use-after-free in vxlan_fdb_destroy Fix this by rejecting the bogus configuration of dynamic FDB entries that point to FDB nexthops, both when created and when an existing entry is updated. As such, the per-nexthop FDB list is only ever mutated under the RTNL lock. Add test cases to make sure that this does not regress in the future. Fixes: 1274e1cc4226 ("vxlan: ecmp support for mac fdb entries") Suggested-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: Seungwon Bae <qotmddnjs@ajou.ac.kr> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260902155956.296699-1-qotmddnjs@ajou.ac.kr Signed-off-by: Jakub Kicinski <kuba@kernel.org>
7 daysselftest: net: Specify netns for ip ntable in test_neigh.sh.Kuniyuki Iwashima
test_neigh.sh configures the following attributes in the root netns, but now these can be set per netns. * NDTA_THRESH1 / NDTA_THRESH2 / NDTA_THRESH3 * NDTPA_BASE_REACHABLE_TIME Let's specify netns for "ip ntable". Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260902203722.926528-16-kuniyu@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
7 daysselftest: net: Deflake Periodic GC test in test_neigh.sh.Kuniyuki Iwashima
test_neigh.sh has a test case to check if GC is running periodically. It applies a new value to BASE_REACHABLE_TIME, waits for half of the old value (+2s) to ensure the config is reflected, and waits for BASE_REACHABLE_TIME to see if the next GC is triggered. orig_base_reachable=$(ip -j ntable show name "$tbl_name" | jq '.[] | \ select(has("thresh1")) | .["base_reachable"]') run_cmd "ip ntable change name $tbl_name thresh1 10 base_reachable 10000" run_cmd "sleep $(((orig_base_reachable / 1000) / 2 + 2))" This is because neigh_periodic_work() schedules the next GC with (BASE_REACHABLE_TIME / 2) seconds: queue_delayed_work(system_power_efficient_wq, &tbl->gc_work, NEIGH_VAR(&tbl->parms, BASE_REACHABLE_TIME) >> 1); However, the very first run is scheduled with a longer period in neigh_table_init(), which will be up to 45s: neigh_set_reach_time(&tbl->parms); queue_delayed_work(system_power_efficient_wq, &tbl->gc_work, tbl->parms.reachable_time); The initial value is randomly chosen, so if it is larger than 27s (larger than two "sleep"s), the test fails. The test fails more frequently when neigh_table is namespacified by the later patch. In addition, the long "sleep" makes the test more flaky on kernel with CONFIG_NO_HZ_IDLE=y, which is enabled by defconfig. The tbl->gc_work is initialised with INIT_DEFERRABLE_WORK() and queued to system_power_efficient_wq. Even when the next GC is supposed to be triggered 5s later, "sleep" makes the CPU idle, delaying GC execution until often 20s later, which is too late. Let's take the initial tbl->parms.reachable_time into account and poll periodic_gc_runs every 0.1s up to the proper timeout, not to make CPU idle. Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260902203722.926528-2-kuniyu@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 daystunnels: Drop stale dst when building an ICMP error for PMTUDIdo Schimmel
Bridged UDP tunnels such as VXLAN and GENEVE build an ICMP error packet around an overlay packet if the packet is going to exceed the underlay path MTU. The ICMP error packet is then injected back into the Rx path with the source and destination addresses swapped, so that it will be delivered to the overlay source. If the overlay packet was routed to the UDP tunnel or locally generated, then it is already carrying a valid dst entry and this entry is not dropped when transforming the packet to an ICMP error packet. This causes the IP layer to reuse the dst entry, leading to the ICMP error packet being dropped or routed out of the UDP tunnel interface in case of forwarding. Prior to the blamed commit this could not happen, as skb_tunnel_check_pmtu() did not build ICMP errors for PACKET_HOST packets. Such packets were instead encapsulated and, unless the DF bit was set in the outer header, fragmented by the underlay. Fix this by making sure that the ICMP error packet does not have a valid dst entry, thereby forcing the IP layer to perform a route lookup. Adjust the bridged PMTU exception selftests accordingly. When the local sender in ns_a pings the overlay destination with a deadline (-w), ping exits on the first socket error before any reply is received and returns a non-zero exit code. The test therefore only passed because the ICMP error was never delivered. Use a packet count (-c) like the ns_c line above it, so that the ICMP error counts against the packet budget and the exit code depends on whether echo replies were received. This passes with and without the fix. Fixes: 8930424777e4 ("tunnels: Accept PACKET_HOST in skb_tunnel_check_pmtu().") Cc: stable@vger.kernel.org Reported-by: Laika Price <laikabcprice@gmail.com> Closes: https://lore.kernel.org/netdev/20260614-master-v3-1-9f5060ba1ed1@gmail.com/ Reported-by: Yaroslav Dudkov <aroslavdudkov622@gmail.com> Closes: https://lore.kernel.org/netdev/20260901081825.287173-1-aroslavdudkov622@gmail.com/ Reported-by: Charles Bordet <rough.rock3059@datachamp.fr> Closes: https://lore.kernel.org/netdev/aHVhQLPJIhq-SYPM@eldamar.lan/ Signed-off-by: Ido Schimmel <idosch@nvidia.com> Tested-by: Yaroslav Dudkov <aroslavdudkov622@gmail.com> Reviewed-by: David Ahern <dsahern@kernel.org> Reviewed-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: Guillaume Nault <gnault@redhat.com> Link: https://patch.msgid.link/20260902190112.4126199-1-idosch@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 daysMerge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Cross-merge networking fixes after downstream PR (net-7.3-rc2). No conflicts, or adjacent changes. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
9 daysselftests: drv-net: split gro.py into one test per coalescing modeJakub Kicinski
gro.py runs its full set of cases three times over - against SW GRO, HW GRO and LRO. It's our test with the longest runtime. The 318 cases take 12m30s on mlx5 with a debug kernel. Bumping the timeout for all tests feels wrong when we can so easily split the GRO test by execution mode. Shorter runtime also helps retry just the failing portion / mode (we retry failing tests to try to detect flakes vs real failures). Move the main logic to gro_lib.py and add one program per mode - gro_sw.py, gro_hw.py and gro_lro.py, 102 cases each. Move PPPoE to a dedicated test. It has been tacked onto the tests in an ugly way, and it only runs against SW GRO anyway. Note that unfortunately this will case a rename of all test cases. The mode moves from the case name to the test name gro.py test.sw_ipv4_data_same becomes gro_sw.py test.ipv4_data_same Reviewed-by: Joe Damato <joe@dama.to> Reviewed-by: Nimrod Oren <noren@nvidia.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260901200728.2063720-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 daysselftests: net: Add exception cache testsIdo Schimmel
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: # ./exception_cache.sh TEST: IPv4: PMTU: exception without a matching socket [FAIL] No socket: exception does not carry an MTU of 1400 TEST: IPv6: PMTU: exception without a matching socket [FAIL] No socket: exception does not carry an MTU of 1400 TEST: IPv4: PMTU: exception with a matching socket [ OK ] TEST: IPv6: PMTU: exception with a matching socket [ OK ] TEST: IPv4: PMTU: exception with a socket ignoring it [FAIL] PMTU discovery disabled: exception does not carry an MTU of 1400 TEST: IPv6: PMTU: exception with a socket ignoring it [FAIL] PMTU discovery disabled: exception does not carry an MTU of 1400 TEST: IPv4: Redirect: exception without a matching socket [FAIL] No socket: exception does not carry the new gateway TEST: IPv6: Redirect: exception without a matching socket [FAIL] No socket: exception does not carry the new gateway TEST: IPv4: Redirect: exception with a matching socket [ OK ] TEST: IPv6: Redirect: exception with a matching socket [ OK ] Signed-off-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260828192344.2596928-5-idosch@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
12 daysvxlan: mdb: Fix use-after-free in vxlan_mdb_remote_src_del()Baul Lee
vxlan_mdb_is_valid_source(), which validates MDBE_ATTR_SOURCE and every MDBE_ATTR_SRC_LIST member, accepts the all-zeros address. A source list is only accepted on a (*, G) entry, whose source is the all-zeros address, and for each member of the list an (S, G) entry is derived from it by substituting the source. Entries are keyed by a plain memcmp() of struct vxlan_mdb_entry_key, so if MDBE_ATTR_SOURCE is present and holds the all-zeros address and the source list holds it as well, the derived (S, G) key is byte-identical to the (*, G) key and resolves to the same entry. Omitting MDBE_ATTR_SOURCE is not equivalent, as the key is then left with a zero address family. vxlan_mdb_remote_src_del() removes the forwarding entry of a source before freeing the source entry: vxlan_mdb_remote_src_fwd_del(vxlan, group, remote, &ent->addr); vxlan_mdb_remote_src_entry_del(ent); With the keys aliased, the first call deletes the remote of the entry that owns 'ent' instead of a separate (S, G) entry, and frees 'ent'. The second call then runs on the freed entry, and its hlist_del() reads ->pprev and ->next out of it and writes through them. Adding the (*, G) entry with NLM_F_REPLACE and no source list marks the all-zeros source for deletion and reaches this from the sweep at the end of vxlan_mdb_remote_srcs_replace(). BUG: KASAN: slab-use-after-free in __vxlan_mdb_add+0x1cd/0xd70 Read of size 8 at addr ffff888102852500 by task poc/84 __vxlan_mdb_add+0x1cd/0xd70 vxlan_mdb_add+0xc0/0x140 rtnl_mdb_add+0x157/0x2a0 rtnetlink_rcv_msg+0x207/0x5a0 Allocated by task 84: __kmalloc_cache_noprof+0x153/0x360 vxlan_mdb_remote_srcs_add+0x2eb/0x440 __vxlan_mdb_add+0x803/0xd70 Freed by task 84: kfree+0x14c/0x3b0 vxlan_mdb_remote_del+0x129/0x1a0 __vxlan_mdb_del+0x4f/0xe0 vxlan_mdb_remote_src_fwd_del.isra.0+0x162/0x1b0 __vxlan_mdb_add+0x1c5/0xd70 The MDB operations are netns-scoped, so an unprivileged user can perform them in a new user and network namespace. Reject the all-zeros address in vxlan_mdb_is_valid_source(), which covers both call sites. A (*, G) entry is expressed by omitting the source, so nothing legitimate is refused. Discovered by XBOW, triaged by Baul Lee <baul.lee@xbow.com> Fixes: a3a48de5eade ("vxlan: mdb: Add MDB control path support") Signed-off-by: Baul Lee <baul.lee@xbow.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org> Link: https://patch.msgid.link/20260826173604.90158-1-baul.lee@xbow.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-27Merge tag 'net-7.3-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net Pull networking fixes from Jakub Kicinski: "Including fixes from Bluetooth, IPSec and Netfilter. Current release - fix to a fix: - netfilter: ipset: remove need to allocate memory on delete operations Current release - regressions: - macb: drop CONFIG_OF #if block, fix build Previous releases - always broken: - stream of fixes for SCTP continues - inet: frags: strip GSO state from fragments before reassembly - virtio-net: ensure that TCP packets don't overflow gso_segs - tcp-ao: fix use-after-free of current_key on reconnect to another peer - page_pool: remove zone/policy GFP flags when allocating XArray entries - Bluetooth: L2CAP: reject accept queue add unless BT_LISTEN - tls: device: fix out-of-bounds write in tls_append_frag() - eth: bnxt: - ring the doorbell when SW USO exits early, avoid packets stuck in Tx - gate TPH enablement behind BNXT_SUPPORTS_QUEUE_API check, avoid users of older NICs seeing non-actionable warning messages - eth: qede: fix NULL pointer dereference in TPA fragment processing" * tag 'net-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (216 commits) inet: frags: strip GSO state from fragments before reassembly net/sched: sch_htb: limit htb_classify inner-class filter hops selftests/net: packetdrill: add tcp_urg_ptr_retransmit tcp: fix corruption of urgent data on multi-segment retransmit usb: atm: usbatm: fix invalid ci_range initialization net: fec: only stop PTP if it was initialized slip: remove slip_hangup() to fix use-after-free in slip_receive_buf() net: bridge: mcast: fix use-after-free of a master VLAN's multicast context net/sched: bound qdisc_pkt_len to prevent qdisc soft lockup net: dsa: mxl862xx: enable assisted learning on CPU port net: stmmac: restore NET_IP_ALIGN in the RX DMA offset net: stmmac: drop gso_enabled_types and rely on netdev features net: stmmac: selftests: Don't test flow control for small rx fifos net: stmmac: selftests: Account for the UC filter list for filtering tests net: stmmac: dwxgmac: Account for the primary MAC address for UC filtering net: stmmac: dwmac4: Account for the primary MAC address for UC filtering net: stmmac: dwmac1000: Account for the primary MAC address for UC filtering net: stmmac: selftests: Check multiple MMC counters selftests: net: Fix slow configurations in big_tcp_tunnels.sh selftests: net: Lower threshold with csum offload off in big_tcp_tunnels.sh ...
2026-08-27selftests/net: packetdrill: add tcp_urg_ptr_retransmitJiayuan Chen
Drive a connection into urgent mode and force a multi-segment retransmit, checking that each retransmitted segment keeps its own urg_ptr. The test asserts the fixed behaviour: the hole is retransmitted as two independent skbs, each with its own urg_ptr (5001 and 4001) and no PSH. An unpatched kernel instead sends one super-skb whose GSO split copies urg_ptr onto the second segment and also sets PSH there, so on an unpatched kernel the mismatch shows up on the PSH bit (actual P.U ... urg 5001) before the urg_ptr: tcp_urg_ptr_retransmit.pkt:63: live packet field tcp_psh: expected: 0 (0x0) vs actual: 1 (0x1) script packet: .U 1001:2001(1000) ack 1 actual packet: P.U 1001:2001(1000) ack 1 win 1050 After the fix the retransmit carries a per-segment urg_ptr and the test passes. Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20260826141145.67823-2-jiayuan.chen@linux.dev Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-27selftests: net: Fix slow configurations in big_tcp_tunnels.shAlice Mikityanska
The combination of checksum offload disabled (that causes software GSO) and a debug kernel is inherently slow. Depending on the CPU power and load, RTT may increase, limiting sk_pacing_rate, so tcp_tso_autosize caps SKBs at around 40 segments, and zero BIG TCP packets are produced. Increase sysctl net.ipv4.tcp_min_tso_segs and set a bigger initial value of CWND in these configurations to force BIG TCP. Fixes: 5cb53743e1ff ("selftests: net: Add a test for BIG TCP in UDP tunnels") Signed-off-by: Alice Mikityanska <alice@isovalent.com> Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260822120308.1165200-5-alice.kernel@fastmail.im Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-27selftests: net: Lower threshold with csum offload off in big_tcp_tunnels.shAlice Mikityanska
With checksum offload disabled, much fewer BIG TCP packets are generated due to overall loss of throughput. Use a separate threshold in these tests, which is 1/10 of the threshold set for the rest of tests. Fixes: 5cb53743e1ff ("selftests: net: Add a test for BIG TCP in UDP tunnels") Signed-off-by: Alice Mikityanska <alice@isovalent.com> Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260822120308.1165200-4-alice.kernel@fastmail.im Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-27selftests: net: Lower threshold on debug kernels for big_tcp_tunnels.shAlice Mikityanska
Debug kernels on upstream CI runners run slower and generate fewer BIG TCP packets, making the test flaky on upstream CI runners. Lower the default threshold for those kernels. Fixes: 5cb53743e1ff ("selftests: net: Add a test for BIG TCP in UDP tunnels") Signed-off-by: Alice Mikityanska <alice@isovalent.com> Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260822120308.1165200-3-alice.kernel@fastmail.im Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-27selftests: net: Wait for netserver to launchAlice Mikityanska
Use wait_local_port_listen after starting netserver in big_tcp_tunnels.sh to ensure it's listening when the test starts. Fixes: 5cb53743e1ff ("selftests: net: Add a test for BIG TCP in UDP tunnels") Signed-off-by: Alice Mikityanska <alice@isovalent.com> Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260822120308.1165200-2-alice.kernel@fastmail.im Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-27selftests: net: tcp_ao: test VRF-scoped key deletionRastislav Szabo
Verify that TCP_AO_DEL_KEY can remove a TCP-AO key scoped to a VRF. Assisted-by: Codex:GPT-5 Signed-off-by: Rastislav Szabo <rastislav.szabo@isovalent.com> Reviewed-by: David Ahern <dsahern@kernel.org> Acked-by: Dmitry Safonov <dima@arista.com> Link: https://patch.msgid.link/20260822201119.272269-2-rastislav.szabo@isovalent.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-08-24selftests/net: check fork() return value in fin_ack_latQingshuang Fu
main() never checks fork() for failure. When fork() returns -1 (EAGAIN/ENOMEM/RLIMIT_NPROC), the !child_pid test is false and the process falls into server()'s infinite accept() loop with no client ever connecting, producing empty output. The wrapper script treats an empty log as a passing test, producing a false positive. Check fork() for failure with error(), as is done for every other syscall in this file. Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn> Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260821031442.1124777-2-fffsqian@163.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-24selftests/net: fix kill() argument order and wrapper cleanup in fin_ack_latQingshuang Fu
sig_handler() passes its arguments to kill() in the wrong order: it sends signal number child_pid to PID SIGTERM (15) instead of sending SIGTERM to the client process. The call therefore always fails and the signal is never forwarded: when only the server process receives SIGTERM, the client keeps running its infinite connect loop as an orphan process. Swap the arguments so that the server forwards SIGTERM to the client. Guard the call with child_pid > 0: the client inherits the handler and sees child_pid == 0, and a plain argument swap would make it call kill(0, SIGTERM), signaling the whole process group instead of exiting quietly. Now that the server actually terminates the client before the wrapper script's cleanup runs, kill() may fail with ESRCH for the already-exited client. The script uses set -e, so make the kill tolerant to avoid aborting the EXIT trap and leaking temporary files. Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn> Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260821031442.1124777-1-fffsqian@163.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-20selftests: net: packetdrill: add tests for advertised MSS with PMTU exceptionsEric Dumazet
Add packetdrill tests for IPv4 and IPv6 to verify that the advertised MSS in SYN-ACK is derived from the configured interface/route MTU, and is not shrunk by learned Path MTU exceptions from previous outbound connections. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev> Link: https://patch.msgid.link/20260815071532.301908-1-jiayuan.chen@linux.dev Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-20Merge tag 'sysctl-7.03-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl Pull sysctl updates from Joel Granados: - Fix kernel-doc warnings by adjusting in file documentation - Consolidate do_proc_* function into do_proc_vec Consolidate three slightly different implementations of applying a converter on all elements of a vector. Fixes to this function now propagate to the three types. - Replace CONFIG_PROC_SYSCTL with CONFIG_SYSCTL (they were the same) and restrict cad_pid modifications to global root (GLOBAL_ROOT_UID) * tag 'sysctl-7.03-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl: sysctl: remove CONFIG_PROC_SYSCTL, it just mirrors CONFIG_SYSCTL sysctl: move the "cad_pid" entry from pid_table[] to kern_reboot_table[] sysctl: repair some kernel-doc comments sysctl: add Returns: kernel-doc for all functions sysctl: Update API function documentation sysctl: Rename proc_doulongvec_minmax_conv to proc_doulongvec_conv sysctl: Group proc_handler declarations and document sysctl: Replace do_proc_do{int,ulong,uint}vec with do_proc_vec sysctl: Add negp parameter to douintvec converter functions sysctl: Move default converter assignment out of do_proc_dointvec
2026-08-17selftest: Add tests for useful handling of LSM denials on SCM_RIGHTSJori Koolstra
Tests SCM_RIGHTS fd passing on a socket with the new socket option SO_RIGHTS_NOTRUNC turned on. To hook into the security_file_receive() call, BPF is used. The BPF program shares a hashmap with userspace that lists the inos to be blocked (of the receiver tgid). Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl> Link: https://patch.msgid.link/20260814172806.158954-1-jkoolstra@xs4all.nl Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-17selftests: mptcp: diag: fix stack buffer overflow in get_subflow_info()Jiangshan Yi
get_subflow_info() parses the subflow address string with: char saddr[64], daddr[64]; ret = sscanf(subflow_addrs, "%[^:]:%d %[^:]:%d", saddr, &sport, daddr, &dport); The subflow_addrs buffer holds up to 1024 bytes and is taken directly from the command line ("-c" argument). The "%[^:]" conversions have no maximum field width, so if the address substring before the ':' exceeds 63 bytes, sscanf() writes past the end of the 64-byte saddr/daddr stack buffers. This overflows the stack, corrupting adjacent stack data such as the saved return address, and can crash the tool or lead to out-of-bounds writes controlled by user-supplied input. Bound both string conversions to the destination buffer size by adding an explicit maximum field width of 63 (leaving room for the terminating NUL), so at most 63 bytes are written into each 64-byte buffer: ret = sscanf(subflow_addrs, "%63[^:]:%d %63[^:]:%d", saddr, &sport, daddr, &dport); The subflow address can be passed in argument, so fixing this is helpful when the tool is manually used. Reviewed-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260812-net-next-mptcp-misc-feat-7-3-v1-11-1905a818f6cb@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-17selftests: mptcp: fix const qualifier warnings in strchr usageGeliang Tang
In mptcp_connect.c, strchr() returns a pointer to a character within the input string, which is declared as const char *. Assigning this return value to a non-const char * discards the const qualifier, triggering compiler warnings: make: Entering directory 'tools/testing/selftests/net/mptcp' CC mptcp_connect mptcp_connect.c: In function 'parse_cmsg_types': mptcp_connect.c:1267:22: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 1267 | char *next = strchr(type, ','); | ^~~~~~ mptcp_connect.c: In function 'parse_setsock_options': mptcp_connect.c:1295:22: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 1295 | char *next = strchr(name, ','); | ^~~~~~ make: Leaving directory 'tools/testing/selftests/net/mptcp' Fix these warnings by declaring the 'next' variable as const char *, as it is only used for read-only parsing. Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260812-net-next-mptcp-misc-feat-7-3-v1-10-1905a818f6cb@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-17selftests: mptcp: pcap: drop most of the payloadMatthieu Baerts (NGI0)
Limit the size of each captured packet to 108B (IPv4 only) or 128B (a mix of v4 and v6): this should drop most of the payload that is generally not needed when debugging an issue. 8 bytes are left in this payload, to be able to inspect the beginning, just in case. Please also note that generally, this payload is usually mostly filled with 0, except at the end. This reduces the .pcap sizes, and reduce IO usage, which helps debugging issues. Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260812-net-next-mptcp-misc-feat-7-3-v1-9-1905a818f6cb@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-17selftests: mptcp: simult_flow: test name in pcap fileMatthieu Baerts (NGI0)
To be able to easily find out which pcap was produced by which test, the selftest name is now added to the pcap file, similar to the other tests. While at it, print the prefix name to be able to find which capture files have been produced by which test after several runs. This prefix was not printed anywhere before. Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260812-net-next-mptcp-misc-feat-7-3-v1-8-1905a818f6cb@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-17selftests: mptcp: connect: test name in pcap fileMatthieu Baerts (NGI0)
Even if the pcap prefix is printed in the test, it is clearer if this prefix also include the test name: mptcp_connect. With this, it is easily possible to find out which pcap was produced by which test, and easily delete the right ones. Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260812-net-next-mptcp-misc-feat-7-3-v1-7-1905a818f6cb@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-17selftests: mptcp: check per-event MPTCP_RST_EMPTCP countersShardul Bankar
Add named env-var expectations for each per-event MPTCP_RST_EMPTCP counter, matching the pattern used by the existing JOIN/RST checks. Each defaults to 0 and is checked silently on success; a mismatch prints a check line and fails the test. Counters absent from the running kernel are skipped silently so older kernels do not false-fail. The JOIN-related counters (MPJoinSynAckNoMPJoin, MPJoinAckNoMPJoin, MPJoinAckNoCtx, MPJoinNotEstablished, MPJoinNoIdFound) are checked in chk_join_nr() on fixed namespaces; the two remaining reset counters (MD5SigReset, DssReset) stay in chk_rst_nr(). Add a test at the end of signal_address_tests that triggers MPJoinSynAckNoMPJoin: ns1 signals an address that is already bound on the client (ns2), where a TCP-only mptcp_connect listener is started. The client's MP_JOIN routes locally to the TCP listener, which responds with a plain SYN/ACK without the MP_JOIN option, and the new counter increments on the client side. Other per-event counters (MD5SigReset, MPJoinAckNoMPJoin, MPJoinAckNoCtx, DssReset, MPJoinNotEstablished, MPJoinNoIdFound) are not currently reachable from mptcp_join.sh; the env-var hooks are in place for future tests to set expectations explicitly. Signed-off-by: Shardul Bankar <shardul.b@mpiricsoftware.com> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260812-net-next-mptcp-misc-feat-7-3-v1-6-1905a818f6cb@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-17selftests: net: separate ipv6_flowlabel_mgr testMarcelo Mendes Spessoto Junior
The ipv6_flowlabel_mgr used to be a component of a broader overall flow label test, defined in the ipv6_flowlabel.sh file. This wrapper script called tests defined on ipv6_flowlabel.c and ipv6_flowlabel_mgr.c files, using predefined parameters and enforcing the in_netns.sh helper to set network namespaces for each test env. However, the ipv6_flowlabel_mgr.c was drastically changed recently. These modifications led to the mgr tests becoming a self contained and independent test suite, enforcing netns creation by itself and not relying on the ipv6_flowlabel.sh wrapper for proper test execution anymore. Therefore, remove the mgr tests from the wrapper and update the Makefile to handle it as a standalone test program instead. Signed-off-by: Marcelo Mendes Spessoto Junior <marcelomspessoto@gmail.com> Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn> Link: https://patch.msgid.link/20260813030708.37609-1-marcelomspessoto@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-14Merge tag 'nf-next-26-08-10' of ↵Jakub Kicinski
git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next Pablo Neira Ayuso says: ==================== Netfilter updates for net This includes an enhancement to detect ct memleaks easier via DEBUG_NET and flowtable preparation patches for IPv4 over IPV6 and vice-versa. This also includes a fix for the nft_ct custom expectation support. 1) Add DEBUG_NET_WARN_ON_ONCE to nf_ct_set() to spot ct memleaks. 2) Pass struct net_device_path_ctx to dev_fill_forward_path() to make it easier to pass more parameters to this function. From Lorenzo Bianconi. 3) Add ether_type field to net_device_path context structucture. 4) Rename tun.l3_proto field to tun.inner_proto. 5) Rename ctx.tun.proto to ctx.tun.inner_proto. 6) Store ether_type in flowtable context. 7) Move IPv4 and IPv6 xmit path to a helper function. 8) Move encapsulation header parser out of the flowtable lookup function. 9) Rework nft_ct custom expectation support to address a possible reallocation of ct extension area while expectation list also contains expectations. Move datapath to a ct helper to fix it. 10) Ensure timeout is always lowered for the non-closing RST case in the TCP connection tracking. 11) Bail out when inserting already dead expectation, this should not ever happen, hence report it via DEBUG_NET. 12) Comestic updates for improving the conntrack selftest dump and flush userspace program, from Qingshuang Fu. * tag 'nf-next-26-08-10' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next: selftests: netfilter: conntrack_dump_flush: remove unused variables and fix typo netfilter: nf_conntrack_expect: bail out on insert dead expectations netfilter: conntrack: always lower timeout for non-closing RST packets netfilter: nft_ct: move custom expectation support to helper netfilter: flowtable: detach layer 2 encapsulation parser from lookup netfilter: flowtable: move ipv4 and ipv6 xmit path to function netfilter: flowtable: store ethertype in flowtable context netfilter: flowtable: rename ctx.tun.proto to ctx.tun.inner_proto netfilter: flowtable: rename tun.l3_proto to tun.inner_proto net: netfilter: add ether_type to net_device_path_ctx and use it net: pass net_device_path_ctx to dev_fill_forward_path() netfilter: add DEBUG_NET_WARN_ON_ONCE to skb_set_nfct() ==================== Link: https://patch.msgid.link/20260810194015.932627-1-pablo@netfilter.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-13selftests/net/openvswitch: add SCTP flow key support and testMinxi Hou
The ovskey flow-string parser has no OVS_KEY_ATTR_SCTP entry, so a flow string containing sctp(src=.../dst=...) parses without error but silently drops the L4 key. The resulting flow carries only ipv4(proto=132), and the kernel rejects it: match_validate() in flow_netlink.c requires OVS_KEY_ATTR_SCTP when the IP protocol is IPPROTO_SCTP and returns -EINVAL for the missing key. Register OVS_KEY_ATTR_SCTP in the parse table and add a matching selftest that verifies SCTP flow key matching (sctp src/dst port). One listener serves the whole test. socat's fork option handles each association in a child, so the flow rules are the only thing that changes between the three phases and the listener is never restarted underneath them. -t 1 bounds how long a forked child lingers after its association closes, and the existing kill -TERM of the captured pid on teardown removes the listener itself. Also enable CONFIG_IP_SCTP in the selftest kernel config. The config checker strips underscores before comparing keys, so the entry sorts before CONFIG_IPV6 rather than after it. Signed-off-by: Minxi Hou <houminxi@gmail.com> Reviewed-by: Aaron Conole <aconole@redhat.com> Link: https://patch.msgid.link/20260811181645.1918420-1-houminxi@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-13Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Cross-merge networking fixes after downstream PR (net-7.2-rc8). No conflicts. Adjacent changes: drivers/net/ethernet/wangxun/ngbe/ngbe_main.c 5f3a13e0bb5e ("net: ngbe: fix NULL pointer dereference in non-MSI-X interrupt enabling") d661abdc30c2 ("net: ngbe: correct misleading interrupt comment") drivers/net/ipvlan/ipvlan_main.c e16e960d55a4 ("ipvlan: inherit needed_headroom and needed_tailroom from phy_dev") 00a40d809207 ("ipvlan: Support per-netns netdev unregistration.") Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-13selftests: net: verify RTA_DEL_REASON on route deletionYuyang Huang
Extend rtnetlink.py to check the reason reported in RTM_DELROUTE: - expired: route with a 2s lifetime collected by the fib6 GC (gc_interval lowered like fib_tests.sh fib6_gc_test does); - ra-withdrawn: a single RA advertises a default route (router lifetime), an on-link prefix route (RFC 4861 prefix information option) and a route information option route (RFC 4191), then a second RA withdraws all three with zero lifetimes; the RAs are crafted over a raw ICMPv6 socket so the test does not depend on an external RA tool; - absence: a userspace deletion request records no cause and must not carry the attribute at all. Signed-off-by: Yuyang Huang <sigefriedhyy@gmail.com> Link: https://patch.msgid.link/20260808005642.26901-11-sigefriedhyy@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-08-11selftests: net: adopt harness for flow label mgrMarcelo Mendes Spessoto Junior
The kselftest_harness.h file contains modern helpers to build tests for kselftest. Dropping the custom test helpers in ipv6_flowlabel_mgr in favor of the harness makes tests more legible and conforms to the structure of the latest selftests. It also enforces the TAP standard. Another change made to the structure of the ipv6_flowlabel_mgr test file was the removal of parse_opts. The supported opts were already unused: the binary is listed in TEST_GEN_FILES, and is driven solely by ipv6_flowlabel.sh via "./ipv6_flowlabel_mgr", which never passed -l or -v. Dropping the -l gate means the two checks it previously guarded (each with a 13-second sleep, ~26 seconds total) are now unconditionally enabled on every run instead of never running at all. The TH_LOG calls and code comments now cover the information that the removed, custom -v flag used to print. Finally, FIXTURE_SETUP(flowlabel) ensures each test gets its own isolated network namespace. The previously added setup() helper was dropped to conform to the netns setup pattern used in icmp_rfc4884.c. disable_flowlabel_consistency() was moved next to reflect_flag, the only test that calls it, and now uses SKIP() instead of an ad hoc [INFO] message when the sysctl cannot be disabled. Signed-off-by: Marcelo Mendes Spessoto Junior <marcelomspessoto@gmail.com> Link: https://patch.msgid.link/20260807220942.421382-6-marcelomspessoto@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-11selftests: net: test IPV6_FL_F_REFLECTMarcelo Mendes Spessoto Junior
According to the source code, flowlabel_consistency must be deactivated for the IPV6_FL_F_REFLECT flag to work. Since ipv6_flowlabel_mgr now runs in its own network namespace, do this directly from the test binary. Attempt to disable net.ipv6.flowlabel_consistency and skip the reflect test if that fails. A disabled flowlabel_consistency does not affect the remaining features being tested on the file, and failing to disable is not fatal and skips the reflect test only. The previously defined tcp_listen and tcp_connect helpers were reused, since the connection flow required for REFLECT validation is very similar to REMOTE. Signed-off-by: Marcelo Mendes Spessoto Junior <marcelomspessoto@gmail.com> Link: https://patch.msgid.link/20260807220942.421382-5-marcelomspessoto@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-11selftests: net: create own netns in ipv6_flowlabel_mgrMarcelo Mendes Spessoto Junior
Have ipv6_flowlabel_mgr create and configure its own network namespace (unshare(CLONE_NEWNET) + bring up lo), the same way ipv6_fragmentation.c and icmp_rfc4884.c already do, instead of relying on the in_netns.sh wrapper script. The setup can then be reused across tests through fixtures and provide isolated network environments for each test in the case of a future adoption of kselftest_harness. It also avoids the leak of modifications to the netns in case the user runs the test file directly, outside the wrapper and without the in_netns.sh file. Signed-off-by: Marcelo Mendes Spessoto Junior <marcelomspessoto@gmail.com> Link: https://patch.msgid.link/20260807220942.421382-4-marcelomspessoto@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>