* (at your option) any later version.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <netinet/if_ether.h>
#include "zebra.h"
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;
}
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;
}
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)