All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harsha Sharma <harshasharmaiitr@gmail.com>
To: Adel Belhouane <bugs.a.b@free.fr>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] src: print 'handle' attribute in tables
Date: Sun, 24 Dec 2017 20:27:16 +0530	[thread overview]
Message-ID: <CANMOCy03a3bNyVe4zhrishJ+n2WrQ45+k2mDqJRH=Vjxr2g9Xg@mail.gmail.com> (raw)
In-Reply-To: <50aa4371-2e39-9a95-89db-01d77dca18e4@free.fr>

On Sun, Dec 24, 2017 at 8:07 PM, Adel Belhouane <bugs.a.b@free.fr> wrote:
> Hello,
>
> Le 23/12/2017 à 20:45, Harsha Sharma a écrit :
>> Print 'handle' attribute in tables, when listing via '-a' option
>>
>> For eg.
>> nft list ruleset -a
>>
>> table ip test-ip4 {
>>       chain input {
>>               ip saddr 8.8.8.8 counter packets 0 bytes 0 # handle 3
>>       }
>>  # handle 1}
>
> [...]
>
>> diff --git a/src/rule.c b/src/rule.c
>> index bb9add0..e875816 100644
>> --- a/src/rule.c
>> +++ b/src/rule.c
>> @@ -820,6 +820,8 @@ static void table_print(const struct table *table, struct output_ctx *octx)
>>               chain_print(chain, octx);
>>               delim = "\n";
>>       }
>> +     if (octx->handle > 0)
>> +             nft_print(octx, " # handle %" PRIu64, table->handle.handle.id);
>>       nft_print(octx, "}\n");
>>  }
>>
>>
>
> I'm wonderning if it wouldn't be easier (for something parsing "nft list ruleset -a" 's output) to have the " # handle ..." after the closing brace instead of before. It makes sence to consider "#" as a start of comment until end of line, and in such case the last "}" would be in the comment and missing (for something choosing to ignore all such "comments").
>
> So the example would become instead:
>
> nft list ruleset -a
>
> table ip test-ip4 {
>         chain input {
>                 ip saddr 8.8.8.8 counter packets 0 bytes 0 # handle 3
>         }
> } # handle 1
>
> What do you think?
>

Yes.Makes sense to me.
Thanks.

> regards,
> Adel Belhouane.

      reply	other threads:[~2017-12-24 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-23 19:45 [PATCH] src: print 'handle' attribute in tables Harsha Sharma
2017-12-24 14:37 ` Adel Belhouane
2017-12-24 14:57   ` Harsha Sharma [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='CANMOCy03a3bNyVe4zhrishJ+n2WrQ45+k2mDqJRH=Vjxr2g9Xg@mail.gmail.com' \
    --to=harshasharmaiitr@gmail.com \
    --cc=bugs.a.b@free.fr \
    --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.