From: Phil Oester <kernel@linuxace.com>
To: netfilter-devel@lists.netfilter.org
Subject: [PATCH] DNAT/SNAT port range must use dash
Date: Sun, 16 Jan 2005 16:33:25 -0800 [thread overview]
Message-ID: <20050117003325.GA1067@linuxace.com> (raw)
[-- 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
next reply other threads:[~2005-01-17 0:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-17 0:33 Phil Oester [this message]
2005-02-01 12:53 ` [PATCH] DNAT/SNAT port range must use dash Harald Welte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050117003325.GA1067@linuxace.com \
--to=kernel@linuxace.com \
--cc=netfilter-devel@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.