netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Bernat <bernat@luffy.cx>
To: netfilter-devel@vger.kernel.org
Cc: Vincent Bernat <bernat@luffy.cx>
Subject: [PATCH] iprange: fix xt_iprange v0 parsing
Date: Wed, 21 Apr 2010 14:09:18 +0200	[thread overview]
Message-ID: <1271851758-12108-1-git-send-email-bernat@luffy.cx> (raw)

iprange_parse() was incomplete and did not include parsed ranges into
ipt_iprange_info structure resulting in always adding range
0.0.0.0-0.0.0.0 in the kernel.

Moreover, when using --dst-range, error messages may display
--src-range instead. Fix this too.

Signed-off-by: Vincent Bernat <bernat@luffy.cx>
---
 extensions/libxt_iprange.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/extensions/libxt_iprange.c b/extensions/libxt_iprange.c
index b28a635..55a2f84 100644
--- a/extensions/libxt_iprange.c
+++ b/extensions/libxt_iprange.c
@@ -108,7 +108,8 @@ static int iprange_parse(int c, char **argv, int invert, unsigned int *flags,
 		if (invert)
 			info->flags |= IPRANGE_SRC_INV;
 		iprange_parse_range(optarg, range, NFPROTO_IPV4, "--src-range");
-
+		info->src.min_ip = range[0].ip;
+		info->src.max_ip = range[1].ip;
 		break;
 
 	case '2':
@@ -122,8 +123,9 @@ static int iprange_parse(int c, char **argv, int invert, unsigned int *flags,
 		if (invert)
 			info->flags |= IPRANGE_DST_INV;
 
-		iprange_parse_range(optarg, range, NFPROTO_IPV4, "--src-range");
-
+		iprange_parse_range(optarg, range, NFPROTO_IPV4, "--dst-range");
+		info->dst.min_ip = range[0].ip;
+		info->dst.max_ip = range[1].ip;
 		break;
 
 	default:
-- 
1.7.0.4


             reply	other threads:[~2010-04-21 12:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21 12:09 Vincent Bernat [this message]
2010-04-21 12:48 ` [PATCH] iprange: fix xt_iprange v0 parsing Patrick McHardy

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=1271851758-12108-1-git-send-email-bernat@luffy.cx \
    --to=bernat@luffy.cx \
    --cc=netfilter-devel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).