+// SPDX-License-Identifier: GPL-2.0-or-later
/* NHRP peer functions
* Copyright (c) 2014-2015 Timo Teräs
- *
- * This file is free software: you may copy, redistribute and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
*/
#ifdef HAVE_CONFIG_H
#include "memory.h"
#include "thread.h"
#include "hash.h"
+#include "network.h"
#include "nhrpd.h"
#include "nhrp_protocol.h"
XFREE(MTYPE_NHRP_PEER, p);
}
-static int nhrp_peer_notify_up(struct thread *t)
+static void nhrp_peer_notify_up(struct thread *t)
{
struct nhrp_peer *p = THREAD_ARG(t);
struct nhrp_vc *vc = p->vc;
notifier_call(&p->notifier_list, NOTIFY_PEER_UP);
nhrp_peer_unref(p);
}
-
- return 0;
}
static void __nhrp_peer_check(struct nhrp_peer *p)
}
}
-static int nhrp_peer_request_timeout(struct thread *t)
+static void nhrp_peer_request_timeout(struct thread *t)
{
struct nhrp_peer *p = THREAD_ARG(t);
struct nhrp_vc *vc = p->vc;
if (p->online)
- return 0;
+ return;
if (nifp->ipsec_fallback_profile && !p->prio
&& !p->fallback_requested) {
} else {
p->requested = p->fallback_requested = 0;
}
-
- return 0;
}
-static int nhrp_peer_defer_vici_request(struct thread *t)
+static void nhrp_peer_defer_vici_request(struct thread *t)
{
struct nhrp_peer *p = THREAD_ARG(t);
struct nhrp_vc *vc = p->vc;
(nifp->ipsec_fallback_profile && !p->prio) ? 15 : 30,
&p->t_fallback);
}
- return 0;
}
int nhrp_peer_check(struct nhrp_peer *p, int establish)
&p->t_fallback);
} else {
/* Maximum timeout is 1 second */
- int r_time_ms = rand() % 1000;
+ int r_time_ms = frr_weak_random() % 1000;
debugf(NHRP_DEBUG_COMMON,
"Initiating IPsec connection request to %pSU after %d ms:",
static void nhrp_packet_debug(struct zbuf *zb, const char *dir)
{
- char buf[2][SU_ADDRSTRLEN];
union sockunion src_nbma, src_proto, dst_proto;
struct nhrp_packet_header *hdr;
struct zbuf zhdr;
zbuf_init(&zhdr, zb->buf, zb->tail - zb->buf, zb->tail - zb->buf);
hdr = nhrp_packet_pull(&zhdr, &src_nbma, &src_proto, &dst_proto);
- sockunion2str(&src_proto, buf[0], sizeof(buf[0]));
- sockunion2str(&dst_proto, buf[1], sizeof(buf[1]));
-
reply = packet_types[hdr->type].type == PACKET_REPLY;
- debugf(NHRP_DEBUG_COMMON, "%s %s(%d) %s -> %s", dir,
+ debugf(NHRP_DEBUG_COMMON, "%s %s(%d) %pSU -> %pSU", dir,
(packet_types[hdr->type].name ? packet_types[hdr->type].name
: "Unknown"),
- hdr->type, reply ? buf[1] : buf[0], reply ? buf[0] : buf[1]);
+ hdr->type, reply ? &dst_proto : &src_proto,
+ reply ? &src_proto : &dst_proto);
}
static int proto2afi(uint16_t proto)