All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shivani Bhardwaj <shivanib134@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 2/2] extensions: libxt_comment: Add translation to nft
Date: Fri, 25 Dec 2015 23:23:36 +0530	[thread overview]
Message-ID: <CAKHNQQG-DRNCewwgiYn1JPzxb8Xbr60i+W2bEPLEUcg1jz9d3Q@mail.gmail.com> (raw)
In-Reply-To: <20151222170401.GA20918@salvia>

On Tue, Dec 22, 2015 at 10:34 PM, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> 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.

Is removing counter at all for this one going to be a good option?

      reply	other threads:[~2015-12-25 17:53 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
2015-12-25 17:53     ` Shivani Bhardwaj [this message]

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=CAKHNQQG-DRNCewwgiYn1JPzxb8Xbr60i+W2bEPLEUcg1jz9d3Q@mail.gmail.com \
    --to=shivanib134@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.