Skip to content

Commit

Permalink
isisd: make the SPF code more modular
Browse files Browse the repository at this point in the history
The goal of modularizing the SPF code is to make it possible for
isisd to run SPF in the behalf of other nodes in the network, which
is going to be necessary later when implementing the R-LFA/TI-LFA
solutions. On top of that, a modularized SPF opens the door for
much needed unit testing.

Summary of the changes:
* Change the isis_spf_preload_tent() function to use the local LSP
  as an input (as per the ISO specification) instead of populating
  the TENT based on the list of local interfaces;
* Introduce the "isis_spf_adj" structure to represent an SPF
  adjacency.  SPF adjacencies are inferred from the LSPDB, different
  from normal adjacencies formed using IIH messages;
* Introduce the F_SPFTREE_NO_ROUTES flag to control whether the
  SPT should create routes or not;
* Introduce the F_SPFTREE_NO_ADJACENCIES flag to specify whether
  IS-IS adjacency information is available or not. When running SPF
  in the behalf of other nodes, or under the context of an unit test,
  no adjacency information will be present.
* On isis_area_create(), move some code around so that the area's isis
  backpointer is set as early as possible.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
  • Loading branch information
rwestphal committed Aug 26, 2020
1 parent 675269d commit 7b36d36
Show file tree
Hide file tree
Showing 6 changed files with 542 additions and 388 deletions.
4 changes: 3 additions & 1 deletion isisd/fabricd.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ struct fabricd *fabricd_new(struct isis_area *area)
rv->area = area;
rv->initial_sync_state = FABRICD_SYNC_PENDING;

rv->spftree = isis_spftree_new(area);
rv->spftree = isis_spftree_new(area, &area->lspdb[IS_LEVEL_2 - 1],
area->isis->sysid, ISIS_LEVEL2,
SPFTREE_IPV4, F_SPFTREE_HOPCOUNT_METRIC);
rv->neighbors = skiplist_new(0, neighbor_entry_list_cmp,
neighbor_entry_del_void);
rv->neighbors_neighbors = hash_create(neighbor_entry_hash_key,
Expand Down
8 changes: 6 additions & 2 deletions isisd/isis_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "isis_pdu.h"
#include "isis_lsp.h"
#include "isis_spf.h"
#include "isis_spf_private.h"
#include "isis_route.h"
#include "isis_zebra.h"

Expand Down Expand Up @@ -165,13 +166,16 @@ static struct isis_route_info *isis_route_info_new(struct prefix *prefix,
struct list *adjacencies)
{
struct isis_route_info *rinfo;
struct isis_adjacency *adj;
struct isis_vertex_adj *vadj;
struct listnode *node;

rinfo = XCALLOC(MTYPE_ISIS_ROUTE_INFO, sizeof(struct isis_route_info));

rinfo->nexthops = list_new();
for (ALL_LIST_ELEMENTS_RO(adjacencies, node, adj)) {
for (ALL_LIST_ELEMENTS_RO(adjacencies, node, vadj)) {
struct isis_spf_adj *sadj = vadj->sadj;
struct isis_adjacency *adj = sadj->adj;

/* check for force resync this route */
if (CHECK_FLAG(adj->circuit->flags,
ISIS_CIRCUIT_FLAPPED_AFTER_SPF))
Expand Down
Loading

0 comments on commit 7b36d36

Please sign in to comment.