netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH 5/7] extensions: SNPT,DNPT: fix save/print output
Date: Thu, 19 Feb 2015 14:11:21 +0100	[thread overview]
Message-ID: <1424351483-27617-6-git-send-email-fw@strlen.de> (raw)
In-Reply-To: <1424351483-27617-1-git-send-email-fw@strlen.de>

wrong placement of ' ', i.e. we get
-j SNPT--src-pfx dead::/64 --dst-pfx 1c3::/64

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 extensions/libip6t_DNPT.c | 8 ++++----
 extensions/libip6t_DNPT.t | 1 +
 extensions/libip6t_SNPT.c | 8 ++++----
 extensions/libip6t_SNPT.t | 1 +
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/extensions/libip6t_DNPT.c b/extensions/libip6t_DNPT.c
index a442de6..d045e44 100644
--- a/extensions/libip6t_DNPT.c
+++ b/extensions/libip6t_DNPT.c
@@ -52,9 +52,9 @@ static void DNPT_print(const void *ip, const struct xt_entry_target *target,
 {
 	const struct ip6t_npt_tginfo *npt = (const void *)target->data;
 
-	printf("src-pfx %s/%u ", xtables_ip6addr_to_numeric(&npt->src_pfx.in6),
+	printf(" DNPT src-pfx %s/%u", xtables_ip6addr_to_numeric(&npt->src_pfx.in6),
 				 npt->src_pfx_len);
-	printf("dst-pfx %s/%u ", xtables_ip6addr_to_numeric(&npt->dst_pfx.in6),
+	printf(" dst-pfx %s/%u", xtables_ip6addr_to_numeric(&npt->dst_pfx.in6),
 				 npt->dst_pfx_len);
 }
 
@@ -65,12 +65,12 @@ static void DNPT_save(const void *ip, const struct xt_entry_target *target)
 
 	if (memcmp(&info->src_pfx.in6, &zero_addr, sizeof(zero_addr)) != 0 ||
 	    info->src_pfx_len != 0)
-		printf("--src-pfx %s/%u ",
+		printf(" --src-pfx %s/%u",
 		       xtables_ip6addr_to_numeric(&info->src_pfx.in6),
 		       info->src_pfx_len);
 	if (memcmp(&info->dst_pfx.in6, &zero_addr, sizeof(zero_addr)) != 0 ||
 	    info->dst_pfx_len != 0)
-		printf("--dst-pfx %s/%u ",
+		printf(" --dst-pfx %s/%u",
 		       xtables_ip6addr_to_numeric(&info->dst_pfx.in6),
 		       info->dst_pfx_len);
 }
diff --git a/extensions/libip6t_DNPT.t b/extensions/libip6t_DNPT.t
index 25ec935..0406dc9 100644
--- a/extensions/libip6t_DNPT.t
+++ b/extensions/libip6t_DNPT.t
@@ -1,5 +1,6 @@
 :PREROUTING
 *mangle
+-j DNPT --src-pfx dead::/64 --dst-pfx 1c3::/64;=;OK
 -j DNPT --src-pfx dead::beef --dst-pfx 1c3::/64;;FAIL
 -j DNPT --src-pfx dead::/64;;FAIL
 -j DNPT --dst-pfx dead::/64;;FAIL
diff --git a/extensions/libip6t_SNPT.c b/extensions/libip6t_SNPT.c
index 4f10de0..65f787d 100644
--- a/extensions/libip6t_SNPT.c
+++ b/extensions/libip6t_SNPT.c
@@ -52,9 +52,9 @@ static void SNPT_print(const void *ip, const struct xt_entry_target *target,
 {
 	const struct ip6t_npt_tginfo *npt = (const void *)target->data;
 
-	printf("src-pfx %s/%u ", xtables_ip6addr_to_numeric(&npt->src_pfx.in6),
+	printf(" SNPT src-pfx %s/%u", xtables_ip6addr_to_numeric(&npt->src_pfx.in6),
 				 npt->src_pfx_len);
-	printf("dst-pfx %s/%u ", xtables_ip6addr_to_numeric(&npt->dst_pfx.in6),
+	printf(" dst-pfx %s/%u", xtables_ip6addr_to_numeric(&npt->dst_pfx.in6),
 				 npt->dst_pfx_len);
 }
 
@@ -65,12 +65,12 @@ static void SNPT_save(const void *ip, const struct xt_entry_target *target)
 
 	if (memcmp(&info->src_pfx.in6, &zero_addr, sizeof(zero_addr)) != 0 ||
 	    info->src_pfx_len != 0)
-		printf("--src-pfx %s/%u ",
+		printf(" --src-pfx %s/%u",
 		       xtables_ip6addr_to_numeric(&info->src_pfx.in6),
 		       info->src_pfx_len);
 	if (memcmp(&info->dst_pfx.in6, &zero_addr, sizeof(zero_addr)) != 0 ||
 	    info->dst_pfx_len != 0)
-		printf("--dst-pfx %s/%u ",
+		printf(" --dst-pfx %s/%u",
 		       xtables_ip6addr_to_numeric(&info->dst_pfx.in6),
 		       info->dst_pfx_len);
 }
diff --git a/extensions/libip6t_SNPT.t b/extensions/libip6t_SNPT.t
index 5a2fe7f..7ed6d0c 100644
--- a/extensions/libip6t_SNPT.t
+++ b/extensions/libip6t_SNPT.t
@@ -1,5 +1,6 @@
 :INPUT,POSTROUTING
 *mangle
+-j SNPT --src-pfx dead::/64 --dst-pfx 1c3::/64;=;OK
 -j SNPT --src-pfx dead::beef --dst-pfx 1c3::/64;;FAIL
 -j SNPT --src-pfx dead::/64;;FAIL
 -j SNPT --dst-pfx dead::/64;;FAIL
-- 
2.0.5


  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 ` Florian Westphal [this message]
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 ` [PATCH 7/7] extensions: libip6t_dst: make inversion work Florian Westphal
2015-02-19 13:33   ` 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-6-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).