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_circuit.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_circuit.c')
-rw-r--r-- | isisd/isis_circuit.c | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 4c095c26d..20094fb62 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -615,37 +615,31 @@ int isis_circuit_up(struct isis_circuit *circuit) /* 8.4.1 a) commence sending of IIH PDUs */ - if (circuit->is_type & IS_LEVEL_1) { - thread_add_event(master, send_lan_l1_hello, circuit, 0, - NULL); - circuit->u.bc.lan_neighs[0] = list_new(); - } + for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) { + if (!(circuit->is_type & level)) + continue; - if (circuit->is_type & IS_LEVEL_2) { - thread_add_event(master, send_lan_l2_hello, circuit, 0, - NULL); - circuit->u.bc.lan_neighs[1] = list_new(); + thread_add_event(master, send_hello_cb, + &circuit->level_arg[level - 1], 0, + &circuit->u.bc.t_send_lan_hello[level - 1]); + circuit->u.bc.lan_neighs[level - 1] = list_new(); + + 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]); } /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */ /* 8.4.1 c) FIXME: listen for ESH PDUs */ - - /* 8.4.1 d) */ - /* dr election will commence in... */ - if (circuit->is_type & IS_LEVEL_1) - thread_add_timer(master, isis_run_dr_l1, circuit, - 2 * circuit->hello_interval[0], - &circuit->u.bc.t_run_dr[0]); - if (circuit->is_type & IS_LEVEL_2) - thread_add_timer(master, isis_run_dr_l2, circuit, - 2 * circuit->hello_interval[1], - &circuit->u.bc.t_run_dr[1]); } else if (circuit->circ_type == CIRCUIT_T_P2P) { /* initializing the hello send threads * for a ptp IF */ circuit->u.p2p.neighbor = NULL; - thread_add_event(master, send_p2p_hello, circuit, 0, NULL); + thread_add_event(master, send_hello_cb, + &circuit->level_arg[0], 0, + &circuit->u.p2p.t_send_p2p_hello); } /* initializing PSNP timers */ |