]> git.proxmox.com Git - mirror_frr.git/blobdiff - nhrpd/nhrp_cache.c
Merge pull request #3515 from mjstapp/fix_rib_wq_timer
[mirror_frr.git] / nhrpd / nhrp_cache.c
index ffc8b5a9bf80a7295e5415377dbf173d73e94d1b..1316a4aad3a6d759649bfc8b7c87f90dfa960570 100644 (file)
@@ -36,10 +36,12 @@ static unsigned int nhrp_cache_protocol_key(void *peer_data)
        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);
 }
 
@@ -48,17 +50,16 @@ static void *nhrp_cache_alloc(void *data)
        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;
 }