mirror-linux/tools/testing/selftests
Florian Westphal 5ec8ca26fe netfilter: nf_nat: remove bogus direction check
Jakub reports spurious failures of the 'conntrack_reverse_clash.sh'
selftest.  A bogus test makes nat core resort to port rewrite even
though there is no need for this.

When the test is made, nf_nat_used_tuple() would already have caused us
to return if no other CPU had added a colliding entry.
Moreover, nf_nat_used_tuple() would have ignored the colliding entry if
their origin tuples had been the same.

All that is left to check is if the colliding entry in the hash table
is subject to NAT, and, if its not, if our entry matches in the reverse
direction, e.g. hash table has

addr1:1234 -> addr2:80, and we want to commit
addr2:80   -> addr1:1234.

Because we already checked that neither the new nor the committed entry is
subject to NAT we only have to check origin vs. reply tuple:
for non-nat entries, the reply tuple is always the inverted original.

Just in case there are more problems extend the error reporting
in the selftest while at it and dump conntrack table/stats on error.

Reported-by: Jakub Kicinski <kuba@kernel.org>
Closes: https://lore.kernel.org/netdev/20251206175135.4a56591b@kernel.org/
Fixes: d8f84a9bc7 ("netfilter: nf_nat: don't try nat source port reallocation for reverse dir clash")
Signed-off-by: Florian Westphal <fw@strlen.de>
2025-12-11 13:08:37 +01:00
..
acct
alsa
amd-pstate
arm64 Merge branches 'for-next/misc', 'for-next/kselftest', 'for-next/efi-preempt', 'for-next/assembler-macro', 'for-next/typos', 'for-next/sme-ptrace-disable', 'for-next/local-tlbi-page-reused', 'for-next/mpam', 'for-next/acpi' and 'for-next/documentation', remote-tracking branch 'arm64/for-next/perf' into for-next/core 2025-11-28 15:47:12 +00:00
bpf Networking changes for 6.19. 2025-12-03 17:24:33 -08:00
breakpoints
cachestat selftests: cachestat: Fix warning on declaration under label 2025-10-22 09:23:18 -06:00
capabilities
cgroup cgroup: Changes for v6.19 2025-12-03 13:04:07 -08:00
clone3
connector
core
coredump selftests/coredump: add second PIDFD_INFO_COREDUMP_SIGNAL test 2025-11-04 22:05:01 +01:00
cpu-hotplug
cpufreq
damon
devices
dma selftests/dma: fix invalid array access in printf 2025-11-19 15:00:14 -07:00
dmabuf-heaps
drivers Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-12-02 15:37:53 -08:00
dt
efivarfs
exec
fchmodat2
filelock
filesystems selftests/filesystems: remove CLONE_NEWPIDNS from setup_userns() helper 2025-11-03 17:41:18 +01:00
firmware
fpu
ftrace linux_kselftest-next-6.19-rc1 2025-12-03 15:08:18 -08:00
futex selftest/futex: Fix spelling mistake "boundarie" -> "boundary" 2025-09-20 18:23:13 +02:00
gpio
hid selftests/hid: add tests for missing release on the Dell Synaptics 2025-10-15 17:27:06 +02:00
ia64
intel_pstate
iommu iommufd: Make vfio_compat's unmap succeed if the range is already empty 2025-11-05 15:11:26 -04:00
ipc
ir
kcmp
kexec selftests/kexec: Ignore selftest binary 2025-09-25 13:43:28 -06:00
kho
kmod
kselftest selftests/run_kselftest.sh: exit with error if tests fail 2025-11-19 15:00:22 -07:00
kselftest_harness
kvm arm64 updates for 6.19: 2025-12-02 17:03:55 -08:00
landlock
lib
livepatch selftests: livepatch: use canonical ftrace path 2025-10-15 14:50:46 +02:00
lkdtm
locking
lsm
media_tests
membarrier
memfd
memory-hotplug
mincore
mm selftests/mm: fix division-by-zero in uffd-unit-tests 2025-11-24 14:25:17 -08:00
module
mount
mount_setattr
move_mount_set_group
mqueue
mseal_system_mappings
namespaces selftests/namespaces: fix nsid tests 2025-11-11 10:01:32 +01:00
nci
net netfilter: nf_nat: remove bogus direction check 2025-12-11 13:08:37 +01:00
nolibc nolibc changes for v6.19 2025-12-03 09:23:25 -08:00
ntb
openat2
pci_endpoint
pcie_bwctrl
perf_events
pid_namespace
pidfd selftests/pidfd: add second supported_mask test 2025-11-04 22:04:38 +01:00
power_supply
powerpc
prctl
proc Patch series in this pull request: 2025-10-02 18:44:54 -07:00
pstore
ptp
ptrace
rcutorture Merge branch 'rcu/misc' into next 2025-11-30 22:20:33 +01:00
resctrl
ring-buffer
riscv
rlimits
rseq tools: Remove s390 compat support 2025-11-17 11:10:38 +01:00
rtc
rust
safesetid
sched
sched_ext sched_ext: Add a selftest for scx_bpf_dsq_peek 2025-10-15 06:46:36 -10:00
seccomp Performance events updates for v6.18: 2025-09-30 11:11:21 -07:00
sgx
signal
size
sparc64
splice
static_keys
sync
syscall_user_dispatch
sysctl
tc-testing selftests/tc-testing: Create tests to exercise ets classes active list misplacements 2025-12-11 01:36:40 -08:00
tdx
thermal/intel
timens
timers selftests/timers/nanosleep: Add tests for return of remaining time 2025-11-14 20:34:50 +01:00
tmpfs
tpm2
tty
turbostat
ublk Summary of significant series in this pull request: 2025-10-02 18:18:33 -07:00
uevent
user_events selftests/user_events: fix type cast for write_index packed member in perf_test 2025-11-15 10:52:02 -08:00
vDSO tools: Remove s390 compat support 2025-11-17 11:10:38 +01:00
vfio vfio: selftests: replace iova=vaddr with allocated iovas 2025-11-12 08:04:42 -07:00
vsock selftests/vsock: disable shellcheck SC2317 and SC2119 2025-11-12 06:19:40 -08:00
watchdog
wireguard wireguard: selftests: remove CONFIG_SPARSEMEM_VMEMMAP=y from qemu kernel config 2025-09-21 14:22:01 -07:00
x86 selftests/x86: Update the negative vsyscall tests to expect a #GP 2025-11-18 10:38:26 -08:00
zram mm: remove unused zpool layer 2025-09-21 14:21:59 -07:00
.gitignore
Makefile VFIO updates for v6.18-rc1 2025-10-04 08:24:54 -07:00
gen_kselftest_tar.sh
kselftest.h Summary of significant series in this pull request: 2025-10-02 18:18:33 -07:00
kselftest_deps.sh
kselftest_harness.h A set of updates for futexes and related selftests: 2025-09-30 16:07:10 -07:00
kselftest_install.sh
kselftest_module.h
lib.mk
run_kselftest.sh selftests/run_kselftest.sh: exit with error if tests fail 2025-11-19 15:00:22 -07:00