From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Eric Leblond <eric@regit.org>, netfilter-devel@vger.kernel.org
Subject: Re: [nft PATCH v2 2/2] src: get rid of printf
Date: Thu, 21 Sep 2017 17:37:45 +0200 [thread overview]
Message-ID: <20170921153745.GX30364@orbyte.nwl.cc> (raw)
In-Reply-To: <20170904205304.GA14816@salvia>
Hi,
On Mon, Sep 04, 2017 at 10:53:04PM +0200, Pablo Neira Ayuso wrote:
> On Mon, Sep 04, 2017 at 10:43:48PM +0200, Pablo Neira Ayuso wrote:
> > On Mon, Sep 04, 2017 at 09:55:58AM +0200, Eric Leblond wrote:
> > > This patch introduces the nft_print function that has to be used
> > > instead of printf to output information that were previously send
> > > to stdout. This function accumulate the output in a buffer that can
> > > be fetched by the user with the nft_ctx_get_output() function.
> > >
> > > This modification will allow the libnftables library to provide an
> > > easy way to the users to get the output data and display them like
> > > they want.
> >
> > tests/shell/./run-tests
> >
> > is reporting problems with this :-(
>
> Eric, I can also see there are missing printf() to nft_print()
> conversion on the monitor side.
>
> I would expect the simple API works like this: if you pass the
> "monitor" command, it justs prints events to whatever destination you
> have specified.
>
> This is the most simple integration that makes sense to me.
>
> Therefore, I think it would be good to convert those too to use
> nft_print().
>
> Let me know, thanks.
With the proposed implementation of nft_print(), this will be
problematic: nft_run_cmd_from_buffer() waits for the command to finish
before printing all the output at once. This obviously breaks monitor
which runs endlessly.
Maybe we should reference nft_print via a function pointer in
output_ctx? This would allow to configure a different nft_print
implementation which flushes the buffer to stdout immediately.
What do you think?
Cheers, Phil
next prev parent reply other threads:[~2017-09-21 15:37 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-03 22:03 [nft PATCH 0/2] libnftables preparation work Eric Leblond
2017-09-03 22:03 ` [nft PATCH 1/2] src: add flags fo nft_ctx_new Eric Leblond
2017-09-03 22:33 ` Pablo Neira Ayuso
2017-09-03 22:45 ` Pablo Neira Ayuso
2017-09-04 7:21 ` Eric Leblond
2017-09-03 22:03 ` [nft PATCH 2/2] src: get rid of printf Eric Leblond
2017-09-03 22:34 ` Pablo Neira Ayuso
2017-09-04 7:45 ` Eric Leblond
2017-09-04 7:55 ` [nft PATCH v2] libnftables preparation work Eric Leblond
2017-09-04 7:55 ` [nft PATCH v2 1/2] src: add flags fo nft_ctx_new Eric Leblond
2017-09-04 20:43 ` Pablo Neira Ayuso
2017-09-04 7:55 ` [nft PATCH v2 2/2] src: get rid of printf Eric Leblond
2017-09-04 20:43 ` Pablo Neira Ayuso
2017-09-04 20:53 ` Pablo Neira Ayuso
2017-09-04 21:23 ` Eric Leblond
2017-09-05 17:33 ` Pablo Neira Ayuso
2017-09-21 15:37 ` Phil Sutter [this message]
2017-09-21 15:43 ` Florian Westphal
2017-09-21 15:51 ` Pablo Neira Ayuso
2017-09-21 16:21 ` Phil Sutter
2017-09-21 17:05 ` Florian Westphal
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=20170921153745.GX30364@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=eric@regit.org \
--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 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).