netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Shivani Bhardwaj <shivanib134@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 2/2] extensions: libxt_comment: Add translation to nft
Date: Tue, 22 Dec 2015 18:04:01 +0100	[thread overview]
Message-ID: <20151222170401.GA20918@salvia> (raw)
In-Reply-To: <bfd658a271224fa7f3cbab52868300f3fbb1caa8.1450779140.git.shivanib134@gmail.com>

On Tue, Dec 22, 2015 at 03:48:34PM +0530, Shivani Bhardwaj wrote:
> Add translation for comment module to nftables.
> 
> Examples:
> 
> $ sudo iptables-translate -A INPUT -m comment --comment "random comment"
> nft add rule ip filter INPUT counter comment \"random comment\"
> 
> $ sudo iptables-translate -A INPUT -i eth1 -m comment --comment "Local LAN"
> nft add rule ip filter INPUT iifname eth1 counter comment \"Local LAN\"
> 
> Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
> ---
>  extensions/libxt_comment.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/extensions/libxt_comment.c b/extensions/libxt_comment.c
> index 6ed2ff9..bbbd6cb 100644
> --- a/extensions/libxt_comment.c
> +++ b/extensions/libxt_comment.c
> @@ -48,6 +48,18 @@ comment_save(const void *ip, const struct xt_entry_match *match)
>  	xtables_save_string(commentinfo->comment);
>  }
>  
> +static int
> +comment_xlate(const struct xt_entry_match *match,
> +	      struct xt_buf *buf, int numeric)
> +{
> +	struct xt_comment_info *commentinfo = (void *)match->data;
> +
> +	commentinfo->comment[XT_MAX_COMMENT_LEN-1] = '\0';
> +	xt_buf_add(buf, "counter comment \\\"%s\\\" ", commentinfo->comment);
                         ^^^^^^^

We have to find a better way to fix this from the core infrastructure.

  reply	other threads:[~2015-12-22 17:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22 10:17 [PATCH 0/2] Add syntax and translation for comment module Shivani Bhardwaj
2015-12-22 10:18 ` [PATCH 1/2] iptables: nft-ipv4: Remove suffix counter " Shivani Bhardwaj
2015-12-22 10:18 ` [PATCH 2/2] extensions: libxt_comment: Add translation to nft Shivani Bhardwaj
2015-12-22 17:04   ` Pablo Neira Ayuso [this message]
2015-12-25 17:53     ` Shivani Bhardwaj

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=20151222170401.GA20918@salvia \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=shivanib134@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).