From: Phil Sutter Date: Fri, 16 May 2025 17:36:37 +0000 (+0200) Subject: cache: Tolerate object deserialization failures X-Git-Tag: v1.1.4~76 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=610089f273c968c983d965f3cac42e4d9784cde8;p=thirdparty%2Fnftables.git cache: Tolerate object deserialization failures If netlink_delinearize_obj() fails, it will print an error message. Skip this object and keep going. Signed-off-by: Phil Sutter Reviewed-by: Pablo Neira Ayuso --- diff --git a/src/cache.c b/src/cache.c index e89acdf5..3ac819cf 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);