From patchwork Sat Jul 6 15:56:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Oester X-Patchwork-Id: 257291 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id DE03C2C0090 for ; Sun, 7 Jul 2013 01:56:04 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751900Ab3GFP4C (ORCPT ); Sat, 6 Jul 2013 11:56:02 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:46000 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751268Ab3GFP4B (ORCPT ); Sat, 6 Jul 2013 11:56:01 -0400 Received: by mail-pd0-f169.google.com with SMTP id y10so2818445pdj.28 for ; Sat, 06 Jul 2013 08:56:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-gm-message-state; bh=HTRb7dKacPyG0BPSyUBFk4VDGBErAIk81SdSvV6LAdQ=; b=SYrF5iz1HXYHOFym0dxSs44H6Tj3QxxBuCrLdZmrZbh9nkb4gZB98nHATazrBoeq6J BAeocdd8MdtagdmRylT0gA4A0ZcFsHzMTI0qkMRsJ17W8E3SeibGg7UueDlN9ZBrt/oe 86rl2KU9TMXQj17zSVnh5W3LXSHxMzM9HUqc2bO0DMqS1MfTdGLbEt+xxrS6kSArfWFv mrKMXudbecJvFFLysQSv6QOQ3gAwRmhIp7IyHfqtRRF/vloWu6w+qxC6OKQXYloQdWvC b74vQbnox3yVcHRk3PZZFC+egYyODjIqEztyRPLDXhI7OUSUVBgBY/r0EH0uf6zungLO tqgg== X-Received: by 10.66.249.202 with SMTP id yw10mr15627586pac.145.1373126160935; Sat, 06 Jul 2013 08:56:00 -0700 (PDT) Received: from linuxace.com (cpe-76-171-169-87.socal.res.rr.com. [76.171.169.87]) by mx.google.com with ESMTPSA id rb1sm411029pbb.29.2013.07.06.08.55.59 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 06 Jul 2013 08:56:00 -0700 (PDT) Date: Sat, 6 Jul 2013 08:56:01 -0700 From: Phil Oester To: Scott Baillie Cc: "netfilter-devel@vger.kernel.org" Subject: Re: ip6tables-save LOG target output is different to iptables-save Message-ID: <20130706155601.GA31065@linuxace.com> References: <20130706044121.GA15084@linuxace.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQl3v5y92CJ1CFst6Jabq6aHtsd5ZWN7vgHLPtUH9nGJ56h5bmHtp5KWFWeNGqxiUOLkn+q5 Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org 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 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);