return sockunion_hash(&p->remote_addr);
}
-static int nhrp_cache_protocol_cmp(const void *cache_data, const void *key_data)
+static bool nhrp_cache_protocol_cmp(const void *cache_data,
+ const void *key_data)
{
const struct nhrp_cache *a = cache_data;
const struct nhrp_cache *b = key_data;
+
return sockunion_same(&a->remote_addr, &b->remote_addr);
}
struct nhrp_cache *p, *key = data;
p = XMALLOC(MTYPE_NHRP_CACHE, sizeof(struct nhrp_cache));
- if (p) {
- *p = (struct nhrp_cache){
- .cur.type = NHRP_CACHE_INVALID,
- .new.type = NHRP_CACHE_INVALID,
- .remote_addr = key->remote_addr,
- .ifp = key->ifp,
- .notifier_list =
- NOTIFIER_LIST_INITIALIZER(&p->notifier_list),
- };
- nhrp_cache_counts[p->cur.type]++;
- }
+
+ *p = (struct nhrp_cache){
+ .cur.type = NHRP_CACHE_INVALID,
+ .new.type = NHRP_CACHE_INVALID,
+ .remote_addr = key->remote_addr,
+ .ifp = key->ifp,
+ .notifier_list =
+ NOTIFIER_LIST_INITIALIZER(&p->notifier_list),
+ };
+ nhrp_cache_counts[p->cur.type]++;
return p;
}