[netfilter-cvslog] r3627 - trunk/iptables/extensions

laforge at netfilter.org laforge at netfilter.org
Tue Feb 1 13:56:17 CET 2005


Author: laforge at netfilter.org
Date: 2005-02-01 13:56:16 +0100 (Tue, 01 Feb 2005)
New Revision: 3627

Modified:
   trunk/iptables/extensions/libipt_DNAT.c
Log:
John McCann points out via bugzilla that iptables happily accepts this
syntax on DNAT/SNAT:

      --to x.x.x.x:y:z

but doesn't actually make use of the second port.  Clear up the confusion
by only accepting a dash between the ports.

This closes bugzilla #265.

Signed-off-by: Phil Oester <kernel at linuxace.com>


Modified: trunk/iptables/extensions/libipt_DNAT.c
===================================================================
--- trunk/iptables/extensions/libipt_DNAT.c	2005-02-01 11:07:59 UTC (rev 3626)
+++ trunk/iptables/extensions/libipt_DNAT.c	2005-02-01 12:56:16 UTC (rev 3627)
@@ -65,7 +65,7 @@
 parse_to(char *arg, int portok, struct ipt_natinfo *info)
 {
 	struct ip_nat_range range;
-	char *colon, *dash;
+	char *colon, *dash, *error;
 	struct in_addr *ip;
 
 	memset(&range, 0, sizeof(range));
@@ -85,6 +85,11 @@
 			exit_error(PARAMETER_PROBLEM,
 				   "Port `%s' not valid\n", colon+1);
 
+		error = strchr(colon+1, ':');
+		if (error)
+			exit_error(PARAMETER_PROBLEM,
+				   "Invalid port:port syntax - use dash\n");
+
 		dash = strchr(colon, '-');
 		if (!dash) {
 			range.min.tcp.port




More information about the netfilter-cvslog mailing list