From: Shivani Bhardwaj <shivanib134@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH] libipt_NETMAP: Avoid listing 32 bit mask and fix tests
Date: Wed, 15 Jun 2016 02:02:40 +0530 [thread overview]
Message-ID: <20160614203240.GA23145@shivani> (raw)
(1) If subnet mask is unspecified with an IPv4 address, the rule
lists as
iptables -I PREROUTING -t nat -j NETMAP --to to:1.2.3.4/32
Remove this and make the rule list as
iptables -I PREROUTING -t nat -j NETMAP --to to:1.2.3.4
(2) Fix the tests for NETMAP for IPv4.
Before this patch,
ERROR: line 3 (cannot find: iptables -I PREROUTING -t nat -j NETMAP --to 1.2.3.0/24)
ERROR: line 4 (cannot find: iptables -I PREROUTING -t nat -j NETMAP --to 1.2.3.4)
After this patch, no errors with tests were observed.
Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
---
extensions/libipt_NETMAP.c | 2 +-
extensions/libipt_NETMAP.t | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/extensions/libipt_NETMAP.c b/extensions/libipt_NETMAP.c
index 4932c96..7c5d657 100644
--- a/extensions/libipt_NETMAP.c
+++ b/extensions/libipt_NETMAP.c
@@ -76,7 +76,7 @@ static void NETMAP_print(const void *ip, const struct xt_entry_target *target,
bits = netmask2bits(a.s_addr);
if (bits < 0)
printf("/%s", xtables_ipaddr_to_numeric(&a));
- else
+ else if (bits < 32)
printf("/%d", bits);
}
diff --git a/extensions/libipt_NETMAP.t b/extensions/libipt_NETMAP.t
index 31924b9..de2bf8f 100644
--- a/extensions/libipt_NETMAP.t
+++ b/extensions/libipt_NETMAP.t
@@ -1,4 +1,4 @@
:PREROUTING,INPUT,OUTPUT,POSTROUTING
*nat
--j NETMAP --to 1.2.3.0/24;=;OK
--j NETMAP --to 1.2.3.4;=;OK
+-j NETMAP --to 1.2.3.0/24;-j NETMAP --to to:1.2.3.0/24;OK
+-j NETMAP --to 1.2.3.4;-j NETMAP --to to:1.2.3.4;OK
--
1.9.1
next reply other threads:[~2016-06-14 20:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-14 20:32 Shivani Bhardwaj [this message]
2016-06-17 11:54 ` [PATCH] libipt_NETMAP: Avoid listing 32 bit mask and fix tests Pablo Neira Ayuso
2016-06-17 12:24 ` 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=20160614203240.GA23145@shivani \
--to=shivanib134@gmail.com \
--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).