netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH iptables-nft] iptables-nft: exit nonzero when iptables-save cannot decode all expressions
Date: Wed, 23 Nov 2022 15:00:59 +0100	[thread overview]
Message-ID: <Y34nm0mdezcnTAKT@orbyte.nwl.cc> (raw)
In-Reply-To: <20221123134929.4700-1-fw@strlen.de>

On Wed, Nov 23, 2022 at 02:49:29PM +0100, Florian Westphal wrote:
> We always return 0, even if we printed some error message half-way.
> Increment an error counter whenever an error message was printed so that
> the chain-loop can exit with an error if this counter is nonzero.
> 
> Another effect is that iptables-restore won't have a chance to print the
                                  ~~~~~~~
*save?

[...]
> diff --git a/iptables/nft.c b/iptables/nft.c
> index 4c0110bb8040..67c5877ce9cc 100644
> --- a/iptables/nft.c
> +++ b/iptables/nft.c
[...]
> @@ -1919,6 +1927,9 @@ int nft_rule_save(struct nft_handle *h, const char *table, unsigned int format)
>  
>  	ret = nft_chain_foreach(h, table, nft_rule_save_cb, &d);
>  
> +	if (ret == 0 && d.errors)
> +		xtables_error(VERSION_PROBLEM, "Cannot decode all rules provided by kernel");

*by the kernel?

My English is certainly worse than yours, though. :D

Apart from that,

Acked-by: Phil Sutter <phil@nwl.cc>

Thanks!

      reply	other threads:[~2022-11-23 14:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 13:49 [PATCH iptables-nft] iptables-nft: exit nonzero when iptables-save cannot decode all expressions Florian Westphal
2022-11-23 14:00 ` Phil Sutter [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=Y34nm0mdezcnTAKT@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=fw@strlen.de \
    --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).