zlog_debug("GR: exiting graceful restart: %s", reason);
ospf->gr_info.restart_in_progress = false;
- OSPF_TIMER_OFF(ospf->gr_info.t_grace_period);
+ THREAD_OFF(ospf->gr_info.t_grace_period);
/* Record in non-volatile memory that the restart is complete. */
ospf_gr_nvm_delete(ospf);
/* oi->nbrs and oi->nbr_nbma should be deleted on InterfaceDown event */
/* delete all static neighbors attached to this interface */
for (ALL_LIST_ELEMENTS(oi->nbr_nbma, node, nnode, nbr_nbma)) {
- OSPF_POLL_TIMER_OFF(nbr_nbma->t_poll);
+ THREAD_OFF(nbr_nbma->t_poll);
if (nbr_nbma->nbr) {
nbr_nbma->nbr->nbr_nbma = NULL;
if (oi->on_write_q) {
listnode_delete(ospf->oi_write_q, oi);
if (list_isempty(ospf->oi_write_q))
- OSPF_TIMER_OFF(ospf->t_write);
+ THREAD_OFF(ospf->t_write);
oi->on_write_q = 0;
}
}
ospf_hello_send(oi);
/* Restart hello timer for this interface */
- OSPF_ISM_TIMER_OFF(oi->t_hello);
+ THREAD_OFF(oi->t_hello);
OSPF_HELLO_TIMER_ON(oi);
}
ospf_hello_send(oi);
/* Restart the hello timer. */
- OSPF_ISM_TIMER_OFF(oi->t_hello);
+ THREAD_OFF(oi->t_hello);
OSPF_HELLO_TIMER_ON(oi);
}
}
interface parameters must be set to initial values, and
timers are
reset also. */
- OSPF_ISM_TIMER_OFF(oi->t_hello);
- OSPF_ISM_TIMER_OFF(oi->t_wait);
- OSPF_ISM_TIMER_OFF(oi->t_ls_ack);
+ THREAD_OFF(oi->t_hello);
+ THREAD_OFF(oi->t_wait);
+ THREAD_OFF(oi->t_ls_ack);
break;
case ISM_Loopback:
/* In this state, the interface may be looped back and will be
unavailable for regular data traffic. */
- OSPF_ISM_TIMER_OFF(oi->t_hello);
- OSPF_ISM_TIMER_OFF(oi->t_wait);
- OSPF_ISM_TIMER_OFF(oi->t_ls_ack);
+ THREAD_OFF(oi->t_hello);
+ THREAD_OFF(oi->t_wait);
+ THREAD_OFF(oi->t_ls_ack);
break;
case ISM_Waiting:
/* The router is trying to determine the identity of DRouter and
OSPF_ISM_TIMER_MSEC_ON(oi->t_hello, ospf_hello_timer, 1);
OSPF_ISM_TIMER_ON(oi->t_wait, ospf_wait_timer,
OSPF_IF_PARAM(oi, v_wait));
- OSPF_ISM_TIMER_OFF(oi->t_ls_ack);
+ THREAD_OFF(oi->t_ls_ack);
break;
case ISM_PointToPoint:
/* The interface connects to a physical Point-to-point network
neighboring router. Hello packets are also sent. */
/* send first hello immediately */
OSPF_ISM_TIMER_MSEC_ON(oi->t_hello, ospf_hello_timer, 1);
- OSPF_ISM_TIMER_OFF(oi->t_wait);
+ THREAD_OFF(oi->t_wait);
OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer,
oi->v_ls_ack);
break;
and the router itself is neither Designated Router nor
Backup Designated Router. */
OSPF_HELLO_TIMER_ON(oi);
- OSPF_ISM_TIMER_OFF(oi->t_wait);
+ THREAD_OFF(oi->t_wait);
OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer,
oi->v_ls_ack);
break;
network,
and the router is Backup Designated Router. */
OSPF_HELLO_TIMER_ON(oi);
- OSPF_ISM_TIMER_OFF(oi->t_wait);
+ THREAD_OFF(oi->t_wait);
OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer,
oi->v_ls_ack);
break;
network,
and the router is Designated Router. */
OSPF_HELLO_TIMER_ON(oi);
- OSPF_ISM_TIMER_OFF(oi->t_wait);
+ THREAD_OFF(oi->t_wait);
OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer,
oi->v_ls_ack);
break;
OSPF_IF_PARAM((O), v_hello)); \
} while (0)
-/* Macro for OSPF ISM timer turn off. */
-#define OSPF_ISM_TIMER_OFF(X) thread_cancel(&(X))
-
/* Macro for OSPF schedule event. */
#define OSPF_ISM_EVENT_SCHEDULE(I, E) \
thread_add_event(master, ospf_ism_event, (I), (E), NULL)
* without conflicting to other threads.
*/
if (ospf->t_maxage != NULL) {
- OSPF_TIMER_OFF(ospf->t_maxage);
+ THREAD_OFF(ospf->t_maxage);
thread_execute(master, ospf_maxage_lsa_remover, ospf, 0);
}
}
/* Cancel all timers. */
- OSPF_NSM_TIMER_OFF(nbr->t_inactivity);
- OSPF_NSM_TIMER_OFF(nbr->t_db_desc);
- OSPF_NSM_TIMER_OFF(nbr->t_ls_req);
- OSPF_NSM_TIMER_OFF(nbr->t_ls_upd);
+ THREAD_OFF(nbr->t_inactivity);
+ THREAD_OFF(nbr->t_db_desc);
+ THREAD_OFF(nbr->t_ls_req);
+ THREAD_OFF(nbr->t_ls_upd);
/* Cancel all events. */ /* Thread lookup cost would be negligible. */
thread_cancel_event(master, nbr);
bfd_sess_free(&nbr->bfd_session);
- OSPF_NSM_TIMER_OFF(nbr->gr_helper_info.t_grace_timer);
+ THREAD_OFF(nbr->gr_helper_info.t_grace_timer);
nbr->oi = NULL;
XFREE(MTYPE_OSPF_NEIGHBOR, nbr);
nbr->nbr_nbma = nbr_nbma;
if (nbr_nbma->t_poll)
- OSPF_POLL_TIMER_OFF(nbr_nbma->t_poll);
+ THREAD_OFF(nbr_nbma->t_poll);
nbr->state_change = nbr_nbma->state_change + 1;
}
switch (nbr->state) {
case NSM_Deleted:
case NSM_Down:
- OSPF_NSM_TIMER_OFF(nbr->t_inactivity);
- OSPF_NSM_TIMER_OFF(nbr->t_hello_reply);
+ THREAD_OFF(nbr->t_inactivity);
+ THREAD_OFF(nbr->t_hello_reply);
/* fallthru */
case NSM_Attempt:
case NSM_Init:
case NSM_TwoWay:
- OSPF_NSM_TIMER_OFF(nbr->t_db_desc);
- OSPF_NSM_TIMER_OFF(nbr->t_ls_upd);
- OSPF_NSM_TIMER_OFF(nbr->t_ls_req);
+ THREAD_OFF(nbr->t_db_desc);
+ THREAD_OFF(nbr->t_ls_upd);
+ THREAD_OFF(nbr->t_ls_req);
break;
case NSM_ExStart:
OSPF_NSM_TIMER_ON(nbr->t_db_desc, ospf_db_desc_timer,
nbr->v_db_desc);
- OSPF_NSM_TIMER_OFF(nbr->t_ls_upd);
- OSPF_NSM_TIMER_OFF(nbr->t_ls_req);
+ THREAD_OFF(nbr->t_ls_upd);
+ THREAD_OFF(nbr->t_ls_req);
break;
case NSM_Exchange:
OSPF_NSM_TIMER_ON(nbr->t_ls_upd, ospf_ls_upd_timer,
nbr->v_ls_upd);
if (!IS_SET_DD_MS(nbr->dd_flags))
- OSPF_NSM_TIMER_OFF(nbr->t_db_desc);
+ THREAD_OFF(nbr->t_db_desc);
break;
case NSM_Loading:
case NSM_Full:
default:
- OSPF_NSM_TIMER_OFF(nbr->t_db_desc);
+ THREAD_OFF(nbr->t_db_desc);
break;
}
}
static int nsm_hello_received(struct ospf_neighbor *nbr)
{
/* Start or Restart Inactivity Timer. */
- OSPF_NSM_TIMER_OFF(nbr->t_inactivity);
+ THREAD_OFF(nbr->t_inactivity);
OSPF_NSM_TIMER_ON(nbr->t_inactivity, ospf_inactivity_timer,
nbr->v_inactivity);
if (nbr->oi->type == OSPF_IFTYPE_NBMA && nbr->nbr_nbma)
- OSPF_POLL_TIMER_OFF(nbr->nbr_nbma->t_poll);
+ THREAD_OFF(nbr->nbr_nbma->t_poll);
/* Send proactive ARP requests */
if (nbr->state < NSM_Exchange)
static int nsm_start(struct ospf_neighbor *nbr)
{
if (nbr->nbr_nbma)
- OSPF_POLL_TIMER_OFF(nbr->nbr_nbma->t_poll);
+ THREAD_OFF(nbr->nbr_nbma->t_poll);
- OSPF_NSM_TIMER_OFF(nbr->t_inactivity);
+ THREAD_OFF(nbr->t_inactivity);
OSPF_NSM_TIMER_ON(nbr->t_inactivity, ospf_inactivity_timer,
nbr->v_inactivity);
/* Macro for OSPF NSM timer turn on. */
#define OSPF_NSM_TIMER_ON(T,F,V) thread_add_timer (master, (F), nbr, (V), &(T))
-/* Macro for OSPF NSM timer turn off. */
-#define OSPF_NSM_TIMER_OFF(X) thread_cancel(&(X))
-
/* Macro for OSPF NSM schedule event. */
#define OSPF_NSM_EVENT_SCHEDULE(N, E) \
thread_add_event(master, ospf_nsm_event, (N), (E), NULL)
void ospf_opaque_type9_lsa_term(struct ospf_interface *oi)
{
- OSPF_TIMER_OFF(oi->t_opaque_lsa_self);
+ THREAD_OFF(oi->t_opaque_lsa_self);
if (oi->opaque_lsa_self != NULL)
list_delete(&oi->opaque_lsa_self);
oi->opaque_lsa_self = NULL;
area->lsdb->new_lsa_hook = area->lsdb->del_lsa_hook = NULL;
#endif /* MONITOR_LSDB_CHANGE */
- OSPF_TIMER_OFF(area->t_opaque_lsa_self);
+ THREAD_OFF(area->t_opaque_lsa_self);
if (area->opaque_lsa_self != NULL)
list_delete(&area->opaque_lsa_self);
return;
top->lsdb->new_lsa_hook = top->lsdb->del_lsa_hook = NULL;
#endif /* MONITOR_LSDB_CHANGE */
- OSPF_TIMER_OFF(top->t_opaque_lsa_self);
+ THREAD_OFF(top->t_opaque_lsa_self);
if (top->opaque_lsa_self != NULL)
list_delete(&top->opaque_lsa_self);
return;
ospf_opaque_lsa_flush_schedule(lsa);
}
- OSPF_TIMER_OFF(oipt->t_opaque_lsa_self);
+ THREAD_OFF(oipt->t_opaque_lsa_self);
list_delete(&oipt->id_list);
if (cleanup_owner) {
/* Remove from its owner's self-originated LSA list. */
{
struct opaque_info_per_id *oipi = (struct opaque_info_per_id *)val;
- OSPF_TIMER_OFF(oipi->t_opaque_lsa_self);
+ THREAD_OFF(oipi->t_opaque_lsa_self);
if (oipi->lsa != NULL)
ospf_lsa_unlock(&oipi->lsa);
XFREE(MTYPE_OPAQUE_INFO_PER_ID, oipi);
* is actually turned off.
*/
if (list_isempty(oi->ospf->oi_write_q))
- OSPF_TIMER_OFF(oi->ospf->t_write);
+ THREAD_OFF(oi->ospf->t_write);
} else {
/* Hook thread to write packet. */
OSPF_ISM_WRITE_ON(oi->ospf);
for (ALL_LIST_ELEMENTS_RO(ospf->areas, ln, area)) {
SET_FLAG(area->stub_router_state,
OSPF_AREA_WAS_START_STUB_ROUTED);
- OSPF_TIMER_OFF(area->t_stub_router);
+ THREAD_OFF(area->t_stub_router);
/* Don't trample on admin stub routed */
if (!CHECK_FLAG(area->stub_router_state,
static void ospf_deferred_shutdown_finish(struct ospf *ospf)
{
ospf->stub_router_shutdown_time = OSPF_STUB_ROUTER_UNCONFIGURED;
- OSPF_TIMER_OFF(ospf->t_deferred_shutdown);
+ THREAD_OFF(ospf->t_deferred_shutdown);
ospf_finish_final(ospf);
/* Clear static neighbors */
for (rn = route_top(ospf->nbr_nbma); rn; rn = route_next(rn))
if ((nbr_nbma = rn->info)) {
- OSPF_POLL_TIMER_OFF(nbr_nbma->t_poll);
+ THREAD_OFF(nbr_nbma->t_poll);
if (nbr_nbma->nbr) {
nbr_nbma->nbr->nbr_nbma = NULL;
}
/* Cancel all timers. */
- OSPF_TIMER_OFF(ospf->t_read);
- OSPF_TIMER_OFF(ospf->t_write);
- OSPF_TIMER_OFF(ospf->t_spf_calc);
- OSPF_TIMER_OFF(ospf->t_ase_calc);
- OSPF_TIMER_OFF(ospf->t_maxage);
- OSPF_TIMER_OFF(ospf->t_maxage_walker);
- OSPF_TIMER_OFF(ospf->t_abr_task);
- OSPF_TIMER_OFF(ospf->t_asbr_check);
- OSPF_TIMER_OFF(ospf->t_asbr_nssa_redist_update);
- OSPF_TIMER_OFF(ospf->t_distribute_update);
- OSPF_TIMER_OFF(ospf->t_lsa_refresher);
- OSPF_TIMER_OFF(ospf->t_opaque_lsa_self);
- OSPF_TIMER_OFF(ospf->t_sr_update);
- OSPF_TIMER_OFF(ospf->t_default_routemap_timer);
- OSPF_TIMER_OFF(ospf->t_external_aggr);
- OSPF_TIMER_OFF(ospf->gr_info.t_grace_period);
+ THREAD_OFF(ospf->t_read);
+ THREAD_OFF(ospf->t_write);
+ THREAD_OFF(ospf->t_spf_calc);
+ THREAD_OFF(ospf->t_ase_calc);
+ THREAD_OFF(ospf->t_maxage);
+ THREAD_OFF(ospf->t_maxage_walker);
+ THREAD_OFF(ospf->t_abr_task);
+ THREAD_OFF(ospf->t_asbr_check);
+ THREAD_OFF(ospf->t_asbr_nssa_redist_update);
+ THREAD_OFF(ospf->t_distribute_update);
+ THREAD_OFF(ospf->t_lsa_refresher);
+ THREAD_OFF(ospf->t_opaque_lsa_self);
+ THREAD_OFF(ospf->t_sr_update);
+ THREAD_OFF(ospf->t_default_routemap_timer);
+ THREAD_OFF(ospf->t_external_aggr);
+ THREAD_OFF(ospf->gr_info.t_grace_period);
LSDB_LOOP (OPAQUE_AS_LSDB(ospf), rn, lsa)
ospf_discard_from_db(ospf, ospf->lsdb, lsa);
free(IMPORT_NAME(area));
/* Cancel timer. */
- OSPF_TIMER_OFF(area->t_stub_router);
- OSPF_TIMER_OFF(area->t_opaque_lsa_self);
+ THREAD_OFF(area->t_stub_router);
+ THREAD_OFF(area->t_opaque_lsa_self);
if (OSPF_IS_AREA_BACKBONE(area))
area->ospf->backbone = NULL;
- (monotime(NULL) - ospf->lsa_refresher_started);
if (time_left > interval) {
- OSPF_TIMER_OFF(ospf->t_lsa_refresher);
+ THREAD_OFF(ospf->t_lsa_refresher);
thread_add_timer(master, ospf_lsa_refresh_walker, ospf,
interval, &ospf->t_lsa_refresher);
}
- (monotime(NULL) - ospf->lsa_refresher_started);
if (time_left > OSPF_LSA_REFRESH_INTERVAL_DEFAULT) {
- OSPF_TIMER_OFF(ospf->t_lsa_refresher);
+ THREAD_OFF(ospf->t_lsa_refresher);
ospf->t_lsa_refresher = NULL;
thread_add_timer(master, ospf_lsa_refresh_walker, ospf,
OSPF_LSA_REFRESH_INTERVAL_DEFAULT,
static void ospf_nbr_nbma_down(struct ospf_nbr_nbma *nbr_nbma)
{
- OSPF_TIMER_OFF(nbr_nbma->t_poll);
+ THREAD_OFF(nbr_nbma->t_poll);
if (nbr_nbma->nbr) {
nbr_nbma->nbr->nbr_nbma = NULL;
if (nbr_nbma->v_poll != interval) {
nbr_nbma->v_poll = interval;
if (nbr_nbma->oi && ospf_if_is_up(nbr_nbma->oi)) {
- OSPF_TIMER_OFF(nbr_nbma->t_poll);
+ THREAD_OFF(nbr_nbma->t_poll);
OSPF_POLL_TIMER_ON(nbr_nbma->t_poll, ospf_poll_timer,
nbr_nbma->v_poll);
}
#define OSPF_TIMER_ON(T,F,V) thread_add_timer (master,(F),ospf,(V),&(T))
#define OSPF_AREA_TIMER_ON(T,F,V) thread_add_timer (master, (F), area, (V), &(T))
#define OSPF_POLL_TIMER_ON(T,F,V) thread_add_timer (master, (F), nbr_nbma, (V), &(T))
-#define OSPF_POLL_TIMER_OFF(X) OSPF_TIMER_OFF((X))
-#define OSPF_TIMER_OFF(X) thread_cancel(&(X))
/* Extern variables. */
extern struct ospf_master *om;