cache: Return -NLE_PROTO_MISMATCH if socket provided mismatches cache protocol

Signed-off-by: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
Thomas Graf 2013-06-29 22:29:43 +02:00
parent 2d0810eb93
commit 408a1b8f07

View file

@ -642,6 +642,9 @@ void nl_cache_set_flags(struct nl_cache *cache, unsigned int flags)
static int nl_cache_request_full_dump(struct nl_sock *sk,
struct nl_cache *cache)
{
if (sk->s_proto != cache->c_ops->co_protocol)
return -NLE_PROTO_MISMATCH;
if (cache->c_ops->co_request_update == NULL)
return -NLE_OPNOTSUPP;
@ -744,6 +747,9 @@ int nl_cache_pickup(struct nl_sock *sk, struct nl_cache *cache)
.pp_arg = cache,
};
if (sk->s_proto != cache->c_ops->co_protocol)
return -NLE_PROTO_MISMATCH;
return __cache_pickup(sk, cache, &p);
}
@ -840,6 +846,9 @@ int nl_cache_resync(struct nl_sock *sk, struct nl_cache *cache,
};
int err;
if (sk->s_proto != cache->c_ops->co_protocol)
return -NLE_PROTO_MISMATCH;
NL_DBG(1, "Resyncing cache %p <%s>...\n", cache, nl_cache_name(cache));
/* Mark all objects so we can see if some of them are obsolete */
@ -953,6 +962,9 @@ int nl_cache_refill(struct nl_sock *sk, struct nl_cache *cache)
struct nl_af_group *grp;
int err;
if (sk->s_proto != cache->c_ops->co_protocol)
return -NLE_PROTO_MISMATCH;
nl_cache_clear(cache);
grp = cache->c_ops->co_groups;
do {