[PATCH nft] rule: reset cache iff there is an existing cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If genid is unset, then do not reset existing cache. In the kernel,
generation ID is assumed to be always != zero.

This patch fixes:

	nft 'add table x; add chain x y;'

that allow us to send several commands in one single batch from the
command line.

Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
 src/rule.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/rule.c b/src/rule.c
index 4334efacbbdf..c65600364e7d 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -165,7 +165,9 @@ replay:
 	genid = netlink_genid_get(&ctx);
 	if (genid && genid == cache->genid)
 		return 0;
-	cache_release(cache);
+	if (cache->genid)
+		cache_release(cache);
+
 	ret = cache_init(&ctx, cmd);
 	if (ret < 0) {
 		cache_release(cache);
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux