diff mbox series

[nft] libnftables: Flush iface cache after command execution

Message ID 20171109122457.25190-1-phil@nwl.cc
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nft] libnftables: Flush iface cache after command execution | expand

Commit Message

Phil Sutter Nov. 9, 2017, 12:24 p.m. UTC
Commit 94a945ffa81b7 ("libnftables: Get rid of explicit cache flushes")
was a bit too optimistic in that it missed the remaining need to flush
interface cache after each command in interactive mode - otherwise,
newly added interfaces won't be recognized.

Although cli.c only calls nft_run_cmd_from_buffer(), flush caches in
nft_run_cmd_from_filename() as well for matters of consistency.

Fixes: 94a945ffa81b7 ("libnftables: Get rid of explicit cache flushes")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/libnftables.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Pablo Neira Ayuso Nov. 13, 2017, 12:36 p.m. UTC | #1
On Thu, Nov 09, 2017 at 01:24:57PM +0100, Phil Sutter wrote:
> Commit 94a945ffa81b7 ("libnftables: Get rid of explicit cache flushes")
> was a bit too optimistic in that it missed the remaining need to flush
> interface cache after each command in interactive mode - otherwise,
> newly added interfaces won't be recognized.
> 
> Although cli.c only calls nft_run_cmd_from_buffer(), flush caches in
> nft_run_cmd_from_filename() as well for matters of consistency.

Applied, thanks Phil.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/src/libnftables.c b/src/libnftables.c
index 0d04ec21d57d3..dc6a5fdf32640 100644
--- a/src/libnftables.c
+++ b/src/libnftables.c
@@ -290,6 +290,7 @@  int nft_run_cmd_from_buffer(struct nft_ctx *nft, char *buf, size_t buflen)
 	erec_print_list(&nft->output, &msgs, nft->debug_mask);
 	nft_ctx_set_output(nft, fp);
 	scanner_destroy(scanner);
+	iface_cache_release();
 
 	return rc;
 }
@@ -322,6 +323,7 @@  err:
 	erec_print_list(&nft->output, &msgs, nft->debug_mask);
 	nft_ctx_set_output(nft, fp);
 	scanner_destroy(scanner);
+	iface_cache_release();
 
 	return rc;
 }