netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Cc: netfilter-devel@vger.kernel.org, anayrey@gmail.com
Subject: Re: [libnftnl PATCH 1/3] expr: masq: optional printing of flags attr in snprintf_default
Date: Fri, 3 Oct 2014 14:05:33 +0200	[thread overview]
Message-ID: <20141003120533.GA10433@salvia> (raw)
In-Reply-To: <20141002115836.10972.3637.stgit@nfdev.cica.es>

On Thu, Oct 02, 2014 at 01:58:36PM +0200, Arturo Borrero Gonzalez wrote:
> The flags attribute is optional. Thus we should print only if it
> was originally set.

Applied with nitpick.

> Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
> ---
>  0 files changed
> 
> diff --git a/src/expr/masq.c b/src/expr/masq.c
> index 6a1c609..c8a6a8d 100644
> --- a/src/expr/masq.c
> +++ b/src/expr/masq.c
> @@ -169,8 +169,10 @@ static int nft_rule_expr_masq_snprintf_default(char *buf, size_t len,
>  {
>  	struct nft_expr_masq *masq = nft_expr_data(e);
>  
> -	return snprintf(buf, len, " flags %u ",
> -			 masq->flags);
> +	if (e->flags & (1 << NFT_EXPR_MASQ_FLAGS))
> +		return snprintf(buf, len, "flags %u", masq->flags);
                                                   ^
                                      missing space there.

Otherwise the output shows flags 0].

And change it to use %x. Hex is better for flags.

      parent reply	other threads:[~2014-10-03 12:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-02 11:58 [libnftnl PATCH 1/3] expr: masq: optional printing of flags attr in snprintf_default Arturo Borrero Gonzalez
2014-10-02 11:58 ` [libnftnl PATCH 2/3] tests: add tests for the masq expression Arturo Borrero Gonzalez
2014-10-03 12:08   ` Pablo Neira Ayuso
2014-10-02 11:58 ` [libnftnl PATCH 3/3] tests: also test nat's flags attribute Arturo Borrero Gonzalez
2014-10-03 12:08   ` Pablo Neira Ayuso
2014-10-03 12:05 ` Pablo Neira Ayuso [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=20141003120533.GA10433@salvia \
    --to=pablo@netfilter.org \
    --cc=anayrey@gmail.com \
    --cc=arturo.borrero.glez@gmail.com \
    --cc=netfilter-devel@vger.kernel.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).