]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
cache: properly invoke change_cb for deleted objects in nl_cache_resync()
authorPatrick McHardy <kaber@trash.net>
Wed, 7 Apr 2010 17:16:22 +0000 (19:16 +0200)
committerThomas Graf <tgraf@suug.ch>
Mon, 19 Apr 2010 10:42:27 +0000 (12:42 +0200)
When resyncing a cache, there are no delete messages, so they need to
be synthesized for deleted objects.

Signed-off-by: Patrick McHardy <kaber@trash.net>
lib/cache.c

index 1d44390bbb3197d7ce264989ed1994fc7e5360ed..5fab32a33406115897542ea412d8fd0d70e3be76 100644 (file)
@@ -605,9 +605,15 @@ int nl_cache_resync(struct nl_sock *sk, struct nl_cache *cache,
        if (err < 0)
                goto errout;
 
-       nl_list_for_each_entry_safe(obj, next, &cache->c_items, ce_list)
-               if (nl_object_is_marked(obj))
+       nl_list_for_each_entry_safe(obj, next, &cache->c_items, ce_list) {
+               if (nl_object_is_marked(obj)) {
+                       nl_object_get(obj);
                        nl_cache_remove(obj);
+                       if (change_cb)
+                               change_cb(cache, obj, NL_ACT_DEL);
+                       nl_object_put(obj);
+               }
+       }
 
        NL_DBG(1, "Finished resyncing %p <%s>\n", cache, nl_cache_name(cache));