From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH 7/7] extensions: libip6t_dst: make inversion work
Date: Thu, 19 Feb 2015 14:11:23 +0100 [thread overview]
Message-ID: <1424351483-27617-8-git-send-email-fw@strlen.de> (raw)
In-Reply-To: <1424351483-27617-1-git-send-email-fw@strlen.de>
The inversion flag wasn't set in the match struct.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
extensions/libip6t_dst.c | 8 ++++----
extensions/libip6t_dst.t | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/extensions/libip6t_dst.c b/extensions/libip6t_dst.c
index 3fd4c01..1f15162 100644
--- a/extensions/libip6t_dst.c
+++ b/extensions/libip6t_dst.c
@@ -70,22 +70,21 @@ parse_options(const char *optsstr, uint16_t *opts)
*next++='\0';
range = strchr(cp, ':');
-
if (range) {
if (i == IP6T_OPTS_OPTSNR-1)
xtables_error(PARAMETER_PROBLEM,
"too many ports specified");
*range++ = '\0';
}
-
opts[i] = (parse_opts_num(cp, "opt") & 0xFF) << 8;
if (range) {
if (opts[i] == 0)
xtables_error(PARAMETER_PROBLEM,
"PAD0 hasn't got length");
opts[i] |= parse_opts_num(range, "length") & 0xFF;
- } else
+ } else {
opts[i] |= (0x00FF);
+ }
#ifdef DEBUG
printf("opts str: %s %s\n", cp, range);
@@ -112,6 +111,8 @@ static void dst_parse(struct xt_option_call *cb)
xtables_option_parse(cb);
switch (cb->entry->id) {
case O_DSTLEN:
+ if (cb->invert)
+ optinfo->invflags |= IP6T_OPTS_INV_LEN;
optinfo->flags |= IP6T_OPTS_LEN;
break;
case O_DSTOPTS:
@@ -152,7 +153,6 @@ static void dst_print(const void *ip, const struct xt_entry_match *match,
printf(" opts");
print_options(optinfo->optsnr, (uint16_t *)optinfo->opts);
-
if (optinfo->invflags & ~IP6T_OPTS_INV_MASK)
printf(" Unknown invflags: 0x%X",
optinfo->invflags & ~IP6T_OPTS_INV_MASK);
diff --git a/extensions/libip6t_dst.t b/extensions/libip6t_dst.t
index b2788aa..0b0013b 100644
--- a/extensions/libip6t_dst.t
+++ b/extensions/libip6t_dst.t
@@ -1,4 +1,5 @@
:INPUT,FORWARD,OUTPUT
-m dst --dst-len 0;=;OK
-m dst --dst-opts 149:92,12:12,123:12;=;OK
+-m dst ! --dst-len 42;=;OK
-m dst --dst-len 42 --dst-opts 149:92,12:12,123:12;=;OK
--
2.0.5
next prev parent reply other threads:[~2015-02-19 13:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-19 13:11 iptables: add more test cases and minor bug fixes Florian Westphal
2015-02-19 13:11 ` [PATCH 1/7] extensions: remove MIRROR Florian Westphal
2015-02-19 13:28 ` Jan Engelhardt
2015-02-19 13:34 ` Florian Westphal
2015-02-19 15:27 ` Pablo Neira Ayuso
2015-02-19 13:11 ` [PATCH 2/7] extensions: remove SAME target Florian Westphal
2015-02-19 13:11 ` [PATCH 3/7] extensions: remove 'unclean' match Florian Westphal
2015-02-19 13:11 ` [PATCH 4/7] extensions: add more test cases for iptables-test.py Florian Westphal
2015-02-19 13:11 ` [PATCH 5/7] extensions: SNPT,DNPT: fix save/print output Florian Westphal
2015-02-19 13:11 ` [PATCH 6/7] extensions/libxt_recent.t: add test case for 3.19 regression Florian Westphal
2015-02-19 13:11 ` Florian Westphal [this message]
2015-02-19 13:33 ` [PATCH 7/7] extensions: libip6t_dst: make inversion work Jan Engelhardt
2015-02-19 13:37 ` Florian Westphal
2015-02-19 13:43 ` Jan Engelhardt
2015-02-19 15:24 ` iptables: add more test cases and minor bug fixes Pablo Neira Ayuso
2015-02-19 16:49 ` Florian Westphal
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=1424351483-27617-8-git-send-email-fw@strlen.de \
--to=fw@strlen.de \
--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).