summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_damp.c2
-rw-r--r--bgpd/bgp_dump.c2
-rw-r--r--bgpd/bgp_evpn_mh.c2
-rw-r--r--bgpd/bgp_fsm.c141
-rw-r--r--bgpd/bgp_fsm.h5
-rw-r--r--bgpd/bgp_network.c4
-rw-r--r--bgpd/bgp_packet.c5
-rw-r--r--bgpd/bgp_route.c6
-rw-r--r--bgpd/bgp_updgrp.c2
-rw-r--r--bgpd/bgp_updgrp_adv.c2
-rw-r--r--bgpd/bgp_vty.c4
-rw-r--r--bgpd/bgpd.c18
-rw-r--r--bgpd/rfapi/rfapi_import.c57
-rw-r--r--bgpd/rfapi/rfapi_monitor.c12
-rw-r--r--bgpd/rfapi/rfapi_rib.c22
-rw-r--r--bgpd/rfapi/vnc_export_bgp.c8
-rw-r--r--isisd/fabricd.c14
-rw-r--r--isisd/isis_adjacency.c2
-rw-r--r--isisd/isis_circuit.c24
-rw-r--r--isisd/isis_dr.c10
-rw-r--r--isisd/isis_dynhn.c2
-rw-r--r--isisd/isis_events.c10
-rw-r--r--isisd/isis_lfa.c4
-rw-r--r--isisd/isis_lsp.c8
-rw-r--r--isisd/isis_pdu.c6
-rw-r--r--isisd/isis_spf.c2
-rw-r--r--isisd/isis_sr.c2
-rw-r--r--isisd/isis_tx_queue.c6
-rw-r--r--isisd/isisd.c16
-rw-r--r--ldpd/accept.c6
-rw-r--r--ldpd/adjacency.c8
-rw-r--r--ldpd/control.c4
-rw-r--r--ldpd/interface.c4
-rw-r--r--ldpd/lde.c8
-rw-r--r--ldpd/lde_lib.c4
-rw-r--r--ldpd/ldpd.c14
-rw-r--r--ldpd/ldpe.c14
-rw-r--r--ldpd/neighbor.c18
-rw-r--r--ldpd/packet.c6
-rw-r--r--lib/agentx.c4
-rw-r--r--lib/northbound_grpc.cpp2
-rw-r--r--ospfd/ospf_apiserver.c8
-rw-r--r--ospfd/ospf_gr.c2
-rw-r--r--ospfd/ospf_interface.c8
-rw-r--r--ospfd/ospf_ism.c22
-rw-r--r--ospfd/ospf_ism.h3
-rw-r--r--ospfd/ospf_lsa.c2
-rw-r--r--ospfd/ospf_neighbor.c12
-rw-r--r--ospfd/ospf_nsm.c26
-rw-r--r--ospfd/ospf_nsm.h3
-rw-r--r--ospfd/ospf_opaque.c10
-rw-r--r--ospfd/ospf_packet.c4
-rw-r--r--ospfd/ospf_vty.c2
-rw-r--r--ospfd/ospfd.c52
-rw-r--r--ospfd/ospfd.h2
-rw-r--r--ripd/rip_interface.c2
-rw-r--r--ripd/rip_nb_rpcs.c4
-rw-r--r--ripd/rip_peer.c4
-rw-r--r--ripd/ripd.c46
-rw-r--r--ripd/ripd.h3
-rw-r--r--ripngd/ripng_interface.c2
-rw-r--r--ripngd/ripng_nb_rpcs.c4
-rw-r--r--ripngd/ripng_peer.c4
-rw-r--r--ripngd/ripngd.c42
-rw-r--r--ripngd/ripngd.h2
-rw-r--r--vrrpd/vrrp.c6
-rw-r--r--zebra/irdp_main.c4
-rw-r--r--zebra/kernel_netlink.c2
-rw-r--r--zebra/zebra_dplane.c4
-rw-r--r--zebra/zebra_fpm.c10
-rw-r--r--zebra/zebra_netns_notify.c2
-rw-r--r--zebra/zebra_ptm.c8
-rw-r--r--zebra/zebra_pw.c4
73 files changed, 385 insertions, 414 deletions
diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c
index 62e8e71aa0..9acbaf7733 100644
--- a/bgpd/bgp_damp.c
+++ b/bgpd/bgp_damp.c
@@ -465,7 +465,7 @@ int bgp_damp_disable(struct bgp *bgp, afi_t afi, safi_t safi)
return 0;
/* Cancel reuse event. */
- thread_cancel(&(bdc->t_reuse));
+ THREAD_OFF(bdc->t_reuse);
/* Clean BGP dampening information. */
bgp_damp_info_clean(afi, safi);
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c
index e57f449f78..720925b20f 100644
--- a/bgpd/bgp_dump.c
+++ b/bgpd/bgp_dump.c
@@ -702,7 +702,7 @@ static int bgp_dump_unset(struct bgp_dump *bgp_dump)
}
/* Removing interval event. */
- thread_cancel(&bgp_dump->t_interval);
+ THREAD_OFF(bgp_dump->t_interval);
bgp_dump->interval = 0;
diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c
index b42296f4de..3f801f7ea0 100644
--- a/bgpd/bgp_evpn_mh.c
+++ b/bgpd/bgp_evpn_mh.c
@@ -4952,7 +4952,7 @@ void bgp_evpn_mh_finish(void)
bgp_evpn_es_local_info_clear(es, true);
}
if (bgp_mh_info->t_cons_check)
- thread_cancel(&bgp_mh_info->t_cons_check);
+ THREAD_OFF(bgp_mh_info->t_cons_check);
list_delete(&bgp_mh_info->local_es_list);
list_delete(&bgp_mh_info->pend_es_list);
list_delete(&bgp_mh_info->ead_es_export_rtl);
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index f66c889fb2..b570c84d8b 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -177,17 +177,17 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
*/
bgp_keepalives_off(from_peer);
- BGP_TIMER_OFF(peer->t_routeadv);
- BGP_TIMER_OFF(peer->t_connect);
- BGP_TIMER_OFF(peer->t_delayopen);
- BGP_TIMER_OFF(peer->t_connect_check_r);
- BGP_TIMER_OFF(peer->t_connect_check_w);
- BGP_TIMER_OFF(from_peer->t_routeadv);
- BGP_TIMER_OFF(from_peer->t_connect);
- BGP_TIMER_OFF(from_peer->t_delayopen);
- BGP_TIMER_OFF(from_peer->t_connect_check_r);
- BGP_TIMER_OFF(from_peer->t_connect_check_w);
- BGP_TIMER_OFF(from_peer->t_process_packet);
+ THREAD_OFF(peer->t_routeadv);
+ THREAD_OFF(peer->t_connect);
+ THREAD_OFF(peer->t_delayopen);
+ THREAD_OFF(peer->t_connect_check_r);
+ THREAD_OFF(peer->t_connect_check_w);
+ THREAD_OFF(from_peer->t_routeadv);
+ THREAD_OFF(from_peer->t_connect);
+ THREAD_OFF(from_peer->t_delayopen);
+ THREAD_OFF(from_peer->t_connect_check_r);
+ THREAD_OFF(from_peer->t_connect_check_w);
+ THREAD_OFF(from_peer->t_process_packet);
/*
* At this point in time, it is possible that there are packets pending
@@ -365,23 +365,23 @@ void bgp_timer_set(struct peer *peer)
inactive. All other timer must be turned off */
if (BGP_PEER_START_SUPPRESSED(peer) || !peer_active(peer)
|| peer->bgp->vrf_id == VRF_UNKNOWN) {
- BGP_TIMER_OFF(peer->t_start);
+ THREAD_OFF(peer->t_start);
} else {
BGP_TIMER_ON(peer->t_start, bgp_start_timer,
peer->v_start);
}
- BGP_TIMER_OFF(peer->t_connect);
- BGP_TIMER_OFF(peer->t_holdtime);
+ THREAD_OFF(peer->t_connect);
+ THREAD_OFF(peer->t_holdtime);
bgp_keepalives_off(peer);
- BGP_TIMER_OFF(peer->t_routeadv);
- BGP_TIMER_OFF(peer->t_delayopen);
+ THREAD_OFF(peer->t_routeadv);
+ THREAD_OFF(peer->t_delayopen);
break;
case Connect:
/* After start timer is expired, the peer moves to Connect
status. Make sure start timer is off and connect timer is
on. */
- BGP_TIMER_OFF(peer->t_start);
+ THREAD_OFF(peer->t_start);
if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER_DELAYOPEN))
BGP_TIMER_ON(peer->t_connect, bgp_connect_timer,
(peer->v_delayopen + peer->v_connect));
@@ -389,19 +389,19 @@ void bgp_timer_set(struct peer *peer)
BGP_TIMER_ON(peer->t_connect, bgp_connect_timer,
peer->v_connect);
- BGP_TIMER_OFF(peer->t_holdtime);
+ THREAD_OFF(peer->t_holdtime);
bgp_keepalives_off(peer);
- BGP_TIMER_OFF(peer->t_routeadv);
+ THREAD_OFF(peer->t_routeadv);
break;
case Active:
/* Active is waiting connection from remote peer. And if
connect timer is expired, change status to Connect. */
- BGP_TIMER_OFF(peer->t_start);
+ THREAD_OFF(peer->t_start);
/* If peer is passive mode, do not set connect timer. */
if (CHECK_FLAG(peer->flags, PEER_FLAG_PASSIVE)
|| CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)) {
- BGP_TIMER_OFF(peer->t_connect);
+ THREAD_OFF(peer->t_connect);
} else {
if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER_DELAYOPEN))
BGP_TIMER_ON(
@@ -411,56 +411,56 @@ void bgp_timer_set(struct peer *peer)
BGP_TIMER_ON(peer->t_connect, bgp_connect_timer,
peer->v_connect);
}
- BGP_TIMER_OFF(peer->t_holdtime);
+ THREAD_OFF(peer->t_holdtime);
bgp_keepalives_off(peer);
- BGP_TIMER_OFF(peer->t_routeadv);
+ THREAD_OFF(peer->t_routeadv);
break;
case OpenSent:
/* OpenSent status. */
- BGP_TIMER_OFF(peer->t_start);
- BGP_TIMER_OFF(peer->t_connect);
+ THREAD_OFF(peer->t_start);
+ THREAD_OFF(peer->t_connect);
if (peer->v_holdtime != 0) {
BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
peer->v_holdtime);
} else {
- BGP_TIMER_OFF(peer->t_holdtime);
+ THREAD_OFF(peer->t_holdtime);
}
bgp_keepalives_off(peer);
- BGP_TIMER_OFF(peer->t_routeadv);
- BGP_TIMER_OFF(peer->t_delayopen);
+ THREAD_OFF(peer->t_routeadv);
+ THREAD_OFF(peer->t_delayopen);
break;
case OpenConfirm:
/* OpenConfirm status. */
- BGP_TIMER_OFF(peer->t_start);
- BGP_TIMER_OFF(peer->t_connect);
+ THREAD_OFF(peer->t_start);
+ THREAD_OFF(peer->t_connect);
/* If the negotiated Hold Time value is zero, then the Hold Time
timer and KeepAlive timers are not started. */
if (peer->v_holdtime == 0) {
- BGP_TIMER_OFF(peer->t_holdtime);
+ THREAD_OFF(peer->t_holdtime);
bgp_keepalives_off(peer);
} else {
BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
peer->v_holdtime);
bgp_keepalives_on(peer);
}
- BGP_TIMER_OFF(peer->t_routeadv);
- BGP_TIMER_OFF(peer->t_delayopen);
+ THREAD_OFF(peer->t_routeadv);
+ THREAD_OFF(peer->t_delayopen);
break;
case Established:
/* In Established status start and connect timer is turned
off. */
- BGP_TIMER_OFF(peer->t_start);
- BGP_TIMER_OFF(peer->t_connect);
- BGP_TIMER_OFF(peer->t_delayopen);
+ THREAD_OFF(peer->t_start);
+ THREAD_OFF(peer->t_connect);
+ THREAD_OFF(peer->t_delayopen);
/* Same as OpenConfirm, if holdtime is zero then both holdtime
and keepalive must be turned off. */
if (peer->v_holdtime == 0) {
- BGP_TIMER_OFF(peer->t_holdtime);
+ THREAD_OFF(peer->t_holdtime);
bgp_keepalives_off(peer);
} else {
BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
@@ -469,22 +469,22 @@ void bgp_timer_set(struct peer *peer)
}
break;
case Deleted:
- BGP_TIMER_OFF(peer->t_gr_restart);
- BGP_TIMER_OFF(peer->t_gr_stale);
+ THREAD_OFF(peer->t_gr_restart);
+ THREAD_OFF(peer->t_gr_stale);
FOREACH_AFI_SAFI (afi, safi)
- BGP_TIMER_OFF(peer->t_llgr_stale[afi][safi]);
+ THREAD_OFF(peer->t_llgr_stale[afi][safi]);
- BGP_TIMER_OFF(peer->t_pmax_restart);
- BGP_TIMER_OFF(peer->t_refresh_stalepath);
+ THREAD_OFF(peer->t_pmax_restart);
+ THREAD_OFF(peer->t_refresh_stalepath);
/* fallthru */
case Clearing:
- BGP_TIMER_OFF(peer->t_start);
- BGP_TIMER_OFF(peer->t_connect);
- BGP_TIMER_OFF(peer->t_holdtime);
+ THREAD_OFF(peer->t_start);
+ THREAD_OFF(peer->t_connect);
+ THREAD_OFF(peer->t_holdtime);
bgp_keepalives_off(peer);
- BGP_TIMER_OFF(peer->t_routeadv);
- BGP_TIMER_OFF(peer->t_delayopen);
+ THREAD_OFF(peer->t_routeadv);
+ THREAD_OFF(peer->t_delayopen);
break;
case BGP_STATUS_MAX:
flog_err(EC_LIB_DEVELOPMENT,
@@ -516,7 +516,7 @@ static void bgp_connect_timer(struct thread *thread)
peer = THREAD_ARG(thread);
/* stop the DelayOpenTimer if it is running */
- BGP_TIMER_OFF(peer->t_delayopen);
+ THREAD_OFF(peer->t_delayopen);
assert(!peer->t_write);
assert(!peer->t_read);
@@ -647,7 +647,7 @@ static void bgp_graceful_restart_timer_off(struct peer *peer)
return;
UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT);
- BGP_TIMER_OFF(peer->t_gr_stale);
+ THREAD_OFF(peer->t_gr_stale);
if (peer_dynamic_neighbor(peer) &&
!(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) {
@@ -965,7 +965,7 @@ void bgp_start_routeadv(struct bgp *bgp)
for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
if (!peer_established(peer))
continue;
- BGP_TIMER_OFF(peer->t_routeadv);
+ THREAD_OFF(peer->t_routeadv);
BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0);
}
}
@@ -985,7 +985,7 @@ void bgp_adjust_routeadv(struct peer *peer)
* different
* duration and schedule write thread immediately.
*/
- BGP_TIMER_OFF(peer->t_routeadv);
+ THREAD_OFF(peer->t_routeadv);
peer->synctime = bgp_clock();
/* If suppress fib pending is enabled, route is advertised to
@@ -1017,7 +1017,7 @@ void bgp_adjust_routeadv(struct peer *peer)
*/
diff = difftime(nowtime, peer->last_update);
if (diff > (double)peer->v_routeadv) {
- BGP_TIMER_OFF(peer->t_routeadv);
+ THREAD_OFF(peer->t_routeadv);
BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0);
return;
}
@@ -1044,7 +1044,7 @@ void bgp_adjust_routeadv(struct peer *peer)
remain = peer->v_routeadv;
diff = peer->v_routeadv - diff;
if (diff <= (double)remain) {
- BGP_TIMER_OFF(peer->t_routeadv);
+ THREAD_OFF(peer->t_routeadv);
BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, diff);
}
}
@@ -1401,7 +1401,7 @@ int bgp_stop(struct peer *peer)
/* graceful restart */
if (peer->t_gr_stale) {
- BGP_TIMER_OFF(peer->t_gr_stale);
+ THREAD_OFF(peer->t_gr_stale);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
"%pBP graceful restart stalepath timer stopped",
@@ -1431,7 +1431,7 @@ int bgp_stop(struct peer *peer)
/* Stop route-refresh stalepath timer */
if (peer->t_refresh_stalepath) {
- BGP_TIMER_OFF(peer->t_refresh_stalepath);
+ THREAD_OFF(peer->t_refresh_stalepath);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
@@ -1464,8 +1464,7 @@ int bgp_stop(struct peer *peer)
/* There is no pending EOR message */
if (gr_info->eor_required == 0) {
- BGP_TIMER_OFF(
- gr_info->t_select_deferral);
+ THREAD_OFF(gr_info->t_select_deferral);
gr_info->eor_received = 0;
}
}
@@ -1494,11 +1493,11 @@ int bgp_stop(struct peer *peer)
THREAD_OFF(peer->t_connect_check_w);
/* Stop all timers. */
- BGP_TIMER_OFF(peer->t_start);
- BGP_TIMER_OFF(peer->t_connect);
- BGP_TIMER_OFF(peer->t_holdtime);
- BGP_TIMER_OFF(peer->t_routeadv);
- BGP_TIMER_OFF(peer->t_delayopen);
+ THREAD_OFF(peer->t_start);
+ THREAD_OFF(peer->t_connect);
+ THREAD_OFF(peer->t_holdtime);
+ THREAD_OFF(peer->t_routeadv);
+ THREAD_OFF(peer->t_delayopen);
/* Clear input and output buffer. */
frr_with_mutex (&peer->io_mtx) {
@@ -1993,7 +1992,7 @@ static int bgp_fsm_holdtime_expire(struct peer *peer)
static int bgp_fsm_delayopen_timer_expire(struct peer *peer)
{
/* Stop the DelayOpenTimer */
- BGP_TIMER_OFF(peer->t_delayopen);
+ THREAD_OFF(peer->t_delayopen);
/* Send open message to peer */
bgp_open_send(peer);
@@ -2203,7 +2202,7 @@ static int bgp_establish(struct peer *peer)
else {
UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_MODE);
if (peer->t_gr_stale) {
- BGP_TIMER_OFF(peer->t_gr_stale);
+ THREAD_OFF(peer->t_gr_stale);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
"%pBP graceful restart stalepath timer stopped",
@@ -2212,7 +2211,7 @@ static int bgp_establish(struct peer *peer)
}
if (peer->t_gr_restart) {
- BGP_TIMER_OFF(peer->t_gr_restart);
+ THREAD_OFF(peer->t_gr_restart);
if (bgp_debug_neighbor_events(peer))
zlog_debug("%pBP graceful restart timer stopped", peer);
}
@@ -2228,7 +2227,7 @@ static int bgp_establish(struct peer *peer)
*/
FOREACH_AFI_SAFI (afi, safi) {
if (peer->t_llgr_stale[afi][safi]) {
- BGP_TIMER_OFF(peer->t_llgr_stale[afi][safi]);
+ THREAD_OFF(peer->t_llgr_stale[afi][safi]);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
"%pBP Long-lived stale timer stopped for afi/safi: %d/%d",
@@ -2273,7 +2272,7 @@ static int bgp_establish(struct peer *peer)
* of read-only mode.
*/
if (!bgp_update_delay_active(peer->bgp)) {
- BGP_TIMER_OFF(peer->t_routeadv);
+ THREAD_OFF(peer->t_routeadv);
BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0);
}
@@ -2309,14 +2308,14 @@ static int bgp_establish(struct peer *peer)
/* Keepalive packet is received. */
static int bgp_fsm_keepalive(struct peer *peer)
{
- BGP_TIMER_OFF(peer->t_holdtime);
+ THREAD_OFF(peer->t_holdtime);
return 0;
}
/* Update packet is received. */
static int bgp_fsm_update(struct peer *peer)
{
- BGP_TIMER_OFF(peer->t_holdtime);
+ THREAD_OFF(peer->t_holdtime);
return 0;
}
@@ -2358,13 +2357,13 @@ void bgp_fsm_nht_update(struct peer *peer, bool has_valid_nexthops)
break;
case Connect:
if (!has_valid_nexthops) {
- BGP_TIMER_OFF(peer->t_connect);
+ THREAD_OFF(peer->t_connect);
BGP_EVENT_ADD(peer, TCP_fatal_error);
}
break;
case Active:
if (has_valid_nexthops) {
- BGP_TIMER_OFF(peer->t_connect);
+ THREAD_OFF(peer->t_connect);
BGP_EVENT_ADD(peer, ConnectRetry_timer_expired);
}
break;
diff --git a/bgpd/bgp_fsm.h b/bgpd/bgp_fsm.h
index 765a5aec5e..aaf6c480b2 100644
--- a/bgpd/bgp_fsm.h
+++ b/bgpd/bgp_fsm.h
@@ -29,11 +29,6 @@
thread_add_timer(bm->master, (F), peer, (V), &(T)); \
} while (0)
-#define BGP_TIMER_OFF(T) \
- do { \
- THREAD_OFF((T)); \
- } while (0)
-
#define BGP_EVENT_ADD(P, E) \
do { \
if ((P)->status != Deleted) \
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index da4cc03b66..9ecc2ae4e4 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -429,7 +429,7 @@ static void bgp_accept(struct thread *thread)
sockopt_tcp_mss_set(bgp_sock, peer1->tcp_mss);
bgp_fsm_change_status(peer1, Active);
- BGP_TIMER_OFF(
+ THREAD_OFF(
peer1->t_start); /* created in peer_create() */
if (peer_active(peer1)) {
@@ -558,7 +558,7 @@ static void bgp_accept(struct thread *thread)
}
bgp_peer_reg_with_nht(peer);
bgp_fsm_change_status(peer, Active);
- BGP_TIMER_OFF(peer->t_start); /* created in peer_create() */
+ THREAD_OFF(peer->t_start); /* created in peer_create() */
SET_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER);
/* Make dummy peer until read Open packet. */
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 508082c6d6..dbf6c0b2e9 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -2002,8 +2002,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
gr_info->eor_required,
"EOR RCV",
gr_info->eor_received);
- BGP_TIMER_OFF(
- gr_info->t_select_deferral);
+ THREAD_OFF(gr_info->t_select_deferral);
gr_info->eor_required = 0;
gr_info->eor_received = 0;
/* Best path selection */
@@ -2510,7 +2509,7 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
return BGP_PACKET_NOOP;
}
- BGP_TIMER_OFF(peer->t_refresh_stalepath);
+ THREAD_OFF(peer->t_refresh_stalepath);
SET_FLAG(peer->af_sflags[afi][safi], PEER_STATUS_EORR_RECEIVED);
UNSET_FLAG(peer->af_sflags[afi][safi],
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 35581e7147..9c79ef5c9d 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -3204,7 +3204,7 @@ int bgp_best_path_select_defer(struct bgp *bgp, afi_t afi, safi_t safi)
thread_info = THREAD_ARG(t);
XFREE(MTYPE_TMP, thread_info);
- BGP_TIMER_OFF(bgp->gr_info[afi][safi].t_route_select);
+ THREAD_OFF(bgp->gr_info[afi][safi].t_route_select);
}
if (BGP_DEBUG(update, UPDATE_OUT)) {
@@ -4744,7 +4744,7 @@ void bgp_stop_announce_route_timer(struct peer_af *paf)
if (!paf->t_announce_route)
return;
- thread_cancel(&paf->t_announce_route);
+ THREAD_OFF(paf->t_announce_route);
}
/*
@@ -5042,7 +5042,7 @@ void bgp_soft_reconfig_table_task_cancel(const struct bgp *bgp,
list_delete(&ntable->soft_reconfig_peers);
bgp_soft_reconfig_table_flag(ntable, false);
- BGP_TIMER_OFF(ntable->soft_reconfig_thread);
+ THREAD_OFF(ntable->soft_reconfig_thread);
}
}
diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c
index ea8d2330c5..17b3db78a2 100644
--- a/bgpd/bgp_updgrp.c
+++ b/bgpd/bgp_updgrp.c
@@ -1896,7 +1896,7 @@ void update_group_refresh_default_originate_route_map(struct thread *thread)
bgp = THREAD_ARG(thread);
update_group_walk(bgp, update_group_default_originate_route_map_walkcb,
reason);
- thread_cancel(&bgp->t_rmap_def_originate_eval);
+ THREAD_OFF(bgp->t_rmap_def_originate_eval);
bgp_unlock(bgp);
}
diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c
index 0f7f2f4c02..e81ab202e5 100644
--- a/bgpd/bgp_updgrp_adv.c
+++ b/bgpd/bgp_updgrp_adv.c
@@ -347,7 +347,7 @@ static void subgroup_coalesce_timer(struct thread *thread)
SUBGRP_FOREACH_PEER (subgrp, paf) {
peer = PAF_PEER(paf);
- BGP_TIMER_OFF(peer->t_routeadv);
+ THREAD_OFF(peer->t_routeadv);
BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0);
}
}
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index c91a62ba0e..695855f407 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -2055,7 +2055,7 @@ DEFUN (no_bgp_maxmed_onstartup,
/* Cancel max-med onstartup if its on */
if (bgp->t_maxmed_onstartup) {
- thread_cancel(&bgp->t_maxmed_onstartup);
+ THREAD_OFF(bgp->t_maxmed_onstartup);
bgp->maxmed_onstartup_over = 1;
}
@@ -7256,7 +7256,7 @@ DEFUN (bgp_set_route_map_delay_timer,
* fired.
*/
if (!rmap_delay_timer && bm->t_rmap_update) {
- BGP_TIMER_OFF(bm->t_rmap_update);
+ THREAD_OFF(bm->t_rmap_update);
thread_execute(bm->master, bgp_route_map_update_timer,
NULL, 0);
}
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index cc15e6f688..aaf8c30415 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -2401,12 +2401,12 @@ void peer_nsf_stop(struct peer *peer)
peer->nsf[afi][safi] = 0;
if (peer->t_gr_restart) {
- BGP_TIMER_OFF(peer->t_gr_restart);
+ THREAD_OFF(peer->t_gr_restart);
if (bgp_debug_neighbor_events(peer))
zlog_debug("%pBP graceful restart timer stopped", peer);
}
if (peer->t_gr_stale) {
- BGP_TIMER_OFF(peer->t_gr_stale);
+ THREAD_OFF(peer->t_gr_stale);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
"%pBP graceful restart stalepath timer stopped",
@@ -3584,7 +3584,7 @@ void bgp_instance_down(struct bgp *bgp)
/* Stop timers. */
if (bgp->t_rmap_def_originate_eval) {
- BGP_TIMER_OFF(bgp->t_rmap_def_originate_eval);
+ THREAD_OFF(bgp->t_rmap_def_originate_eval);
bgp_unlock(bgp); /* TODO - This timer is started with a lock -
why? */
}
@@ -3651,7 +3651,7 @@ int bgp_delete(struct bgp *bgp)
if (!gr_info)
continue;
- BGP_TIMER_OFF(gr_info->t_select_deferral);
+ THREAD_OFF(gr_info->t_select_deferral);
t = gr_info->t_route_select;
if (t) {
@@ -3659,7 +3659,7 @@ int bgp_delete(struct bgp *bgp)
XFREE(MTYPE_TMP, info);
}
- BGP_TIMER_OFF(gr_info->t_route_select);
+ THREAD_OFF(gr_info->t_route_select);
}
if (BGP_DEBUG(zebra, ZEBRA)) {
@@ -3682,7 +3682,7 @@ int bgp_delete(struct bgp *bgp)
/* Stop timers. */
if (bgp->t_rmap_def_originate_eval) {
- BGP_TIMER_OFF(bgp->t_rmap_def_originate_eval);
+ THREAD_OFF(bgp->t_rmap_def_originate_eval);
bgp_unlock(bgp); /* TODO - This timer is started with a lock -
why? */
}
@@ -4351,7 +4351,7 @@ static void peer_flag_modify_action(struct peer *peer, uint32_t flag)
UNSET_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW);
if (peer->t_pmax_restart) {
- BGP_TIMER_OFF(peer->t_pmax_restart);
+ THREAD_OFF(peer->t_pmax_restart);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
"%pBP Maximum-prefix restart timer canceled",
@@ -7371,7 +7371,7 @@ static bool peer_maximum_prefix_clear_overflow(struct peer *peer)
UNSET_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW);
if (peer->t_pmax_restart) {
- BGP_TIMER_OFF(peer->t_pmax_restart);
+ THREAD_OFF(peer->t_pmax_restart);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
"%pBP Maximum-prefix restart timer cancelled",
@@ -8243,7 +8243,7 @@ void bgp_terminate(void)
if (bm->listen_sockets)
list_delete(&bm->listen_sockets);
- BGP_TIMER_OFF(bm->t_rmap_update);
+ THREAD_OFF(bm->t_rmap_update);
bgp_mac_finish();
}
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index 91b68b13d8..1d42702769 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -856,13 +856,11 @@ static void rfapiBgpInfoChainFree(struct bgp_path_info *bpi)
*/
if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
&& bpi->extra->vnc.import.timer) {
-
- struct thread **t =
- &(bpi->extra->vnc.import.timer);
- struct rfapi_withdraw *wcb = (*t)->arg;
+ struct rfapi_withdraw *wcb =
+ THREAD_ARG(bpi->extra->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- thread_cancel(t);
+ THREAD_OFF(bpi->extra->vnc.import.timer);
}
next = bpi->next;
@@ -2371,7 +2369,7 @@ static void rfapiMonitorEncapDelete(struct bgp_path_info *vpn_bpi)
*/
static void rfapiWithdrawTimerVPN(struct thread *t)
{
- struct rfapi_withdraw *wcb = t->arg;
+ struct rfapi_withdraw *wcb = THREAD_ARG(t);
struct bgp_path_info *bpi = wcb->info;
struct bgp *bgp = bgp_get_default();
const struct prefix *p;
@@ -2672,7 +2670,7 @@ rfapiWithdrawEncapUpdateCachedUn(struct rfapi_import_table *import_table,
static void rfapiWithdrawTimerEncap(struct thread *t)
{
- struct rfapi_withdraw *wcb = t->arg;
+ struct rfapi_withdraw *wcb = THREAD_ARG(t);
struct bgp_path_info *bpi = wcb->info;
int was_first_route = 0;
struct rfapi_monitor_encap *em;
@@ -3089,13 +3087,12 @@ static void rfapiBgpInfoFilteredImportEncap(
*/
if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
&& bpi->extra->vnc.import.timer) {
-
- struct thread **t =
- &(bpi->extra->vnc.import.timer);
- struct rfapi_withdraw *wcb = (*t)->arg;
+ struct rfapi_withdraw *wcb = THREAD_ARG(
+ bpi->extra->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- thread_cancel(t);
+ THREAD_OFF(
+ bpi->extra->vnc.import.timer);
}
if (action == FIF_ACTION_UPDATE) {
@@ -3182,12 +3179,11 @@ static void rfapiBgpInfoFilteredImportEncap(
"%s: removing holddown bpi matching NVE of new route",
__func__);
if (bpi->extra->vnc.import.timer) {
- struct thread **t =
- &(bpi->extra->vnc.import.timer);
- struct rfapi_withdraw *wcb = (*t)->arg;
+ struct rfapi_withdraw *wcb =
+ THREAD_ARG(bpi->extra->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- thread_cancel(t);
+ THREAD_OFF(bpi->extra->vnc.import.timer);
}
rfapiExpireEncapNow(import_table, rn, bpi);
}
@@ -3543,13 +3539,12 @@ void rfapiBgpInfoFilteredImportVPN(
*/
if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
&& bpi->extra->vnc.import.timer) {
-
- struct thread **t =
- &(bpi->extra->vnc.import.timer);
- struct rfapi_withdraw *wcb = (*t)->arg;
+ struct rfapi_withdraw *wcb = THREAD_ARG(
+ bpi->extra->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- thread_cancel(t);
+ THREAD_OFF(
+ bpi->extra->vnc.import.timer);
import_table->holddown_count[afi] -= 1;
RFAPI_UPDATE_ITABLE_COUNT(
@@ -3762,12 +3757,11 @@ void rfapiBgpInfoFilteredImportVPN(
"%s: removing holddown bpi matching NVE of new route",
__func__);
if (bpi->extra->vnc.import.timer) {
- struct thread **t =
- &(bpi->extra->vnc.import.timer);
- struct rfapi_withdraw *wcb = (*t)->arg;
+ struct rfapi_withdraw *wcb =
+ THREAD_ARG(bpi->extra->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- thread_cancel(t);
+ THREAD_OFF(bpi->extra->vnc.import.timer);
}
rfapiExpireVpnNow(import_table, rn, bpi, 0);
}
@@ -4490,12 +4484,11 @@ static void rfapiDeleteRemotePrefixesIt(
if (!delete_holddown)
continue;
if (bpi->extra->vnc.import.timer) {
-
- struct thread **t =
- &(bpi->extra->vnc
- .import.timer);
struct rfapi_withdraw *wcb =
- (*t)->arg;
+ THREAD_ARG(
+ bpi->extra->vnc
+ .import
+ .timer);
wcb->import_table
->holddown_count[afi] -=
@@ -4505,7 +4498,9 @@ static void rfapiDeleteRemotePrefixesIt(
afi, 1);
XFREE(MTYPE_RFAPI_WITHDRAW,
wcb);
- thread_cancel(t);
+ THREAD_OFF(
+ bpi->extra->vnc.import
+ .timer);
}
} else {
if (!delete_active)
diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c
index 8529676118..0e71d5d7e1 100644
--- a/bgpd/rfapi/rfapi_monitor.c
+++ b/bgpd/rfapi/rfapi_monitor.c
@@ -620,7 +620,7 @@ void rfapiMonitorDel(struct bgp *bgp, struct rfapi_descriptor *rfd,
rfapiMonitorDetachImport(m);
}
- thread_cancel(&m->timer);
+ THREAD_OFF(m->timer);
/*
* remove from rfd list
@@ -657,7 +657,7 @@ int rfapiMonitorDelHd(struct rfapi_descriptor *rfd)
rfapiMonitorDetachImport(m);
}
- thread_cancel(&m->timer);
+ THREAD_OFF(m->timer);
XFREE(MTYPE_RFAPI_MONITOR, m);
rn->info = NULL;
@@ -691,7 +691,7 @@ int rfapiMonitorDelHd(struct rfapi_descriptor *rfd)
#endif
}
- thread_cancel(&mon_eth->timer);
+ THREAD_OFF(mon_eth->timer);
/*
* remove from rfd list
@@ -733,7 +733,7 @@ void rfapiMonitorResponseRemovalOn(struct bgp *bgp)
static void rfapiMonitorTimerExpire(struct thread *t)
{
- struct rfapi_monitor_vpn *m = t->arg;
+ struct rfapi_monitor_vpn *m = THREAD_ARG(t);
/* forget reference to thread, it's gone */
m->timer = NULL;
@@ -1039,7 +1039,7 @@ void rfapiMonitorMovedUp(struct rfapi_import_table *import_table,
static void rfapiMonitorEthTimerExpire(struct thread *t)
{
- struct rfapi_monitor_eth *m = t->arg;
+ struct rfapi_monitor_eth *m = THREAD_ARG(t);
/* forget reference to thread, it's gone */
m->timer = NULL;
@@ -1400,7 +1400,7 @@ void rfapiMonitorEthDel(struct bgp *bgp, struct rfapi_descriptor *rfd,
rfapiMonitorEthDetachImport(bgp, val);
}
- thread_cancel(&val->timer);
+ THREAD_OFF(val->timer);
/*
* remove from rfd list
diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c
index c4fc96f5ae..9d61ada7db 100644
--- a/bgpd/rfapi/rfapi_rib.c
+++ b/bgpd/rfapi/rfapi_rib.c
@@ -268,8 +268,8 @@ static void rfapi_info_free(struct rfapi_info *goner)
if (goner->timer) {
struct rfapi_rib_tcb *tcb;
- tcb = goner->timer->arg;
- thread_cancel(&goner->timer);
+ tcb = THREAD_ARG(goner->timer);
+ THREAD_OFF(goner->timer);
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb);
}
XFREE(MTYPE_RFAPI_INFO, goner);
@@ -293,7 +293,7 @@ struct rfapi_rib_tcb {
*/
static void rfapiRibExpireTimer(struct thread *t)
{
- struct rfapi_rib_tcb *tcb = t->arg;
+ struct rfapi_rib_tcb *tcb = THREAD_ARG(t);
RFAPI_RIB_CHECK_COUNTS(1, 0);
@@ -338,8 +338,8 @@ static void rfapiRibStartTimer(struct rfapi_descriptor *rfd,
struct rfapi_rib_tcb *tcb = NULL;
if (ri->timer) {
- tcb = ri->timer->arg;
- thread_cancel(&ri->timer);
+ tcb = THREAD_ARG(ri->timer);
+ THREAD_OFF(ri->timer);
} else {
tcb = XCALLOC(MTYPE_RFAPI_RECENT_DELETE,
sizeof(struct rfapi_rib_tcb));
@@ -913,8 +913,8 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd,
if (ri->timer) {
struct rfapi_rib_tcb *tcb;
- tcb = ri->timer->arg;
- thread_cancel(&ri->timer);
+ tcb = THREAD_ARG(ri->timer);
+ THREAD_OFF(ri->timer);
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb);
}
@@ -998,8 +998,8 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd,
if (ori->timer) {
struct rfapi_rib_tcb *tcb;
- tcb = ori->timer->arg;
- thread_cancel(&ori->timer);
+ tcb = THREAD_ARG(ori->timer);
+ THREAD_OFF(ori->timer);
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb);
}
@@ -1342,8 +1342,8 @@ callback:
if (ri->timer) {
struct rfapi_rib_tcb *tcb;
- tcb = ri->timer->arg;
- thread_cancel(&ri->timer);
+ tcb = THREAD_ARG(ri->timer);
+ THREAD_OFF(ri->timer);
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb);
}
RFAPI_RIB_CHECK_COUNTS(0, delete_list->count);
diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c
index 2152a55ca3..05e45bc4c8 100644
--- a/bgpd/rfapi/vnc_export_bgp.c
+++ b/bgpd/rfapi/vnc_export_bgp.c
@@ -1712,7 +1712,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
* export expiration timer is already running on
* this route: cancel it
*/
- thread_cancel(&eti->timer);
+ THREAD_OFF(eti->timer);
bgp_update(peer, prefix, /* prefix */
0, /* addpath_id */
@@ -1726,7 +1726,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
static void vncExportWithdrawTimer(struct thread *t)
{
- struct vnc_export_info *eti = t->arg;
+ struct vnc_export_info *eti = THREAD_ARG(t);
const struct prefix *p = agg_node_get_prefix(eti->node);
/*
@@ -1943,7 +1943,7 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi)
* already running on
* this route: cancel it
*/
- thread_cancel(&eti->timer);
+ THREAD_OFF(eti->timer);
vnc_zlog_debug_verbose(
"%s: calling bgp_update",
@@ -2012,7 +2012,7 @@ void vnc_direct_bgp_rh_vpn_disable(struct bgp *bgp, afi_t afi)
ZEBRA_ROUTE_VNC_DIRECT_RH,
BGP_ROUTE_REDISTRIBUTE);
if (eti) {
- thread_cancel(&eti->timer);
+ THREAD_OFF(eti->timer);
vnc_eti_delete(eti);
}
diff --git a/isisd/fabricd.c b/isisd/fabricd.c
index d431787ebb..a37cda1ce1 100644
--- a/isisd/fabricd.c
+++ b/isisd/fabricd.c
@@ -238,11 +238,11 @@ struct fabricd *fabricd_new(struct isis_area *area)
void fabricd_finish(struct fabricd *f)
{
- thread_cancel(&(f->initial_sync_timeout));
+ THREAD_OFF(f->initial_sync_timeout);
- thread_cancel(&(f->tier_calculation_timer));
+ THREAD_OFF(f->tier_calculation_timer);
- thread_cancel(&(f->tier_set_timer));
+ THREAD_OFF(f->tier_set_timer);
isis_spftree_del(f->spftree);
neighbor_lists_clear(f);
@@ -334,7 +334,7 @@ void fabricd_initial_sync_finish(struct isis_area *area)
f->initial_sync_circuit->interface->name);
f->initial_sync_state = FABRICD_SYNC_COMPLETE;
f->initial_sync_circuit = NULL;
- thread_cancel(&(f->initial_sync_timeout));
+ THREAD_OFF(f->initial_sync_timeout);
}
static void fabricd_bump_tier_calculation_timer(struct fabricd *f);
@@ -427,14 +427,14 @@ static void fabricd_bump_tier_calculation_timer(struct fabricd *f)
{
/* Cancel timer if we already know our tier */
if (f->tier != ISIS_TIER_UNDEFINED || f->tier_set_timer) {
- thread_cancel(&(f->tier_calculation_timer));
+ THREAD_OFF(f->tier_calculation_timer);
return;
}
/* If we need to calculate the tier, wait some
* time for the topology to settle before running
* the calculation */
- thread_cancel(&(f->tier_calculation_timer));
+ THREAD_OFF(f->tier_calculation_timer);
thread_add_timer(master, fabricd_tier_calculation_cb, f,
2 * f->area->lsp_gen_interval[ISIS_LEVEL2 - 1],
@@ -719,7 +719,7 @@ void fabricd_trigger_csnp(struct isis_area *area, bool circuit_scoped)
if (!circuit->t_send_csnp[1])
continue;
- thread_cancel(&(circuit->t_send_csnp[ISIS_LEVEL2 - 1]));
+ THREAD_OFF(circuit->t_send_csnp[ISIS_LEVEL2 - 1]);
thread_add_timer_msec(master, send_l2_csnp, circuit,
isis_jitter(f->csnp_delay, CSNP_JITTER),
&circuit->t_send_csnp[ISIS_LEVEL2 - 1]);
diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c
index 11f17ec7bf..eda39a844b 100644
--- a/isisd/isis_adjacency.c
+++ b/isisd/isis_adjacency.c
@@ -161,7 +161,7 @@ void isis_delete_adj(void *arg)
/* Remove self from snmp list without walking the list*/
list_delete_node(adj->circuit->snmp_adj_list, adj->snmp_list_node);
- thread_cancel(&adj->t_expire);
+ THREAD_OFF(adj->t_expire);
if (adj->adj_state != ISIS_ADJ_DOWN)
adj->adj_state = ISIS_ADJ_DOWN;
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index 28d4b530fc..9e97e48937 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -845,12 +845,12 @@ void isis_circuit_down(struct isis_circuit *circuit)
memset(circuit->u.bc.l2_desig_is, 0, ISIS_SYS_ID_LEN + 1);
memset(circuit->u.bc.snpa, 0, ETH_ALEN);
- thread_cancel(&circuit->u.bc.t_send_lan_hello[0]);
- thread_cancel(&circuit->u.bc.t_send_lan_hello[1]);
- thread_cancel(&circuit->u.bc.t_run_dr[0]);
- thread_cancel(&circuit->u.bc.t_run_dr[1]);
- thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[0]);
- thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[1]);
+ THREAD_OFF(circuit->u.bc.t_send_lan_hello[0]);
+ THREAD_OFF(circuit->u.bc.t_send_lan_hello[1]);
+ THREAD_OFF(circuit->u.bc.t_run_dr[0]);
+ THREAD_OFF(circuit->u.bc.t_run_dr[1]);
+ THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[0]);
+ THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[1]);
circuit->lsp_regenerate_pending[0] = 0;
circuit->lsp_regenerate_pending[1] = 0;
@@ -860,7 +860,7 @@ void isis_circuit_down(struct isis_circuit *circuit)
} else if (circuit->circ_type == CIRCUIT_T_P2P) {
isis_delete_adj(circuit->u.p2p.neighbor);
circuit->u.p2p.neighbor = NULL;
- thread_cancel(&circuit->u.p2p.t_send_p2p_hello);
+ THREAD_OFF(circuit->u.p2p.t_send_p2p_hello);
}
/*
@@ -873,11 +873,11 @@ void isis_circuit_down(struct isis_circuit *circuit)
circuit->snmp_adj_idx_gen = 0;
/* Cancel all active threads */
- thread_cancel(&circuit->t_send_csnp[0]);
- thread_cancel(&circuit->t_send_csnp[1]);
- thread_cancel(&circuit->t_send_psnp[0]);
- thread_cancel(&circuit->t_send_psnp[1]);
- thread_cancel(&circuit->t_read);
+ THREAD_OFF(circuit->t_send_csnp[0]);
+ THREAD_OFF(circuit->t_send_csnp[1]);
+ THREAD_OFF(circuit->t_send_psnp[0]);
+ THREAD_OFF(circuit->t_send_psnp[1]);
+ THREAD_OFF(circuit->t_read);
if (circuit->tx_queue) {
isis_tx_queue_free(circuit->tx_queue);
diff --git a/isisd/isis_dr.c b/isisd/isis_dr.c
index 27b7388072..b9bf49867d 100644
--- a/isisd/isis_dr.c
+++ b/isisd/isis_dr.c
@@ -222,8 +222,8 @@ int isis_dr_resign(struct isis_circuit *circuit, int level)
circuit->u.bc.is_dr[level - 1] = 0;
circuit->u.bc.run_dr_elect[level - 1] = 0;
- thread_cancel(&circuit->u.bc.t_run_dr[level - 1]);
- thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[level - 1]);
+ THREAD_OFF(circuit->u.bc.t_run_dr[level - 1]);
+ THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[level - 1]);
circuit->lsp_regenerate_pending[level - 1] = 0;
memcpy(id, circuit->isis->sysid, ISIS_SYS_ID_LEN);
@@ -247,7 +247,7 @@ int isis_dr_resign(struct isis_circuit *circuit, int level)
&circuit->t_send_psnp[1]);
}
- thread_cancel(&circuit->t_send_csnp[level - 1]);
+ THREAD_OFF(circuit->t_send_csnp[level - 1]);
thread_add_timer(master, isis_run_dr,
&circuit->level_arg[level - 1],
@@ -285,8 +285,6 @@ int isis_dr_commence(struct isis_circuit *circuit, int level)
circuit->circuit_id;
assert(circuit->circuit_id); /* must be non-zero */
- /* if (circuit->t_send_l1_psnp)
- thread_cancel (circuit->t_send_l1_psnp); */
lsp_generate_pseudo(circuit, 1);
thread_add_timer(master, send_l1_csnp, circuit,
@@ -307,8 +305,6 @@ int isis_dr_commence(struct isis_circuit *circuit, int level)
circuit->circuit_id;
assert(circuit->circuit_id); /* must be non-zero */
- /* if (circuit->t_send_l1_psnp)
- thread_cancel (circuit->t_send_l1_psnp); */
lsp_generate_pseudo(circuit, 2);
thread_add_timer(master, send_l2_csnp, circuit,
diff --git a/isisd/isis_dynhn.c b/isisd/isis_dynhn.c
index 8d76e81934..5d6b7bc60a 100644
--- a/isisd/isis_dynhn.c
+++ b/isisd/isis_dynhn.c
@@ -57,7 +57,7 @@ void dyn_cache_finish(struct isis *isis)
struct listnode *node, *nnode;
struct isis_dynhn *dyn;
- thread_cancel(&isis->t_dync_clean);
+ THREAD_OFF(isis->t_dync_clean);
for (ALL_LIST_ELEMENTS(isis->dyn_cache, node, nnode, dyn)) {
list_delete_node(isis->dyn_cache, node);
diff --git a/isisd/isis_events.c b/isisd/isis_events.c
index fce48fec97..42823cf2b3 100644
--- a/isisd/isis_events.c
+++ b/isisd/isis_events.c
@@ -109,13 +109,13 @@ static void circuit_resign_level(struct isis_circuit *circuit, int level)
circuit->area->area_tag, circuit->circuit_id,
circuit->interface->name, level);
- thread_cancel(&circuit->t_send_csnp[idx]);
- thread_cancel(&circuit->t_send_psnp[idx]);
+ THREAD_OFF(circuit->t_send_csnp[idx]);
+ THREAD_OFF(circuit->t_send_psnp[idx]);
if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
- thread_cancel(&circuit->u.bc.t_send_lan_hello[idx]);
- thread_cancel(&circuit->u.bc.t_run_dr[idx]);
- thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[idx]);
+ THREAD_OFF(circuit->u.bc.t_send_lan_hello[idx]);
+ THREAD_OFF(circuit->u.bc.t_run_dr[idx]);
+ THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[idx]);
circuit->lsp_regenerate_pending[idx] = 0;
circuit->u.bc.run_dr_elect[idx] = 0;
circuit->u.bc.is_dr[idx] = 0;
diff --git a/isisd/isis_lfa.c b/isisd/isis_lfa.c
index 800cac8521..c4fadcba03 100644
--- a/isisd/isis_lfa.c
+++ b/isisd/isis_lfa.c
@@ -1519,7 +1519,7 @@ int isis_rlfa_activate(struct isis_spftree *spftree, struct rlfa *rlfa,
spftree->route_table_backup);
spftree->lfa.protection_counters.rlfa[vertex->N.ip.priority] += 1;
- thread_cancel(&area->t_rlfa_rib_update);
+ THREAD_OFF(area->t_rlfa_rib_update);
thread_add_timer(master, isis_area_verify_routes_cb, area, 2,
&area->t_rlfa_rib_update);
@@ -1538,7 +1538,7 @@ void isis_rlfa_deactivate(struct isis_spftree *spftree, struct rlfa *rlfa)
isis_route_delete(area, rn, spftree->route_table_backup);
spftree->lfa.protection_counters.rlfa[vertex->N.ip.priority] -= 1;
- thread_cancel(&area->t_rlfa_rib_update);
+ THREAD_OFF(area->t_rlfa_rib_update);
thread_add_timer(master, isis_area_verify_routes_cb, area, 2,
&area->t_rlfa_rib_update);
}
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index 8dbd41b5d9..5387f37039 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -1390,7 +1390,7 @@ int lsp_generate(struct isis_area *area, int level)
refresh_time = lsp_refresh_time(newlsp, rem_lifetime);
- thread_cancel(&area->t_lsp_refresh[level - 1]);
+ THREAD_OFF(area->t_lsp_refresh[level - 1]);
area->lsp_regenerate_pending[level - 1] = 0;
thread_add_timer(master, lsp_refresh,
&area->lsp_refresh_arg[level - 1], refresh_time,
@@ -1601,7 +1601,7 @@ int _lsp_regenerate_schedule(struct isis_area *area, int level,
"ISIS (%s): Will schedule regen timer. Last run was: %lld, Now is: %lld",
area->area_tag, (long long)lsp->last_generated,
(long long)now);
- thread_cancel(&area->t_lsp_refresh[lvl - 1]);
+ THREAD_OFF(area->t_lsp_refresh[lvl - 1]);
diff = now - lsp->last_generated;
if (diff < area->lsp_gen_interval[lvl - 1]
&& !(area->bfd_signalled_down)) {
@@ -1794,7 +1794,7 @@ int lsp_generate_pseudo(struct isis_circuit *circuit, int level)
lsp_flood(lsp, NULL);
refresh_time = lsp_refresh_time(lsp, rem_lifetime);
- thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[level - 1]);
+ THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[level - 1]);
circuit->lsp_regenerate_pending[level - 1] = 0;
if (level == IS_LEVEL_1)
thread_add_timer(
@@ -1985,7 +1985,7 @@ int lsp_regenerate_schedule_pseudo(struct isis_circuit *circuit, int level)
"ISIS (%s): Will schedule PSN regen timer. Last run was: %lld, Now is: %lld",
area->area_tag, (long long)lsp->last_generated,
(long long)now);
- thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[lvl - 1]);
+ THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[lvl - 1]);
diff = now - lsp->last_generated;
if (diff < circuit->area->lsp_gen_interval[lvl - 1]) {
timeout =
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index b1fbfd5140..47093fdd6b 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -205,7 +205,7 @@ static int process_p2p_hello(struct iih_info *iih)
adj);
/* lets take care of the expiry */
- thread_cancel(&adj->t_expire);
+ THREAD_OFF(adj->t_expire);
thread_add_timer(master, isis_adj_expire, adj, (long)adj->hold_time,
&adj->t_expire);
@@ -497,7 +497,7 @@ static int process_lan_hello(struct iih_info *iih)
adj);
/* lets take care of the expiry */
- thread_cancel(&adj->t_expire);
+ THREAD_OFF(adj->t_expire);
thread_add_timer(master, isis_adj_expire, adj, (long)adj->hold_time,
&adj->t_expire);
@@ -2064,7 +2064,7 @@ static void _send_hello_sched(struct isis_circuit *circuit,
if (thread_timer_remain_msec(*threadp) < (unsigned long)delay)
return;
- thread_cancel(threadp);
+ THREAD_OFF(*threadp);
}
thread_add_timer_msec(master, send_hello_cb,
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index 3aef8ada24..6be7c2d608 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -1938,7 +1938,7 @@ int _isis_spf_schedule(struct isis_area *area, int level,
area->area_tag, level, diff, func, file, line);
}
- thread_cancel(&area->t_rlfa_rib_update);
+ THREAD_OFF(area->t_rlfa_rib_update);
if (area->spf_delay_ietf[level - 1]) {
/* Need to call schedule function also if spf delay is running
* to
diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c
index 107fa71d71..259047ff66 100644
--- a/isisd/isis_sr.c
+++ b/isisd/isis_sr.c
@@ -1180,7 +1180,7 @@ void isis_sr_stop(struct isis_area *area)
area->area_tag);
/* Disable any re-attempt to connect to Label Manager */
- thread_cancel(&srdb->t_start_lm);
+ THREAD_OFF(srdb->t_start_lm);
/* Uninstall all local Adjacency-SIDs. */
for (ALL_LIST_ELEMENTS(area->srdb.adj_sids, node, nnode, sra))
diff --git a/isisd/isis_tx_queue.c b/isisd/isis_tx_queue.c
index 078329221a..06369c6d70 100644
--- a/isisd/isis_tx_queue.c
+++ b/isisd/isis_tx_queue.c
@@ -92,7 +92,7 @@ static void tx_queue_element_free(void *element)
{
struct isis_tx_queue_entry *e = element;
- thread_cancel(&(e->retry));
+ THREAD_OFF(e->retry);
XFREE(MTYPE_TX_QUEUE_ENTRY, e);
}
@@ -161,7 +161,7 @@ void _isis_tx_queue_add(struct isis_tx_queue *queue,
e->type = type;
- thread_cancel(&(e->retry));
+ THREAD_OFF(e->retry);
thread_add_event(master, tx_queue_send_event, e, 0, &e->retry);
e->is_retry = false;
@@ -184,7 +184,7 @@ void _isis_tx_queue_del(struct isis_tx_queue *queue, struct isis_lsp *lsp,
func, file, line);
}
- thread_cancel(&(e->retry));
+ THREAD_OFF(e->retry);
hash_release(queue->hash, e);
XFREE(MTYPE_TX_QUEUE_ENTRY, e);
diff --git a/isisd/isisd.c b/isisd/isisd.c
index 996a62f4d5..3fd2476ad1 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -514,10 +514,10 @@ void isis_area_destroy(struct isis_area *area)
if (area->spf_timer[0])
isis_spf_timer_free(THREAD_ARG(area->spf_timer[0]));
- thread_cancel(&area->spf_timer[0]);
+ THREAD_OFF(area->spf_timer[0]);
if (area->spf_timer[1])
isis_spf_timer_free(THREAD_ARG(area->spf_timer[1]));
- thread_cancel(&area->spf_timer[1]);
+ THREAD_OFF(area->spf_timer[1]);
spf_backoff_free(area->spf_delay_ietf[0]);
spf_backoff_free(area->spf_delay_ietf[1]);
@@ -541,10 +541,10 @@ void isis_area_destroy(struct isis_area *area)
isis_lfa_tiebreakers_clear(area, ISIS_LEVEL1);
isis_lfa_tiebreakers_clear(area, ISIS_LEVEL2);
- thread_cancel(&area->t_tick);
- thread_cancel(&area->t_lsp_refresh[0]);
- thread_cancel(&area->t_lsp_refresh[1]);
- thread_cancel(&area->t_rlfa_rib_update);
+ THREAD_OFF(area->t_tick);
+ THREAD_OFF(area->t_lsp_refresh[0]);
+ THREAD_OFF(area->t_lsp_refresh[1]);
+ THREAD_OFF(area->t_rlfa_rib_update);
thread_cancel_event(master, area);
@@ -3094,12 +3094,12 @@ static void area_resign_level(struct isis_area *area, int level)
if (area->spf_timer[level - 1])
isis_spf_timer_free(THREAD_ARG(area->spf_timer[level - 1]));
- thread_cancel(&area->spf_timer[level - 1]);
+ THREAD_OFF(area->spf_timer[level - 1]);
sched_debug(
"ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.",
area->area_tag, level);
- thread_cancel(&area->t_lsp_refresh[level - 1]);
+ THREAD_OFF(area->t_lsp_refresh[level - 1]);
area->lsp_regenerate_pending[level - 1] = 0;
}
diff --git a/ldpd/accept.c b/ldpd/accept.c
index 2999a35c06..1a04c563c1 100644
--- a/ldpd/accept.c
+++ b/ldpd/accept.c
@@ -72,7 +72,7 @@ accept_del(int fd)
LIST_FOREACH(av, &accept_queue.queue, entry)
if (av->fd == fd) {
log_debug("%s: %d removed from queue", __func__, fd);
- thread_cancel(&av->ev);
+ THREAD_OFF(av->ev);
LIST_REMOVE(av, entry);
free(av);
return;
@@ -92,7 +92,7 @@ accept_unpause(void)
{
if (accept_queue.evt != NULL) {
log_debug(__func__);
- thread_cancel(&accept_queue.evt);
+ THREAD_OFF(accept_queue.evt);
accept_arm();
}
}
@@ -111,7 +111,7 @@ accept_unarm(void)
{
struct accept_ev *av;
LIST_FOREACH(av, &accept_queue.queue, entry)
- thread_cancel(&av->ev);
+ THREAD_OFF(av->ev);
}
static void accept_cb(struct thread *thread)
diff --git a/ldpd/adjacency.c b/ldpd/adjacency.c
index 04a24242dc..8caa3c4e24 100644
--- a/ldpd/adjacency.c
+++ b/ldpd/adjacency.c
@@ -196,7 +196,7 @@ static void adj_itimer(struct thread *thread)
void
adj_start_itimer(struct adj *adj)
{
- thread_cancel(&adj->inactivity_timer);
+ THREAD_OFF(adj->inactivity_timer);
adj->inactivity_timer = NULL;
thread_add_timer(master, adj_itimer, adj, adj->holdtime,
&adj->inactivity_timer);
@@ -205,7 +205,7 @@ adj_start_itimer(struct adj *adj)
void
adj_stop_itimer(struct adj *adj)
{
- thread_cancel(&adj->inactivity_timer);
+ THREAD_OFF(adj->inactivity_timer);
}
/* targeted neighbors */
@@ -354,7 +354,7 @@ static void tnbr_hello_timer(struct thread *thread)
static void
tnbr_start_hello_timer(struct tnbr *tnbr)
{
- thread_cancel(&tnbr->hello_timer);
+ THREAD_OFF(tnbr->hello_timer);
tnbr->hello_timer = NULL;
thread_add_timer(master, tnbr_hello_timer, tnbr, tnbr_get_hello_interval(tnbr),
&tnbr->hello_timer);
@@ -363,7 +363,7 @@ tnbr_start_hello_timer(struct tnbr *tnbr)
static void
tnbr_stop_hello_timer(struct tnbr *tnbr)
{
- thread_cancel(&tnbr->hello_timer);
+ THREAD_OFF(tnbr->hello_timer);
}
struct ctl_adj *
diff --git a/ldpd/control.c b/ldpd/control.c
index 376f488bd1..09e91217ae 100644
--- a/ldpd/control.c
+++ b/ldpd/control.c
@@ -180,8 +180,8 @@ control_close(int fd)
msgbuf_clear(&c->iev.ibuf.w);
TAILQ_REMOVE(&ctl_conns, c, entry);
- thread_cancel(&c->iev.ev_read);
- thread_cancel(&c->iev.ev_write);
+ THREAD_OFF(c->iev.ev_read);
+ THREAD_OFF(c->iev.ev_write);
close(c->iev.ibuf.fd);
accept_unpause();
free(c);
diff --git a/ldpd/interface.c b/ldpd/interface.c
index ddf6c395ae..392e25470f 100644
--- a/ldpd/interface.c
+++ b/ldpd/interface.c
@@ -467,7 +467,7 @@ static void if_hello_timer(struct thread *thread)
static void
if_start_hello_timer(struct iface_af *ia)
{
- thread_cancel(&ia->hello_timer);
+ THREAD_OFF(ia->hello_timer);
thread_add_timer(master, if_hello_timer, ia, if_get_hello_interval(ia),
&ia->hello_timer);
}
@@ -475,7 +475,7 @@ if_start_hello_timer(struct iface_af *ia)
static void
if_stop_hello_timer(struct iface_af *ia)
{
- thread_cancel(&ia->hello_timer);
+ THREAD_OFF(ia->hello_timer);
}
struct ctl_iface *
diff --git a/ldpd/lde.c b/ldpd/lde.c
index 9d1daabbe9..efc07b4547 100644
--- a/ldpd/lde.c
+++ b/ldpd/lde.c
@@ -417,8 +417,8 @@ static void lde_dispatch_imsg(struct thread *thread)
imsg_event_add(iev);
else {
/* this pipe is dead, so remove the event handlers and exit */
- thread_cancel(&iev->ev_read);
- thread_cancel(&iev->ev_write);
+ THREAD_OFF(iev->ev_read);
+ THREAD_OFF(iev->ev_write);
lde_shutdown();
}
}
@@ -702,8 +702,8 @@ static void lde_dispatch_parent(struct thread *thread)
imsg_event_add(iev);
else {
/* this pipe is dead, so remove the event handlers and exit */
- thread_cancel(&iev->ev_read);
- thread_cancel(&iev->ev_write);
+ THREAD_OFF(iev->ev_read);
+ THREAD_OFF(iev->ev_write);
lde_shutdown();
}
}
diff --git a/ldpd/lde_lib.c b/ldpd/lde_lib.c
index 1ade3c5378..4366560546 100644
--- a/ldpd/lde_lib.c
+++ b/ldpd/lde_lib.c
@@ -1068,7 +1068,7 @@ void lde_gc_timer(struct thread *thread)
void
lde_gc_start_timer(void)
{
- thread_cancel(&gc_timer);
+ THREAD_OFF(gc_timer);
thread_add_timer(master, lde_gc_timer, NULL, LDE_GC_INTERVAL,
&gc_timer);
}
@@ -1076,5 +1076,5 @@ lde_gc_start_timer(void)
void
lde_gc_stop_timer(void)
{
- thread_cancel(&gc_timer);
+ THREAD_OFF(gc_timer);
}
diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c
index 796cf11798..87d78afa25 100644
--- a/ldpd/ldpd.c
+++ b/ldpd/ldpd.c
@@ -616,8 +616,8 @@ static void main_dispatch_ldpe(struct thread *thread)
imsg_event_add(iev);
else {
/* this pipe is dead, so remove the event handlers and exit */
- thread_cancel(&iev->ev_read);
- thread_cancel(&iev->ev_write);
+ THREAD_OFF(iev->ev_read);
+ THREAD_OFF(iev->ev_write);
ldpe_pid = 0;
if (lde_pid == 0)
ldpd_shutdown();
@@ -721,8 +721,8 @@ static void main_dispatch_lde(struct thread *thread)
imsg_event_add(iev);
else {
/* this pipe is dead, so remove the event handlers and exit */
- thread_cancel(&iev->ev_read);
- thread_cancel(&iev->ev_write);
+ THREAD_OFF(iev->ev_read);
+ THREAD_OFF(iev->ev_write);
lde_pid = 0;
if (ldpe_pid == 0)
ldpd_shutdown();
@@ -744,8 +744,8 @@ void ldp_write_handler(struct thread *thread)
fatal("msgbuf_write");
if (n == 0) {
/* this pipe is dead, so remove the event handlers */
- thread_cancel(&iev->ev_read);
- thread_cancel(&iev->ev_write);
+ THREAD_OFF(iev->ev_read);
+ THREAD_OFF(iev->ev_write);
return;
}
@@ -829,7 +829,7 @@ void evbuf_init(struct evbuf *eb, int fd, void (*handler)(struct thread *),
void
evbuf_clear(struct evbuf *eb)
{
- thread_cancel(&eb->ev);
+ THREAD_OFF(eb->ev);
msgbuf_clear(&eb->wbuf);
eb->wbuf.fd = -1;
}
diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c
index 29abd420e5..792dcb2f2a 100644
--- a/ldpd/ldpe.c
+++ b/ldpd/ldpe.c
@@ -212,7 +212,7 @@ ldpe_shutdown(void)
#ifdef __OpenBSD__
if (sysdep.no_pfkey == 0) {
- thread_cancel(&pfkey_ev);
+ THREAD_OFF(pfkey_ev);
close(global.pfkeysock);
}
#endif
@@ -626,8 +626,8 @@ static void ldpe_dispatch_main(struct thread *thread)
imsg_event_add(iev);
else {
/* this pipe is dead, so remove the event handlers and exit */
- thread_cancel(&iev->ev_read);
- thread_cancel(&iev->ev_write);
+ THREAD_OFF(iev->ev_read);
+ THREAD_OFF(iev->ev_write);
ldpe_shutdown();
}
}
@@ -762,8 +762,8 @@ static void ldpe_dispatch_lde(struct thread *thread)
imsg_event_add(iev);
else {
/* this pipe is dead, so remove the event handlers and exit */
- thread_cancel(&iev->ev_read);
- thread_cancel(&iev->ev_write);
+ THREAD_OFF(iev->ev_read);
+ THREAD_OFF(iev->ev_write);
ldpe_shutdown();
}
}
@@ -813,14 +813,14 @@ ldpe_close_sockets(int af)
af_global = ldp_af_global_get(&global, af);
/* discovery socket */
- thread_cancel(&af_global->disc_ev);
+ THREAD_OFF(af_global->disc_ev);
if (af_global->ldp_disc_socket != -1) {
close(af_global->ldp_disc_socket);
af_global->ldp_disc_socket = -1;
}
/* extended discovery socket */
- thread_cancel(&af_global->edisc_ev);
+ THREAD_OFF(af_global->edisc_ev);
if (af_global->ldp_edisc_socket != -1) {
close(af_global->ldp_edisc_socket);
af_global->ldp_edisc_socket = -1;
diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c
index 514bcee32b..e1db9e8e1e 100644
--- a/ldpd/neighbor.c
+++ b/ldpd/neighbor.c
@@ -307,7 +307,7 @@ nbr_del(struct nbr *nbr)
nbr->auth.method = AUTH_NONE;
if (nbr_pending_connect(nbr))
- thread_cancel(&nbr->ev_connect);
+ THREAD_OFF(nbr->ev_connect);
nbr_stop_ktimer(nbr);
nbr_stop_ktimeout(nbr);
nbr_stop_itimeout(nbr);
@@ -435,7 +435,7 @@ nbr_start_ktimer(struct nbr *nbr)
/* send three keepalives per period */
secs = nbr->keepalive / KEEPALIVE_PER_PERIOD;
- thread_cancel(&nbr->keepalive_timer);
+ THREAD_OFF(nbr->keepalive_timer);
nbr->keepalive_timer = NULL;
thread_add_timer(master, nbr_ktimer, nbr, secs, &nbr->keepalive_timer);
}
@@ -443,7 +443,7 @@ nbr_start_ktimer(struct nbr *nbr)
void
nbr_stop_ktimer(struct nbr *nbr)
{
- thread_cancel(&nbr->keepalive_timer);
+ THREAD_OFF(nbr->keepalive_timer);
}
/* Keepalive timeout: if the nbr hasn't sent keepalive */
@@ -462,7 +462,7 @@ static void nbr_ktimeout(struct thread *thread)
static void
nbr_start_ktimeout(struct nbr *nbr)
{
- thread_cancel(&nbr->keepalive_timeout);
+ THREAD_OFF(nbr->keepalive_timeout);
nbr->keepalive_timeout = NULL;
thread_add_timer(master, nbr_ktimeout, nbr, nbr->keepalive,
&nbr->keepalive_timeout);
@@ -471,7 +471,7 @@ nbr_start_ktimeout(struct nbr *nbr)
void
nbr_stop_ktimeout(struct nbr *nbr)
{
- thread_cancel(&nbr->keepalive_timeout);
+ THREAD_OFF(nbr->keepalive_timeout);
}
/* Session initialization timeout: if nbr got stuck in the initialization FSM */
@@ -491,7 +491,7 @@ nbr_start_itimeout(struct nbr *nbr)
int secs;
secs = INIT_FSM_TIMEOUT;
- thread_cancel(&nbr->init_timeout);
+ THREAD_OFF(nbr->init_timeout);
nbr->init_timeout = NULL;
thread_add_timer(master, nbr_itimeout, nbr, secs, &nbr->init_timeout);
}
@@ -499,7 +499,7 @@ nbr_start_itimeout(struct nbr *nbr)
void
nbr_stop_itimeout(struct nbr *nbr)
{
- thread_cancel(&nbr->init_timeout);
+ THREAD_OFF(nbr->init_timeout);
}
/* Init delay timer: timer to retry to iniziatize session */
@@ -537,7 +537,7 @@ nbr_start_idtimer(struct nbr *nbr)
break;
}
- thread_cancel(&nbr->initdelay_timer);
+ THREAD_OFF(nbr->initdelay_timer);
nbr->initdelay_timer = NULL;
thread_add_timer(master, nbr_idtimer, nbr, secs,
&nbr->initdelay_timer);
@@ -546,7 +546,7 @@ nbr_start_idtimer(struct nbr *nbr)
void
nbr_stop_idtimer(struct nbr *nbr)
{
- thread_cancel(&nbr->initdelay_timer);
+ THREAD_OFF(nbr->initdelay_timer);
}
int
diff --git a/ldpd/packet.c b/ldpd/packet.c
index 707878ca9f..2cca52461f 100644
--- a/ldpd/packet.c
+++ b/ldpd/packet.c
@@ -651,7 +651,7 @@ session_shutdown(struct nbr *nbr, uint32_t status, uint32_t msg_id,
switch (nbr->state) {
case NBR_STA_PRESENT:
if (nbr_pending_connect(nbr))
- thread_cancel(&nbr->ev_connect);
+ THREAD_OFF(nbr->ev_connect);
break;
case NBR_STA_INITIAL:
case NBR_STA_OPENREC:
@@ -756,7 +756,7 @@ tcp_close(struct tcp_conn *tcp)
evbuf_clear(&tcp->wbuf);
if (tcp->nbr) {
- thread_cancel(&tcp->rev);
+ THREAD_OFF(tcp->rev);
free(tcp->rbuf);
tcp->nbr->tcp = NULL;
}
@@ -788,7 +788,7 @@ pending_conn_new(int fd, int af, union ldpd_addr *addr)
void
pending_conn_del(struct pending_conn *pconn)
{
- thread_cancel(&pconn->ev_timeout);
+ THREAD_OFF(pconn->ev_timeout);
TAILQ_REMOVE(&global.pending_conns, pconn, entry);
free(pconn);
}
diff --git a/lib/agentx.c b/lib/agentx.c
index e03e19aad5..4c087219cb 100644
--- a/lib/agentx.c
+++ b/lib/agentx.c
@@ -146,9 +146,9 @@ static void agentx_events_update(void)
else if (FD_ISSET(fd, &fds)) {
struct listnode *newln;
thr = XCALLOC(MTYPE_TMP, sizeof(struct thread *));
- thread_add_read(agentx_tm, agentx_read, NULL, fd, thr);
+
newln = listnode_add_before(events, ln, thr);
- (*thr)->arg = newln;
+ thread_add_read(agentx_tm, agentx_read, newln, fd, thr);
}
}
diff --git a/lib/northbound_grpc.cpp b/lib/northbound_grpc.cpp
index 9cb999110b..95721ffc77 100644
--- a/lib/northbound_grpc.cpp
+++ b/lib/northbound_grpc.cpp
@@ -198,7 +198,7 @@ class RpcStateBase
static void c_callback(struct thread *thread)
{
- auto _tag = static_cast<RpcStateBase *>(thread->arg);
+ auto _tag = static_cast<RpcStateBase *>(THREAD_ARG(thread));
/*
* We hold the lock until the callback finishes and has updated
* _tag->state, then we signal done and release.
diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c
index 9d73c3dfe6..b8567830b1 100644
--- a/ospfd/ospf_apiserver.c
+++ b/ospfd/ospf_apiserver.c
@@ -318,12 +318,12 @@ void ospf_apiserver_free(struct ospf_apiserver *apiserv)
struct listnode *node;
/* Cancel read and write threads. */
- thread_cancel(&apiserv->t_sync_read);
+ THREAD_OFF(apiserv->t_sync_read);
#ifdef USE_ASYNC_READ
- thread_cancel(&apiserv->t_async_read);
+ THREAD_OFF(apiserv->t_async_read);
#endif /* USE_ASYNC_READ */
- thread_cancel(&apiserv->t_sync_write);
- thread_cancel(&apiserv->t_async_write);
+ THREAD_OFF(apiserv->t_sync_write);
+ THREAD_OFF(apiserv->t_async_write);
/* Unregister all opaque types that application registered
and flush opaque LSAs if still in LSDB. */
diff --git a/ospfd/ospf_gr.c b/ospfd/ospf_gr.c
index 2521f2fce0..66ef1d6564 100644
--- a/ospfd/ospf_gr.c
+++ b/ospfd/ospf_gr.c
@@ -216,7 +216,7 @@ static void ospf_gr_restart_exit(struct ospf *ospf, const char *reason)
zlog_debug("GR: exiting graceful restart: %s", reason);
ospf->gr_info.restart_in_progress = false;
- OSPF_TIMER_OFF(ospf->gr_info.t_grace_period);
+ THREAD_OFF(ospf->gr_info.t_grace_period);
/* Record in non-volatile memory that the restart is complete. */
ospf_gr_nvm_delete(ospf);
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 5df2ecf070..633ab05131 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -302,7 +302,7 @@ void ospf_if_cleanup(struct ospf_interface *oi)
/* oi->nbrs and oi->nbr_nbma should be deleted on InterfaceDown event */
/* delete all static neighbors attached to this interface */
for (ALL_LIST_ELEMENTS(oi->nbr_nbma, node, nnode, nbr_nbma)) {
- OSPF_POLL_TIMER_OFF(nbr_nbma->t_poll);
+ THREAD_OFF(nbr_nbma->t_poll);
if (nbr_nbma->nbr) {
nbr_nbma->nbr->nbr_nbma = NULL;
@@ -513,7 +513,7 @@ void ospf_if_stream_unset(struct ospf_interface *oi)
if (oi->on_write_q) {
listnode_delete(ospf->oi_write_q, oi);
if (list_isempty(ospf->oi_write_q))
- OSPF_TIMER_OFF(ospf->t_write);
+ THREAD_OFF(ospf->t_write);
oi->on_write_q = 0;
}
}
@@ -1474,7 +1474,7 @@ void ospf_reset_hello_timer(struct interface *ifp, struct in_addr addr,
ospf_hello_send(oi);
/* Restart hello timer for this interface */
- OSPF_ISM_TIMER_OFF(oi->t_hello);
+ THREAD_OFF(oi->t_hello);
OSPF_HELLO_TIMER_ON(oi);
}
@@ -1498,7 +1498,7 @@ void ospf_reset_hello_timer(struct interface *ifp, struct in_addr addr,
ospf_hello_send(oi);
/* Restart the hello timer. */
- OSPF_ISM_TIMER_OFF(oi->t_hello);
+ THREAD_OFF(oi->t_hello);
OSPF_HELLO_TIMER_ON(oi);
}
}
diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c
index 97da61034f..ab75ab9a1a 100644
--- a/ospfd/ospf_ism.c
+++ b/ospfd/ospf_ism.c
@@ -290,16 +290,16 @@ static void ism_timer_set(struct ospf_interface *oi)
interface parameters must be set to initial values, and
timers are
reset also. */
- OSPF_ISM_TIMER_OFF(oi->t_hello);
- OSPF_ISM_TIMER_OFF(oi->t_wait);
- OSPF_ISM_TIMER_OFF(oi->t_ls_ack);
+ THREAD_OFF(oi->t_hello);
+ THREAD_OFF(oi->t_wait);
+ THREAD_OFF(oi->t_ls_ack);
break;
case ISM_Loopback:
/* In this state, the interface may be looped back and will be
unavailable for regular data traffic. */
- OSPF_ISM_TIMER_OFF(oi->t_hello);
- OSPF_ISM_TIMER_OFF(oi->t_wait);
- OSPF_ISM_TIMER_OFF(oi->t_ls_ack);
+ THREAD_OFF(oi->t_hello);
+ THREAD_OFF(oi->t_wait);
+ THREAD_OFF(oi->t_ls_ack);
break;
case ISM_Waiting:
/* The router is trying to determine the identity of DRouter and
@@ -309,7 +309,7 @@ static void ism_timer_set(struct ospf_interface *oi)
OSPF_ISM_TIMER_MSEC_ON(oi->t_hello, ospf_hello_timer, 1);
OSPF_ISM_TIMER_ON(oi->t_wait, ospf_wait_timer,
OSPF_IF_PARAM(oi, v_wait));
- OSPF_ISM_TIMER_OFF(oi->t_ls_ack);
+ THREAD_OFF(oi->t_ls_ack);
break;
case ISM_PointToPoint:
/* The interface connects to a physical Point-to-point network
@@ -318,7 +318,7 @@ static void ism_timer_set(struct ospf_interface *oi)
neighboring router. Hello packets are also sent. */
/* send first hello immediately */
OSPF_ISM_TIMER_MSEC_ON(oi->t_hello, ospf_hello_timer, 1);
- OSPF_ISM_TIMER_OFF(oi->t_wait);
+ THREAD_OFF(oi->t_wait);
OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer,
oi->v_ls_ack);
break;
@@ -328,7 +328,7 @@ static void ism_timer_set(struct ospf_interface *oi)
and the router itself is neither Designated Router nor
Backup Designated Router. */
OSPF_HELLO_TIMER_ON(oi);
- OSPF_ISM_TIMER_OFF(oi->t_wait);
+ THREAD_OFF(oi->t_wait);
OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer,
oi->v_ls_ack);
break;
@@ -337,7 +337,7 @@ static void ism_timer_set(struct ospf_interface *oi)
network,
and the router is Backup Designated Router. */
OSPF_HELLO_TIMER_ON(oi);
- OSPF_ISM_TIMER_OFF(oi->t_wait);
+ THREAD_OFF(oi->t_wait);
OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer,
oi->v_ls_ack);
break;
@@ -346,7 +346,7 @@ static void ism_timer_set(struct ospf_interface *oi)
network,
and the router is Designated Router. */
OSPF_HELLO_TIMER_ON(oi);
- OSPF_ISM_TIMER_OFF(oi->t_wait);
+ THREAD_OFF(oi->t_wait);
OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer,
oi->v_ls_ack);
break;
diff --git a/ospfd/ospf_ism.h b/ospfd/ospf_ism.h
index 35fbd15d00..92329bc55e 100644
--- a/ospfd/ospf_ism.h
+++ b/ospfd/ospf_ism.h
@@ -78,9 +78,6 @@
OSPF_IF_PARAM((O), v_hello)); \
} while (0)
-/* Macro for OSPF ISM timer turn off. */
-#define OSPF_ISM_TIMER_OFF(X) thread_cancel(&(X))
-
/* Macro for OSPF schedule event. */
#define OSPF_ISM_EVENT_SCHEDULE(I, E) \
thread_add_event(master, ospf_ism_event, (I), (E), NULL)
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index 39330fb926..2c2ddd4394 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -3625,7 +3625,7 @@ void ospf_flush_self_originated_lsas_now(struct ospf *ospf)
* without conflicting to other threads.
*/
if (ospf->t_maxage != NULL) {
- OSPF_TIMER_OFF(ospf->t_maxage);
+ THREAD_OFF(ospf->t_maxage);
thread_execute(master, ospf_maxage_lsa_remover, ospf, 0);
}
diff --git a/ospfd/ospf_neighbor.c b/ospfd/ospf_neighbor.c
index c59734b9f3..02c44dcdc1 100644
--- a/ospfd/ospf_neighbor.c
+++ b/ospfd/ospf_neighbor.c
@@ -140,17 +140,17 @@ void ospf_nbr_free(struct ospf_neighbor *nbr)
}
/* Cancel all timers. */
- OSPF_NSM_TIMER_OFF(nbr->t_inactivity);
- OSPF_NSM_TIMER_OFF(nbr->t_db_desc);
- OSPF_NSM_TIMER_OFF(nbr->t_ls_req);
- OSPF_NSM_TIMER_OFF(nbr->t_ls_upd);
+ THREAD_OFF(nbr->t_inactivity);
+ THREAD_OFF(nbr->t_db_desc);
+ THREAD_OFF(nbr->t_ls_req);
+ THREAD_OFF(nbr->t_ls_upd);
/* Cancel all events. */ /* Thread lookup cost would be negligible. */
thread_cancel_event(master, nbr);
bfd_sess_free(&nbr->bfd_session);
- OSPF_NSM_TIMER_OFF(nbr->gr_helper_info.t_grace_timer);
+ THREAD_OFF(nbr->gr_helper_info.t_grace_timer);
nbr->oi = NULL;
XFREE(MTYPE_OSPF_NEIGHBOR, nbr);
@@ -456,7 +456,7 @@ static struct ospf_neighbor *ospf_nbr_add(struct ospf_interface *oi,
nbr->nbr_nbma = nbr_nbma;
if (nbr_nbma->t_poll)
- OSPF_POLL_TIMER_OFF(nbr_nbma->t_poll);
+ THREAD_OFF(nbr_nbma->t_poll);
nbr->state_change = nbr_nbma->state_change + 1;
}
diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c
index c538d1a09a..333389596b 100644
--- a/ospfd/ospf_nsm.c
+++ b/ospfd/ospf_nsm.c
@@ -120,32 +120,32 @@ static void nsm_timer_set(struct ospf_neighbor *nbr)
switch (nbr->state) {
case NSM_Deleted:
case NSM_Down:
- OSPF_NSM_TIMER_OFF(nbr->t_inactivity);
- OSPF_NSM_TIMER_OFF(nbr->t_hello_reply);
+ THREAD_OFF(nbr->t_inactivity);
+ THREAD_OFF(nbr->t_hello_reply);
/* fallthru */
case NSM_Attempt:
case NSM_Init:
case NSM_TwoWay:
- OSPF_NSM_TIMER_OFF(nbr->t_db_desc);
- OSPF_NSM_TIMER_OFF(nbr->t_ls_upd);
- OSPF_NSM_TIMER_OFF(nbr->t_ls_req);
+ THREAD_OFF(nbr->t_db_desc);
+ THREAD_OFF(nbr->t_ls_upd);
+ THREAD_OFF(nbr->t_ls_req);
break;
case NSM_ExStart:
OSPF_NSM_TIMER_ON(nbr->t_db_desc, ospf_db_desc_timer,
nbr->v_db_desc);
- OSPF_NSM_TIMER_OFF(nbr->t_ls_upd);
- OSPF_NSM_TIMER_OFF(nbr->t_ls_req);
+ THREAD_OFF(nbr->t_ls_upd);
+ THREAD_OFF(nbr->t_ls_req);
break;
case NSM_Exchange:
OSPF_NSM_TIMER_ON(nbr->t_ls_upd, ospf_ls_upd_timer,
nbr->v_ls_upd);
if (!IS_SET_DD_MS(nbr->dd_flags))
- OSPF_NSM_TIMER_OFF(nbr->t_db_desc);
+ THREAD_OFF(nbr->t_db_desc);
break;
case NSM_Loading:
case NSM_Full:
default:
- OSPF_NSM_TIMER_OFF(nbr->t_db_desc);
+ THREAD_OFF(nbr->t_db_desc);
break;
}
}
@@ -176,13 +176,13 @@ int nsm_should_adj(struct ospf_neighbor *nbr)
static int nsm_hello_received(struct ospf_neighbor *nbr)
{
/* Start or Restart Inactivity Timer. */
- OSPF_NSM_TIMER_OFF(nbr->t_inactivity);
+ THREAD_OFF(nbr->t_inactivity);
OSPF_NSM_TIMER_ON(nbr->t_inactivity, ospf_inactivity_timer,
nbr->v_inactivity);
if (nbr->oi->type == OSPF_IFTYPE_NBMA && nbr->nbr_nbma)
- OSPF_POLL_TIMER_OFF(nbr->nbr_nbma->t_poll);
+ THREAD_OFF(nbr->nbr_nbma->t_poll);
/* Send proactive ARP requests */
if (nbr->state < NSM_Exchange)
@@ -194,9 +194,9 @@ static int nsm_hello_received(struct ospf_neighbor *nbr)
static int nsm_start(struct ospf_neighbor *nbr)
{
if (nbr->nbr_nbma)
- OSPF_POLL_TIMER_OFF(nbr->nbr_nbma->t_poll);
+ THREAD_OFF(nbr->nbr_nbma->t_poll);
- OSPF_NSM_TIMER_OFF(nbr->t_inactivity);
+ THREAD_OFF(nbr->t_inactivity);
OSPF_NSM_TIMER_ON(nbr->t_inactivity, ospf_inactivity_timer,
nbr->v_inactivity);
diff --git a/ospfd/ospf_nsm.h b/ospfd/ospf_nsm.h
index 0b40b1f424..c526c4c3ed 100644
--- a/ospfd/ospf_nsm.h
+++ b/ospfd/ospf_nsm.h
@@ -58,9 +58,6 @@
/* Macro for OSPF NSM timer turn on. */
#define OSPF_NSM_TIMER_ON(T,F,V) thread_add_timer (master, (F), nbr, (V), &(T))
-/* Macro for OSPF NSM timer turn off. */
-#define OSPF_NSM_TIMER_OFF(X) thread_cancel(&(X))
-
/* Macro for OSPF NSM schedule event. */
#define OSPF_NSM_EVENT_SCHEDULE(N, E) \
thread_add_event(master, ospf_nsm_event, (N), (E), NULL)
diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c
index 7e95cb591a..c7ac81d961 100644
--- a/ospfd/ospf_opaque.c
+++ b/ospfd/ospf_opaque.c
@@ -147,7 +147,7 @@ int ospf_opaque_type9_lsa_init(struct ospf_interface *oi)
void ospf_opaque_type9_lsa_term(struct ospf_interface *oi)
{
- OSPF_TIMER_OFF(oi->t_opaque_lsa_self);
+ THREAD_OFF(oi->t_opaque_lsa_self);
if (oi->opaque_lsa_self != NULL)
list_delete(&oi->opaque_lsa_self);
oi->opaque_lsa_self = NULL;
@@ -176,7 +176,7 @@ void ospf_opaque_type10_lsa_term(struct ospf_area *area)
area->lsdb->new_lsa_hook = area->lsdb->del_lsa_hook = NULL;
#endif /* MONITOR_LSDB_CHANGE */
- OSPF_TIMER_OFF(area->t_opaque_lsa_self);
+ THREAD_OFF(area->t_opaque_lsa_self);
if (area->opaque_lsa_self != NULL)
list_delete(&area->opaque_lsa_self);
return;
@@ -204,7 +204,7 @@ void ospf_opaque_type11_lsa_term(struct ospf *top)
top->lsdb->new_lsa_hook = top->lsdb->del_lsa_hook = NULL;
#endif /* MONITOR_LSDB_CHANGE */
- OSPF_TIMER_OFF(top->t_opaque_lsa_self);
+ THREAD_OFF(top->t_opaque_lsa_self);
if (top->opaque_lsa_self != NULL)
list_delete(&top->opaque_lsa_self);
return;
@@ -603,7 +603,7 @@ static void free_opaque_info_per_type(struct opaque_info_per_type *oipt,
ospf_opaque_lsa_flush_schedule(lsa);
}
- OSPF_TIMER_OFF(oipt->t_opaque_lsa_self);
+ THREAD_OFF(oipt->t_opaque_lsa_self);
list_delete(&oipt->id_list);
if (cleanup_owner) {
/* Remove from its owner's self-originated LSA list. */
@@ -711,7 +711,7 @@ static void free_opaque_info_per_id(void *val)
{
struct opaque_info_per_id *oipi = (struct opaque_info_per_id *)val;
- OSPF_TIMER_OFF(oipi->t_opaque_lsa_self);
+ THREAD_OFF(oipi->t_opaque_lsa_self);
if (oipi->lsa != NULL)
ospf_lsa_unlock(&oipi->lsa);
XFREE(MTYPE_OPAQUE_INFO_PER_ID, oipi);
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index c319f8068a..4b3f30a3f1 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -466,7 +466,7 @@ static void ospf_ls_req_timer(struct thread *thread)
void ospf_ls_req_event(struct ospf_neighbor *nbr)
{
- thread_cancel(&nbr->t_ls_req);
+ THREAD_OFF(nbr->t_ls_req);
thread_add_event(master, ospf_ls_req_timer, nbr, 0, &nbr->t_ls_req);
}
@@ -4103,7 +4103,7 @@ static void ospf_ls_upd_queue_send(struct ospf_interface *oi,
* is actually turned off.
*/
if (list_isempty(oi->ospf->oi_write_q))
- OSPF_TIMER_OFF(oi->ospf->t_write);
+ THREAD_OFF(oi->ospf->t_write);
} else {
/* Hook thread to write packet. */
OSPF_ISM_WRITE_ON(oi->ospf);
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 5bb65b6abc..1c22fad669 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -9748,7 +9748,7 @@ DEFUN (no_ospf_max_metric_router_lsa_startup,
for (ALL_LIST_ELEMENTS_RO(ospf->areas, ln, area)) {
SET_FLAG(area->stub_router_state,
OSPF_AREA_WAS_START_STUB_ROUTED);
- OSPF_TIMER_OFF(area->t_stub_router);
+ THREAD_OFF(area->t_stub_router);
/* Don't trample on admin stub routed */
if (!CHECK_FLAG(area->stub_router_state,
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 33872950ac..8512b6a339 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -572,7 +572,7 @@ static struct ospf *ospf_lookup_by_name(const char *vrf_name)
static void ospf_deferred_shutdown_finish(struct ospf *ospf)
{
ospf->stub_router_shutdown_time = OSPF_STUB_ROUTER_UNCONFIGURED;
- OSPF_TIMER_OFF(ospf->t_deferred_shutdown);
+ THREAD_OFF(ospf->t_deferred_shutdown);
ospf_finish_final(ospf);
@@ -754,7 +754,7 @@ static void ospf_finish_final(struct ospf *ospf)
/* Clear static neighbors */
for (rn = route_top(ospf->nbr_nbma); rn; rn = route_next(rn))
if ((nbr_nbma = rn->info)) {
- OSPF_POLL_TIMER_OFF(nbr_nbma->t_poll);
+ THREAD_OFF(nbr_nbma->t_poll);
if (nbr_nbma->nbr) {
nbr_nbma->nbr->nbr_nbma = NULL;
@@ -790,22 +790,22 @@ static void ospf_finish_final(struct ospf *ospf)
}
/* Cancel all timers. */
- OSPF_TIMER_OFF(ospf->t_read);
- OSPF_TIMER_OFF(ospf->t_write);
- OSPF_TIMER_OFF(ospf->t_spf_calc);
- OSPF_TIMER_OFF(ospf->t_ase_calc);
- OSPF_TIMER_OFF(ospf->t_maxage);
- OSPF_TIMER_OFF(ospf->t_maxage_walker);
- OSPF_TIMER_OFF(ospf->t_abr_task);
- OSPF_TIMER_OFF(ospf->t_asbr_check);
- OSPF_TIMER_OFF(ospf->t_asbr_nssa_redist_update);
- OSPF_TIMER_OFF(ospf->t_distribute_update);
- OSPF_TIMER_OFF(ospf->t_lsa_refresher);
- OSPF_TIMER_OFF(ospf->t_opaque_lsa_self);
- OSPF_TIMER_OFF(ospf->t_sr_update);
- OSPF_TIMER_OFF(ospf->t_default_routemap_timer);
- OSPF_TIMER_OFF(ospf->t_external_aggr);
- OSPF_TIMER_OFF(ospf->gr_info.t_grace_period);
+ THREAD_OFF(ospf->t_read);
+ THREAD_OFF(ospf->t_write);
+ THREAD_OFF(ospf->t_spf_calc);
+ THREAD_OFF(ospf->t_ase_calc);
+ THREAD_OFF(ospf->t_maxage);
+ THREAD_OFF(ospf->t_maxage_walker);
+ THREAD_OFF(ospf->t_abr_task);
+ THREAD_OFF(ospf->t_asbr_check);
+ THREAD_OFF(ospf->t_asbr_nssa_redist_update);
+ THREAD_OFF(ospf->t_distribute_update);
+ THREAD_OFF(ospf->t_lsa_refresher);
+ THREAD_OFF(ospf->t_opaque_lsa_self);
+ THREAD_OFF(ospf->t_sr_update);
+ THREAD_OFF(ospf->t_default_routemap_timer);
+ THREAD_OFF(ospf->t_external_aggr);
+ THREAD_OFF(ospf->gr_info.t_grace_period);
LSDB_LOOP (OPAQUE_AS_LSDB(ospf), rn, lsa)
ospf_discard_from_db(ospf, ospf->lsdb, lsa);
@@ -992,8 +992,8 @@ static void ospf_area_free(struct ospf_area *area)
free(IMPORT_NAME(area));
/* Cancel timer. */
- OSPF_TIMER_OFF(area->t_stub_router);
- OSPF_TIMER_OFF(area->t_opaque_lsa_self);
+ THREAD_OFF(area->t_stub_router);
+ THREAD_OFF(area->t_opaque_lsa_self);
if (OSPF_IS_AREA_BACKBONE(area))
area->ospf->backbone = NULL;
@@ -1428,7 +1428,7 @@ void ospf_ls_upd_queue_empty(struct ospf_interface *oi)
}
/* remove update event */
- thread_cancel(&oi->t_ls_upd_event);
+ THREAD_OFF(oi->t_ls_upd_event);
}
void ospf_if_update(struct ospf *ospf, struct interface *ifp)
@@ -1836,7 +1836,7 @@ int ospf_timers_refresh_set(struct ospf *ospf, int interval)
- (monotime(NULL) - ospf->lsa_refresher_started);
if (time_left > interval) {
- OSPF_TIMER_OFF(ospf->t_lsa_refresher);
+ THREAD_OFF(ospf->t_lsa_refresher);
thread_add_timer(master, ospf_lsa_refresh_walker, ospf,
interval, &ospf->t_lsa_refresher);
}
@@ -1853,7 +1853,7 @@ int ospf_timers_refresh_unset(struct ospf *ospf)
- (monotime(NULL) - ospf->lsa_refresher_started);
if (time_left > OSPF_LSA_REFRESH_INTERVAL_DEFAULT) {
- OSPF_TIMER_OFF(ospf->t_lsa_refresher);
+ THREAD_OFF(ospf->t_lsa_refresher);
ospf->t_lsa_refresher = NULL;
thread_add_timer(master, ospf_lsa_refresh_walker, ospf,
OSPF_LSA_REFRESH_INTERVAL_DEFAULT,
@@ -1905,7 +1905,7 @@ static void ospf_nbr_nbma_delete(struct ospf *ospf,
static void ospf_nbr_nbma_down(struct ospf_nbr_nbma *nbr_nbma)
{
- OSPF_TIMER_OFF(nbr_nbma->t_poll);
+ THREAD_OFF(nbr_nbma->t_poll);
if (nbr_nbma->nbr) {
nbr_nbma->nbr->nbr_nbma = NULL;
@@ -2094,7 +2094,7 @@ int ospf_nbr_nbma_poll_interval_set(struct ospf *ospf, struct in_addr nbr_addr,
if (nbr_nbma->v_poll != interval) {
nbr_nbma->v_poll = interval;
if (nbr_nbma->oi && ospf_if_is_up(nbr_nbma->oi)) {
- OSPF_TIMER_OFF(nbr_nbma->t_poll);
+ THREAD_OFF(nbr_nbma->t_poll);
OSPF_POLL_TIMER_ON(nbr_nbma->t_poll, ospf_poll_timer,
nbr_nbma->v_poll);
}
@@ -2263,7 +2263,7 @@ static int ospf_vrf_disable(struct vrf *vrf)
if (IS_DEBUG_OSPF_EVENT)
zlog_debug("%s: ospf old_vrf_id %d unlinked", __func__,
old_vrf_id);
- thread_cancel(&ospf->t_read);
+ THREAD_OFF(ospf->t_read);
close(ospf->fd);
ospf->fd = -1;
}
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index 401a89fa38..8478c96ddc 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -647,8 +647,6 @@ struct ospf_nbr_nbma {
#define OSPF_TIMER_ON(T,F,V) thread_add_timer (master,(F),ospf,(V),&(T))
#define OSPF_AREA_TIMER_ON(T,F,V) thread_add_timer (master, (F), area, (V), &(T))
#define OSPF_POLL_TIMER_ON(T,F,V) thread_add_timer (master, (F), nbr_nbma, (V), &(T))
-#define OSPF_POLL_TIMER_OFF(X) OSPF_TIMER_OFF((X))
-#define OSPF_TIMER_OFF(X) thread_cancel(&(X))
/* Extern variables. */
extern struct ospf_master *om;
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 7ac37b7ee2..02da56e4f3 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -428,7 +428,7 @@ static void rip_interface_clean(struct rip_interface *ri)
ri->enable_interface = 0;
ri->running = 0;
- thread_cancel(&ri->t_wakeup);
+ THREAD_OFF(ri->t_wakeup);
}
void rip_interfaces_clean(struct rip *rip)
diff --git a/ripd/rip_nb_rpcs.c b/ripd/rip_nb_rpcs.c
index 52f2985cb3..25641f2f79 100644
--- a/ripd/rip_nb_rpcs.c
+++ b/ripd/rip_nb_rpcs.c
@@ -64,8 +64,8 @@ static void clear_rip_route(struct rip *rip)
}
if (rinfo) {
- RIP_TIMER_OFF(rinfo->t_timeout);
- RIP_TIMER_OFF(rinfo->t_garbage_collect);
+ THREAD_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_garbage_collect);
listnode_delete(list, rinfo);
rip_info_free(rinfo);
}
diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c
index 8febb436e7..a52914bcf9 100644
--- a/ripd/rip_peer.c
+++ b/ripd/rip_peer.c
@@ -38,7 +38,7 @@ static struct rip_peer *rip_peer_new(void)
static void rip_peer_free(struct rip_peer *peer)
{
- RIP_TIMER_OFF(peer->t_timeout);
+ THREAD_OFF(peer->t_timeout);
XFREE(MTYPE_RIP_PEER, peer);
}
@@ -84,7 +84,7 @@ static struct rip_peer *rip_peer_get(struct rip *rip, struct in_addr *addr)
peer = rip_peer_lookup(rip, addr);
if (peer) {
- thread_cancel(&peer->t_timeout);
+ THREAD_OFF(peer->t_timeout);
} else {
peer = rip_peer_new();
peer->rip = rip;
diff --git a/ripd/ripd.c b/ripd/ripd.c
index cc21c0bd69..9798186036 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -144,7 +144,7 @@ static void rip_garbage_collect(struct thread *t)
rinfo = THREAD_ARG(t);
/* Off timeout timer. */
- RIP_TIMER_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_timeout);
/* Get route_node pointer. */
rp = rinfo->rp;
@@ -226,14 +226,14 @@ struct rip_info *rip_ecmp_replace(struct rip *rip, struct rip_info *rinfo_new)
if (tmp_rinfo == rinfo)
continue;
- RIP_TIMER_OFF(tmp_rinfo->t_timeout);
- RIP_TIMER_OFF(tmp_rinfo->t_garbage_collect);
+ THREAD_OFF(tmp_rinfo->t_timeout);
+ THREAD_OFF(tmp_rinfo->t_garbage_collect);
list_delete_node(list, node);
rip_info_free(tmp_rinfo);
}
- RIP_TIMER_OFF(rinfo->t_timeout);
- RIP_TIMER_OFF(rinfo->t_garbage_collect);
+ THREAD_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_garbage_collect);
memcpy(rinfo, rinfo_new, sizeof(struct rip_info));
if (rip_route_rte(rinfo)) {
@@ -262,12 +262,12 @@ struct rip_info *rip_ecmp_delete(struct rip *rip, struct rip_info *rinfo)
struct route_node *rp = rinfo->rp;
struct list *list = (struct list *)rp->info;
- RIP_TIMER_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_timeout);
if (listcount(list) > 1) {
/* Some other ECMP entries still exist. Just delete this entry.
*/
- RIP_TIMER_OFF(rinfo->t_garbage_collect);
+ THREAD_OFF(rinfo->t_garbage_collect);
listnode_delete(list, rinfo);
if (rip_route_rte(rinfo)
&& CHECK_FLAG(rinfo->flags, RIP_RTF_FIB))
@@ -313,7 +313,7 @@ static void rip_timeout(struct thread *t)
static void rip_timeout_update(struct rip *rip, struct rip_info *rinfo)
{
if (rinfo->metric != RIP_METRIC_INFINITY) {
- RIP_TIMER_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_timeout);
thread_add_timer(master, rip_timeout, rinfo, rip->timeout_time,
&rinfo->t_timeout);
}
@@ -659,8 +659,8 @@ static void rip_rte_process(struct rte *rte, struct sockaddr_in *from,
assert(newinfo.metric
!= RIP_METRIC_INFINITY);
- RIP_TIMER_OFF(rinfo->t_timeout);
- RIP_TIMER_OFF(rinfo->t_garbage_collect);
+ THREAD_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_garbage_collect);
memcpy(rinfo, &newinfo,
sizeof(struct rip_info));
rip_timeout_update(rip, rinfo);
@@ -1614,7 +1614,7 @@ void rip_redistribute_delete(struct rip *rip, int type, int sub_type,
RIP_TIMER_ON(rinfo->t_garbage_collect,
rip_garbage_collect,
rip->garbage_time);
- RIP_TIMER_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_timeout);
rinfo->flags |= RIP_RTF_CHANGED;
if (IS_RIP_DEBUG_EVENT)
@@ -2506,7 +2506,7 @@ static void rip_update(struct thread *t)
/* Triggered updates may be suppressed if a regular update is due by
the time the triggered update would be sent. */
- RIP_TIMER_OFF(rip->t_triggered_interval);
+ THREAD_OFF(rip->t_triggered_interval);
rip->trigger = 0;
/* Register myself. */
@@ -2553,7 +2553,7 @@ static void rip_triggered_update(struct thread *t)
int interval;
/* Cancel interval timer. */
- RIP_TIMER_OFF(rip->t_triggered_interval);
+ THREAD_OFF(rip->t_triggered_interval);
rip->trigger = 0;
/* Logging triggered update. */
@@ -2603,7 +2603,7 @@ void rip_redistribute_withdraw(struct rip *rip, int type)
rinfo->metric = RIP_METRIC_INFINITY;
RIP_TIMER_ON(rinfo->t_garbage_collect, rip_garbage_collect,
rip->garbage_time);
- RIP_TIMER_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_timeout);
rinfo->flags |= RIP_RTF_CHANGED;
if (IS_RIP_DEBUG_EVENT) {
@@ -2785,7 +2785,7 @@ void rip_event(struct rip *rip, enum rip_event event, int sock)
thread_add_read(master, rip_read, rip, sock, &rip->t_read);
break;
case RIP_UPDATE_EVENT:
- RIP_TIMER_OFF(rip->t_update);
+ THREAD_OFF(rip->t_update);
jitter = rip_update_jitter(rip->update_time);
thread_add_timer(master, rip_update, rip,
sock ? 2 : rip->update_time + jitter,
@@ -2915,8 +2915,8 @@ void rip_ecmp_disable(struct rip *rip)
if (tmp_rinfo == rinfo)
continue;
- RIP_TIMER_OFF(tmp_rinfo->t_timeout);
- RIP_TIMER_OFF(tmp_rinfo->t_garbage_collect);
+ THREAD_OFF(tmp_rinfo->t_timeout);
+ THREAD_OFF(tmp_rinfo->t_garbage_collect);
list_delete_node(list, node);
rip_info_free(tmp_rinfo);
}
@@ -3508,8 +3508,8 @@ static void rip_instance_disable(struct rip *rip)
rip_zebra_ipv4_delete(rip, rp);
for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) {
- RIP_TIMER_OFF(rinfo->t_timeout);
- RIP_TIMER_OFF(rinfo->t_garbage_collect);
+ THREAD_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_garbage_collect);
rip_info_free(rinfo);
}
list_delete(&list);
@@ -3521,12 +3521,12 @@ static void rip_instance_disable(struct rip *rip)
rip_redistribute_disable(rip);
/* Cancel RIP related timers. */
- RIP_TIMER_OFF(rip->t_update);
- RIP_TIMER_OFF(rip->t_triggered_update);
- RIP_TIMER_OFF(rip->t_triggered_interval);
+ THREAD_OFF(rip->t_update);
+ THREAD_OFF(rip->t_triggered_update);
+ THREAD_OFF(rip->t_triggered_interval);
/* Cancel read thread. */
- thread_cancel(&rip->t_read);
+ THREAD_OFF(rip->t_read);
/* Close RIP socket. */
close(rip->sock);
diff --git a/ripd/ripd.h b/ripd/ripd.h
index f26dcd8775..d26592dac2 100644
--- a/ripd/ripd.h
+++ b/ripd/ripd.h
@@ -404,9 +404,6 @@ enum rip_event {
/* Macro for timer turn on. */
#define RIP_TIMER_ON(T,F,V) thread_add_timer (master, (F), rinfo, (V), &(T))
-/* Macro for timer turn off. */
-#define RIP_TIMER_OFF(X) thread_cancel(&(X))
-
#define RIP_OFFSET_LIST_IN 0
#define RIP_OFFSET_LIST_OUT 1
#define RIP_OFFSET_LIST_MAX 2
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index 5159a9825b..3068d04b73 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -316,7 +316,7 @@ void ripng_interface_clean(struct ripng *ripng)
ri->enable_interface = 0;
ri->running = 0;
- thread_cancel(&ri->t_wakeup);
+ THREAD_OFF(ri->t_wakeup);
}
}
diff --git a/ripngd/ripng_nb_rpcs.c b/ripngd/ripng_nb_rpcs.c
index 4dfe9d9640..57a5f26688 100644
--- a/ripngd/ripng_nb_rpcs.c
+++ b/ripngd/ripng_nb_rpcs.c
@@ -66,8 +66,8 @@ static void clear_ripng_route(struct ripng *ripng)
}
if (rinfo) {
- RIPNG_TIMER_OFF(rinfo->t_timeout);
- RIPNG_TIMER_OFF(rinfo->t_garbage_collect);
+ THREAD_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_garbage_collect);
listnode_delete(list, rinfo);
ripng_info_free(rinfo);
}
diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c
index 010fdda89e..37cfe9833f 100644
--- a/ripngd/ripng_peer.c
+++ b/ripngd/ripng_peer.c
@@ -43,7 +43,7 @@ static struct ripng_peer *ripng_peer_new(void)
static void ripng_peer_free(struct ripng_peer *peer)
{
- RIPNG_TIMER_OFF(peer->t_timeout);
+ THREAD_OFF(peer->t_timeout);
XFREE(MTYPE_RIPNG_PEER, peer);
}
@@ -93,7 +93,7 @@ static struct ripng_peer *ripng_peer_get(struct ripng *ripng,
peer = ripng_peer_lookup(ripng, addr);
if (peer) {
- thread_cancel(&peer->t_timeout);
+ THREAD_OFF(peer->t_timeout);
} else {
peer = ripng_peer_new();
peer->ripng = ripng;
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index e7d2928697..1e7a13d7dc 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -431,7 +431,7 @@ static void ripng_garbage_collect(struct thread *t)
rinfo = THREAD_ARG(t);
/* Off timeout timer. */
- RIPNG_TIMER_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_timeout);
/* Get route_node pointer. */
rp = rinfo->rp;
@@ -518,14 +518,14 @@ struct ripng_info *ripng_ecmp_replace(struct ripng *ripng,
/* Re-use the first entry, and delete the others. */
for (ALL_LIST_ELEMENTS(list, node, nextnode, tmp_rinfo))
if (tmp_rinfo != rinfo) {
- RIPNG_TIMER_OFF(tmp_rinfo->t_timeout);
- RIPNG_TIMER_OFF(tmp_rinfo->t_garbage_collect);
+ THREAD_OFF(tmp_rinfo->t_timeout);
+ THREAD_OFF(tmp_rinfo->t_garbage_collect);
list_delete_node(list, node);
ripng_info_free(tmp_rinfo);
}
- RIPNG_TIMER_OFF(rinfo->t_timeout);
- RIPNG_TIMER_OFF(rinfo->t_garbage_collect);
+ THREAD_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_garbage_collect);
memcpy(rinfo, rinfo_new, sizeof(struct ripng_info));
if (ripng_route_rte(rinfo)) {
@@ -557,7 +557,7 @@ struct ripng_info *ripng_ecmp_delete(struct ripng *ripng,
struct agg_node *rp = rinfo->rp;
struct list *list = (struct list *)rp->info;
- RIPNG_TIMER_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_timeout);
if (rinfo->metric != RIPNG_METRIC_INFINITY)
ripng_aggregate_decrement(rp, rinfo);
@@ -565,7 +565,7 @@ struct ripng_info *ripng_ecmp_delete(struct ripng *ripng,
if (listcount(list) > 1) {
/* Some other ECMP entries still exist. Just delete this entry.
*/
- RIPNG_TIMER_OFF(rinfo->t_garbage_collect);
+ THREAD_OFF(rinfo->t_garbage_collect);
listnode_delete(list, rinfo);
if (ripng_route_rte(rinfo)
&& CHECK_FLAG(rinfo->flags, RIPNG_RTF_FIB))
@@ -611,7 +611,7 @@ static void ripng_timeout(struct thread *t)
static void ripng_timeout_update(struct ripng *ripng, struct ripng_info *rinfo)
{
if (rinfo->metric != RIPNG_METRIC_INFINITY) {
- RIPNG_TIMER_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_timeout);
thread_add_timer(master, ripng_timeout, rinfo,
ripng->timeout_time, &rinfo->t_timeout);
}
@@ -1022,7 +1022,7 @@ void ripng_redistribute_delete(struct ripng *ripng, int type, int sub_type,
RIPNG_TIMER_ON(rinfo->t_garbage_collect,
ripng_garbage_collect,
ripng->garbage_time);
- RIPNG_TIMER_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_timeout);
/* Aggregate count decrement. */
ripng_aggregate_decrement(rp, rinfo);
@@ -1061,7 +1061,7 @@ void ripng_redistribute_withdraw(struct ripng *ripng, int type)
RIPNG_TIMER_ON(rinfo->t_garbage_collect,
ripng_garbage_collect,
ripng->garbage_time);
- RIPNG_TIMER_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_timeout);
/* Aggregate count decrement. */
ripng_aggregate_decrement(rp, rinfo);
@@ -1445,7 +1445,7 @@ static void ripng_update(struct thread *t)
/* Triggered updates may be suppressed if a regular update is due by
the time the triggered update would be sent. */
- thread_cancel(&ripng->t_triggered_interval);
+ THREAD_OFF(ripng->t_triggered_interval);
ripng->trigger = 0;
/* Reset flush event. */
@@ -1472,7 +1472,7 @@ void ripng_triggered_update(struct thread *t)
int interval;
/* Cancel interval timer. */
- thread_cancel(&ripng->t_triggered_interval);
+ THREAD_OFF(ripng->t_triggered_interval);
ripng->trigger = 0;
/* Logging triggered update. */
@@ -1917,7 +1917,7 @@ void ripng_event(struct ripng *ripng, enum ripng_event event, int sock)
&ripng->t_read);
break;
case RIPNG_UPDATE_EVENT:
- thread_cancel(&ripng->t_update);
+ THREAD_OFF(ripng->t_update);
/* Update timer jitter. */
jitter = ripng_update_jitter(ripng->update_time);
@@ -2209,8 +2209,8 @@ void ripng_ecmp_disable(struct ripng *ripng)
/* Drop all other entries, except the first one. */
for (ALL_LIST_ELEMENTS(list, node, nextnode, tmp_rinfo))
if (tmp_rinfo != rinfo) {
- RIPNG_TIMER_OFF(tmp_rinfo->t_timeout);
- RIPNG_TIMER_OFF(
+ THREAD_OFF(tmp_rinfo->t_timeout);
+ THREAD_OFF(
tmp_rinfo->t_garbage_collect);
list_delete_node(list, node);
ripng_info_free(tmp_rinfo);
@@ -2528,8 +2528,8 @@ static void ripng_instance_disable(struct ripng *ripng)
ripng_zebra_ipv6_delete(ripng, rp);
for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) {
- RIPNG_TIMER_OFF(rinfo->t_timeout);
- RIPNG_TIMER_OFF(rinfo->t_garbage_collect);
+ THREAD_OFF(rinfo->t_timeout);
+ THREAD_OFF(rinfo->t_garbage_collect);
ripng_info_free(rinfo);
}
list_delete(&list);
@@ -2548,12 +2548,12 @@ static void ripng_instance_disable(struct ripng *ripng)
ripng_redistribute_disable(ripng);
/* Cancel the RIPng timers */
- RIPNG_TIMER_OFF(ripng->t_update);
- RIPNG_TIMER_OFF(ripng->t_triggered_update);
- RIPNG_TIMER_OFF(ripng->t_triggered_interval);
+ THREAD_OFF(ripng->t_update);
+ THREAD_OFF(ripng->t_triggered_update);
+ THREAD_OFF(ripng->t_triggered_interval);
/* Cancel the read thread */
- thread_cancel(&ripng->t_read);
+ THREAD_OFF(ripng->t_read);
/* Close the RIPng socket */
if (ripng->sock >= 0) {
diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h
index 6bf687b02a..ac2edc5b2c 100644
--- a/ripngd/ripngd.h
+++ b/ripngd/ripngd.h
@@ -312,8 +312,6 @@ enum ripng_event {
/* RIPng timer on/off macro. */
#define RIPNG_TIMER_ON(T,F,V) thread_add_timer (master, (F), rinfo, (V), &(T))
-#define RIPNG_TIMER_OFF(T) thread_cancel(&(T))
-
#define RIPNG_OFFSET_LIST_IN 0
#define RIPNG_OFFSET_LIST_OUT 1
#define RIPNG_OFFSET_LIST_MAX 2
diff --git a/vrrpd/vrrp.c b/vrrpd/vrrp.c
index 3081c0d955..4a0356411f 100644
--- a/vrrpd/vrrp.c
+++ b/vrrpd/vrrp.c
@@ -985,7 +985,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src,
*/
static void vrrp_read(struct thread *thread)
{
- struct vrrp_router *r = thread->arg;
+ struct vrrp_router *r = THREAD_ARG(thread);
struct vrrp_pkt *pkt;
ssize_t pktsize;
@@ -1480,7 +1480,7 @@ static void vrrp_change_state(struct vrrp_router *r, int to)
*/
static void vrrp_adver_timer_expire(struct thread *thread)
{
- struct vrrp_router *r = thread->arg;
+ struct vrrp_router *r = THREAD_ARG(thread);
DEBUGD(&vrrp_dbg_proto,
VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
@@ -1508,7 +1508,7 @@ static void vrrp_adver_timer_expire(struct thread *thread)
*/
static void vrrp_master_down_timer_expire(struct thread *thread)
{
- struct vrrp_router *r = thread->arg;
+ struct vrrp_router *r = THREAD_ARG(thread);
zlog_info(VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
"Master_Down_Timer expired",
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c
index 43478c98f1..65aad49a25 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -260,7 +260,7 @@ void irdp_advert_off(struct interface *ifp)
if (!irdp)
return;
- thread_cancel(&irdp->t_advertise);
+ THREAD_OFF(irdp->t_advertise);
if (ifp->connected)
for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, ifc)) {
@@ -295,7 +295,7 @@ void process_solicit(struct interface *ifp)
return;
irdp->flags |= IF_SOLICIT;
- thread_cancel(&irdp->t_advertise);
+ THREAD_OFF(irdp->t_advertise);
timer = (frr_weak_random() % MAX_RESPONSE_DELAY) + 1;
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index 31d8294a0f..5c8aca9691 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -1902,7 +1902,7 @@ static void kernel_nlsock_fini(struct nlsock *nls)
void kernel_terminate(struct zebra_ns *zns, bool complete)
{
- thread_cancel(&zns->t_netlink);
+ THREAD_OFF(zns->t_netlink);
kernel_nlsock_fini(&zns->netlink);
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index 424cea4673..a4330a3200 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -6043,8 +6043,8 @@ static void dplane_check_shutdown_status(struct thread *event)
zns_info_list_del(&zdplane_info.dg_zns_list, zi);
if (zdplane_info.dg_master) {
- thread_cancel(&zi->t_read);
- thread_cancel(&zi->t_request);
+ THREAD_OFF(zi->t_read);
+ THREAD_OFF(zi->t_request);
}
XFREE(MTYPE_DP_NS, zi);
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index 39b7156ce4..21acaa823c 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -496,7 +496,7 @@ static inline void zfpm_write_on(void)
*/
static inline void zfpm_read_off(void)
{
- thread_cancel(&zfpm_g->t_read);
+ THREAD_OFF(zfpm_g->t_read);
}
/*
@@ -504,12 +504,12 @@ static inline void zfpm_read_off(void)
*/
static inline void zfpm_write_off(void)
{
- thread_cancel(&zfpm_g->t_write);
+ THREAD_OFF(zfpm_g->t_write);
}
static inline void zfpm_connect_off(void)
{
- thread_cancel(&zfpm_g->t_connect);
+ THREAD_OFF(zfpm_g->t_connect);
}
/*
@@ -583,7 +583,7 @@ static void zfpm_connection_up(const char *detail)
/*
* Start thread to push existing routes to the FPM.
*/
- thread_cancel(&zfpm_g->t_conn_up);
+ THREAD_OFF(zfpm_g->t_conn_up);
zfpm_rnodes_iter_init(&zfpm_g->t_conn_up_state.iter);
zfpm_g->fpm_mac_dump_done = false;
@@ -1687,7 +1687,7 @@ static void zfpm_stop_stats_timer(void)
return;
zfpm_debug("Stopping existing stats timer");
- thread_cancel(&zfpm_g->t_stats);
+ THREAD_OFF(zfpm_g->t_stats);
}
/*
diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c
index b3cb061242..6ad54d5c50 100644
--- a/zebra/zebra_netns_notify.c
+++ b/zebra/zebra_netns_notify.c
@@ -413,7 +413,7 @@ void zebra_ns_notify_close(void)
fd = zebra_netns_notify_current->u.fd;
if (zebra_netns_notify_current->master != NULL)
- thread_cancel(&zebra_netns_notify_current);
+ THREAD_OFF(zebra_netns_notify_current);
/* auto-removal of notify items */
if (fd > 0)
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index 3127d2d304..4a18eb021e 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -157,9 +157,9 @@ void zebra_ptm_finish(void)
free(ptm_cb.in_data);
/* Cancel events. */
- thread_cancel(&ptm_cb.t_read);
- thread_cancel(&ptm_cb.t_write);
- thread_cancel(&ptm_cb.t_timer);
+ THREAD_OFF(ptm_cb.t_read);
+ THREAD_OFF(ptm_cb.t_write);
+ THREAD_OFF(ptm_cb.t_timer);
if (ptm_cb.wb)
buffer_free(ptm_cb.wb);
@@ -213,7 +213,7 @@ static int zebra_ptm_send_message(char *data, int size)
ptm_cb.reconnect_time, &ptm_cb.t_timer);
return -1;
case BUFFER_EMPTY:
- thread_cancel(&ptm_cb.t_write);
+ THREAD_OFF(ptm_cb.t_write);
break;
case BUFFER_PENDING:
thread_add_write(zrouter.master, zebra_ptm_flush_messages, NULL,
diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c
index 7d1153f21f..6dde513f40 100644
--- a/zebra/zebra_pw.c
+++ b/zebra/zebra_pw.c
@@ -102,7 +102,7 @@ void zebra_pw_del(struct zebra_vrf *zvrf, struct zebra_pw *pw)
hook_call(pw_uninstall, pw);
dplane_pw_uninstall(pw);
} else if (pw->install_retry_timer)
- thread_cancel(&pw->install_retry_timer);
+ THREAD_OFF(pw->install_retry_timer);
/* unlink and release memory */
RB_REMOVE(zebra_pw_head, &zvrf->pseudowires, pw);
@@ -219,7 +219,7 @@ void zebra_pw_install_failure(struct zebra_pw *pw, int pwstatus)
pw->vrf_id, pw->ifname, PW_INSTALL_RETRY_INTERVAL);
/* schedule to retry later */
- thread_cancel(&pw->install_retry_timer);
+ THREAD_OFF(pw->install_retry_timer);
thread_add_timer(zrouter.master, zebra_pw_install_retry, pw,
PW_INSTALL_RETRY_INTERVAL, &pw->install_retry_timer);