diff options
author | Christian Franke <chris@opensourcerouting.org> | 2018-10-10 11:16:39 +0200 |
---|---|---|
committer | Christian Franke <chris@opensourcerouting.org> | 2018-12-04 12:49:25 +0100 |
commit | 7c4f7aabc5866238584dfd9497ec6cef32311ca1 (patch) | |
tree | 23e5bd786dee59dfda8dbeaa4010e18ae55808b0 /isisd/isis_events.c | |
parent | isisd: Add level&circuit thread argument to circuit (diff) | |
download | frr-7c4f7aabc5866238584dfd9497ec6cef32311ca1.tar.xz frr-7c4f7aabc5866238584dfd9497ec6cef32311ca1.zip |
isisd: reduce code duplication for levels
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Diffstat (limited to 'isisd/isis_events.c')
-rw-r--r-- | isisd/isis_events.c | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/isisd/isis_events.c b/isisd/isis_events.c index 9f58c24b7..db197c7be 100644 --- a/isisd/isis_events.c +++ b/isisd/isis_events.c @@ -77,47 +77,34 @@ void isis_event_circuit_state_change(struct isis_circuit *circuit, static void circuit_commence_level(struct isis_circuit *circuit, int level) { - if (level == 1) { - if (!circuit->is_passive) + if (!circuit->is_passive) { + if (level == 1) { thread_add_timer(master, send_l1_psnp, circuit, isis_jitter(circuit->psnp_interval[0], PSNP_JITTER), &circuit->t_send_psnp[0]); - - if (circuit->circ_type == CIRCUIT_T_BROADCAST) { - thread_add_timer(master, isis_run_dr_l1, circuit, - 2 * circuit->hello_interval[0], - &circuit->u.bc.t_run_dr[0]); - - thread_add_timer(master, send_lan_l1_hello, circuit, - isis_jitter(circuit->hello_interval[0], - IIH_JITTER), - &circuit->u.bc.t_send_lan_hello[0]); - - circuit->u.bc.lan_neighs[0] = list_new(); - } - } else { - if (!circuit->is_passive) + } else { thread_add_timer(master, send_l2_psnp, circuit, isis_jitter(circuit->psnp_interval[1], PSNP_JITTER), &circuit->t_send_psnp[1]); - - if (circuit->circ_type == CIRCUIT_T_BROADCAST) { - thread_add_timer(master, isis_run_dr_l2, circuit, - 2 * circuit->hello_interval[1], - &circuit->u.bc.t_run_dr[1]); - - thread_add_timer(master, send_lan_l2_hello, circuit, - isis_jitter(circuit->hello_interval[1], - IIH_JITTER), - &circuit->u.bc.t_send_lan_hello[1]); - - circuit->u.bc.lan_neighs[1] = list_new(); } } - return; + if (circuit->circ_type == CIRCUIT_T_BROADCAST) { + thread_add_timer(master, isis_run_dr, + &circuit->level_arg[level - 1], + 2 * circuit->hello_interval[level - 1], + &circuit->u.bc.t_run_dr[level - 1]); + + thread_add_timer(master, send_hello_cb, + &circuit->level_arg[level - 1], + isis_jitter(circuit->hello_interval[level - 1], + IIH_JITTER), + &circuit->u.bc.t_send_lan_hello[level - 1]); + + circuit->u.bc.lan_neighs[level - 1] = list_new(); + } } static void circuit_resign_level(struct isis_circuit *circuit, int level) |