summaryrefslogtreecommitdiff
path: root/nhrpd
diff options
context:
space:
mode:
Diffstat (limited to 'nhrpd')
-rw-r--r--nhrpd/netlink_arp.c2
-rw-r--r--nhrpd/nhrp_interface.c14
-rw-r--r--nhrpd/nhrp_nhs.c2
-rw-r--r--nhrpd/nhrp_route.c27
-rw-r--r--nhrpd/nhrp_shortcut.c28
5 files changed, 28 insertions, 45 deletions
diff --git a/nhrpd/netlink_arp.c b/nhrpd/netlink_arp.c
index cf338a0876..309f733526 100644
--- a/nhrpd/netlink_arp.c
+++ b/nhrpd/netlink_arp.c
@@ -257,7 +257,7 @@ static int netlink_log_recv(struct thread *t)
void netlink_set_nflog_group(int nlgroup)
{
if (netlink_log_fd >= 0) {
- THREAD_OFF(netlink_log_thread);
+ thread_cancel(&netlink_log_thread);
close(netlink_log_fd);
netlink_log_fd = -1;
}
diff --git a/nhrpd/nhrp_interface.c b/nhrpd/nhrp_interface.c
index 1e576fc5ac..0ed2371eb0 100644
--- a/nhrpd/nhrp_interface.c
+++ b/nhrpd/nhrp_interface.c
@@ -220,8 +220,8 @@ static void nhrp_interface_update_address(struct interface *ifp, afi_t afi,
/* On NHRP interfaces a host prefix is required */
if (best && if_ad->configured
&& best->address->prefixlen != 8 * prefix_blen(best->address)) {
- zlog_notice("%s: %s is not a host prefix", ifp->name,
- prefix2str(best->address, buf, sizeof(buf)));
+ zlog_notice("%s: %pFX is not a host prefix", ifp->name,
+ best->address);
best = NULL;
}
@@ -335,14 +335,13 @@ int nhrp_ifp_down(struct interface *ifp)
int nhrp_interface_address_add(ZAPI_CALLBACK_ARGS)
{
struct connected *ifc;
- char buf[PREFIX_STRLEN];
ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (ifc == NULL)
return 0;
- debugf(NHRP_DEBUG_IF, "if-addr-add: %s: %s", ifc->ifp->name,
- prefix2str(ifc->address, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_IF, "if-addr-add: %s: %pFX", ifc->ifp->name,
+ ifc->address);
nhrp_interface_update_address(
ifc->ifp, family2afi(PREFIX_FAMILY(ifc->address)), 0);
@@ -353,14 +352,13 @@ int nhrp_interface_address_add(ZAPI_CALLBACK_ARGS)
int nhrp_interface_address_delete(ZAPI_CALLBACK_ARGS)
{
struct connected *ifc;
- char buf[PREFIX_STRLEN];
ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (ifc == NULL)
return 0;
- debugf(NHRP_DEBUG_IF, "if-addr-del: %s: %s", ifc->ifp->name,
- prefix2str(ifc->address, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_IF, "if-addr-del: %s: %pFX", ifc->ifp->name,
+ ifc->address);
nhrp_interface_update_address(
ifc->ifp, family2afi(PREFIX_FAMILY(ifc->address)), 0);
diff --git a/nhrpd/nhrp_nhs.c b/nhrpd/nhrp_nhs.c
index 8509cedcee..085cab347f 100644
--- a/nhrpd/nhrp_nhs.c
+++ b/nhrpd/nhrp_nhs.c
@@ -137,7 +137,7 @@ static void nhrp_reg_peer_notify(struct notifier_block *n, unsigned long cmd)
debugf(NHRP_DEBUG_COMMON, "NHS: Flush timer for %s",
sockunion2str(&r->peer->vc->remote.nbma, buf,
sizeof(buf)));
- THREAD_TIMER_OFF(r->t_register);
+ THREAD_OFF(r->t_register);
thread_add_timer_msec(master, nhrp_reg_send_req, r, 10,
&r->t_register);
break;
diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c
index 0c5513b892..2bc2d91597 100644
--- a/nhrpd/nhrp_route.c
+++ b/nhrpd/nhrp_route.c
@@ -166,14 +166,13 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type,
}
if (unlikely(debug_flags & NHRP_DEBUG_ROUTE)) {
- char buf[2][PREFIX_STRLEN];
+ char buf[PREFIX_STRLEN];
- prefix2str(&api.prefix, buf[0], sizeof(buf[0]));
zlog_debug(
- "Zebra send: route %s %s nexthop %s metric %u count %d dev %s",
- add ? "add" : "del", buf[0],
+ "Zebra send: route %s %pFX nexthop %s metric %u count %d dev %s",
+ add ? "add" : "del", &api.prefix,
nexthop ? inet_ntop(api.prefix.family, &api_nh->gate,
- buf[1], sizeof(buf[1]))
+ buf, sizeof(buf))
: "<onlink>",
api.metric, api.nexthop_num, ifp ? ifp->name : "none");
}
@@ -188,7 +187,7 @@ int nhrp_route_read(ZAPI_CALLBACK_ARGS)
struct zapi_nexthop *api_nh;
struct interface *ifp = NULL;
union sockunion nexthop_addr;
- char buf[2][PREFIX_STRLEN];
+ char buf[PREFIX_STRLEN];
int added;
if (zapi_route_decode(zclient->ibuf, &api) < 0)
@@ -221,10 +220,9 @@ int nhrp_route_read(ZAPI_CALLBACK_ARGS)
}
added = (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD);
- debugf(NHRP_DEBUG_ROUTE, "if-route-%s: %s via %s dev %s",
- added ? "add" : "del",
- prefix2str(&api.prefix, buf[0], sizeof(buf[0])),
- sockunion2str(&nexthop_addr, buf[1], sizeof(buf[1])),
+ debugf(NHRP_DEBUG_ROUTE, "if-route-%s: %pFX via %s dev %s",
+ added ? "add" : "del", &api.prefix,
+ sockunion2str(&nexthop_addr, buf, sizeof(buf)),
ifp ? ifp->name : "(none)");
nhrp_route_update_zebra(&api.prefix, &nexthop_addr, ifp);
@@ -240,7 +238,6 @@ int nhrp_route_get_nexthop(const union sockunion *addr, struct prefix *p,
struct route_info *ri;
struct prefix lookup;
afi_t afi = family2afi(sockunion_family(addr));
- char buf[PREFIX_STRLEN];
sockunion2hostprefix(addr, &lookup);
@@ -250,8 +247,7 @@ int nhrp_route_get_nexthop(const union sockunion *addr, struct prefix *p,
ri = rn->info;
if (ri->nhrp_ifp) {
- debugf(NHRP_DEBUG_ROUTE, "lookup %s: nhrp_if=%s",
- prefix2str(&lookup, buf, sizeof(buf)),
+ debugf(NHRP_DEBUG_ROUTE, "lookup %pFX: nhrp_if=%s", &lookup,
ri->nhrp_ifp->name);
if (via)
@@ -259,9 +255,8 @@ int nhrp_route_get_nexthop(const union sockunion *addr, struct prefix *p,
if (ifp)
*ifp = ri->nhrp_ifp;
} else {
- debugf(NHRP_DEBUG_ROUTE, "lookup %s: zebra route dev %s",
- prefix2str(&lookup, buf, sizeof(buf)),
- ri->ifp ? ri->ifp->name : "(none)");
+ debugf(NHRP_DEBUG_ROUTE, "lookup %pFX: zebra route dev %s",
+ &lookup, ri->ifp ? ri->ifp->name : "(none)");
if (via)
*via = ri->via;
diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c
index 1c2b2b28f2..9a6f77334f 100644
--- a/nhrpd/nhrp_shortcut.c
+++ b/nhrpd/nhrp_shortcut.c
@@ -28,11 +28,9 @@ static void nhrp_shortcut_send_resolution_req(struct nhrp_shortcut *s);
static void nhrp_shortcut_check_use(struct nhrp_shortcut *s)
{
- char buf[PREFIX_STRLEN];
-
if (s->expiring && s->cache && s->cache->used) {
- debugf(NHRP_DEBUG_ROUTE, "Shortcut %s used and expiring",
- prefix2str(s->p, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_ROUTE, "Shortcut %pFX used and expiring",
+ s->p);
nhrp_shortcut_send_resolution_req(s);
}
}
@@ -53,8 +51,6 @@ static int nhrp_shortcut_do_expire(struct thread *t)
static void nhrp_shortcut_cache_notify(struct notifier_block *n,
unsigned long cmd)
{
- char buf[PREFIX_STRLEN];
-
struct nhrp_shortcut *s =
container_of(n, struct nhrp_shortcut, cache_notifier);
@@ -62,9 +58,8 @@ static void nhrp_shortcut_cache_notify(struct notifier_block *n,
case NOTIFY_CACHE_UP:
if (!s->route_installed) {
debugf(NHRP_DEBUG_ROUTE,
- "Shortcut: route install %s nh (unspec) dev %s",
- prefix2str(s->p, buf, sizeof(buf)),
- s->cache->ifp->name);
+ "Shortcut: route install %pFX nh (unspec) dev %s",
+ s->p, s->cache->ifp->name);
nhrp_route_announce(1, s->type, s->p, s->cache->ifp,
NULL, 0);
@@ -152,13 +147,11 @@ static void nhrp_shortcut_delete(struct nhrp_shortcut *s)
{
struct route_node *rn;
afi_t afi = family2afi(PREFIX_FAMILY(s->p));
- char buf[PREFIX_STRLEN];
THREAD_OFF(s->t_timer);
nhrp_reqid_free(&nhrp_packet_reqid, &s->reqid);
- debugf(NHRP_DEBUG_ROUTE, "Shortcut %s purged",
- prefix2str(s->p, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_ROUTE, "Shortcut %pFX purged", s->p);
nhrp_shortcut_update_binding(s, NHRP_CACHE_INVALID, NULL, 0);
@@ -184,7 +177,6 @@ static struct nhrp_shortcut *nhrp_shortcut_get(struct prefix *p)
{
struct nhrp_shortcut *s;
struct route_node *rn;
- char buf[PREFIX_STRLEN];
afi_t afi = family2afi(PREFIX_FAMILY(p));
if (!shortcut_rib[afi])
@@ -197,8 +189,7 @@ static struct nhrp_shortcut *nhrp_shortcut_get(struct prefix *p)
s->type = NHRP_CACHE_INVALID;
s->p = &rn->p;
- debugf(NHRP_DEBUG_ROUTE, "Shortcut %s created",
- prefix2str(s->p, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_ROUTE, "Shortcut %pFX created", s->p);
} else {
s = rn->info;
route_unlock_node(rn);
@@ -219,7 +210,7 @@ static void nhrp_shortcut_recv_resolution_rep(struct nhrp_reqid *reqid,
union sockunion *proto, cie_proto, *nbma, cie_nbma, nat_nbma;
struct prefix prefix, route_prefix;
struct zbuf extpl;
- char bufp[PREFIX_STRLEN], buf[4][SU_ADDRSTRLEN];
+ char buf[4][SU_ADDRSTRLEN];
int holding_time = pp->if_ad->holdtime;
nhrp_reqid_free(&nhrp_packet_reqid, &s->reqid);
@@ -287,9 +278,8 @@ static void nhrp_shortcut_recv_resolution_rep(struct nhrp_reqid *reqid,
}
debugf(NHRP_DEBUG_COMMON,
- "Shortcut: %s is at proto %s dst_proto %s cie-nbma %s nat-nbma %s cie-holdtime %d",
- prefix2str(&prefix, bufp, sizeof(bufp)),
- sockunion2str(proto, buf[0], sizeof(buf[0])),
+ "Shortcut: %pFX is at proto %s dst_proto %s cie-nbma %s nat-nbma %s cie-holdtime %d",
+ &prefix, sockunion2str(proto, buf[0], sizeof(buf[0])),
sockunion2str(&pp->dst_proto, buf[1], sizeof(buf[1])),
sockunion2str(&cie_nbma, buf[2], sizeof(buf[2])),
sockunion2str(&nat_nbma, buf[3], sizeof(buf[3])),