From 83241d3f173dd57c3fdc347490213776a070fa40 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Wed, 23 Nov 2022 14:44:22 +0100 Subject: iptables-nft: exit nonzero when iptables-save cannot decode all expressions 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-save will no longer print the COMMIT line anmore. Reported-by: Phil Sutter Signed-off-by: Florian Westphal Acked-by: Phil Sutter --- iptables/nft-bridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'iptables/nft-bridge.c') diff --git a/iptables/nft-bridge.c b/iptables/nft-bridge.c index e8ac7a36..4367d072 100644 --- a/iptables/nft-bridge.c +++ b/iptables/nft-bridge.c @@ -563,12 +563,12 @@ static void nft_bridge_parse_target(struct xtables_target *t, cs->jumpto = t->name; } -static void nft_rule_to_ebtables_command_state(struct nft_handle *h, +static bool nft_rule_to_ebtables_command_state(struct nft_handle *h, const struct nftnl_rule *r, struct iptables_command_state *cs) { cs->eb.bitmask = EBT_NOPROTO; - nft_rule_to_iptables_command_state(h, r, cs); + return nft_rule_to_iptables_command_state(h, r, cs); } static void print_iface(const char *option, const char *name, bool invert) -- cgit v1.2.3