Skip to content

netfilter: nat: fix ancient dnat+edemux bug

Florian Westphal netfilter-devel 1 version Applied

Status from this message: Applied, thanks Florian.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/3netfilter: nf_nat: undo erroneous tcp edemux lookupnet/netfilter/nf_nat_proto.c+21 -40 replies
2/3netfilter: conntrack: avoid misleading 'invalid' in log messagenet/netfilter/nf_conntrack_proto_tcp.c+4 -20 replies
3/3selftests: netfilter: test nat port clash resolution interaction with tcp early demuxtools/testing/selftests/netfilter/Makefile tools/testing/selftests/netfilter/nf_nat_edemux.sh+100 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH nf 0/3] netfilter: nat: fix ancient dnat+edemux bug

Netfilter NAT collision handling + TCP edemux can cause packets to end up with the wrong socket.
This happens since TCP early demux was added more than 8 years ago, so this needs very rare and specific conditions to trigger.

Patch 1 fixes the bug.
Patch 2 rewords a debug message that imlies packets are treated as invalid while they are not.
Patch 3 adds a test case for this. On unpatched kernel this script should error out with:
(UNKNOWN) [10.96.0.1] 443 (https) : Connection timed out
FAIL: nc cannot connect via NAT'd address

Florian Westphal (3):
netfilter: nf_nat: undo erroneous tcp edemux lookup
netfilter: conntrack: avoid misleading 'invalid' in log message
selftests: netfilter: test nat port clash resolution interaction with
tcp early demux

 net/netfilter/nf_conntrack_proto_tcp.c        |  6 +-
 net/netfilter/nf_nat_proto.c                  | 25 ++++-
 tools/testing/selftests/netfilter/Makefile    |  2 +-
 .../selftests/netfilter/nf_nat_edemux.sh      | 99 +++++++++++++++++++
 4 files changed, 125 insertions(+), 7 deletions(-)
 create mode 100755 tools/testing/selftests/netfilter/nf_nat_edemux.sh
Signature · 1 line
2.26.2