[nft PATCH 4/4] cache: Tolerate object deserialization failures

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

 



If netlink_delinearize_obj() fails, it will print an error message. Skip
this object and keep going.

Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 src/cache.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/cache.c b/src/cache.c
index e89acdf55a9b0..3ac819cf68fb7 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -871,12 +871,11 @@ static int obj_cache_cb(struct nftnl_obj *nlo, void *arg)
 		return 0;
 
 	obj = netlink_delinearize_obj(ctx->nlctx, nlo);
-	if (!obj)
-		return -1;
-
-	obj_name = nftnl_obj_get_str(nlo, NFTNL_OBJ_NAME);
-	hash = djb_hash(obj_name) % NFT_CACHE_HSIZE;
-	cache_add(&obj->cache, &ctx->table->obj_cache, hash);
+	if (obj) {
+		obj_name = nftnl_obj_get_str(nlo, NFTNL_OBJ_NAME);
+		hash = djb_hash(obj_name) % NFT_CACHE_HSIZE;
+		cache_add(&obj->cache, &ctx->table->obj_cache, hash);
+	}
 
 	nftnl_obj_list_del(nlo);
 	nftnl_obj_free(nlo);
-- 
2.49.0





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux