]> git.proxmox.com Git - mirror_frr.git/blobdiff - nhrpd/nhrp_peer.c
staticd: Do not ready prefix for printing till it's decoded
[mirror_frr.git] / nhrpd / nhrp_peer.c
index 8952a282e904ec42ada73237da520bc0b29c1525..db2f72ac2211e4d4e19ba320c9e51f6448f151c9 100644 (file)
@@ -7,6 +7,10 @@
  * (at your option) any later version.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <netinet/if_ether.h>
 
 #include "zebra.h"
@@ -153,10 +157,11 @@ static unsigned int nhrp_peer_key(void *peer_data)
        return sockunion_hash(&p->vc->remote.nbma);
 }
 
-static int nhrp_peer_cmp(const void *cache_data, const void *key_data)
+static bool nhrp_peer_cmp(const void *cache_data, const void *key_data)
 {
        const struct nhrp_peer *a = cache_data;
        const struct nhrp_peer *b = key_data;
+
        return a->ifp == b->ifp && a->vc == b->vc;
 }
 
@@ -165,18 +170,18 @@ static void *nhrp_peer_create(void *data)
        struct nhrp_peer *p, *key = data;
 
        p = XMALLOC(MTYPE_NHRP_PEER, sizeof(*p));
-       if (p) {
-               *p = (struct nhrp_peer){
-                       .ref = 0,
-                       .ifp = key->ifp,
-                       .vc = key->vc,
-                       .notifier_list =
-                               NOTIFIER_LIST_INITIALIZER(&p->notifier_list),
-               };
-               nhrp_vc_notify_add(p->vc, &p->vc_notifier, nhrp_peer_vc_notify);
-               nhrp_interface_notify_add(p->ifp, &p->ifp_notifier,
-                                         nhrp_peer_ifp_notify);
-       }
+
+       *p = (struct nhrp_peer){
+               .ref = 0,
+               .ifp = key->ifp,
+               .vc = key->vc,
+               .notifier_list =
+               NOTIFIER_LIST_INITIALIZER(&p->notifier_list),
+       };
+       nhrp_vc_notify_add(p->vc, &p->vc_notifier, nhrp_peer_vc_notify);
+       nhrp_interface_notify_add(p->ifp, &p->ifp_notifier,
+                                 nhrp_peer_ifp_notify);
+
        return p;
 }
 
@@ -810,8 +815,9 @@ static void nhrp_packet_debug(struct zbuf *zb, const char *dir)
 
        reply = packet_types[hdr->type].type == PACKET_REPLY;
        debugf(NHRP_DEBUG_COMMON, "%s %s(%d) %s -> %s", dir,
-              packet_types[hdr->type].name ?: "Unknown", hdr->type,
-              reply ? buf[1] : buf[0], reply ? buf[0] : buf[1]);
+              (packet_types[hdr->type].name ? packet_types[hdr->type].name
+                                            : "Unknown"),
+              hdr->type, reply ? buf[1] : buf[0], reply ? buf[0] : buf[1]);
 }
 
 static int proto2afi(uint16_t proto)