netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Oester <kernel@linuxace.com>
To: Scott Baillie <scott.a.baillie@gmail.com>
Cc: "netfilter-devel@vger.kernel.org" <netfilter-devel@vger.kernel.org>
Subject: Re: ip6tables-save LOG target output is different to iptables-save
Date: Sat, 6 Jul 2013 08:56:01 -0700	[thread overview]
Message-ID: <20130706155601.GA31065@linuxace.com> (raw)
In-Reply-To: <CAC+BxFovBteFJQ=K7LHPX47CxAAbGpBuzCvdTdsU00AvxJ-pag@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 534 bytes --]

On Sat, Jul 06, 2013 at 03:07:15PM +1000, Scott Baillie wrote:
> It just makes it a little bit harder to parse the output , because
> both tools should produce the same output
> wherever possible in my opinion.

Agreed.  Patch follows which makes the two tools consistent, however
they will now both not quote the prefix if only one word is present.

libipt_LOG is using the xtables_save_string func, which escapes unsafe
characters as needed.  libip6t_LOG should do the same.

Phil

Signed-off-by: Phil Oester <kernel@linuxace.com>


[-- Attachment #2: patch-ip6ts-log --]
[-- Type: text/plain, Size: 640 bytes --]

diff --git a/extensions/libip6t_LOG.c b/extensions/libip6t_LOG.c
index 2b1ae28..4639268 100644
--- a/extensions/libip6t_LOG.c
+++ b/extensions/libip6t_LOG.c
@@ -146,8 +146,10 @@ static void LOG_save(const void *ip, const struct xt_entry_target *target)
 	const struct ip6t_log_info *loginfo
 		= (const struct ip6t_log_info *)target->data;
 
-	if (strcmp(loginfo->prefix, "") != 0)
-		printf(" --log-prefix \"%s\"", loginfo->prefix);
+	if (strcmp(loginfo->prefix, "") != 0) {
+		printf(" --log-prefix");
+		xtables_save_string(loginfo->prefix);
+	}
 
 	if (loginfo->level != LOG_DEFAULT_LEVEL)
 		printf(" --log-level %d", loginfo->level);

  reply	other threads:[~2013-07-06 15:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-06  3:42 ip6tables-save LOG target output is different to iptables-save Scott Baillie
2013-07-06  4:41 ` Phil Oester
2013-07-06  5:07   ` Scott Baillie
2013-07-06 15:56     ` Phil Oester [this message]
2013-07-15 10:51       ` Pablo Neira Ayuso

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=20130706155601.GA31065@linuxace.com \
    --to=kernel@linuxace.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=scott.a.baillie@gmail.com \
    /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).