fabricd: Update neighbor list on adjacency state change

We should update our neighbors list immediately when an adjacency
changes state, not when we run SPF.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This commit is contained in:
Christian Franke 2018-11-23 04:46:09 +01:00 committed by Rodny Molina
parent e923107c7b
commit 2cd971af00
3 changed files with 26 additions and 4 deletions

View File

@ -161,9 +161,15 @@ static struct neighbor_entry *neighbor_entry_lookup_hash(struct hash *hash,
return rv;
}
static void neighbor_lists_update(struct fabricd *f)
static int fabricd_handle_adj_state_change(struct isis_adjacency *arg)
{
neighbor_lists_clear(f);
struct fabricd *f = arg->circuit->area->fabricd;
if (!f)
return 0;
while (!skiplist_empty(f->neighbors))
skiplist_delete_first(f->neighbors);
struct listnode *node;
struct isis_circuit *circuit;
@ -182,6 +188,14 @@ static void neighbor_lists_update(struct fabricd *f)
skiplist_insert(f->neighbors, n, n);
}
return 0;
}
static void neighbors_neighbors_update(struct fabricd *f)
{
hash_clean(f->neighbors_neighbors, neighbor_entry_del_void);
struct listnode *node;
struct isis_vertex *v;
for (ALL_QUEUE_ELEMENTS_RO(&f->spftree->paths, node, v)) {
@ -463,7 +477,7 @@ void fabricd_run_spf(struct isis_area *area)
return;
isis_run_hopcount_spf(area, isis->sysid, f->spftree);
neighbor_lists_update(f);
neighbors_neighbors_update(f);
fabricd_bump_tier_calculation_timer(f);
}
@ -799,3 +813,9 @@ void fabricd_configure_triggered_csnp(struct isis_area *area, int delay,
f->csnp_delay = delay;
f->always_send_csnp = always_send_csnp;
}
void fabricd_init(void)
{
hook_register(isis_adj_state_change_hook,
fabricd_handle_adj_state_change);
}

View File

@ -52,5 +52,5 @@ void fabricd_update_lsp_no_flood(struct isis_lsp *lsp,
struct isis_circuit *circuit);
void fabricd_configure_triggered_csnp(struct isis_area *area, int delay,
bool always_send_csnp);
void fabricd_init(void);
#endif

View File

@ -58,6 +58,7 @@
#include "isisd/isis_bfd.h"
#include "isisd/isis_lsp.h"
#include "isisd/isis_mt.h"
#include "isisd/fabricd.h"
/* Default configuration file name */
#define ISISD_DEFAULT_CONFIG "isisd.conf"
@ -228,6 +229,7 @@ int main(int argc, char **argv, char **envp)
isis_zebra_init(master);
isis_bfd_init();
fabricd_init();
frr_config_fork();
frr_run(master);