summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
authorhasso <hasso>2004-02-11 21:26:31 +0100
committerhasso <hasso>2004-02-11 21:26:31 +0100
commitd70f99e15b7849f59b970bd62392ed42bda25ab6 (patch)
treeed59bcf87fa39e18ef82e21ae59fa9e842622a67 /isisd
parentYet another "set thread pointer to NULL during thread run" fix. (diff)
downloadfrr-d70f99e15b7849f59b970bd62392ed42bda25ab6.tar.xz
frr-d70f99e15b7849f59b970bd62392ed42bda25ab6.zip
Threads usage cleanup. Still at least one bug to go.
Diffstat (limited to 'isisd')
-rw-r--r--isisd/ChangeLog4
-rw-r--r--isisd/isis_circuit.c42
-rw-r--r--isisd/isis_dr.c89
-rw-r--r--isisd/isis_events.c59
-rw-r--r--isisd/isis_lsp.c58
-rw-r--r--isisd/isis_pdu.c63
-rw-r--r--isisd/isis_spf.c18
-rw-r--r--isisd/isisd.c11
8 files changed, 124 insertions, 220 deletions
diff --git a/isisd/ChangeLog b/isisd/ChangeLog
index 8a00cccbe..60d5933fd 100644
--- a/isisd/ChangeLog
+++ b/isisd/ChangeLog
@@ -1,3 +1,7 @@
+2004-02-11 Hasso Tepper <hasso@estpak.ee>
+ * many *.c files: Replace thread_add_xxx() and thread_cancel() with
+ THREAD_XXX_ON and THREAD_XXX_OFF macros.
+
2004-01-27 Hasso Tepper <hasso@estpak.ee>
* isis_circuit.c: Commented out "(no) ip address" commands so it doesn't
confuse vtysh.
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index fce599799..1865e33e2 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -414,12 +414,12 @@ isis_circuit_up (struct isis_circuit *circuit)
/* 8.4.1 d) */
/* dr election will commence in... */
if (circuit->circuit_is_type & IS_LEVEL_1)
- circuit->u.bc.t_run_dr[0] =
- thread_add_timer (master, isis_run_dr_l1, circuit,
+ THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
+ circuit,
2 * circuit->hello_multiplier[0] * circuit->hello_interval[0]);
if (circuit->circuit_is_type & IS_LEVEL_2)
- circuit->u.bc.t_run_dr[1] =
- thread_add_timer (master, isis_run_dr_l2, circuit,
+ THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
+ circuit,
2 * circuit->hello_multiplier[1] * circuit->hello_interval[1]);
} else {
/* initializing the hello send threads
@@ -431,22 +431,13 @@ isis_circuit_up (struct isis_circuit *circuit)
/* initializing PSNP timers */
if (circuit->circuit_is_type & IS_LEVEL_1) {
- circuit->t_send_psnp[0] = thread_add_timer (master,
- send_l1_psnp,
- circuit,
- isis_jitter
- (circuit->psnp_interval[0],
- PSNP_JITTER));
+ THREAD_TIMER_ON(master, circuit->t_send_psnp[0], send_l1_psnp, circuit,
+ isis_jitter(circuit->psnp_interval[0], PSNP_JITTER));
}
if (circuit->circuit_is_type & IS_LEVEL_2) {
- circuit->t_send_psnp[1] = thread_add_timer (master,
- send_l2_psnp,
- circuit,
- isis_jitter
- (circuit->psnp_interval[1],
- PSNP_JITTER));
-
+ THREAD_TIMER_ON(master, circuit->t_send_psnp[1], send_l2_psnp, circuit,
+ isis_jitter(circuit->psnp_interval[1], PSNP_JITTER));
}
/* initialize the circuit streams */
@@ -460,10 +451,10 @@ isis_circuit_up (struct isis_circuit *circuit)
isis_sock_init (circuit);
#ifdef GNU_LINUX
- circuit->t_read = thread_add_read (master, isis_receive, circuit,
+ THREAD_READ_ON(master, circuit->t_read, isis_receive, circuit,
circuit->fd);
#else
- circuit->t_read = thread_add_timer (master, isis_receive, circuit,
+ THREAD_TIMER_ON(master, circuit->t_read, isis_receive, circuit,
circuit->fd);
#endif
return;
@@ -473,16 +464,13 @@ void
isis_circuit_down (struct isis_circuit *circuit)
{
/* Cancel all active threads -- FIXME: wrong place*/
- if (circuit->t_read)
- thread_cancel (circuit->t_read);
+ /* HT: Read thread if GNU_LINUX, TIMER thread otherwise. */
+ THREAD_OFF(circuit->t_read);
if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
- if (circuit->u.bc.t_send_lan_hello[0])
- thread_cancel (circuit->u.bc.t_send_lan_hello[0]);
- if (circuit->u.bc.t_send_lan_hello[1])
- thread_cancel (circuit->u.bc.t_send_lan_hello[1]);
+ THREAD_TIMER_OFF(circuit->u.bc.t_send_lan_hello[0]);
+ THREAD_TIMER_OFF(circuit->u.bc.t_send_lan_hello[1]);
} else if (circuit->circ_type == CIRCUIT_T_P2P) {
- if (circuit->u.p2p.t_send_p2p_hello)
- thread_cancel (circuit->u.p2p.t_send_p2p_hello);
+ THREAD_TIMER_OFF(circuit->u.p2p.t_send_p2p_hello);
}
/* close the socket */
close (circuit->fd);
diff --git a/isisd/isis_dr.c b/isisd/isis_dr.c
index f2fcb39d8..8b6c8ff00 100644
--- a/isisd/isis_dr.c
+++ b/isisd/isis_dr.c
@@ -242,14 +242,8 @@ isis_dr_resign (struct isis_circuit *circuit, int level)
circuit->u.bc.is_dr[level - 1] = 0;
circuit->u.bc.run_dr_elect[level - 1] = 0;
- if (circuit->u.bc.t_run_dr[level - 1]) {
- thread_cancel (circuit->u.bc.t_run_dr[level - 1]);
- circuit->u.bc.t_run_dr[level - 1] = NULL;
- }
- if (circuit->u.bc.t_refresh_pseudo_lsp[level - 1]) {
- thread_cancel (circuit->u.bc.t_refresh_pseudo_lsp[level - 1]);
- circuit->u.bc.t_refresh_pseudo_lsp[level - 1] = NULL;
- }
+ THREAD_TIMER_OFF(circuit->u.bc.t_run_dr[level - 1]);
+ THREAD_TIMER_OFF(circuit->u.bc.t_refresh_pseudo_lsp[level - 1]);
memcpy (id, isis->sysid, ISIS_SYS_ID_LEN);
LSP_PSEUDO_ID(id) = circuit->circuit_id;
@@ -259,34 +253,23 @@ isis_dr_resign (struct isis_circuit *circuit, int level)
if (level == 1) {
memset (circuit->u.bc.l1_desig_is, 0, ISIS_SYS_ID_LEN + 1);
- if (circuit->t_send_csnp[0])
- thread_cancel (circuit->t_send_csnp[0]);
+ THREAD_TIMER_OFF(circuit->t_send_csnp[0]);
+
+ THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
+ circuit, 2 * circuit->hello_interval[1]);
- circuit->u.bc.t_run_dr[0] =
- thread_add_timer (master, isis_run_dr_l1, circuit,
- 2 * circuit->hello_interval[1]);
-
- circuit->t_send_psnp[0] =
- thread_add_timer (master,
- send_l1_psnp,
- circuit,
- isis_jitter (circuit->psnp_interval[level - 1],
- PSNP_JITTER));
+ THREAD_TIMER_ON(master, circuit->t_send_psnp[0], send_l1_psnp, circuit,
+ isis_jitter (circuit->psnp_interval[level - 1], PSNP_JITTER));
} else {
memset (circuit->u.bc.l2_desig_is, 0, ISIS_SYS_ID_LEN + 1);
- if (circuit->t_send_csnp[1])
- thread_cancel (circuit->t_send_csnp[1]);
-
- circuit->u.bc.t_run_dr[1] =
- thread_add_timer (master, isis_run_dr_l2, circuit,
- 2 * circuit->hello_interval[1]);
- circuit->t_send_psnp[1] =
- thread_add_timer (master,
- send_l2_psnp,
- circuit,
- isis_jitter (circuit->psnp_interval[level - 1],
- PSNP_JITTER));
+ THREAD_TIMER_OFF(circuit->t_send_csnp[1]);
+
+ THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
+ circuit, 2 * circuit->hello_interval[1]);
+
+ THREAD_TIMER_ON(master, circuit->t_send_psnp[1], send_l2_psnp, circuit,
+ isis_jitter (circuit->psnp_interval[level - 1], PSNP_JITTER));
}
thread_add_event (master, isis_event_dis_status_change, circuit, 0);
@@ -304,14 +287,12 @@ isis_dr_commence (struct isis_circuit *circuit, int level)
/* Lets keep a pause in DR election */
circuit->u.bc.run_dr_elect[level - 1] = 0;
if (level == 1)
- circuit->u.bc.t_run_dr[0] =
- thread_add_timer (master, isis_run_dr_l1, circuit,
- 2 * circuit->hello_multiplier[0] *
+ THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
+ circuit, 2 * circuit->hello_multiplier[0] *
circuit->hello_interval[0]);
else
- circuit->u.bc.t_run_dr[1] =
- thread_add_timer (master, isis_run_dr_l2, circuit,
- 2 * circuit->hello_multiplier[1] *
+ THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
+ circuit, 2 * circuit->hello_multiplier[1] *
circuit->hello_interval[1]);
circuit->u.bc.is_dr[level - 1] = 1;
@@ -330,16 +311,13 @@ isis_dr_commence (struct isis_circuit *circuit, int level)
thread_cancel (circuit->t_send_l1_psnp); */
lsp_l1_pseudo_generate (circuit);
- circuit->u.bc.t_run_dr[0] =
- thread_add_timer (master, isis_run_dr_l1, circuit,
- 2 * circuit->hello_interval[0]);
-
- circuit->t_send_csnp[0] = thread_add_timer (master,
- send_l1_csnp,
- circuit,
- isis_jitter
- (circuit->csnp_interval[level-1],
- CSNP_JITTER));
+ THREAD_TIMER_OFF(circuit->u.bc.t_run_dr[0]);
+ THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
+ circuit, 2 * circuit->hello_interval[0]);
+
+ THREAD_TIMER_ON(master, circuit->t_send_csnp[0], send_l1_csnp, circuit,
+ isis_jitter(circuit->csnp_interval[level-1], CSNP_JITTER));
+
} else {
memcpy (old_dr, circuit->u.bc.l2_desig_is, ISIS_SYS_ID_LEN + 1);
LSP_FRAGMENT (old_dr) = 0;
@@ -355,17 +333,12 @@ isis_dr_commence (struct isis_circuit *circuit, int level)
thread_cancel (circuit->t_send_l1_psnp); */
lsp_l2_pseudo_generate (circuit);
- circuit->u.bc.t_run_dr[1] =
- thread_add_timer (master, isis_run_dr_l2, circuit,
- 2 * circuit->hello_interval[1]);
-
- circuit->t_send_csnp[1] =
- thread_add_timer (master,
- send_l2_csnp,
- circuit,
- isis_jitter (circuit->csnp_interval[level-1],
- CSNP_JITTER));
+ THREAD_TIMER_OFF(circuit->u.bc.t_run_dr[1]);
+ THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
+ circuit, 2 * circuit->hello_interval[1]);
+ THREAD_TIMER_ON(master, circuit->t_send_csnp[1], send_l2_csnp, circuit,
+ isis_jitter (circuit->csnp_interval[level-1], CSNP_JITTER));
}
thread_add_event (master, isis_event_dis_status_change, circuit, 0);
diff --git a/isisd/isis_events.c b/isisd/isis_events.c
index aada395dc..29ea8067b 100644
--- a/isisd/isis_events.c
+++ b/isisd/isis_events.c
@@ -148,41 +148,35 @@ circuit_commence_level (struct isis_circuit *circuit, int level)
uint32_t interval;
if (level == 1) {
- circuit->t_send_psnp[0] = thread_add_timer (master, send_l1_psnp,
- circuit,
- isis_jitter
- (circuit->psnp_interval[0],
- PSNP_JITTER));
+ THREAD_TIMER_ON(master, circuit->t_send_psnp[0], send_l1_psnp, circuit,
+ isis_jitter(circuit->psnp_interval[0], PSNP_JITTER));
+
if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
interval = circuit->hello_multiplier[0] * (circuit->hello_interval[0]);
- circuit->u.bc.t_run_dr[0] = thread_add_timer (master, isis_run_dr_l1,
+
+ THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
circuit, interval);
- circuit->u.bc.t_send_lan_hello[0] =
- thread_add_timer (master,
- send_lan_l1_hello,
- circuit,
- isis_jitter
- (circuit->hello_interval[0], IIH_JITTER));
+ THREAD_TIMER_ON(master, circuit->u.bc.t_send_lan_hello[0],
+ send_lan_l1_hello, circuit,
+ isis_jitter(circuit->hello_interval[0], IIH_JITTER));
+
circuit->u.bc.lan_neighs[0] = list_new ();
}
} else {
- circuit->t_send_psnp[1] = thread_add_timer (master, send_l2_psnp,
- circuit,
- isis_jitter
- (circuit->psnp_interval[1],
- PSNP_JITTER));
+ THREAD_TIMER_ON(master, circuit->t_send_psnp[1], send_l2_psnp, circuit,
+ isis_jitter(circuit->psnp_interval[1], PSNP_JITTER));
+
if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
interval = circuit->hello_multiplier[1] * (circuit->hello_interval[1]);
- circuit->u.bc.t_run_dr[1] = thread_add_timer (master, isis_run_dr_l2,
+
+ THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
circuit, interval);
- circuit->u.bc.t_send_lan_hello[1] =
- thread_add_timer (master,
- send_lan_l2_hello,
- circuit,
- isis_jitter
- (circuit->hello_interval[1], IIH_JITTER));
+ THREAD_TIMER_ON(master, circuit->u.bc.t_send_lan_hello[1],
+ send_lan_l2_hello, circuit,
+ isis_jitter(circuit->hello_interval[1], IIH_JITTER));
+
circuit->u.bc.lan_neighs[1] = list_new ();
}
}
@@ -195,21 +189,12 @@ circuit_resign_level (struct isis_circuit *circuit, int level)
{
int idx = level - 1;
- if (circuit->t_send_csnp[idx])
- thread_cancel (circuit->t_send_csnp[idx]);
- circuit->t_send_csnp[idx] = NULL;
-
- if (circuit->t_send_psnp[idx])
- thread_cancel (circuit->t_send_psnp[idx]);
- circuit->t_send_psnp[level - 1] = NULL;
+ THREAD_TIMER_OFF(circuit->t_send_csnp[idx]);
+ THREAD_TIMER_OFF(circuit->t_send_psnp[idx]);
if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
- if (circuit->u.bc.t_send_lan_hello[idx])
- thread_cancel (circuit->u.bc.t_send_lan_hello[idx]);
- circuit->u.bc.t_send_lan_hello[idx] = NULL;
- if (circuit->u.bc.t_run_dr[idx])
- thread_cancel (circuit->u.bc.t_run_dr[idx]);
- circuit->u.bc.t_run_dr[idx] = NULL;
+ THREAD_TIMER_OFF(circuit->u.bc.t_send_lan_hello[idx]);
+ THREAD_TIMER_OFF(circuit->u.bc.t_run_dr[idx]);
circuit->u.bc.run_dr_elect[idx] = 0;
}
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index 3f6a57b93..0faadbd8c 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -1652,8 +1652,7 @@ lsp_generate_non_pseudo (struct isis_area *area, int level) {
int
lsp_l1_generate (struct isis_area *area)
{
-
- area->t_lsp_refresh[0] = thread_add_timer (master, lsp_refresh_l1, area,
+ THREAD_TIMER_ON(master, area->t_lsp_refresh[0], lsp_refresh_l1, area,
MAX_LSP_GEN_INTERVAL);
return lsp_generate_non_pseudo (area, 1);
@@ -1666,8 +1665,7 @@ lsp_l1_generate (struct isis_area *area)
int
lsp_l2_generate (struct isis_area *area)
{
-
- area->t_lsp_refresh[1] = thread_add_timer (master, lsp_refresh_l2, area,
+ THREAD_TIMER_ON(master, area->t_lsp_refresh[1], lsp_refresh_l2, area,
MAX_LSP_GEN_INTERVAL);
return lsp_generate_non_pseudo (area, 2);
@@ -1753,9 +1751,9 @@ lsp_refresh_l1 (struct thread *thread)
ref_time = area->lsp_refresh[0] > MAX_LSP_GEN_INTERVAL ?
MAX_LSP_GEN_INTERVAL : area->lsp_refresh[0];
- area->t_lsp_refresh[0] = thread_add_timer (master, lsp_refresh_l1, area,
- isis_jitter (ref_time,
- MAX_AGE_JITTER));
+ THREAD_TIMER_ON(master, area->t_lsp_refresh[0], lsp_refresh_l1, area,
+ isis_jitter(ref_time, MAX_AGE_JITTER));
+
return ISIS_OK;
}
@@ -1775,10 +1773,9 @@ lsp_refresh_l2 (struct thread *thread)
ref_time = area->lsp_refresh[1] > MAX_LSP_GEN_INTERVAL ?
MAX_LSP_GEN_INTERVAL : area->lsp_refresh[1];
+ THREAD_TIMER_ON(master, area->t_lsp_refresh[1], lsp_refresh_l2, area,
+ isis_jitter(ref_time, MAX_AGE_JITTER));
- area->t_lsp_refresh[1] = thread_add_timer (master, lsp_refresh_l2, area,
- isis_jitter (ref_time,
- MAX_AGE_JITTER));
return ISIS_OK;
}
@@ -2018,10 +2015,9 @@ lsp_l1_refresh_pseudo (struct thread *thread)
ref_time = circuit->area->lsp_refresh[0] > MAX_LSP_GEN_INTERVAL ?
MAX_LSP_GEN_INTERVAL : circuit->area->lsp_refresh[0];
- circuit->u.bc.t_refresh_pseudo_lsp[0] =
- thread_add_timer (master, lsp_l1_refresh_pseudo, circuit,
- isis_jitter (ref_time,
- MAX_AGE_JITTER));
+ THREAD_TIMER_ON(master, circuit->u.bc.t_refresh_pseudo_lsp[0],
+ lsp_l1_refresh_pseudo, circuit, isis_jitter (ref_time, MAX_AGE_JITTER));
+
return retval;
}
@@ -2053,11 +2049,8 @@ lsp_l1_pseudo_generate (struct isis_circuit *circuit)
ref_time = circuit->area->lsp_refresh[0] > MAX_LSP_GEN_INTERVAL ?
MAX_LSP_GEN_INTERVAL : circuit->area->lsp_refresh[0];
-
- circuit->u.bc.t_refresh_pseudo_lsp[0] =
- thread_add_timer (master, lsp_l1_refresh_pseudo, circuit,
- isis_jitter (ref_time,
- MAX_AGE_JITTER));
+ THREAD_TIMER_ON(master, circuit->u.bc.t_refresh_pseudo_lsp[0],
+ lsp_l1_refresh_pseudo, circuit, isis_jitter (ref_time, MAX_AGE_JITTER));
return lsp_regenerate_schedule (circuit->area);
}
@@ -2078,11 +2071,9 @@ lsp_l2_refresh_pseudo (struct thread *thread)
ref_time = circuit->area->lsp_refresh[1] > MAX_LSP_GEN_INTERVAL ?
MAX_LSP_GEN_INTERVAL : circuit->area->lsp_refresh[1];
+ THREAD_TIMER_ON(master, circuit->u.bc.t_refresh_pseudo_lsp[1],
+ lsp_l2_refresh_pseudo, circuit, isis_jitter (ref_time, MAX_AGE_JITTER));
- circuit->u.bc.t_refresh_pseudo_lsp[1] =
- thread_add_timer (master, lsp_l2_refresh_pseudo, circuit,
- isis_jitter (ref_time,
- MAX_AGE_JITTER));
return retval;
}
@@ -2114,10 +2105,8 @@ lsp_l2_pseudo_generate (struct isis_circuit *circuit)
lsp_insert (lsp, circuit->area->lspdb[1]);
ISIS_FLAGS_SET_ALL (lsp->SRMflags);
- circuit->u.bc.t_refresh_pseudo_lsp[1] =
- thread_add_timer (master, lsp_l2_refresh_pseudo, circuit,
- isis_jitter (ref_time,
- MAX_AGE_JITTER));
+ THREAD_TIMER_ON(master, circuit->u.bc.t_refresh_pseudo_lsp[1],
+ lsp_l2_refresh_pseudo, circuit, isis_jitter (ref_time, MAX_AGE_JITTER));
return lsp_regenerate_schedule (circuit->area);
}
@@ -2144,7 +2133,7 @@ lsp_tick (struct thread *thread)
area = THREAD_ARG (thread);
assert (area);
- area->t_tick = thread_add_timer (master, lsp_tick, area, 1);
+ THREAD_TIMER_ON(master, area->t_tick, lsp_tick, area, 1);
/*
* Build a list of LSPs with (any) SRMflag set
@@ -2289,10 +2278,8 @@ top_lsp_refresh (struct thread *thread)
/* time to calculate our checksum */
iso_csum_create (STREAM_DATA (lsp->pdu) + 12,
ntohs(lsp->lsp_header->pdu_len) - 12, 12);
-
- lsp->t_lsp_top_ref = thread_add_timer (master, top_lsp_refresh, lsp,
- isis_jitter (MAX_LSP_GEN_INTERVAL,
- MAX_LSP_GEN_JITTER));
+ THREAD_TIMER_ON(master, lsp->t_lsp_top_ref, top_lsp_refresh, lsp,
+ isis_jitter (MAX_LSP_GEN_INTERVAL, MAX_LSP_GEN_JITTER));
return ISIS_OK;
}
@@ -2328,9 +2315,8 @@ generate_topology_lsps (struct isis_area *area)
/* time to calculate our checksum */
iso_csum_create (STREAM_DATA (lsp->pdu) + 12,
ntohs(lsp->lsp_header->pdu_len) - 12, 12);
- lsp->t_lsp_top_ref = thread_add_timer (master, top_lsp_refresh, lsp,
- isis_jitter(MAX_LSP_GEN_INTERVAL,
- MAX_LSP_GEN_JITTER));
+ THREAD_TIMER_ON(master, lsp->t_lsp_top_ref, top_lsp_refresh, lsp,
+ isis_jitter(MAX_LSP_GEN_INTERVAL, MAX_LSP_GEN_JITTER));
ISIS_FLAGS_SET_ALL(lsp->SRMflags);
lsp_insert (lsp,area->lspdb[0]);
@@ -2349,7 +2335,7 @@ remove_topology_lsps (struct isis_area *area)
dnode_next = dict_next (area->lspdb[0], dnode);
lsp = dnode_get (dnode);
if (lsp->from_topology) {
- thread_cancel(lsp->t_lsp_top_ref);
+ THREAD_TIMER_OFF(lsp->t_lsp_top_ref);
lsp_destroy (lsp);
dict_delete (area->lspdb[0], dnode);
}
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index 8d636b30c..65009ba63 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -381,10 +381,8 @@ process_p2p_hello (struct isis_circuit *circuit)
#endif /* HAVE_IPV6 */
/* lets take care of the expiry */
- if(adj->t_expire) {
- thread_cancel (adj->t_expire);
- }
- adj->t_expire = thread_add_timer (master, isis_adj_expire, adj,
+ THREAD_TIMER_OFF(adj->t_expire);
+ THREAD_TIMER_ON(master, adj->t_expire, isis_adj_expire, adj,
(long)adj->hold_time);
/* 8.2.5.2 a) a match was detected */
@@ -786,10 +784,8 @@ process_lan_hello (int level, struct isis_circuit *circuit, u_char *ssnpa)
adj->circuit_t = hdr.circuit_t;
/* lets take care of the expiry */
- if (adj->t_expire) {
- thread_cancel (adj->t_expire);
- }
- adj->t_expire = thread_add_timer (master, isis_adj_expire, adj,
+ THREAD_TIMER_OFF(adj->t_expire);
+ THREAD_TIMER_ON(master, adj->t_expire, isis_adj_expire, adj,
(long)adj->hold_time);
/*
@@ -1614,8 +1610,7 @@ isis_receive (struct thread *thread)
/*
* prepare for next packet.
*/
- circuit->t_read = thread_add_read (master, isis_receive, circuit,
- circuit->fd);
+ THREAD_READ_ON(master, circuit->t_read, isis_receive, circuit, circuit->fd);
return retval;
}
@@ -1879,9 +1874,8 @@ send_lan_l1_hello (struct thread *thread)
retval = send_lan_hello (circuit, 1);
/* set next timer thread */
- circuit->u.bc.t_send_lan_hello[0] =
- thread_add_timer (master, send_lan_l1_hello, circuit,
- isis_jitter (circuit->hello_interval[0], IIH_JITTER));
+ THREAD_TIMER_ON(master, circuit->u.bc.t_send_lan_hello[0], send_lan_l1_hello,
+ circuit, isis_jitter (circuit->hello_interval[0], IIH_JITTER));
return retval;
}
@@ -1902,9 +1896,8 @@ send_lan_l2_hello (struct thread *thread)
retval = send_lan_hello (circuit, 2);
/* set next timer thread*/
- circuit->u.bc.t_send_lan_hello[1] =
- thread_add_timer (master, send_lan_l2_hello, circuit,
- isis_jitter (circuit->hello_interval[1], IIH_JITTER));
+ THREAD_TIMER_ON(master, circuit->u.bc.t_send_lan_hello[1], send_lan_l2_hello,
+ circuit, isis_jitter (circuit->hello_interval[1], IIH_JITTER));
return retval;
}
@@ -1921,9 +1914,8 @@ send_p2p_hello (struct thread *thread)
send_hello(circuit,1);
/* set next timer thread*/
- circuit->u.p2p.t_send_p2p_hello = thread_add_timer
- (master, send_p2p_hello, circuit, isis_jitter (circuit->hello_interval[1],
- IIH_JITTER));
+ THREAD_TIMER_ON(master, circuit->u.p2p.t_send_p2p_hello, send_p2p_hello,
+ circuit, isis_jitter (circuit->hello_interval[1], IIH_JITTER));
return ISIS_OK;
}
@@ -2049,12 +2041,8 @@ send_l1_csnp (struct thread *thread)
send_csnp(circuit,1);
}
/* set next timer thread */
- circuit->t_send_csnp[0] = thread_add_timer (master,
- send_l1_csnp,
- circuit,
- isis_jitter
- (circuit->csnp_interval[0],
- CSNP_JITTER));
+ THREAD_TIMER_ON(master, circuit->t_send_csnp[0], send_l1_csnp, circuit,
+ isis_jitter(circuit->csnp_interval[0], CSNP_JITTER));
return retval;
}
@@ -2074,12 +2062,9 @@ send_l2_csnp (struct thread *thread)
send_csnp(circuit,2);
}
/* set next timer thread */
- circuit->t_send_csnp[1] = thread_add_timer (master,
- send_l2_csnp,
- circuit,
- isis_jitter
- (circuit->csnp_interval[1],
- CSNP_JITTER));
+ THREAD_TIMER_ON(master, circuit->t_send_csnp[1], send_l2_csnp, circuit,
+ isis_jitter(circuit->csnp_interval[1], CSNP_JITTER));
+
return retval;
}
@@ -2215,12 +2200,8 @@ send_l1_psnp (struct thread *thread)
send_psnp (1, circuit);
/* set next timer thread */
- circuit->t_send_psnp[0] = thread_add_timer (master,
- send_l1_psnp,
- circuit,
- isis_jitter
- (circuit->psnp_interval[0],
- PSNP_JITTER));
+ THREAD_TIMER_ON(master, circuit->t_send_psnp[0], send_l1_psnp, circuit,
+ isis_jitter(circuit->psnp_interval[0], PSNP_JITTER));
return retval;
}
@@ -2244,12 +2225,8 @@ send_l2_psnp (struct thread *thread)
send_psnp (2, circuit);
/* set next timer thread */
- circuit->t_send_psnp[1] = thread_add_timer (master,
- send_l2_psnp,
- circuit,
- isis_jitter
- (circuit->psnp_interval[1],
- PSNP_JITTER));
+ THREAD_TIMER_ON(master, circuit->t_send_psnp[1], send_l2_psnp, circuit,
+ isis_jitter(circuit->psnp_interval[1], PSNP_JITTER));
return retval;
}
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index 37c435e03..a522877ad 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -944,15 +944,11 @@ isis_run_spf (struct isis_area *area, int level, int family)
spftree->pending = 0;
if (level == 1)
- spftree->t_spf_periodic = thread_add_timer (master,
- isis_run_spf_l1, area,
- isis_jitter
- (PERIODIC_SPF_INTERVAL, 10));
+ THREAD_TIMER_ON(master, spftree->t_spf_periodic, isis_run_spf_l1, area,
+ isis_jitter(PERIODIC_SPF_INTERVAL, 10));
else
- spftree->t_spf_periodic = thread_add_timer (master,
- isis_run_spf_l2, area,
- isis_jitter
- (PERIODIC_SPF_INTERVAL, 10));
+ THREAD_TIMER_ON(master, spftree->t_spf_periodic, isis_run_spf_l2, area,
+ isis_jitter(PERIODIC_SPF_INTERVAL, 10));
return retval;
}
@@ -1042,8 +1038,7 @@ isis_spf_schedule (struct isis_area *area, int level)
spftree->pending = 1;
return retval;
}
- if (spftree->t_spf_periodic)
- thread_cancel (spftree->t_spf_periodic);
+ THREAD_TIMER_OFF(spftree->t_spf_periodic);
if (diff < MINIMUM_SPF_INTERVAL) {
if (level == 1)
@@ -1075,8 +1070,7 @@ isis_spf_schedule6 (struct isis_area *area, int level)
diff = now - spftree->lastrun;
- if (spftree->t_spf_periodic)
- thread_cancel (spftree->t_spf_periodic);
+ THREAD_TIMER_OFF(spftree->t_spf_periodic);
/* FIXME: let's wait a minute before doing the SPF */
if (now - isis->uptime < 60 || isis->uptime == 0) {
diff --git a/isisd/isisd.c b/isisd/isisd.c
index 135acf0ef..9cdb2557a 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -120,7 +120,7 @@ isis_area_create ()
#endif /* HAVE_IPV6 */
area->circuit_list = list_new ();
area->area_addrs = list_new ();
- area->t_tick = thread_add_timer (master, lsp_tick, area, 1);
+ THREAD_TIMER_ON(master, area->t_tick, lsp_tick, area, 1);
area->flags.maxindex = -1;
/*
* Default values
@@ -210,14 +210,11 @@ isis_area_destroy (struct vty *vty, char *area_tag)
list_delete (area->circuit_list);
}
listnode_delete (isis->area_list, area);
- if (area->t_tick)
- thread_cancel (area->t_tick);
+ THREAD_TIMER_OFF(area->t_tick);
if (area->t_remove_aged)
thread_cancel (area->t_remove_aged);
- if (area->t_lsp_refresh[0])
- thread_cancel (area->t_lsp_refresh[0]);
- if (area->t_lsp_refresh[1])
- thread_cancel (area->t_lsp_refresh[1]);
+ THREAD_TIMER_OFF(area->t_lsp_refresh[0]);
+ THREAD_TIMER_OFF(area->t_lsp_refresh[1]);
XFREE (MTYPE_ISIS_AREA, area);