Skip to content
Snippets Groups Projects
Commit 0f1ae282 authored by Kyle Swenson's avatar Kyle Swenson Committed by Pablo Neira Ayuso
Browse files

netfilter: nat: restore default DNAT behavior


When a DNAT rule is configured via iptables with different port ranges,

iptables -t nat -A PREROUTING -p tcp -d 10.0.0.2 -m tcp --dport 32000:32010
-j DNAT --to-destination 192.168.0.10:21000-21010

we seem to be DNATing to some random port on the LAN side. While this is
expected if --random is passed to the iptables command, it is not
expected without passing --random.  The expected behavior (and the
observed behavior prior to the commit in the "Fixes" tag) is the traffic
will be DNAT'd to 192.168.0.10:21000 unless there is a tuple collision
with that destination.  In that case, we expect the traffic to be
instead DNAT'd to 192.168.0.10:21001, so on so forth until the end of
the range.

This patch intends to restore the behavior observed prior to the "Fixes"
tag.

Fixes: 6ed5943f ("netfilter: nat: remove l4 protocol port rovers")
Signed-off-by: default avatarKyle Swenson <kyle.swenson@est.tech>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent f6374a82
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment