All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] DNAT/SNAT port range must use dash
@ 2005-01-17  0:33 Phil Oester
  2005-02-01 12:53 ` Harald Welte
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Oester @ 2005-01-17  0:33 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

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.

Phil

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



[-- Attachment #2: patch-colons --]
[-- Type: text/plain, Size: 1528 bytes --]

diff -ru iptables-orig/extensions/libipt_DNAT.c iptables-new/extensions/libipt_DNAT.c
--- iptables-orig/extensions/libipt_DNAT.c	2004-12-28 08:11:59.000000000 -0500
+++ iptables-new/extensions/libipt_DNAT.c	2005-01-16 19:26:29.059808992 -0500
@@ -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
diff -ru iptables-orig/extensions/libipt_SNAT.c iptables-new/extensions/libipt_SNAT.c
--- iptables-orig/extensions/libipt_SNAT.c	2004-12-28 08:11:59.000000000 -0500
+++ iptables-new/extensions/libipt_SNAT.c	2005-01-16 19:13:42.446351952 -0500
@@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-02-01 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-17  0:33 [PATCH] DNAT/SNAT port range must use dash Phil Oester
2005-02-01 12:53 ` Harald Welte

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.