Skip to contentSkip to conversation

NAT range calculation fix

PATCH Applied Harald Welte 2 participants 2 messages Sep 4, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NAT range calculation fix

Hi Dave!

Please apply the following fix to your 2.4 and 2.6 tree:

Author: Karlis Peisenieks

D: This patch fixes a logic bug in NAT range calculations, which also
D: causes a large slowdown when ICMP floods go through NAT.

net/ipv4/netfilter/ip_nat_core.c +2 -2
@@ -159,8 +159,8 @@
 				continue;
 		}
 
-		if ((mr->range[i].flags & IP_NAT_RANGE_PROTO_SPECIFIED)
-		    && proto->in_range(&newtuple, IP_NAT_MANIP_SRC,
+		if (!(mr->range[i].flags & IP_NAT_RANGE_PROTO_SPECIFIED)
+		    || proto->in_range(&newtuple, IP_NAT_MANIP_SRC,
 				       &mr->range[i].min, &mr->range[i].max))
 			return 1;
 	}
Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#1 lore raw
Quoted 1 line · On Thu, 4 Sep 2003 12:04:03 +0200 Harald Welte <[email protected]> wrote:

Please apply the following fix to your 2.4 and 2.6 tree:

Applied, thanks Harald.