Merge pull request #11657 from donaldsharp/why_timer

convert thread_cancel to THREAD_OFF
This commit is contained in:
Donatas Abraitis 2022-07-22 08:26:08 +03:00 committed by GitHub
commit eed5b70f94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
73 changed files with 385 additions and 414 deletions

View File

@ -465,7 +465,7 @@ int bgp_damp_disable(struct bgp *bgp, afi_t afi, safi_t safi)
return 0; return 0;
/* Cancel reuse event. */ /* Cancel reuse event. */
thread_cancel(&(bdc->t_reuse)); THREAD_OFF(bdc->t_reuse);
/* Clean BGP dampening information. */ /* Clean BGP dampening information. */
bgp_damp_info_clean(afi, safi); bgp_damp_info_clean(afi, safi);

View File

@ -702,7 +702,7 @@ static int bgp_dump_unset(struct bgp_dump *bgp_dump)
} }
/* Removing interval event. */ /* Removing interval event. */
thread_cancel(&bgp_dump->t_interval); THREAD_OFF(bgp_dump->t_interval);
bgp_dump->interval = 0; bgp_dump->interval = 0;

View File

@ -4952,7 +4952,7 @@ void bgp_evpn_mh_finish(void)
bgp_evpn_es_local_info_clear(es, true); bgp_evpn_es_local_info_clear(es, true);
} }
if (bgp_mh_info->t_cons_check) 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->local_es_list);
list_delete(&bgp_mh_info->pend_es_list); list_delete(&bgp_mh_info->pend_es_list);
list_delete(&bgp_mh_info->ead_es_export_rtl); list_delete(&bgp_mh_info->ead_es_export_rtl);

View File

@ -177,17 +177,17 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
*/ */
bgp_keepalives_off(from_peer); bgp_keepalives_off(from_peer);
BGP_TIMER_OFF(peer->t_routeadv); THREAD_OFF(peer->t_routeadv);
BGP_TIMER_OFF(peer->t_connect); THREAD_OFF(peer->t_connect);
BGP_TIMER_OFF(peer->t_delayopen); THREAD_OFF(peer->t_delayopen);
BGP_TIMER_OFF(peer->t_connect_check_r); THREAD_OFF(peer->t_connect_check_r);
BGP_TIMER_OFF(peer->t_connect_check_w); THREAD_OFF(peer->t_connect_check_w);
BGP_TIMER_OFF(from_peer->t_routeadv); THREAD_OFF(from_peer->t_routeadv);
BGP_TIMER_OFF(from_peer->t_connect); THREAD_OFF(from_peer->t_connect);
BGP_TIMER_OFF(from_peer->t_delayopen); THREAD_OFF(from_peer->t_delayopen);
BGP_TIMER_OFF(from_peer->t_connect_check_r); THREAD_OFF(from_peer->t_connect_check_r);
BGP_TIMER_OFF(from_peer->t_connect_check_w); THREAD_OFF(from_peer->t_connect_check_w);
BGP_TIMER_OFF(from_peer->t_process_packet); THREAD_OFF(from_peer->t_process_packet);
/* /*
* At this point in time, it is possible that there are packets pending * 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 */ inactive. All other timer must be turned off */
if (BGP_PEER_START_SUPPRESSED(peer) || !peer_active(peer) if (BGP_PEER_START_SUPPRESSED(peer) || !peer_active(peer)
|| peer->bgp->vrf_id == VRF_UNKNOWN) { || peer->bgp->vrf_id == VRF_UNKNOWN) {
BGP_TIMER_OFF(peer->t_start); THREAD_OFF(peer->t_start);
} else { } else {
BGP_TIMER_ON(peer->t_start, bgp_start_timer, BGP_TIMER_ON(peer->t_start, bgp_start_timer,
peer->v_start); peer->v_start);
} }
BGP_TIMER_OFF(peer->t_connect); THREAD_OFF(peer->t_connect);
BGP_TIMER_OFF(peer->t_holdtime); THREAD_OFF(peer->t_holdtime);
bgp_keepalives_off(peer); bgp_keepalives_off(peer);
BGP_TIMER_OFF(peer->t_routeadv); THREAD_OFF(peer->t_routeadv);
BGP_TIMER_OFF(peer->t_delayopen); THREAD_OFF(peer->t_delayopen);
break; break;
case Connect: case Connect:
/* After start timer is expired, the peer moves to Connect /* After start timer is expired, the peer moves to Connect
status. Make sure start timer is off and connect timer is status. Make sure start timer is off and connect timer is
on. */ on. */
BGP_TIMER_OFF(peer->t_start); THREAD_OFF(peer->t_start);
if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER_DELAYOPEN)) if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER_DELAYOPEN))
BGP_TIMER_ON(peer->t_connect, bgp_connect_timer, BGP_TIMER_ON(peer->t_connect, bgp_connect_timer,
(peer->v_delayopen + peer->v_connect)); (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, BGP_TIMER_ON(peer->t_connect, bgp_connect_timer,
peer->v_connect); peer->v_connect);
BGP_TIMER_OFF(peer->t_holdtime); THREAD_OFF(peer->t_holdtime);
bgp_keepalives_off(peer); bgp_keepalives_off(peer);
BGP_TIMER_OFF(peer->t_routeadv); THREAD_OFF(peer->t_routeadv);
break; break;
case Active: case Active:
/* Active is waiting connection from remote peer. And if /* Active is waiting connection from remote peer. And if
connect timer is expired, change status to Connect. */ 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 peer is passive mode, do not set connect timer. */
if (CHECK_FLAG(peer->flags, PEER_FLAG_PASSIVE) if (CHECK_FLAG(peer->flags, PEER_FLAG_PASSIVE)
|| CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)) { || CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)) {
BGP_TIMER_OFF(peer->t_connect); THREAD_OFF(peer->t_connect);
} else { } else {
if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER_DELAYOPEN)) if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER_DELAYOPEN))
BGP_TIMER_ON( BGP_TIMER_ON(
@ -411,56 +411,56 @@ void bgp_timer_set(struct peer *peer)
BGP_TIMER_ON(peer->t_connect, bgp_connect_timer, BGP_TIMER_ON(peer->t_connect, bgp_connect_timer,
peer->v_connect); peer->v_connect);
} }
BGP_TIMER_OFF(peer->t_holdtime); THREAD_OFF(peer->t_holdtime);
bgp_keepalives_off(peer); bgp_keepalives_off(peer);
BGP_TIMER_OFF(peer->t_routeadv); THREAD_OFF(peer->t_routeadv);
break; break;
case OpenSent: case OpenSent:
/* OpenSent status. */ /* OpenSent status. */
BGP_TIMER_OFF(peer->t_start); THREAD_OFF(peer->t_start);
BGP_TIMER_OFF(peer->t_connect); THREAD_OFF(peer->t_connect);
if (peer->v_holdtime != 0) { if (peer->v_holdtime != 0) {
BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer, BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
peer->v_holdtime); peer->v_holdtime);
} else { } else {
BGP_TIMER_OFF(peer->t_holdtime); THREAD_OFF(peer->t_holdtime);
} }
bgp_keepalives_off(peer); bgp_keepalives_off(peer);
BGP_TIMER_OFF(peer->t_routeadv); THREAD_OFF(peer->t_routeadv);
BGP_TIMER_OFF(peer->t_delayopen); THREAD_OFF(peer->t_delayopen);
break; break;
case OpenConfirm: case OpenConfirm:
/* OpenConfirm status. */ /* OpenConfirm status. */
BGP_TIMER_OFF(peer->t_start); THREAD_OFF(peer->t_start);
BGP_TIMER_OFF(peer->t_connect); THREAD_OFF(peer->t_connect);
/* If the negotiated Hold Time value is zero, then the Hold Time /* If the negotiated Hold Time value is zero, then the Hold Time
timer and KeepAlive timers are not started. */ timer and KeepAlive timers are not started. */
if (peer->v_holdtime == 0) { if (peer->v_holdtime == 0) {
BGP_TIMER_OFF(peer->t_holdtime); THREAD_OFF(peer->t_holdtime);
bgp_keepalives_off(peer); bgp_keepalives_off(peer);
} else { } else {
BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer, BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
peer->v_holdtime); peer->v_holdtime);
bgp_keepalives_on(peer); bgp_keepalives_on(peer);
} }
BGP_TIMER_OFF(peer->t_routeadv); THREAD_OFF(peer->t_routeadv);
BGP_TIMER_OFF(peer->t_delayopen); THREAD_OFF(peer->t_delayopen);
break; break;
case Established: case Established:
/* In Established status start and connect timer is turned /* In Established status start and connect timer is turned
off. */ off. */
BGP_TIMER_OFF(peer->t_start); THREAD_OFF(peer->t_start);
BGP_TIMER_OFF(peer->t_connect); THREAD_OFF(peer->t_connect);
BGP_TIMER_OFF(peer->t_delayopen); THREAD_OFF(peer->t_delayopen);
/* Same as OpenConfirm, if holdtime is zero then both holdtime /* Same as OpenConfirm, if holdtime is zero then both holdtime
and keepalive must be turned off. */ and keepalive must be turned off. */
if (peer->v_holdtime == 0) { if (peer->v_holdtime == 0) {
BGP_TIMER_OFF(peer->t_holdtime); THREAD_OFF(peer->t_holdtime);
bgp_keepalives_off(peer); bgp_keepalives_off(peer);
} else { } else {
BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer, BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
@ -469,22 +469,22 @@ void bgp_timer_set(struct peer *peer)
} }
break; break;
case Deleted: case Deleted:
BGP_TIMER_OFF(peer->t_gr_restart); THREAD_OFF(peer->t_gr_restart);
BGP_TIMER_OFF(peer->t_gr_stale); THREAD_OFF(peer->t_gr_stale);
FOREACH_AFI_SAFI (afi, safi) 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); THREAD_OFF(peer->t_pmax_restart);
BGP_TIMER_OFF(peer->t_refresh_stalepath); THREAD_OFF(peer->t_refresh_stalepath);
/* fallthru */ /* fallthru */
case Clearing: case Clearing:
BGP_TIMER_OFF(peer->t_start); THREAD_OFF(peer->t_start);
BGP_TIMER_OFF(peer->t_connect); THREAD_OFF(peer->t_connect);
BGP_TIMER_OFF(peer->t_holdtime); THREAD_OFF(peer->t_holdtime);
bgp_keepalives_off(peer); bgp_keepalives_off(peer);
BGP_TIMER_OFF(peer->t_routeadv); THREAD_OFF(peer->t_routeadv);
BGP_TIMER_OFF(peer->t_delayopen); THREAD_OFF(peer->t_delayopen);
break; break;
case BGP_STATUS_MAX: case BGP_STATUS_MAX:
flog_err(EC_LIB_DEVELOPMENT, flog_err(EC_LIB_DEVELOPMENT,
@ -516,7 +516,7 @@ static void bgp_connect_timer(struct thread *thread)
peer = THREAD_ARG(thread); peer = THREAD_ARG(thread);
/* stop the DelayOpenTimer if it is running */ /* 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_write);
assert(!peer->t_read); assert(!peer->t_read);
@ -647,7 +647,7 @@ static void bgp_graceful_restart_timer_off(struct peer *peer)
return; return;
UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT); 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) && if (peer_dynamic_neighbor(peer) &&
!(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) { !(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)) { for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
if (!peer_established(peer)) if (!peer_established(peer))
continue; continue;
BGP_TIMER_OFF(peer->t_routeadv); THREAD_OFF(peer->t_routeadv);
BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0); BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0);
} }
} }
@ -985,7 +985,7 @@ void bgp_adjust_routeadv(struct peer *peer)
* different * different
* duration and schedule write thread immediately. * duration and schedule write thread immediately.
*/ */
BGP_TIMER_OFF(peer->t_routeadv); THREAD_OFF(peer->t_routeadv);
peer->synctime = bgp_clock(); peer->synctime = bgp_clock();
/* If suppress fib pending is enabled, route is advertised to /* 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); diff = difftime(nowtime, peer->last_update);
if (diff > (double)peer->v_routeadv) { 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); BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0);
return; return;
} }
@ -1044,7 +1044,7 @@ void bgp_adjust_routeadv(struct peer *peer)
remain = peer->v_routeadv; remain = peer->v_routeadv;
diff = peer->v_routeadv - diff; diff = peer->v_routeadv - diff;
if (diff <= (double)remain) { 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); BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, diff);
} }
} }
@ -1401,7 +1401,7 @@ int bgp_stop(struct peer *peer)
/* graceful restart */ /* graceful restart */
if (peer->t_gr_stale) { if (peer->t_gr_stale) {
BGP_TIMER_OFF(peer->t_gr_stale); THREAD_OFF(peer->t_gr_stale);
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug( zlog_debug(
"%pBP graceful restart stalepath timer stopped", "%pBP graceful restart stalepath timer stopped",
@ -1431,7 +1431,7 @@ int bgp_stop(struct peer *peer)
/* Stop route-refresh stalepath timer */ /* Stop route-refresh stalepath timer */
if (peer->t_refresh_stalepath) { if (peer->t_refresh_stalepath) {
BGP_TIMER_OFF(peer->t_refresh_stalepath); THREAD_OFF(peer->t_refresh_stalepath);
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug( zlog_debug(
@ -1464,8 +1464,7 @@ int bgp_stop(struct peer *peer)
/* There is no pending EOR message */ /* There is no pending EOR message */
if (gr_info->eor_required == 0) { if (gr_info->eor_required == 0) {
BGP_TIMER_OFF( THREAD_OFF(gr_info->t_select_deferral);
gr_info->t_select_deferral);
gr_info->eor_received = 0; gr_info->eor_received = 0;
} }
} }
@ -1494,11 +1493,11 @@ int bgp_stop(struct peer *peer)
THREAD_OFF(peer->t_connect_check_w); THREAD_OFF(peer->t_connect_check_w);
/* Stop all timers. */ /* Stop all timers. */
BGP_TIMER_OFF(peer->t_start); THREAD_OFF(peer->t_start);
BGP_TIMER_OFF(peer->t_connect); THREAD_OFF(peer->t_connect);
BGP_TIMER_OFF(peer->t_holdtime); THREAD_OFF(peer->t_holdtime);
BGP_TIMER_OFF(peer->t_routeadv); THREAD_OFF(peer->t_routeadv);
BGP_TIMER_OFF(peer->t_delayopen); THREAD_OFF(peer->t_delayopen);
/* Clear input and output buffer. */ /* Clear input and output buffer. */
frr_with_mutex (&peer->io_mtx) { 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) static int bgp_fsm_delayopen_timer_expire(struct peer *peer)
{ {
/* Stop the DelayOpenTimer */ /* Stop the DelayOpenTimer */
BGP_TIMER_OFF(peer->t_delayopen); THREAD_OFF(peer->t_delayopen);
/* Send open message to peer */ /* Send open message to peer */
bgp_open_send(peer); bgp_open_send(peer);
@ -2203,7 +2202,7 @@ static int bgp_establish(struct peer *peer)
else { else {
UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_MODE); UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_MODE);
if (peer->t_gr_stale) { if (peer->t_gr_stale) {
BGP_TIMER_OFF(peer->t_gr_stale); THREAD_OFF(peer->t_gr_stale);
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug( zlog_debug(
"%pBP graceful restart stalepath timer stopped", "%pBP graceful restart stalepath timer stopped",
@ -2212,7 +2211,7 @@ static int bgp_establish(struct peer *peer)
} }
if (peer->t_gr_restart) { if (peer->t_gr_restart) {
BGP_TIMER_OFF(peer->t_gr_restart); THREAD_OFF(peer->t_gr_restart);
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug("%pBP graceful restart timer stopped", 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) { FOREACH_AFI_SAFI (afi, safi) {
if (peer->t_llgr_stale[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)) if (bgp_debug_neighbor_events(peer))
zlog_debug( zlog_debug(
"%pBP Long-lived stale timer stopped for afi/safi: %d/%d", "%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. * of read-only mode.
*/ */
if (!bgp_update_delay_active(peer->bgp)) { 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); 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. */ /* Keepalive packet is received. */
static int bgp_fsm_keepalive(struct peer *peer) static int bgp_fsm_keepalive(struct peer *peer)
{ {
BGP_TIMER_OFF(peer->t_holdtime); THREAD_OFF(peer->t_holdtime);
return 0; return 0;
} }
/* Update packet is received. */ /* Update packet is received. */
static int bgp_fsm_update(struct peer *peer) static int bgp_fsm_update(struct peer *peer)
{ {
BGP_TIMER_OFF(peer->t_holdtime); THREAD_OFF(peer->t_holdtime);
return 0; return 0;
} }
@ -2358,13 +2357,13 @@ void bgp_fsm_nht_update(struct peer *peer, bool has_valid_nexthops)
break; break;
case Connect: case Connect:
if (!has_valid_nexthops) { if (!has_valid_nexthops) {
BGP_TIMER_OFF(peer->t_connect); THREAD_OFF(peer->t_connect);
BGP_EVENT_ADD(peer, TCP_fatal_error); BGP_EVENT_ADD(peer, TCP_fatal_error);
} }
break; break;
case Active: case Active:
if (has_valid_nexthops) { if (has_valid_nexthops) {
BGP_TIMER_OFF(peer->t_connect); THREAD_OFF(peer->t_connect);
BGP_EVENT_ADD(peer, ConnectRetry_timer_expired); BGP_EVENT_ADD(peer, ConnectRetry_timer_expired);
} }
break; break;

View File

@ -29,11 +29,6 @@
thread_add_timer(bm->master, (F), peer, (V), &(T)); \ thread_add_timer(bm->master, (F), peer, (V), &(T)); \
} while (0) } while (0)
#define BGP_TIMER_OFF(T) \
do { \
THREAD_OFF((T)); \
} while (0)
#define BGP_EVENT_ADD(P, E) \ #define BGP_EVENT_ADD(P, E) \
do { \ do { \
if ((P)->status != Deleted) \ if ((P)->status != Deleted) \

View File

@ -429,7 +429,7 @@ static void bgp_accept(struct thread *thread)
sockopt_tcp_mss_set(bgp_sock, peer1->tcp_mss); sockopt_tcp_mss_set(bgp_sock, peer1->tcp_mss);
bgp_fsm_change_status(peer1, Active); bgp_fsm_change_status(peer1, Active);
BGP_TIMER_OFF( THREAD_OFF(
peer1->t_start); /* created in peer_create() */ peer1->t_start); /* created in peer_create() */
if (peer_active(peer1)) { if (peer_active(peer1)) {
@ -558,7 +558,7 @@ static void bgp_accept(struct thread *thread)
} }
bgp_peer_reg_with_nht(peer); bgp_peer_reg_with_nht(peer);
bgp_fsm_change_status(peer, Active); 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); SET_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER);
/* Make dummy peer until read Open packet. */ /* Make dummy peer until read Open packet. */

View File

@ -2002,8 +2002,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
gr_info->eor_required, gr_info->eor_required,
"EOR RCV", "EOR RCV",
gr_info->eor_received); gr_info->eor_received);
BGP_TIMER_OFF( THREAD_OFF(gr_info->t_select_deferral);
gr_info->t_select_deferral);
gr_info->eor_required = 0; gr_info->eor_required = 0;
gr_info->eor_received = 0; gr_info->eor_received = 0;
/* Best path selection */ /* Best path selection */
@ -2510,7 +2509,7 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
return BGP_PACKET_NOOP; 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); SET_FLAG(peer->af_sflags[afi][safi], PEER_STATUS_EORR_RECEIVED);
UNSET_FLAG(peer->af_sflags[afi][safi], UNSET_FLAG(peer->af_sflags[afi][safi],

View File

@ -3204,7 +3204,7 @@ int bgp_best_path_select_defer(struct bgp *bgp, afi_t afi, safi_t safi)
thread_info = THREAD_ARG(t); thread_info = THREAD_ARG(t);
XFREE(MTYPE_TMP, thread_info); 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)) { 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) if (!paf->t_announce_route)
return; 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); list_delete(&ntable->soft_reconfig_peers);
bgp_soft_reconfig_table_flag(ntable, false); bgp_soft_reconfig_table_flag(ntable, false);
BGP_TIMER_OFF(ntable->soft_reconfig_thread); THREAD_OFF(ntable->soft_reconfig_thread);
} }
} }

View File

@ -1896,7 +1896,7 @@ void update_group_refresh_default_originate_route_map(struct thread *thread)
bgp = THREAD_ARG(thread); bgp = THREAD_ARG(thread);
update_group_walk(bgp, update_group_default_originate_route_map_walkcb, update_group_walk(bgp, update_group_default_originate_route_map_walkcb,
reason); reason);
thread_cancel(&bgp->t_rmap_def_originate_eval); THREAD_OFF(bgp->t_rmap_def_originate_eval);
bgp_unlock(bgp); bgp_unlock(bgp);
} }

View File

@ -347,7 +347,7 @@ static void subgroup_coalesce_timer(struct thread *thread)
SUBGRP_FOREACH_PEER (subgrp, paf) { SUBGRP_FOREACH_PEER (subgrp, paf) {
peer = PAF_PEER(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); BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0);
} }
} }

View File

@ -2055,7 +2055,7 @@ DEFUN (no_bgp_maxmed_onstartup,
/* Cancel max-med onstartup if its on */ /* Cancel max-med onstartup if its on */
if (bgp->t_maxmed_onstartup) { if (bgp->t_maxmed_onstartup) {
thread_cancel(&bgp->t_maxmed_onstartup); THREAD_OFF(bgp->t_maxmed_onstartup);
bgp->maxmed_onstartup_over = 1; bgp->maxmed_onstartup_over = 1;
} }
@ -7256,7 +7256,7 @@ DEFUN (bgp_set_route_map_delay_timer,
* fired. * fired.
*/ */
if (!rmap_delay_timer && bm->t_rmap_update) { 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, thread_execute(bm->master, bgp_route_map_update_timer,
NULL, 0); NULL, 0);
} }

View File

@ -2401,12 +2401,12 @@ void peer_nsf_stop(struct peer *peer)
peer->nsf[afi][safi] = 0; peer->nsf[afi][safi] = 0;
if (peer->t_gr_restart) { if (peer->t_gr_restart) {
BGP_TIMER_OFF(peer->t_gr_restart); THREAD_OFF(peer->t_gr_restart);
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug("%pBP graceful restart timer stopped", peer); zlog_debug("%pBP graceful restart timer stopped", peer);
} }
if (peer->t_gr_stale) { if (peer->t_gr_stale) {
BGP_TIMER_OFF(peer->t_gr_stale); THREAD_OFF(peer->t_gr_stale);
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug( zlog_debug(
"%pBP graceful restart stalepath timer stopped", "%pBP graceful restart stalepath timer stopped",
@ -3584,7 +3584,7 @@ void bgp_instance_down(struct bgp *bgp)
/* Stop timers. */ /* Stop timers. */
if (bgp->t_rmap_def_originate_eval) { 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 - bgp_unlock(bgp); /* TODO - This timer is started with a lock -
why? */ why? */
} }
@ -3651,7 +3651,7 @@ int bgp_delete(struct bgp *bgp)
if (!gr_info) if (!gr_info)
continue; continue;
BGP_TIMER_OFF(gr_info->t_select_deferral); THREAD_OFF(gr_info->t_select_deferral);
t = gr_info->t_route_select; t = gr_info->t_route_select;
if (t) { if (t) {
@ -3659,7 +3659,7 @@ int bgp_delete(struct bgp *bgp)
XFREE(MTYPE_TMP, info); XFREE(MTYPE_TMP, info);
} }
BGP_TIMER_OFF(gr_info->t_route_select); THREAD_OFF(gr_info->t_route_select);
} }
if (BGP_DEBUG(zebra, ZEBRA)) { if (BGP_DEBUG(zebra, ZEBRA)) {
@ -3682,7 +3682,7 @@ int bgp_delete(struct bgp *bgp)
/* Stop timers. */ /* Stop timers. */
if (bgp->t_rmap_def_originate_eval) { 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 - bgp_unlock(bgp); /* TODO - This timer is started with a lock -
why? */ 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); UNSET_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW);
if (peer->t_pmax_restart) { if (peer->t_pmax_restart) {
BGP_TIMER_OFF(peer->t_pmax_restart); THREAD_OFF(peer->t_pmax_restart);
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug( zlog_debug(
"%pBP Maximum-prefix restart timer canceled", "%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); UNSET_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW);
if (peer->t_pmax_restart) { if (peer->t_pmax_restart) {
BGP_TIMER_OFF(peer->t_pmax_restart); THREAD_OFF(peer->t_pmax_restart);
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug( zlog_debug(
"%pBP Maximum-prefix restart timer cancelled", "%pBP Maximum-prefix restart timer cancelled",
@ -8243,7 +8243,7 @@ void bgp_terminate(void)
if (bm->listen_sockets) if (bm->listen_sockets)
list_delete(&bm->listen_sockets); list_delete(&bm->listen_sockets);
BGP_TIMER_OFF(bm->t_rmap_update); THREAD_OFF(bm->t_rmap_update);
bgp_mac_finish(); bgp_mac_finish();
} }

View File

@ -856,13 +856,11 @@ static void rfapiBgpInfoChainFree(struct bgp_path_info *bpi)
*/ */
if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
&& bpi->extra->vnc.import.timer) { && bpi->extra->vnc.import.timer) {
struct rfapi_withdraw *wcb =
struct thread **t = THREAD_ARG(bpi->extra->vnc.import.timer);
&(bpi->extra->vnc.import.timer);
struct rfapi_withdraw *wcb = (*t)->arg;
XFREE(MTYPE_RFAPI_WITHDRAW, wcb); XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
thread_cancel(t); THREAD_OFF(bpi->extra->vnc.import.timer);
} }
next = bpi->next; next = bpi->next;
@ -2371,7 +2369,7 @@ static void rfapiMonitorEncapDelete(struct bgp_path_info *vpn_bpi)
*/ */
static void rfapiWithdrawTimerVPN(struct thread *t) 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_path_info *bpi = wcb->info;
struct bgp *bgp = bgp_get_default(); struct bgp *bgp = bgp_get_default();
const struct prefix *p; const struct prefix *p;
@ -2672,7 +2670,7 @@ rfapiWithdrawEncapUpdateCachedUn(struct rfapi_import_table *import_table,
static void rfapiWithdrawTimerEncap(struct thread *t) 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; struct bgp_path_info *bpi = wcb->info;
int was_first_route = 0; int was_first_route = 0;
struct rfapi_monitor_encap *em; struct rfapi_monitor_encap *em;
@ -3089,13 +3087,12 @@ static void rfapiBgpInfoFilteredImportEncap(
*/ */
if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
&& bpi->extra->vnc.import.timer) { && bpi->extra->vnc.import.timer) {
struct rfapi_withdraw *wcb = THREAD_ARG(
struct thread **t = bpi->extra->vnc.import.timer);
&(bpi->extra->vnc.import.timer);
struct rfapi_withdraw *wcb = (*t)->arg;
XFREE(MTYPE_RFAPI_WITHDRAW, wcb); XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
thread_cancel(t); THREAD_OFF(
bpi->extra->vnc.import.timer);
} }
if (action == FIF_ACTION_UPDATE) { if (action == FIF_ACTION_UPDATE) {
@ -3182,12 +3179,11 @@ static void rfapiBgpInfoFilteredImportEncap(
"%s: removing holddown bpi matching NVE of new route", "%s: removing holddown bpi matching NVE of new route",
__func__); __func__);
if (bpi->extra->vnc.import.timer) { if (bpi->extra->vnc.import.timer) {
struct thread **t = struct rfapi_withdraw *wcb =
&(bpi->extra->vnc.import.timer); THREAD_ARG(bpi->extra->vnc.import.timer);
struct rfapi_withdraw *wcb = (*t)->arg;
XFREE(MTYPE_RFAPI_WITHDRAW, wcb); XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
thread_cancel(t); THREAD_OFF(bpi->extra->vnc.import.timer);
} }
rfapiExpireEncapNow(import_table, rn, bpi); rfapiExpireEncapNow(import_table, rn, bpi);
} }
@ -3543,13 +3539,12 @@ void rfapiBgpInfoFilteredImportVPN(
*/ */
if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
&& bpi->extra->vnc.import.timer) { && bpi->extra->vnc.import.timer) {
struct rfapi_withdraw *wcb = THREAD_ARG(
struct thread **t = bpi->extra->vnc.import.timer);
&(bpi->extra->vnc.import.timer);
struct rfapi_withdraw *wcb = (*t)->arg;
XFREE(MTYPE_RFAPI_WITHDRAW, wcb); XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
thread_cancel(t); THREAD_OFF(
bpi->extra->vnc.import.timer);
import_table->holddown_count[afi] -= 1; import_table->holddown_count[afi] -= 1;
RFAPI_UPDATE_ITABLE_COUNT( RFAPI_UPDATE_ITABLE_COUNT(
@ -3762,12 +3757,11 @@ void rfapiBgpInfoFilteredImportVPN(
"%s: removing holddown bpi matching NVE of new route", "%s: removing holddown bpi matching NVE of new route",
__func__); __func__);
if (bpi->extra->vnc.import.timer) { if (bpi->extra->vnc.import.timer) {
struct thread **t = struct rfapi_withdraw *wcb =
&(bpi->extra->vnc.import.timer); THREAD_ARG(bpi->extra->vnc.import.timer);
struct rfapi_withdraw *wcb = (*t)->arg;
XFREE(MTYPE_RFAPI_WITHDRAW, wcb); XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
thread_cancel(t); THREAD_OFF(bpi->extra->vnc.import.timer);
} }
rfapiExpireVpnNow(import_table, rn, bpi, 0); rfapiExpireVpnNow(import_table, rn, bpi, 0);
} }
@ -4490,12 +4484,11 @@ static void rfapiDeleteRemotePrefixesIt(
if (!delete_holddown) if (!delete_holddown)
continue; continue;
if (bpi->extra->vnc.import.timer) { if (bpi->extra->vnc.import.timer) {
struct thread **t =
&(bpi->extra->vnc
.import.timer);
struct rfapi_withdraw *wcb = struct rfapi_withdraw *wcb =
(*t)->arg; THREAD_ARG(
bpi->extra->vnc
.import
.timer);
wcb->import_table wcb->import_table
->holddown_count[afi] -= ->holddown_count[afi] -=
@ -4505,7 +4498,9 @@ static void rfapiDeleteRemotePrefixesIt(
afi, 1); afi, 1);
XFREE(MTYPE_RFAPI_WITHDRAW, XFREE(MTYPE_RFAPI_WITHDRAW,
wcb); wcb);
thread_cancel(t); THREAD_OFF(
bpi->extra->vnc.import
.timer);
} }
} else { } else {
if (!delete_active) if (!delete_active)

View File

@ -620,7 +620,7 @@ void rfapiMonitorDel(struct bgp *bgp, struct rfapi_descriptor *rfd,
rfapiMonitorDetachImport(m); rfapiMonitorDetachImport(m);
} }
thread_cancel(&m->timer); THREAD_OFF(m->timer);
/* /*
* remove from rfd list * remove from rfd list
@ -657,7 +657,7 @@ int rfapiMonitorDelHd(struct rfapi_descriptor *rfd)
rfapiMonitorDetachImport(m); rfapiMonitorDetachImport(m);
} }
thread_cancel(&m->timer); THREAD_OFF(m->timer);
XFREE(MTYPE_RFAPI_MONITOR, m); XFREE(MTYPE_RFAPI_MONITOR, m);
rn->info = NULL; rn->info = NULL;
@ -691,7 +691,7 @@ int rfapiMonitorDelHd(struct rfapi_descriptor *rfd)
#endif #endif
} }
thread_cancel(&mon_eth->timer); THREAD_OFF(mon_eth->timer);
/* /*
* remove from rfd list * remove from rfd list
@ -733,7 +733,7 @@ void rfapiMonitorResponseRemovalOn(struct bgp *bgp)
static void rfapiMonitorTimerExpire(struct thread *t) 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 */ /* forget reference to thread, it's gone */
m->timer = NULL; m->timer = NULL;
@ -1039,7 +1039,7 @@ void rfapiMonitorMovedUp(struct rfapi_import_table *import_table,
static void rfapiMonitorEthTimerExpire(struct thread *t) 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 */ /* forget reference to thread, it's gone */
m->timer = NULL; m->timer = NULL;
@ -1400,7 +1400,7 @@ void rfapiMonitorEthDel(struct bgp *bgp, struct rfapi_descriptor *rfd,
rfapiMonitorEthDetachImport(bgp, val); rfapiMonitorEthDetachImport(bgp, val);
} }
thread_cancel(&val->timer); THREAD_OFF(val->timer);
/* /*
* remove from rfd list * remove from rfd list

View File

@ -268,8 +268,8 @@ static void rfapi_info_free(struct rfapi_info *goner)
if (goner->timer) { if (goner->timer) {
struct rfapi_rib_tcb *tcb; struct rfapi_rib_tcb *tcb;
tcb = goner->timer->arg; tcb = THREAD_ARG(goner->timer);
thread_cancel(&goner->timer); THREAD_OFF(goner->timer);
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb); XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb);
} }
XFREE(MTYPE_RFAPI_INFO, goner); XFREE(MTYPE_RFAPI_INFO, goner);
@ -293,7 +293,7 @@ struct rfapi_rib_tcb {
*/ */
static void rfapiRibExpireTimer(struct thread *t) 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); RFAPI_RIB_CHECK_COUNTS(1, 0);
@ -338,8 +338,8 @@ static void rfapiRibStartTimer(struct rfapi_descriptor *rfd,
struct rfapi_rib_tcb *tcb = NULL; struct rfapi_rib_tcb *tcb = NULL;
if (ri->timer) { if (ri->timer) {
tcb = ri->timer->arg; tcb = THREAD_ARG(ri->timer);
thread_cancel(&ri->timer); THREAD_OFF(ri->timer);
} else { } else {
tcb = XCALLOC(MTYPE_RFAPI_RECENT_DELETE, tcb = XCALLOC(MTYPE_RFAPI_RECENT_DELETE,
sizeof(struct rfapi_rib_tcb)); sizeof(struct rfapi_rib_tcb));
@ -913,8 +913,8 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd,
if (ri->timer) { if (ri->timer) {
struct rfapi_rib_tcb *tcb; struct rfapi_rib_tcb *tcb;
tcb = ri->timer->arg; tcb = THREAD_ARG(ri->timer);
thread_cancel(&ri->timer); THREAD_OFF(ri->timer);
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb); 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) { if (ori->timer) {
struct rfapi_rib_tcb *tcb; struct rfapi_rib_tcb *tcb;
tcb = ori->timer->arg; tcb = THREAD_ARG(ori->timer);
thread_cancel(&ori->timer); THREAD_OFF(ori->timer);
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb); XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb);
} }
@ -1342,8 +1342,8 @@ callback:
if (ri->timer) { if (ri->timer) {
struct rfapi_rib_tcb *tcb; struct rfapi_rib_tcb *tcb;
tcb = ri->timer->arg; tcb = THREAD_ARG(ri->timer);
thread_cancel(&ri->timer); THREAD_OFF(ri->timer);
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb); XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb);
} }
RFAPI_RIB_CHECK_COUNTS(0, delete_list->count); RFAPI_RIB_CHECK_COUNTS(0, delete_list->count);

View File

@ -1712,7 +1712,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
* export expiration timer is already running on * export expiration timer is already running on
* this route: cancel it * this route: cancel it
*/ */
thread_cancel(&eti->timer); THREAD_OFF(eti->timer);
bgp_update(peer, prefix, /* prefix */ bgp_update(peer, prefix, /* prefix */
0, /* addpath_id */ 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) 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); 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 * already running on
* this route: cancel it * this route: cancel it
*/ */
thread_cancel(&eti->timer); THREAD_OFF(eti->timer);
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: calling bgp_update", "%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, ZEBRA_ROUTE_VNC_DIRECT_RH,
BGP_ROUTE_REDISTRIBUTE); BGP_ROUTE_REDISTRIBUTE);
if (eti) { if (eti) {
thread_cancel(&eti->timer); THREAD_OFF(eti->timer);
vnc_eti_delete(eti); vnc_eti_delete(eti);
} }

View File

@ -238,11 +238,11 @@ struct fabricd *fabricd_new(struct isis_area *area)
void fabricd_finish(struct fabricd *f) 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); isis_spftree_del(f->spftree);
neighbor_lists_clear(f); 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_circuit->interface->name);
f->initial_sync_state = FABRICD_SYNC_COMPLETE; f->initial_sync_state = FABRICD_SYNC_COMPLETE;
f->initial_sync_circuit = NULL; 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); 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 */ /* Cancel timer if we already know our tier */
if (f->tier != ISIS_TIER_UNDEFINED || f->tier_set_timer) { if (f->tier != ISIS_TIER_UNDEFINED || f->tier_set_timer) {
thread_cancel(&(f->tier_calculation_timer)); THREAD_OFF(f->tier_calculation_timer);
return; return;
} }
/* If we need to calculate the tier, wait some /* If we need to calculate the tier, wait some
* time for the topology to settle before running * time for the topology to settle before running
* the calculation */ * the calculation */
thread_cancel(&(f->tier_calculation_timer)); THREAD_OFF(f->tier_calculation_timer);
thread_add_timer(master, fabricd_tier_calculation_cb, f, thread_add_timer(master, fabricd_tier_calculation_cb, f,
2 * f->area->lsp_gen_interval[ISIS_LEVEL2 - 1], 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]) if (!circuit->t_send_csnp[1])
continue; 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, thread_add_timer_msec(master, send_l2_csnp, circuit,
isis_jitter(f->csnp_delay, CSNP_JITTER), isis_jitter(f->csnp_delay, CSNP_JITTER),
&circuit->t_send_csnp[ISIS_LEVEL2 - 1]); &circuit->t_send_csnp[ISIS_LEVEL2 - 1]);

View File

@ -161,7 +161,7 @@ void isis_delete_adj(void *arg)
/* Remove self from snmp list without walking the list*/ /* Remove self from snmp list without walking the list*/
list_delete_node(adj->circuit->snmp_adj_list, adj->snmp_list_node); 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) if (adj->adj_state != ISIS_ADJ_DOWN)
adj->adj_state = ISIS_ADJ_DOWN; adj->adj_state = ISIS_ADJ_DOWN;

View File

@ -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.l2_desig_is, 0, ISIS_SYS_ID_LEN + 1);
memset(circuit->u.bc.snpa, 0, ETH_ALEN); memset(circuit->u.bc.snpa, 0, ETH_ALEN);
thread_cancel(&circuit->u.bc.t_send_lan_hello[0]); THREAD_OFF(circuit->u.bc.t_send_lan_hello[0]);
thread_cancel(&circuit->u.bc.t_send_lan_hello[1]); THREAD_OFF(circuit->u.bc.t_send_lan_hello[1]);
thread_cancel(&circuit->u.bc.t_run_dr[0]); THREAD_OFF(circuit->u.bc.t_run_dr[0]);
thread_cancel(&circuit->u.bc.t_run_dr[1]); THREAD_OFF(circuit->u.bc.t_run_dr[1]);
thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[0]); THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[0]);
thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[1]); THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[1]);
circuit->lsp_regenerate_pending[0] = 0; circuit->lsp_regenerate_pending[0] = 0;
circuit->lsp_regenerate_pending[1] = 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) { } else if (circuit->circ_type == CIRCUIT_T_P2P) {
isis_delete_adj(circuit->u.p2p.neighbor); isis_delete_adj(circuit->u.p2p.neighbor);
circuit->u.p2p.neighbor = NULL; 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; circuit->snmp_adj_idx_gen = 0;
/* Cancel all active threads */ /* Cancel all active threads */
thread_cancel(&circuit->t_send_csnp[0]); THREAD_OFF(circuit->t_send_csnp[0]);
thread_cancel(&circuit->t_send_csnp[1]); THREAD_OFF(circuit->t_send_csnp[1]);
thread_cancel(&circuit->t_send_psnp[0]); THREAD_OFF(circuit->t_send_psnp[0]);
thread_cancel(&circuit->t_send_psnp[1]); THREAD_OFF(circuit->t_send_psnp[1]);
thread_cancel(&circuit->t_read); THREAD_OFF(circuit->t_read);
if (circuit->tx_queue) { if (circuit->tx_queue) {
isis_tx_queue_free(circuit->tx_queue); isis_tx_queue_free(circuit->tx_queue);

View File

@ -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.is_dr[level - 1] = 0;
circuit->u.bc.run_dr_elect[level - 1] = 0; circuit->u.bc.run_dr_elect[level - 1] = 0;
thread_cancel(&circuit->u.bc.t_run_dr[level - 1]); THREAD_OFF(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_refresh_pseudo_lsp[level - 1]);
circuit->lsp_regenerate_pending[level - 1] = 0; circuit->lsp_regenerate_pending[level - 1] = 0;
memcpy(id, circuit->isis->sysid, ISIS_SYS_ID_LEN); 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]); &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, thread_add_timer(master, isis_run_dr,
&circuit->level_arg[level - 1], &circuit->level_arg[level - 1],
@ -285,8 +285,6 @@ int isis_dr_commence(struct isis_circuit *circuit, int level)
circuit->circuit_id; circuit->circuit_id;
assert(circuit->circuit_id); /* must be non-zero */ 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); lsp_generate_pseudo(circuit, 1);
thread_add_timer(master, send_l1_csnp, circuit, 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; circuit->circuit_id;
assert(circuit->circuit_id); /* must be non-zero */ 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); lsp_generate_pseudo(circuit, 2);
thread_add_timer(master, send_l2_csnp, circuit, thread_add_timer(master, send_l2_csnp, circuit,

View File

@ -57,7 +57,7 @@ void dyn_cache_finish(struct isis *isis)
struct listnode *node, *nnode; struct listnode *node, *nnode;
struct isis_dynhn *dyn; 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)) { for (ALL_LIST_ELEMENTS(isis->dyn_cache, node, nnode, dyn)) {
list_delete_node(isis->dyn_cache, node); list_delete_node(isis->dyn_cache, node);

View File

@ -109,13 +109,13 @@ static void circuit_resign_level(struct isis_circuit *circuit, int level)
circuit->area->area_tag, circuit->circuit_id, circuit->area->area_tag, circuit->circuit_id,
circuit->interface->name, level); circuit->interface->name, level);
thread_cancel(&circuit->t_send_csnp[idx]); THREAD_OFF(circuit->t_send_csnp[idx]);
thread_cancel(&circuit->t_send_psnp[idx]); THREAD_OFF(circuit->t_send_psnp[idx]);
if (circuit->circ_type == CIRCUIT_T_BROADCAST) { if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
thread_cancel(&circuit->u.bc.t_send_lan_hello[idx]); THREAD_OFF(circuit->u.bc.t_send_lan_hello[idx]);
thread_cancel(&circuit->u.bc.t_run_dr[idx]); THREAD_OFF(circuit->u.bc.t_run_dr[idx]);
thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[idx]); THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[idx]);
circuit->lsp_regenerate_pending[idx] = 0; circuit->lsp_regenerate_pending[idx] = 0;
circuit->u.bc.run_dr_elect[idx] = 0; circuit->u.bc.run_dr_elect[idx] = 0;
circuit->u.bc.is_dr[idx] = 0; circuit->u.bc.is_dr[idx] = 0;

View File

@ -1519,7 +1519,7 @@ int isis_rlfa_activate(struct isis_spftree *spftree, struct rlfa *rlfa,
spftree->route_table_backup); spftree->route_table_backup);
spftree->lfa.protection_counters.rlfa[vertex->N.ip.priority] += 1; 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, thread_add_timer(master, isis_area_verify_routes_cb, area, 2,
&area->t_rlfa_rib_update); &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); isis_route_delete(area, rn, spftree->route_table_backup);
spftree->lfa.protection_counters.rlfa[vertex->N.ip.priority] -= 1; 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, thread_add_timer(master, isis_area_verify_routes_cb, area, 2,
&area->t_rlfa_rib_update); &area->t_rlfa_rib_update);
} }

View File

@ -1390,7 +1390,7 @@ int lsp_generate(struct isis_area *area, int level)
refresh_time = lsp_refresh_time(newlsp, rem_lifetime); 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; area->lsp_regenerate_pending[level - 1] = 0;
thread_add_timer(master, lsp_refresh, thread_add_timer(master, lsp_refresh,
&area->lsp_refresh_arg[level - 1], refresh_time, &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", "ISIS (%s): Will schedule regen timer. Last run was: %lld, Now is: %lld",
area->area_tag, (long long)lsp->last_generated, area->area_tag, (long long)lsp->last_generated,
(long long)now); (long long)now);
thread_cancel(&area->t_lsp_refresh[lvl - 1]); THREAD_OFF(area->t_lsp_refresh[lvl - 1]);
diff = now - lsp->last_generated; diff = now - lsp->last_generated;
if (diff < area->lsp_gen_interval[lvl - 1] if (diff < area->lsp_gen_interval[lvl - 1]
&& !(area->bfd_signalled_down)) { && !(area->bfd_signalled_down)) {
@ -1794,7 +1794,7 @@ int lsp_generate_pseudo(struct isis_circuit *circuit, int level)
lsp_flood(lsp, NULL); lsp_flood(lsp, NULL);
refresh_time = lsp_refresh_time(lsp, rem_lifetime); 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; circuit->lsp_regenerate_pending[level - 1] = 0;
if (level == IS_LEVEL_1) if (level == IS_LEVEL_1)
thread_add_timer( 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", "ISIS (%s): Will schedule PSN regen timer. Last run was: %lld, Now is: %lld",
area->area_tag, (long long)lsp->last_generated, area->area_tag, (long long)lsp->last_generated,
(long long)now); (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; diff = now - lsp->last_generated;
if (diff < circuit->area->lsp_gen_interval[lvl - 1]) { if (diff < circuit->area->lsp_gen_interval[lvl - 1]) {
timeout = timeout =

View File

@ -205,7 +205,7 @@ static int process_p2p_hello(struct iih_info *iih)
adj); adj);
/* lets take care of the expiry */ /* 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, thread_add_timer(master, isis_adj_expire, adj, (long)adj->hold_time,
&adj->t_expire); &adj->t_expire);
@ -497,7 +497,7 @@ static int process_lan_hello(struct iih_info *iih)
adj); adj);
/* lets take care of the expiry */ /* 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, thread_add_timer(master, isis_adj_expire, adj, (long)adj->hold_time,
&adj->t_expire); &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) if (thread_timer_remain_msec(*threadp) < (unsigned long)delay)
return; return;
thread_cancel(threadp); THREAD_OFF(*threadp);
} }
thread_add_timer_msec(master, send_hello_cb, thread_add_timer_msec(master, send_hello_cb,

View File

@ -1938,7 +1938,7 @@ int _isis_spf_schedule(struct isis_area *area, int level,
area->area_tag, level, diff, func, file, line); 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]) { if (area->spf_delay_ietf[level - 1]) {
/* Need to call schedule function also if spf delay is running /* Need to call schedule function also if spf delay is running
* to * to

View File

@ -1180,7 +1180,7 @@ void isis_sr_stop(struct isis_area *area)
area->area_tag); area->area_tag);
/* Disable any re-attempt to connect to Label Manager */ /* 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. */ /* Uninstall all local Adjacency-SIDs. */
for (ALL_LIST_ELEMENTS(area->srdb.adj_sids, node, nnode, sra)) for (ALL_LIST_ELEMENTS(area->srdb.adj_sids, node, nnode, sra))

View File

@ -92,7 +92,7 @@ static void tx_queue_element_free(void *element)
{ {
struct isis_tx_queue_entry *e = element; struct isis_tx_queue_entry *e = element;
thread_cancel(&(e->retry)); THREAD_OFF(e->retry);
XFREE(MTYPE_TX_QUEUE_ENTRY, e); XFREE(MTYPE_TX_QUEUE_ENTRY, e);
} }
@ -161,7 +161,7 @@ void _isis_tx_queue_add(struct isis_tx_queue *queue,
e->type = type; e->type = type;
thread_cancel(&(e->retry)); THREAD_OFF(e->retry);
thread_add_event(master, tx_queue_send_event, e, 0, &e->retry); thread_add_event(master, tx_queue_send_event, e, 0, &e->retry);
e->is_retry = false; 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); func, file, line);
} }
thread_cancel(&(e->retry)); THREAD_OFF(e->retry);
hash_release(queue->hash, e); hash_release(queue->hash, e);
XFREE(MTYPE_TX_QUEUE_ENTRY, e); XFREE(MTYPE_TX_QUEUE_ENTRY, e);

View File

@ -514,10 +514,10 @@ void isis_area_destroy(struct isis_area *area)
if (area->spf_timer[0]) if (area->spf_timer[0])
isis_spf_timer_free(THREAD_ARG(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]) if (area->spf_timer[1])
isis_spf_timer_free(THREAD_ARG(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[0]);
spf_backoff_free(area->spf_delay_ietf[1]); 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_LEVEL1);
isis_lfa_tiebreakers_clear(area, ISIS_LEVEL2); isis_lfa_tiebreakers_clear(area, ISIS_LEVEL2);
thread_cancel(&area->t_tick); THREAD_OFF(area->t_tick);
thread_cancel(&area->t_lsp_refresh[0]); THREAD_OFF(area->t_lsp_refresh[0]);
thread_cancel(&area->t_lsp_refresh[1]); THREAD_OFF(area->t_lsp_refresh[1]);
thread_cancel(&area->t_rlfa_rib_update); THREAD_OFF(area->t_rlfa_rib_update);
thread_cancel_event(master, area); 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]) if (area->spf_timer[level - 1])
isis_spf_timer_free(THREAD_ARG(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( sched_debug(
"ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.", "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.",
area->area_tag, level); 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; area->lsp_regenerate_pending[level - 1] = 0;
} }

View File

@ -72,7 +72,7 @@ accept_del(int fd)
LIST_FOREACH(av, &accept_queue.queue, entry) LIST_FOREACH(av, &accept_queue.queue, entry)
if (av->fd == fd) { if (av->fd == fd) {
log_debug("%s: %d removed from queue", __func__, fd); log_debug("%s: %d removed from queue", __func__, fd);
thread_cancel(&av->ev); THREAD_OFF(av->ev);
LIST_REMOVE(av, entry); LIST_REMOVE(av, entry);
free(av); free(av);
return; return;
@ -92,7 +92,7 @@ accept_unpause(void)
{ {
if (accept_queue.evt != NULL) { if (accept_queue.evt != NULL) {
log_debug(__func__); log_debug(__func__);
thread_cancel(&accept_queue.evt); THREAD_OFF(accept_queue.evt);
accept_arm(); accept_arm();
} }
} }
@ -111,7 +111,7 @@ accept_unarm(void)
{ {
struct accept_ev *av; struct accept_ev *av;
LIST_FOREACH(av, &accept_queue.queue, entry) LIST_FOREACH(av, &accept_queue.queue, entry)
thread_cancel(&av->ev); THREAD_OFF(av->ev);
} }
static void accept_cb(struct thread *thread) static void accept_cb(struct thread *thread)

View File

@ -196,7 +196,7 @@ static void adj_itimer(struct thread *thread)
void void
adj_start_itimer(struct adj *adj) adj_start_itimer(struct adj *adj)
{ {
thread_cancel(&adj->inactivity_timer); THREAD_OFF(adj->inactivity_timer);
adj->inactivity_timer = NULL; adj->inactivity_timer = NULL;
thread_add_timer(master, adj_itimer, adj, adj->holdtime, thread_add_timer(master, adj_itimer, adj, adj->holdtime,
&adj->inactivity_timer); &adj->inactivity_timer);
@ -205,7 +205,7 @@ adj_start_itimer(struct adj *adj)
void void
adj_stop_itimer(struct adj *adj) adj_stop_itimer(struct adj *adj)
{ {
thread_cancel(&adj->inactivity_timer); THREAD_OFF(adj->inactivity_timer);
} }
/* targeted neighbors */ /* targeted neighbors */
@ -354,7 +354,7 @@ static void tnbr_hello_timer(struct thread *thread)
static void static void
tnbr_start_hello_timer(struct tnbr *tnbr) tnbr_start_hello_timer(struct tnbr *tnbr)
{ {
thread_cancel(&tnbr->hello_timer); THREAD_OFF(tnbr->hello_timer);
tnbr->hello_timer = NULL; tnbr->hello_timer = NULL;
thread_add_timer(master, tnbr_hello_timer, tnbr, tnbr_get_hello_interval(tnbr), thread_add_timer(master, tnbr_hello_timer, tnbr, tnbr_get_hello_interval(tnbr),
&tnbr->hello_timer); &tnbr->hello_timer);
@ -363,7 +363,7 @@ tnbr_start_hello_timer(struct tnbr *tnbr)
static void static void
tnbr_stop_hello_timer(struct tnbr *tnbr) tnbr_stop_hello_timer(struct tnbr *tnbr)
{ {
thread_cancel(&tnbr->hello_timer); THREAD_OFF(tnbr->hello_timer);
} }
struct ctl_adj * struct ctl_adj *

View File

@ -180,8 +180,8 @@ control_close(int fd)
msgbuf_clear(&c->iev.ibuf.w); msgbuf_clear(&c->iev.ibuf.w);
TAILQ_REMOVE(&ctl_conns, c, entry); TAILQ_REMOVE(&ctl_conns, c, entry);
thread_cancel(&c->iev.ev_read); THREAD_OFF(c->iev.ev_read);
thread_cancel(&c->iev.ev_write); THREAD_OFF(c->iev.ev_write);
close(c->iev.ibuf.fd); close(c->iev.ibuf.fd);
accept_unpause(); accept_unpause();
free(c); free(c);

View File

@ -467,7 +467,7 @@ static void if_hello_timer(struct thread *thread)
static void static void
if_start_hello_timer(struct iface_af *ia) 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), thread_add_timer(master, if_hello_timer, ia, if_get_hello_interval(ia),
&ia->hello_timer); &ia->hello_timer);
} }
@ -475,7 +475,7 @@ if_start_hello_timer(struct iface_af *ia)
static void static void
if_stop_hello_timer(struct iface_af *ia) if_stop_hello_timer(struct iface_af *ia)
{ {
thread_cancel(&ia->hello_timer); THREAD_OFF(ia->hello_timer);
} }
struct ctl_iface * struct ctl_iface *

View File

@ -417,8 +417,8 @@ static void lde_dispatch_imsg(struct thread *thread)
imsg_event_add(iev); imsg_event_add(iev);
else { else {
/* this pipe is dead, so remove the event handlers and exit */ /* this pipe is dead, so remove the event handlers and exit */
thread_cancel(&iev->ev_read); THREAD_OFF(iev->ev_read);
thread_cancel(&iev->ev_write); THREAD_OFF(iev->ev_write);
lde_shutdown(); lde_shutdown();
} }
} }
@ -702,8 +702,8 @@ static void lde_dispatch_parent(struct thread *thread)
imsg_event_add(iev); imsg_event_add(iev);
else { else {
/* this pipe is dead, so remove the event handlers and exit */ /* this pipe is dead, so remove the event handlers and exit */
thread_cancel(&iev->ev_read); THREAD_OFF(iev->ev_read);
thread_cancel(&iev->ev_write); THREAD_OFF(iev->ev_write);
lde_shutdown(); lde_shutdown();
} }
} }

View File

@ -1068,7 +1068,7 @@ void lde_gc_timer(struct thread *thread)
void void
lde_gc_start_timer(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, thread_add_timer(master, lde_gc_timer, NULL, LDE_GC_INTERVAL,
&gc_timer); &gc_timer);
} }
@ -1076,5 +1076,5 @@ lde_gc_start_timer(void)
void void
lde_gc_stop_timer(void) lde_gc_stop_timer(void)
{ {
thread_cancel(&gc_timer); THREAD_OFF(gc_timer);
} }

View File

@ -616,8 +616,8 @@ static void main_dispatch_ldpe(struct thread *thread)
imsg_event_add(iev); imsg_event_add(iev);
else { else {
/* this pipe is dead, so remove the event handlers and exit */ /* this pipe is dead, so remove the event handlers and exit */
thread_cancel(&iev->ev_read); THREAD_OFF(iev->ev_read);
thread_cancel(&iev->ev_write); THREAD_OFF(iev->ev_write);
ldpe_pid = 0; ldpe_pid = 0;
if (lde_pid == 0) if (lde_pid == 0)
ldpd_shutdown(); ldpd_shutdown();
@ -721,8 +721,8 @@ static void main_dispatch_lde(struct thread *thread)
imsg_event_add(iev); imsg_event_add(iev);
else { else {
/* this pipe is dead, so remove the event handlers and exit */ /* this pipe is dead, so remove the event handlers and exit */
thread_cancel(&iev->ev_read); THREAD_OFF(iev->ev_read);
thread_cancel(&iev->ev_write); THREAD_OFF(iev->ev_write);
lde_pid = 0; lde_pid = 0;
if (ldpe_pid == 0) if (ldpe_pid == 0)
ldpd_shutdown(); ldpd_shutdown();
@ -744,8 +744,8 @@ void ldp_write_handler(struct thread *thread)
fatal("msgbuf_write"); fatal("msgbuf_write");
if (n == 0) { if (n == 0) {
/* this pipe is dead, so remove the event handlers */ /* this pipe is dead, so remove the event handlers */
thread_cancel(&iev->ev_read); THREAD_OFF(iev->ev_read);
thread_cancel(&iev->ev_write); THREAD_OFF(iev->ev_write);
return; return;
} }
@ -829,7 +829,7 @@ void evbuf_init(struct evbuf *eb, int fd, void (*handler)(struct thread *),
void void
evbuf_clear(struct evbuf *eb) evbuf_clear(struct evbuf *eb)
{ {
thread_cancel(&eb->ev); THREAD_OFF(eb->ev);
msgbuf_clear(&eb->wbuf); msgbuf_clear(&eb->wbuf);
eb->wbuf.fd = -1; eb->wbuf.fd = -1;
} }

View File

@ -212,7 +212,7 @@ ldpe_shutdown(void)
#ifdef __OpenBSD__ #ifdef __OpenBSD__
if (sysdep.no_pfkey == 0) { if (sysdep.no_pfkey == 0) {
thread_cancel(&pfkey_ev); THREAD_OFF(pfkey_ev);
close(global.pfkeysock); close(global.pfkeysock);
} }
#endif #endif
@ -626,8 +626,8 @@ static void ldpe_dispatch_main(struct thread *thread)
imsg_event_add(iev); imsg_event_add(iev);
else { else {
/* this pipe is dead, so remove the event handlers and exit */ /* this pipe is dead, so remove the event handlers and exit */
thread_cancel(&iev->ev_read); THREAD_OFF(iev->ev_read);
thread_cancel(&iev->ev_write); THREAD_OFF(iev->ev_write);
ldpe_shutdown(); ldpe_shutdown();
} }
} }
@ -762,8 +762,8 @@ static void ldpe_dispatch_lde(struct thread *thread)
imsg_event_add(iev); imsg_event_add(iev);
else { else {
/* this pipe is dead, so remove the event handlers and exit */ /* this pipe is dead, so remove the event handlers and exit */
thread_cancel(&iev->ev_read); THREAD_OFF(iev->ev_read);
thread_cancel(&iev->ev_write); THREAD_OFF(iev->ev_write);
ldpe_shutdown(); ldpe_shutdown();
} }
} }
@ -813,14 +813,14 @@ ldpe_close_sockets(int af)
af_global = ldp_af_global_get(&global, af); af_global = ldp_af_global_get(&global, af);
/* discovery socket */ /* discovery socket */
thread_cancel(&af_global->disc_ev); THREAD_OFF(af_global->disc_ev);
if (af_global->ldp_disc_socket != -1) { if (af_global->ldp_disc_socket != -1) {
close(af_global->ldp_disc_socket); close(af_global->ldp_disc_socket);
af_global->ldp_disc_socket = -1; af_global->ldp_disc_socket = -1;
} }
/* extended discovery socket */ /* extended discovery socket */
thread_cancel(&af_global->edisc_ev); THREAD_OFF(af_global->edisc_ev);
if (af_global->ldp_edisc_socket != -1) { if (af_global->ldp_edisc_socket != -1) {
close(af_global->ldp_edisc_socket); close(af_global->ldp_edisc_socket);
af_global->ldp_edisc_socket = -1; af_global->ldp_edisc_socket = -1;

View File

@ -307,7 +307,7 @@ nbr_del(struct nbr *nbr)
nbr->auth.method = AUTH_NONE; nbr->auth.method = AUTH_NONE;
if (nbr_pending_connect(nbr)) if (nbr_pending_connect(nbr))
thread_cancel(&nbr->ev_connect); THREAD_OFF(nbr->ev_connect);
nbr_stop_ktimer(nbr); nbr_stop_ktimer(nbr);
nbr_stop_ktimeout(nbr); nbr_stop_ktimeout(nbr);
nbr_stop_itimeout(nbr); nbr_stop_itimeout(nbr);
@ -435,7 +435,7 @@ nbr_start_ktimer(struct nbr *nbr)
/* send three keepalives per period */ /* send three keepalives per period */
secs = nbr->keepalive / KEEPALIVE_PER_PERIOD; secs = nbr->keepalive / KEEPALIVE_PER_PERIOD;
thread_cancel(&nbr->keepalive_timer); THREAD_OFF(nbr->keepalive_timer);
nbr->keepalive_timer = NULL; nbr->keepalive_timer = NULL;
thread_add_timer(master, nbr_ktimer, nbr, secs, &nbr->keepalive_timer); thread_add_timer(master, nbr_ktimer, nbr, secs, &nbr->keepalive_timer);
} }
@ -443,7 +443,7 @@ nbr_start_ktimer(struct nbr *nbr)
void void
nbr_stop_ktimer(struct nbr *nbr) 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 */ /* Keepalive timeout: if the nbr hasn't sent keepalive */
@ -462,7 +462,7 @@ static void nbr_ktimeout(struct thread *thread)
static void static void
nbr_start_ktimeout(struct nbr *nbr) nbr_start_ktimeout(struct nbr *nbr)
{ {
thread_cancel(&nbr->keepalive_timeout); THREAD_OFF(nbr->keepalive_timeout);
nbr->keepalive_timeout = NULL; nbr->keepalive_timeout = NULL;
thread_add_timer(master, nbr_ktimeout, nbr, nbr->keepalive, thread_add_timer(master, nbr_ktimeout, nbr, nbr->keepalive,
&nbr->keepalive_timeout); &nbr->keepalive_timeout);
@ -471,7 +471,7 @@ nbr_start_ktimeout(struct nbr *nbr)
void void
nbr_stop_ktimeout(struct nbr *nbr) 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 */ /* Session initialization timeout: if nbr got stuck in the initialization FSM */
@ -491,7 +491,7 @@ nbr_start_itimeout(struct nbr *nbr)
int secs; int secs;
secs = INIT_FSM_TIMEOUT; secs = INIT_FSM_TIMEOUT;
thread_cancel(&nbr->init_timeout); THREAD_OFF(nbr->init_timeout);
nbr->init_timeout = NULL; nbr->init_timeout = NULL;
thread_add_timer(master, nbr_itimeout, nbr, secs, &nbr->init_timeout); thread_add_timer(master, nbr_itimeout, nbr, secs, &nbr->init_timeout);
} }
@ -499,7 +499,7 @@ nbr_start_itimeout(struct nbr *nbr)
void void
nbr_stop_itimeout(struct nbr *nbr) 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 */ /* Init delay timer: timer to retry to iniziatize session */
@ -537,7 +537,7 @@ nbr_start_idtimer(struct nbr *nbr)
break; break;
} }
thread_cancel(&nbr->initdelay_timer); THREAD_OFF(nbr->initdelay_timer);
nbr->initdelay_timer = NULL; nbr->initdelay_timer = NULL;
thread_add_timer(master, nbr_idtimer, nbr, secs, thread_add_timer(master, nbr_idtimer, nbr, secs,
&nbr->initdelay_timer); &nbr->initdelay_timer);
@ -546,7 +546,7 @@ nbr_start_idtimer(struct nbr *nbr)
void void
nbr_stop_idtimer(struct nbr *nbr) nbr_stop_idtimer(struct nbr *nbr)
{ {
thread_cancel(&nbr->initdelay_timer); THREAD_OFF(nbr->initdelay_timer);
} }
int int

View File

@ -651,7 +651,7 @@ session_shutdown(struct nbr *nbr, uint32_t status, uint32_t msg_id,
switch (nbr->state) { switch (nbr->state) {
case NBR_STA_PRESENT: case NBR_STA_PRESENT:
if (nbr_pending_connect(nbr)) if (nbr_pending_connect(nbr))
thread_cancel(&nbr->ev_connect); THREAD_OFF(nbr->ev_connect);
break; break;
case NBR_STA_INITIAL: case NBR_STA_INITIAL:
case NBR_STA_OPENREC: case NBR_STA_OPENREC:
@ -756,7 +756,7 @@ tcp_close(struct tcp_conn *tcp)
evbuf_clear(&tcp->wbuf); evbuf_clear(&tcp->wbuf);
if (tcp->nbr) { if (tcp->nbr) {
thread_cancel(&tcp->rev); THREAD_OFF(tcp->rev);
free(tcp->rbuf); free(tcp->rbuf);
tcp->nbr->tcp = NULL; tcp->nbr->tcp = NULL;
} }
@ -788,7 +788,7 @@ pending_conn_new(int fd, int af, union ldpd_addr *addr)
void void
pending_conn_del(struct pending_conn *pconn) pending_conn_del(struct pending_conn *pconn)
{ {
thread_cancel(&pconn->ev_timeout); THREAD_OFF(pconn->ev_timeout);
TAILQ_REMOVE(&global.pending_conns, pconn, entry); TAILQ_REMOVE(&global.pending_conns, pconn, entry);
free(pconn); free(pconn);
} }

View File

@ -146,9 +146,9 @@ static void agentx_events_update(void)
else if (FD_ISSET(fd, &fds)) { else if (FD_ISSET(fd, &fds)) {
struct listnode *newln; struct listnode *newln;
thr = XCALLOC(MTYPE_TMP, sizeof(struct thread *)); thr = XCALLOC(MTYPE_TMP, sizeof(struct thread *));
thread_add_read(agentx_tm, agentx_read, NULL, fd, thr);
newln = listnode_add_before(events, ln, thr); newln = listnode_add_before(events, ln, thr);
(*thr)->arg = newln; thread_add_read(agentx_tm, agentx_read, newln, fd, thr);
} }
} }

View File

@ -198,7 +198,7 @@ class RpcStateBase
static void c_callback(struct thread *thread) 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 * We hold the lock until the callback finishes and has updated
* _tag->state, then we signal done and release. * _tag->state, then we signal done and release.

View File

@ -318,12 +318,12 @@ void ospf_apiserver_free(struct ospf_apiserver *apiserv)
struct listnode *node; struct listnode *node;
/* Cancel read and write threads. */ /* Cancel read and write threads. */
thread_cancel(&apiserv->t_sync_read); THREAD_OFF(apiserv->t_sync_read);
#ifdef USE_ASYNC_READ #ifdef USE_ASYNC_READ
thread_cancel(&apiserv->t_async_read); THREAD_OFF(apiserv->t_async_read);
#endif /* USE_ASYNC_READ */ #endif /* USE_ASYNC_READ */
thread_cancel(&apiserv->t_sync_write); THREAD_OFF(apiserv->t_sync_write);
thread_cancel(&apiserv->t_async_write); THREAD_OFF(apiserv->t_async_write);
/* Unregister all opaque types that application registered /* Unregister all opaque types that application registered
and flush opaque LSAs if still in LSDB. */ and flush opaque LSAs if still in LSDB. */

View File

@ -216,7 +216,7 @@ static void ospf_gr_restart_exit(struct ospf *ospf, const char *reason)
zlog_debug("GR: exiting graceful restart: %s", reason); zlog_debug("GR: exiting graceful restart: %s", reason);
ospf->gr_info.restart_in_progress = false; 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. */ /* Record in non-volatile memory that the restart is complete. */
ospf_gr_nvm_delete(ospf); ospf_gr_nvm_delete(ospf);

View File

@ -302,7 +302,7 @@ void ospf_if_cleanup(struct ospf_interface *oi)
/* oi->nbrs and oi->nbr_nbma should be deleted on InterfaceDown event */ /* oi->nbrs and oi->nbr_nbma should be deleted on InterfaceDown event */
/* delete all static neighbors attached to this interface */ /* delete all static neighbors attached to this interface */
for (ALL_LIST_ELEMENTS(oi->nbr_nbma, node, nnode, nbr_nbma)) { 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) { if (nbr_nbma->nbr) {
nbr_nbma->nbr->nbr_nbma = NULL; nbr_nbma->nbr->nbr_nbma = NULL;
@ -513,7 +513,7 @@ void ospf_if_stream_unset(struct ospf_interface *oi)
if (oi->on_write_q) { if (oi->on_write_q) {
listnode_delete(ospf->oi_write_q, oi); listnode_delete(ospf->oi_write_q, oi);
if (list_isempty(ospf->oi_write_q)) if (list_isempty(ospf->oi_write_q))
OSPF_TIMER_OFF(ospf->t_write); THREAD_OFF(ospf->t_write);
oi->on_write_q = 0; 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); ospf_hello_send(oi);
/* Restart hello timer for this interface */ /* Restart hello timer for this interface */
OSPF_ISM_TIMER_OFF(oi->t_hello); THREAD_OFF(oi->t_hello);
OSPF_HELLO_TIMER_ON(oi); 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); ospf_hello_send(oi);
/* Restart the hello timer. */ /* Restart the hello timer. */
OSPF_ISM_TIMER_OFF(oi->t_hello); THREAD_OFF(oi->t_hello);
OSPF_HELLO_TIMER_ON(oi); OSPF_HELLO_TIMER_ON(oi);
} }
} }

View File

@ -290,16 +290,16 @@ static void ism_timer_set(struct ospf_interface *oi)
interface parameters must be set to initial values, and interface parameters must be set to initial values, and
timers are timers are
reset also. */ reset also. */
OSPF_ISM_TIMER_OFF(oi->t_hello); THREAD_OFF(oi->t_hello);
OSPF_ISM_TIMER_OFF(oi->t_wait); THREAD_OFF(oi->t_wait);
OSPF_ISM_TIMER_OFF(oi->t_ls_ack); THREAD_OFF(oi->t_ls_ack);
break; break;
case ISM_Loopback: case ISM_Loopback:
/* In this state, the interface may be looped back and will be /* In this state, the interface may be looped back and will be
unavailable for regular data traffic. */ unavailable for regular data traffic. */
OSPF_ISM_TIMER_OFF(oi->t_hello); THREAD_OFF(oi->t_hello);
OSPF_ISM_TIMER_OFF(oi->t_wait); THREAD_OFF(oi->t_wait);
OSPF_ISM_TIMER_OFF(oi->t_ls_ack); THREAD_OFF(oi->t_ls_ack);
break; break;
case ISM_Waiting: case ISM_Waiting:
/* The router is trying to determine the identity of DRouter and /* 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_MSEC_ON(oi->t_hello, ospf_hello_timer, 1);
OSPF_ISM_TIMER_ON(oi->t_wait, ospf_wait_timer, OSPF_ISM_TIMER_ON(oi->t_wait, ospf_wait_timer,
OSPF_IF_PARAM(oi, v_wait)); OSPF_IF_PARAM(oi, v_wait));
OSPF_ISM_TIMER_OFF(oi->t_ls_ack); THREAD_OFF(oi->t_ls_ack);
break; break;
case ISM_PointToPoint: case ISM_PointToPoint:
/* The interface connects to a physical Point-to-point network /* 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. */ neighboring router. Hello packets are also sent. */
/* send first hello immediately */ /* send first hello immediately */
OSPF_ISM_TIMER_MSEC_ON(oi->t_hello, ospf_hello_timer, 1); 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, OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer,
oi->v_ls_ack); oi->v_ls_ack);
break; break;
@ -328,7 +328,7 @@ static void ism_timer_set(struct ospf_interface *oi)
and the router itself is neither Designated Router nor and the router itself is neither Designated Router nor
Backup Designated Router. */ Backup Designated Router. */
OSPF_HELLO_TIMER_ON(oi); 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, OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer,
oi->v_ls_ack); oi->v_ls_ack);
break; break;
@ -337,7 +337,7 @@ static void ism_timer_set(struct ospf_interface *oi)
network, network,
and the router is Backup Designated Router. */ and the router is Backup Designated Router. */
OSPF_HELLO_TIMER_ON(oi); 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, OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer,
oi->v_ls_ack); oi->v_ls_ack);
break; break;
@ -346,7 +346,7 @@ static void ism_timer_set(struct ospf_interface *oi)
network, network,
and the router is Designated Router. */ and the router is Designated Router. */
OSPF_HELLO_TIMER_ON(oi); 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, OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer,
oi->v_ls_ack); oi->v_ls_ack);
break; break;

View File

@ -78,9 +78,6 @@
OSPF_IF_PARAM((O), v_hello)); \ OSPF_IF_PARAM((O), v_hello)); \
} while (0) } while (0)
/* Macro for OSPF ISM timer turn off. */
#define OSPF_ISM_TIMER_OFF(X) thread_cancel(&(X))
/* Macro for OSPF schedule event. */ /* Macro for OSPF schedule event. */
#define OSPF_ISM_EVENT_SCHEDULE(I, E) \ #define OSPF_ISM_EVENT_SCHEDULE(I, E) \
thread_add_event(master, ospf_ism_event, (I), (E), NULL) thread_add_event(master, ospf_ism_event, (I), (E), NULL)

View File

@ -3625,7 +3625,7 @@ void ospf_flush_self_originated_lsas_now(struct ospf *ospf)
* without conflicting to other threads. * without conflicting to other threads.
*/ */
if (ospf->t_maxage != NULL) { 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); thread_execute(master, ospf_maxage_lsa_remover, ospf, 0);
} }

View File

@ -140,17 +140,17 @@ void ospf_nbr_free(struct ospf_neighbor *nbr)
} }
/* Cancel all timers. */ /* Cancel all timers. */
OSPF_NSM_TIMER_OFF(nbr->t_inactivity); THREAD_OFF(nbr->t_inactivity);
OSPF_NSM_TIMER_OFF(nbr->t_db_desc); THREAD_OFF(nbr->t_db_desc);
OSPF_NSM_TIMER_OFF(nbr->t_ls_req); THREAD_OFF(nbr->t_ls_req);
OSPF_NSM_TIMER_OFF(nbr->t_ls_upd); THREAD_OFF(nbr->t_ls_upd);
/* Cancel all events. */ /* Thread lookup cost would be negligible. */ /* Cancel all events. */ /* Thread lookup cost would be negligible. */
thread_cancel_event(master, nbr); thread_cancel_event(master, nbr);
bfd_sess_free(&nbr->bfd_session); 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; nbr->oi = NULL;
XFREE(MTYPE_OSPF_NEIGHBOR, nbr); 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; nbr->nbr_nbma = nbr_nbma;
if (nbr_nbma->t_poll) 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; nbr->state_change = nbr_nbma->state_change + 1;
} }

View File

@ -120,32 +120,32 @@ static void nsm_timer_set(struct ospf_neighbor *nbr)
switch (nbr->state) { switch (nbr->state) {
case NSM_Deleted: case NSM_Deleted:
case NSM_Down: case NSM_Down:
OSPF_NSM_TIMER_OFF(nbr->t_inactivity); THREAD_OFF(nbr->t_inactivity);
OSPF_NSM_TIMER_OFF(nbr->t_hello_reply); THREAD_OFF(nbr->t_hello_reply);
/* fallthru */ /* fallthru */
case NSM_Attempt: case NSM_Attempt:
case NSM_Init: case NSM_Init:
case NSM_TwoWay: case NSM_TwoWay:
OSPF_NSM_TIMER_OFF(nbr->t_db_desc); THREAD_OFF(nbr->t_db_desc);
OSPF_NSM_TIMER_OFF(nbr->t_ls_upd); THREAD_OFF(nbr->t_ls_upd);
OSPF_NSM_TIMER_OFF(nbr->t_ls_req); THREAD_OFF(nbr->t_ls_req);
break; break;
case NSM_ExStart: case NSM_ExStart:
OSPF_NSM_TIMER_ON(nbr->t_db_desc, ospf_db_desc_timer, OSPF_NSM_TIMER_ON(nbr->t_db_desc, ospf_db_desc_timer,
nbr->v_db_desc); nbr->v_db_desc);
OSPF_NSM_TIMER_OFF(nbr->t_ls_upd); THREAD_OFF(nbr->t_ls_upd);
OSPF_NSM_TIMER_OFF(nbr->t_ls_req); THREAD_OFF(nbr->t_ls_req);
break; break;
case NSM_Exchange: case NSM_Exchange:
OSPF_NSM_TIMER_ON(nbr->t_ls_upd, ospf_ls_upd_timer, OSPF_NSM_TIMER_ON(nbr->t_ls_upd, ospf_ls_upd_timer,
nbr->v_ls_upd); nbr->v_ls_upd);
if (!IS_SET_DD_MS(nbr->dd_flags)) if (!IS_SET_DD_MS(nbr->dd_flags))
OSPF_NSM_TIMER_OFF(nbr->t_db_desc); THREAD_OFF(nbr->t_db_desc);
break; break;
case NSM_Loading: case NSM_Loading:
case NSM_Full: case NSM_Full:
default: default:
OSPF_NSM_TIMER_OFF(nbr->t_db_desc); THREAD_OFF(nbr->t_db_desc);
break; break;
} }
} }
@ -176,13 +176,13 @@ int nsm_should_adj(struct ospf_neighbor *nbr)
static int nsm_hello_received(struct ospf_neighbor *nbr) static int nsm_hello_received(struct ospf_neighbor *nbr)
{ {
/* Start or Restart Inactivity Timer. */ /* 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, OSPF_NSM_TIMER_ON(nbr->t_inactivity, ospf_inactivity_timer,
nbr->v_inactivity); nbr->v_inactivity);
if (nbr->oi->type == OSPF_IFTYPE_NBMA && nbr->nbr_nbma) 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 */ /* Send proactive ARP requests */
if (nbr->state < NSM_Exchange) 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) static int nsm_start(struct ospf_neighbor *nbr)
{ {
if (nbr->nbr_nbma) 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, OSPF_NSM_TIMER_ON(nbr->t_inactivity, ospf_inactivity_timer,
nbr->v_inactivity); nbr->v_inactivity);

View File

@ -58,9 +58,6 @@
/* Macro for OSPF NSM timer turn on. */ /* Macro for OSPF NSM timer turn on. */
#define OSPF_NSM_TIMER_ON(T,F,V) thread_add_timer (master, (F), nbr, (V), &(T)) #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. */ /* Macro for OSPF NSM schedule event. */
#define OSPF_NSM_EVENT_SCHEDULE(N, E) \ #define OSPF_NSM_EVENT_SCHEDULE(N, E) \
thread_add_event(master, ospf_nsm_event, (N), (E), NULL) thread_add_event(master, ospf_nsm_event, (N), (E), NULL)

View File

@ -147,7 +147,7 @@ int ospf_opaque_type9_lsa_init(struct ospf_interface *oi)
void ospf_opaque_type9_lsa_term(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) if (oi->opaque_lsa_self != NULL)
list_delete(&oi->opaque_lsa_self); list_delete(&oi->opaque_lsa_self);
oi->opaque_lsa_self = NULL; 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; area->lsdb->new_lsa_hook = area->lsdb->del_lsa_hook = NULL;
#endif /* MONITOR_LSDB_CHANGE */ #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) if (area->opaque_lsa_self != NULL)
list_delete(&area->opaque_lsa_self); list_delete(&area->opaque_lsa_self);
return; 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; top->lsdb->new_lsa_hook = top->lsdb->del_lsa_hook = NULL;
#endif /* MONITOR_LSDB_CHANGE */ #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) if (top->opaque_lsa_self != NULL)
list_delete(&top->opaque_lsa_self); list_delete(&top->opaque_lsa_self);
return; 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_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); list_delete(&oipt->id_list);
if (cleanup_owner) { if (cleanup_owner) {
/* Remove from its owner's self-originated LSA list. */ /* 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; 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) if (oipi->lsa != NULL)
ospf_lsa_unlock(&oipi->lsa); ospf_lsa_unlock(&oipi->lsa);
XFREE(MTYPE_OPAQUE_INFO_PER_ID, oipi); XFREE(MTYPE_OPAQUE_INFO_PER_ID, oipi);

View File

@ -466,7 +466,7 @@ static void ospf_ls_req_timer(struct thread *thread)
void ospf_ls_req_event(struct ospf_neighbor *nbr) 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); 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. * is actually turned off.
*/ */
if (list_isempty(oi->ospf->oi_write_q)) if (list_isempty(oi->ospf->oi_write_q))
OSPF_TIMER_OFF(oi->ospf->t_write); THREAD_OFF(oi->ospf->t_write);
} else { } else {
/* Hook thread to write packet. */ /* Hook thread to write packet. */
OSPF_ISM_WRITE_ON(oi->ospf); OSPF_ISM_WRITE_ON(oi->ospf);

View File

@ -9748,7 +9748,7 @@ DEFUN (no_ospf_max_metric_router_lsa_startup,
for (ALL_LIST_ELEMENTS_RO(ospf->areas, ln, area)) { for (ALL_LIST_ELEMENTS_RO(ospf->areas, ln, area)) {
SET_FLAG(area->stub_router_state, SET_FLAG(area->stub_router_state,
OSPF_AREA_WAS_START_STUB_ROUTED); 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 */ /* Don't trample on admin stub routed */
if (!CHECK_FLAG(area->stub_router_state, if (!CHECK_FLAG(area->stub_router_state,

View File

@ -572,7 +572,7 @@ static struct ospf *ospf_lookup_by_name(const char *vrf_name)
static void ospf_deferred_shutdown_finish(struct ospf *ospf) static void ospf_deferred_shutdown_finish(struct ospf *ospf)
{ {
ospf->stub_router_shutdown_time = OSPF_STUB_ROUTER_UNCONFIGURED; 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); ospf_finish_final(ospf);
@ -754,7 +754,7 @@ static void ospf_finish_final(struct ospf *ospf)
/* Clear static neighbors */ /* Clear static neighbors */
for (rn = route_top(ospf->nbr_nbma); rn; rn = route_next(rn)) for (rn = route_top(ospf->nbr_nbma); rn; rn = route_next(rn))
if ((nbr_nbma = rn->info)) { if ((nbr_nbma = rn->info)) {
OSPF_POLL_TIMER_OFF(nbr_nbma->t_poll); THREAD_OFF(nbr_nbma->t_poll);
if (nbr_nbma->nbr) { if (nbr_nbma->nbr) {
nbr_nbma->nbr->nbr_nbma = NULL; nbr_nbma->nbr->nbr_nbma = NULL;
@ -790,22 +790,22 @@ static void ospf_finish_final(struct ospf *ospf)
} }
/* Cancel all timers. */ /* Cancel all timers. */
OSPF_TIMER_OFF(ospf->t_read); THREAD_OFF(ospf->t_read);
OSPF_TIMER_OFF(ospf->t_write); THREAD_OFF(ospf->t_write);
OSPF_TIMER_OFF(ospf->t_spf_calc); THREAD_OFF(ospf->t_spf_calc);
OSPF_TIMER_OFF(ospf->t_ase_calc); THREAD_OFF(ospf->t_ase_calc);
OSPF_TIMER_OFF(ospf->t_maxage); THREAD_OFF(ospf->t_maxage);
OSPF_TIMER_OFF(ospf->t_maxage_walker); THREAD_OFF(ospf->t_maxage_walker);
OSPF_TIMER_OFF(ospf->t_abr_task); THREAD_OFF(ospf->t_abr_task);
OSPF_TIMER_OFF(ospf->t_asbr_check); THREAD_OFF(ospf->t_asbr_check);
OSPF_TIMER_OFF(ospf->t_asbr_nssa_redist_update); THREAD_OFF(ospf->t_asbr_nssa_redist_update);
OSPF_TIMER_OFF(ospf->t_distribute_update); THREAD_OFF(ospf->t_distribute_update);
OSPF_TIMER_OFF(ospf->t_lsa_refresher); THREAD_OFF(ospf->t_lsa_refresher);
OSPF_TIMER_OFF(ospf->t_opaque_lsa_self); THREAD_OFF(ospf->t_opaque_lsa_self);
OSPF_TIMER_OFF(ospf->t_sr_update); THREAD_OFF(ospf->t_sr_update);
OSPF_TIMER_OFF(ospf->t_default_routemap_timer); THREAD_OFF(ospf->t_default_routemap_timer);
OSPF_TIMER_OFF(ospf->t_external_aggr); THREAD_OFF(ospf->t_external_aggr);
OSPF_TIMER_OFF(ospf->gr_info.t_grace_period); THREAD_OFF(ospf->gr_info.t_grace_period);
LSDB_LOOP (OPAQUE_AS_LSDB(ospf), rn, lsa) LSDB_LOOP (OPAQUE_AS_LSDB(ospf), rn, lsa)
ospf_discard_from_db(ospf, ospf->lsdb, 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)); free(IMPORT_NAME(area));
/* Cancel timer. */ /* Cancel timer. */
OSPF_TIMER_OFF(area->t_stub_router); THREAD_OFF(area->t_stub_router);
OSPF_TIMER_OFF(area->t_opaque_lsa_self); THREAD_OFF(area->t_opaque_lsa_self);
if (OSPF_IS_AREA_BACKBONE(area)) if (OSPF_IS_AREA_BACKBONE(area))
area->ospf->backbone = NULL; area->ospf->backbone = NULL;
@ -1428,7 +1428,7 @@ void ospf_ls_upd_queue_empty(struct ospf_interface *oi)
} }
/* remove update event */ /* 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) 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); - (monotime(NULL) - ospf->lsa_refresher_started);
if (time_left > interval) { 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, thread_add_timer(master, ospf_lsa_refresh_walker, ospf,
interval, &ospf->t_lsa_refresher); interval, &ospf->t_lsa_refresher);
} }
@ -1853,7 +1853,7 @@ int ospf_timers_refresh_unset(struct ospf *ospf)
- (monotime(NULL) - ospf->lsa_refresher_started); - (monotime(NULL) - ospf->lsa_refresher_started);
if (time_left > OSPF_LSA_REFRESH_INTERVAL_DEFAULT) { 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; ospf->t_lsa_refresher = NULL;
thread_add_timer(master, ospf_lsa_refresh_walker, ospf, thread_add_timer(master, ospf_lsa_refresh_walker, ospf,
OSPF_LSA_REFRESH_INTERVAL_DEFAULT, 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) 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) { if (nbr_nbma->nbr) {
nbr_nbma->nbr->nbr_nbma = NULL; 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) { if (nbr_nbma->v_poll != interval) {
nbr_nbma->v_poll = interval; nbr_nbma->v_poll = interval;
if (nbr_nbma->oi && ospf_if_is_up(nbr_nbma->oi)) { 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, OSPF_POLL_TIMER_ON(nbr_nbma->t_poll, ospf_poll_timer,
nbr_nbma->v_poll); nbr_nbma->v_poll);
} }
@ -2263,7 +2263,7 @@ static int ospf_vrf_disable(struct vrf *vrf)
if (IS_DEBUG_OSPF_EVENT) if (IS_DEBUG_OSPF_EVENT)
zlog_debug("%s: ospf old_vrf_id %d unlinked", __func__, zlog_debug("%s: ospf old_vrf_id %d unlinked", __func__,
old_vrf_id); old_vrf_id);
thread_cancel(&ospf->t_read); THREAD_OFF(ospf->t_read);
close(ospf->fd); close(ospf->fd);
ospf->fd = -1; ospf->fd = -1;
} }

View File

@ -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_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_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_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 variables. */
extern struct ospf_master *om; extern struct ospf_master *om;

View File

@ -428,7 +428,7 @@ static void rip_interface_clean(struct rip_interface *ri)
ri->enable_interface = 0; ri->enable_interface = 0;
ri->running = 0; ri->running = 0;
thread_cancel(&ri->t_wakeup); THREAD_OFF(ri->t_wakeup);
} }
void rip_interfaces_clean(struct rip *rip) void rip_interfaces_clean(struct rip *rip)

View File

@ -64,8 +64,8 @@ static void clear_rip_route(struct rip *rip)
} }
if (rinfo) { if (rinfo) {
RIP_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
RIP_TIMER_OFF(rinfo->t_garbage_collect); THREAD_OFF(rinfo->t_garbage_collect);
listnode_delete(list, rinfo); listnode_delete(list, rinfo);
rip_info_free(rinfo); rip_info_free(rinfo);
} }

View File

@ -38,7 +38,7 @@ static struct rip_peer *rip_peer_new(void)
static void rip_peer_free(struct rip_peer *peer) 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); 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); peer = rip_peer_lookup(rip, addr);
if (peer) { if (peer) {
thread_cancel(&peer->t_timeout); THREAD_OFF(peer->t_timeout);
} else { } else {
peer = rip_peer_new(); peer = rip_peer_new();
peer->rip = rip; peer->rip = rip;

View File

@ -144,7 +144,7 @@ static void rip_garbage_collect(struct thread *t)
rinfo = THREAD_ARG(t); rinfo = THREAD_ARG(t);
/* Off timeout timer. */ /* Off timeout timer. */
RIP_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
/* Get route_node pointer. */ /* Get route_node pointer. */
rp = rinfo->rp; 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) if (tmp_rinfo == rinfo)
continue; continue;
RIP_TIMER_OFF(tmp_rinfo->t_timeout); THREAD_OFF(tmp_rinfo->t_timeout);
RIP_TIMER_OFF(tmp_rinfo->t_garbage_collect); THREAD_OFF(tmp_rinfo->t_garbage_collect);
list_delete_node(list, node); list_delete_node(list, node);
rip_info_free(tmp_rinfo); rip_info_free(tmp_rinfo);
} }
RIP_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
RIP_TIMER_OFF(rinfo->t_garbage_collect); THREAD_OFF(rinfo->t_garbage_collect);
memcpy(rinfo, rinfo_new, sizeof(struct rip_info)); memcpy(rinfo, rinfo_new, sizeof(struct rip_info));
if (rip_route_rte(rinfo)) { 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 route_node *rp = rinfo->rp;
struct list *list = (struct list *)rp->info; struct list *list = (struct list *)rp->info;
RIP_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
if (listcount(list) > 1) { if (listcount(list) > 1) {
/* Some other ECMP entries still exist. Just delete this entry. /* 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); listnode_delete(list, rinfo);
if (rip_route_rte(rinfo) if (rip_route_rte(rinfo)
&& CHECK_FLAG(rinfo->flags, RIP_RTF_FIB)) && 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) static void rip_timeout_update(struct rip *rip, struct rip_info *rinfo)
{ {
if (rinfo->metric != RIP_METRIC_INFINITY) { 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, thread_add_timer(master, rip_timeout, rinfo, rip->timeout_time,
&rinfo->t_timeout); &rinfo->t_timeout);
} }
@ -659,8 +659,8 @@ static void rip_rte_process(struct rte *rte, struct sockaddr_in *from,
assert(newinfo.metric assert(newinfo.metric
!= RIP_METRIC_INFINITY); != RIP_METRIC_INFINITY);
RIP_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
RIP_TIMER_OFF(rinfo->t_garbage_collect); THREAD_OFF(rinfo->t_garbage_collect);
memcpy(rinfo, &newinfo, memcpy(rinfo, &newinfo,
sizeof(struct rip_info)); sizeof(struct rip_info));
rip_timeout_update(rip, rinfo); 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_TIMER_ON(rinfo->t_garbage_collect,
rip_garbage_collect, rip_garbage_collect,
rip->garbage_time); rip->garbage_time);
RIP_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
rinfo->flags |= RIP_RTF_CHANGED; rinfo->flags |= RIP_RTF_CHANGED;
if (IS_RIP_DEBUG_EVENT) 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 /* Triggered updates may be suppressed if a regular update is due by
the time the triggered update would be sent. */ the time the triggered update would be sent. */
RIP_TIMER_OFF(rip->t_triggered_interval); THREAD_OFF(rip->t_triggered_interval);
rip->trigger = 0; rip->trigger = 0;
/* Register myself. */ /* Register myself. */
@ -2553,7 +2553,7 @@ static void rip_triggered_update(struct thread *t)
int interval; int interval;
/* Cancel interval timer. */ /* Cancel interval timer. */
RIP_TIMER_OFF(rip->t_triggered_interval); THREAD_OFF(rip->t_triggered_interval);
rip->trigger = 0; rip->trigger = 0;
/* Logging triggered update. */ /* Logging triggered update. */
@ -2603,7 +2603,7 @@ void rip_redistribute_withdraw(struct rip *rip, int type)
rinfo->metric = RIP_METRIC_INFINITY; rinfo->metric = RIP_METRIC_INFINITY;
RIP_TIMER_ON(rinfo->t_garbage_collect, rip_garbage_collect, RIP_TIMER_ON(rinfo->t_garbage_collect, rip_garbage_collect,
rip->garbage_time); rip->garbage_time);
RIP_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
rinfo->flags |= RIP_RTF_CHANGED; rinfo->flags |= RIP_RTF_CHANGED;
if (IS_RIP_DEBUG_EVENT) { 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); thread_add_read(master, rip_read, rip, sock, &rip->t_read);
break; break;
case RIP_UPDATE_EVENT: case RIP_UPDATE_EVENT:
RIP_TIMER_OFF(rip->t_update); THREAD_OFF(rip->t_update);
jitter = rip_update_jitter(rip->update_time); jitter = rip_update_jitter(rip->update_time);
thread_add_timer(master, rip_update, rip, thread_add_timer(master, rip_update, rip,
sock ? 2 : rip->update_time + jitter, sock ? 2 : rip->update_time + jitter,
@ -2915,8 +2915,8 @@ void rip_ecmp_disable(struct rip *rip)
if (tmp_rinfo == rinfo) if (tmp_rinfo == rinfo)
continue; continue;
RIP_TIMER_OFF(tmp_rinfo->t_timeout); THREAD_OFF(tmp_rinfo->t_timeout);
RIP_TIMER_OFF(tmp_rinfo->t_garbage_collect); THREAD_OFF(tmp_rinfo->t_garbage_collect);
list_delete_node(list, node); list_delete_node(list, node);
rip_info_free(tmp_rinfo); rip_info_free(tmp_rinfo);
} }
@ -3508,8 +3508,8 @@ static void rip_instance_disable(struct rip *rip)
rip_zebra_ipv4_delete(rip, rp); rip_zebra_ipv4_delete(rip, rp);
for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) { for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) {
RIP_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
RIP_TIMER_OFF(rinfo->t_garbage_collect); THREAD_OFF(rinfo->t_garbage_collect);
rip_info_free(rinfo); rip_info_free(rinfo);
} }
list_delete(&list); list_delete(&list);
@ -3521,12 +3521,12 @@ static void rip_instance_disable(struct rip *rip)
rip_redistribute_disable(rip); rip_redistribute_disable(rip);
/* Cancel RIP related timers. */ /* Cancel RIP related timers. */
RIP_TIMER_OFF(rip->t_update); THREAD_OFF(rip->t_update);
RIP_TIMER_OFF(rip->t_triggered_update); THREAD_OFF(rip->t_triggered_update);
RIP_TIMER_OFF(rip->t_triggered_interval); THREAD_OFF(rip->t_triggered_interval);
/* Cancel read thread. */ /* Cancel read thread. */
thread_cancel(&rip->t_read); THREAD_OFF(rip->t_read);
/* Close RIP socket. */ /* Close RIP socket. */
close(rip->sock); close(rip->sock);

View File

@ -404,9 +404,6 @@ enum rip_event {
/* Macro for timer turn on. */ /* Macro for timer turn on. */
#define RIP_TIMER_ON(T,F,V) thread_add_timer (master, (F), rinfo, (V), &(T)) #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_IN 0
#define RIP_OFFSET_LIST_OUT 1 #define RIP_OFFSET_LIST_OUT 1
#define RIP_OFFSET_LIST_MAX 2 #define RIP_OFFSET_LIST_MAX 2

View File

@ -316,7 +316,7 @@ void ripng_interface_clean(struct ripng *ripng)
ri->enable_interface = 0; ri->enable_interface = 0;
ri->running = 0; ri->running = 0;
thread_cancel(&ri->t_wakeup); THREAD_OFF(ri->t_wakeup);
} }
} }

View File

@ -66,8 +66,8 @@ static void clear_ripng_route(struct ripng *ripng)
} }
if (rinfo) { if (rinfo) {
RIPNG_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
RIPNG_TIMER_OFF(rinfo->t_garbage_collect); THREAD_OFF(rinfo->t_garbage_collect);
listnode_delete(list, rinfo); listnode_delete(list, rinfo);
ripng_info_free(rinfo); ripng_info_free(rinfo);
} }

View File

@ -43,7 +43,7 @@ static struct ripng_peer *ripng_peer_new(void)
static void ripng_peer_free(struct ripng_peer *peer) 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); 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); peer = ripng_peer_lookup(ripng, addr);
if (peer) { if (peer) {
thread_cancel(&peer->t_timeout); THREAD_OFF(peer->t_timeout);
} else { } else {
peer = ripng_peer_new(); peer = ripng_peer_new();
peer->ripng = ripng; peer->ripng = ripng;

View File

@ -431,7 +431,7 @@ static void ripng_garbage_collect(struct thread *t)
rinfo = THREAD_ARG(t); rinfo = THREAD_ARG(t);
/* Off timeout timer. */ /* Off timeout timer. */
RIPNG_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
/* Get route_node pointer. */ /* Get route_node pointer. */
rp = rinfo->rp; 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. */ /* Re-use the first entry, and delete the others. */
for (ALL_LIST_ELEMENTS(list, node, nextnode, tmp_rinfo)) for (ALL_LIST_ELEMENTS(list, node, nextnode, tmp_rinfo))
if (tmp_rinfo != rinfo) { if (tmp_rinfo != rinfo) {
RIPNG_TIMER_OFF(tmp_rinfo->t_timeout); THREAD_OFF(tmp_rinfo->t_timeout);
RIPNG_TIMER_OFF(tmp_rinfo->t_garbage_collect); THREAD_OFF(tmp_rinfo->t_garbage_collect);
list_delete_node(list, node); list_delete_node(list, node);
ripng_info_free(tmp_rinfo); ripng_info_free(tmp_rinfo);
} }
RIPNG_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
RIPNG_TIMER_OFF(rinfo->t_garbage_collect); THREAD_OFF(rinfo->t_garbage_collect);
memcpy(rinfo, rinfo_new, sizeof(struct ripng_info)); memcpy(rinfo, rinfo_new, sizeof(struct ripng_info));
if (ripng_route_rte(rinfo)) { 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 agg_node *rp = rinfo->rp;
struct list *list = (struct list *)rp->info; struct list *list = (struct list *)rp->info;
RIPNG_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
if (rinfo->metric != RIPNG_METRIC_INFINITY) if (rinfo->metric != RIPNG_METRIC_INFINITY)
ripng_aggregate_decrement(rp, rinfo); ripng_aggregate_decrement(rp, rinfo);
@ -565,7 +565,7 @@ struct ripng_info *ripng_ecmp_delete(struct ripng *ripng,
if (listcount(list) > 1) { if (listcount(list) > 1) {
/* Some other ECMP entries still exist. Just delete this entry. /* 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); listnode_delete(list, rinfo);
if (ripng_route_rte(rinfo) if (ripng_route_rte(rinfo)
&& CHECK_FLAG(rinfo->flags, RIPNG_RTF_FIB)) && 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) static void ripng_timeout_update(struct ripng *ripng, struct ripng_info *rinfo)
{ {
if (rinfo->metric != RIPNG_METRIC_INFINITY) { if (rinfo->metric != RIPNG_METRIC_INFINITY) {
RIPNG_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
thread_add_timer(master, ripng_timeout, rinfo, thread_add_timer(master, ripng_timeout, rinfo,
ripng->timeout_time, &rinfo->t_timeout); 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_TIMER_ON(rinfo->t_garbage_collect,
ripng_garbage_collect, ripng_garbage_collect,
ripng->garbage_time); ripng->garbage_time);
RIPNG_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
/* Aggregate count decrement. */ /* Aggregate count decrement. */
ripng_aggregate_decrement(rp, rinfo); 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_TIMER_ON(rinfo->t_garbage_collect,
ripng_garbage_collect, ripng_garbage_collect,
ripng->garbage_time); ripng->garbage_time);
RIPNG_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
/* Aggregate count decrement. */ /* Aggregate count decrement. */
ripng_aggregate_decrement(rp, rinfo); 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 /* Triggered updates may be suppressed if a regular update is due by
the time the triggered update would be sent. */ the time the triggered update would be sent. */
thread_cancel(&ripng->t_triggered_interval); THREAD_OFF(ripng->t_triggered_interval);
ripng->trigger = 0; ripng->trigger = 0;
/* Reset flush event. */ /* Reset flush event. */
@ -1472,7 +1472,7 @@ void ripng_triggered_update(struct thread *t)
int interval; int interval;
/* Cancel interval timer. */ /* Cancel interval timer. */
thread_cancel(&ripng->t_triggered_interval); THREAD_OFF(ripng->t_triggered_interval);
ripng->trigger = 0; ripng->trigger = 0;
/* Logging triggered update. */ /* Logging triggered update. */
@ -1917,7 +1917,7 @@ void ripng_event(struct ripng *ripng, enum ripng_event event, int sock)
&ripng->t_read); &ripng->t_read);
break; break;
case RIPNG_UPDATE_EVENT: case RIPNG_UPDATE_EVENT:
thread_cancel(&ripng->t_update); THREAD_OFF(ripng->t_update);
/* Update timer jitter. */ /* Update timer jitter. */
jitter = ripng_update_jitter(ripng->update_time); 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. */ /* Drop all other entries, except the first one. */
for (ALL_LIST_ELEMENTS(list, node, nextnode, tmp_rinfo)) for (ALL_LIST_ELEMENTS(list, node, nextnode, tmp_rinfo))
if (tmp_rinfo != rinfo) { if (tmp_rinfo != rinfo) {
RIPNG_TIMER_OFF(tmp_rinfo->t_timeout); THREAD_OFF(tmp_rinfo->t_timeout);
RIPNG_TIMER_OFF( THREAD_OFF(
tmp_rinfo->t_garbage_collect); tmp_rinfo->t_garbage_collect);
list_delete_node(list, node); list_delete_node(list, node);
ripng_info_free(tmp_rinfo); ripng_info_free(tmp_rinfo);
@ -2528,8 +2528,8 @@ static void ripng_instance_disable(struct ripng *ripng)
ripng_zebra_ipv6_delete(ripng, rp); ripng_zebra_ipv6_delete(ripng, rp);
for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) { for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) {
RIPNG_TIMER_OFF(rinfo->t_timeout); THREAD_OFF(rinfo->t_timeout);
RIPNG_TIMER_OFF(rinfo->t_garbage_collect); THREAD_OFF(rinfo->t_garbage_collect);
ripng_info_free(rinfo); ripng_info_free(rinfo);
} }
list_delete(&list); list_delete(&list);
@ -2548,12 +2548,12 @@ static void ripng_instance_disable(struct ripng *ripng)
ripng_redistribute_disable(ripng); ripng_redistribute_disable(ripng);
/* Cancel the RIPng timers */ /* Cancel the RIPng timers */
RIPNG_TIMER_OFF(ripng->t_update); THREAD_OFF(ripng->t_update);
RIPNG_TIMER_OFF(ripng->t_triggered_update); THREAD_OFF(ripng->t_triggered_update);
RIPNG_TIMER_OFF(ripng->t_triggered_interval); THREAD_OFF(ripng->t_triggered_interval);
/* Cancel the read thread */ /* Cancel the read thread */
thread_cancel(&ripng->t_read); THREAD_OFF(ripng->t_read);
/* Close the RIPng socket */ /* Close the RIPng socket */
if (ripng->sock >= 0) { if (ripng->sock >= 0) {

View File

@ -312,8 +312,6 @@ enum ripng_event {
/* RIPng timer on/off macro. */ /* RIPng timer on/off macro. */
#define RIPNG_TIMER_ON(T,F,V) thread_add_timer (master, (F), rinfo, (V), &(T)) #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_IN 0
#define RIPNG_OFFSET_LIST_OUT 1 #define RIPNG_OFFSET_LIST_OUT 1
#define RIPNG_OFFSET_LIST_MAX 2 #define RIPNG_OFFSET_LIST_MAX 2

View File

@ -985,7 +985,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src,
*/ */
static void vrrp_read(struct thread *thread) static void vrrp_read(struct thread *thread)
{ {
struct vrrp_router *r = thread->arg; struct vrrp_router *r = THREAD_ARG(thread);
struct vrrp_pkt *pkt; struct vrrp_pkt *pkt;
ssize_t pktsize; 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) 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, DEBUGD(&vrrp_dbg_proto,
VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM 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) 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 zlog_info(VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
"Master_Down_Timer expired", "Master_Down_Timer expired",

View File

@ -260,7 +260,7 @@ void irdp_advert_off(struct interface *ifp)
if (!irdp) if (!irdp)
return; return;
thread_cancel(&irdp->t_advertise); THREAD_OFF(irdp->t_advertise);
if (ifp->connected) if (ifp->connected)
for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, ifc)) { for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, ifc)) {
@ -295,7 +295,7 @@ void process_solicit(struct interface *ifp)
return; return;
irdp->flags |= IF_SOLICIT; irdp->flags |= IF_SOLICIT;
thread_cancel(&irdp->t_advertise); THREAD_OFF(irdp->t_advertise);
timer = (frr_weak_random() % MAX_RESPONSE_DELAY) + 1; timer = (frr_weak_random() % MAX_RESPONSE_DELAY) + 1;

View File

@ -1902,7 +1902,7 @@ static void kernel_nlsock_fini(struct nlsock *nls)
void kernel_terminate(struct zebra_ns *zns, bool complete) void kernel_terminate(struct zebra_ns *zns, bool complete)
{ {
thread_cancel(&zns->t_netlink); THREAD_OFF(zns->t_netlink);
kernel_nlsock_fini(&zns->netlink); kernel_nlsock_fini(&zns->netlink);

View File

@ -6043,8 +6043,8 @@ static void dplane_check_shutdown_status(struct thread *event)
zns_info_list_del(&zdplane_info.dg_zns_list, zi); zns_info_list_del(&zdplane_info.dg_zns_list, zi);
if (zdplane_info.dg_master) { if (zdplane_info.dg_master) {
thread_cancel(&zi->t_read); THREAD_OFF(zi->t_read);
thread_cancel(&zi->t_request); THREAD_OFF(zi->t_request);
} }
XFREE(MTYPE_DP_NS, zi); XFREE(MTYPE_DP_NS, zi);

View File

@ -496,7 +496,7 @@ static inline void zfpm_write_on(void)
*/ */
static inline void zfpm_read_off(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) 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) 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. * 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_rnodes_iter_init(&zfpm_g->t_conn_up_state.iter);
zfpm_g->fpm_mac_dump_done = false; zfpm_g->fpm_mac_dump_done = false;
@ -1687,7 +1687,7 @@ static void zfpm_stop_stats_timer(void)
return; return;
zfpm_debug("Stopping existing stats timer"); zfpm_debug("Stopping existing stats timer");
thread_cancel(&zfpm_g->t_stats); THREAD_OFF(zfpm_g->t_stats);
} }
/* /*

View File

@ -413,7 +413,7 @@ void zebra_ns_notify_close(void)
fd = zebra_netns_notify_current->u.fd; fd = zebra_netns_notify_current->u.fd;
if (zebra_netns_notify_current->master != NULL) if (zebra_netns_notify_current->master != NULL)
thread_cancel(&zebra_netns_notify_current); THREAD_OFF(zebra_netns_notify_current);
/* auto-removal of notify items */ /* auto-removal of notify items */
if (fd > 0) if (fd > 0)

View File

@ -157,9 +157,9 @@ void zebra_ptm_finish(void)
free(ptm_cb.in_data); free(ptm_cb.in_data);
/* Cancel events. */ /* Cancel events. */
thread_cancel(&ptm_cb.t_read); THREAD_OFF(ptm_cb.t_read);
thread_cancel(&ptm_cb.t_write); THREAD_OFF(ptm_cb.t_write);
thread_cancel(&ptm_cb.t_timer); THREAD_OFF(ptm_cb.t_timer);
if (ptm_cb.wb) if (ptm_cb.wb)
buffer_free(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); ptm_cb.reconnect_time, &ptm_cb.t_timer);
return -1; return -1;
case BUFFER_EMPTY: case BUFFER_EMPTY:
thread_cancel(&ptm_cb.t_write); THREAD_OFF(ptm_cb.t_write);
break; break;
case BUFFER_PENDING: case BUFFER_PENDING:
thread_add_write(zrouter.master, zebra_ptm_flush_messages, NULL, thread_add_write(zrouter.master, zebra_ptm_flush_messages, NULL,

View File

@ -102,7 +102,7 @@ void zebra_pw_del(struct zebra_vrf *zvrf, struct zebra_pw *pw)
hook_call(pw_uninstall, pw); hook_call(pw_uninstall, pw);
dplane_pw_uninstall(pw); dplane_pw_uninstall(pw);
} else if (pw->install_retry_timer) } else if (pw->install_retry_timer)
thread_cancel(&pw->install_retry_timer); THREAD_OFF(pw->install_retry_timer);
/* unlink and release memory */ /* unlink and release memory */
RB_REMOVE(zebra_pw_head, &zvrf->pseudowires, pw); 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); pw->vrf_id, pw->ifname, PW_INSTALL_RETRY_INTERVAL);
/* schedule to retry later */ /* 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, thread_add_timer(zrouter.master, zebra_pw_install_retry, pw,
PW_INSTALL_RETRY_INTERVAL, &pw->install_retry_timer); PW_INSTALL_RETRY_INTERVAL, &pw->install_retry_timer);