summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/netlink-private/types.h1
-rw-r--r--lib/cache.c18
2 files changed, 16 insertions, 3 deletions
diff --git a/include/netlink-private/types.h b/include/netlink-private/types.h
index 0f67ddd..ad1a6d0 100644
--- a/include/netlink-private/types.h
+++ b/include/netlink-private/types.h
@@ -114,6 +114,7 @@ struct nl_parser_param;
#define ID_COMPARISON 2
#define NL_OBJ_MARK 1
+#define NL_OBJ_DUMP 2 /* object received due to a dump */
struct nl_data
{
diff --git a/lib/cache.c b/lib/cache.c
index 9aba0c9..ba5fa72 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -714,6 +714,7 @@ static int pickup_checkdup_cb(struct nl_object *c, struct nl_parser_param *p)
{
struct nl_cache *cache = (struct nl_cache *)p->pp_arg;
struct nl_object *old;
+ int ret;
old = nl_cache_search(cache, c);
if (old) {
@@ -726,7 +727,11 @@ static int pickup_checkdup_cb(struct nl_object *c, struct nl_parser_param *p)
nl_object_put(old);
}
- return nl_cache_add(cache, c);
+ c->ce_flags |= NL_OBJ_DUMP;
+ ret = nl_cache_add(cache, c);
+ c->ce_flags &= ~NL_OBJ_DUMP;
+
+ return ret;
}
static int pickup_cb(struct nl_object *c, struct nl_parser_param *p)
@@ -783,8 +788,10 @@ int nl_cache_pickup(struct nl_sock *sk, struct nl_cache *cache)
return __nl_cache_pickup(sk, cache, 0);
}
+
static int cache_include(struct nl_cache *cache, struct nl_object *obj,
- struct nl_msgtype *type, change_func_t cb, void *data)
+ struct nl_msgtype *type, change_func_t cb,
+ void *data)
{
struct nl_object *old;
@@ -856,8 +863,13 @@ int nl_cache_include(struct nl_cache *cache, struct nl_object *obj,
static int resync_cb(struct nl_object *c, struct nl_parser_param *p)
{
struct nl_cache_assoc *ca = p->pp_arg;
+ int ret;
+
+ c->ce_flags |= NL_OBJ_DUMP;
+ ret = nl_cache_include(ca->ca_cache, c, ca->ca_change, ca->ca_change_data);
+ c->ce_flags &= ~NL_OBJ_DUMP;
- return nl_cache_include(ca->ca_cache, c, ca->ca_change, ca->ca_change_data);
+ return ret;
}
int nl_cache_resync(struct nl_sock *sk, struct nl_cache *cache,