summaryrefslogtreecommitdiff
path: root/isisd/isis_sr.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2020-08-10 23:09:12 -0300
committerRenato Westphal <renato@opensourcerouting.org>2020-08-11 01:07:11 -0300
commit75eddbc39225b7218b7f7094cdb78d2e3c35d563 (patch)
tree3561f7bc1a8ed4ec71c6bc6cacd545bab6247efa /isisd/isis_sr.c
parent8e4b740efbf0a0a00bb8ce706c8275a6bb09a5ec (diff)
isisd: introduce per-area list of IS-IS adjacencies
This should simplify all code that needs to iterate over all adjacencies of a given area (iterating over all adjacencies of all circuits is cumbersome). While here, repurpose isis_adj_exists() into a lookup function, making it more generally useful. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'isisd/isis_sr.c')
-rw-r--r--isisd/isis_sr.c37
1 files changed, 7 insertions, 30 deletions
diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c
index afb814c089..c69bf31d24 100644
--- a/isisd/isis_sr.c
+++ b/isisd/isis_sr.c
@@ -1223,7 +1223,7 @@ static void process_node_changes(struct isis_area *area, int level,
* If an neighbor router's SRGB was changed or created, then reinstall
* all Prefix-SIDs from all nodes that use this neighbor as nexthop.
*/
- adjacent = isis_adj_exists(area, level, sysid);
+ adjacent = !!isis_adj_find(area, level, sysid);
switch (srn->state) {
case SRDB_STATE_NEW:
case SRDB_STATE_MODIFIED:
@@ -2103,7 +2103,7 @@ static int sr_start_label_manager(struct thread *start)
int isis_sr_start(struct isis_area *area)
{
struct isis_sr_db *srdb = &area->srdb;
- struct isis_circuit *circuit;
+ struct isis_adjacency *adj;
struct listnode *node;
/* First start Label Manager if not ready */
@@ -2140,34 +2140,11 @@ int isis_sr_start(struct isis_area *area)
area->area_tag);
/* Create Adjacency-SIDs from existing IS-IS Adjacencies. */
- for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) {
- struct isis_adjacency *adj;
- struct listnode *anode;
-
- switch (circuit->circ_type) {
- case CIRCUIT_T_BROADCAST:
- for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS;
- level++) {
- for (ALL_LIST_ELEMENTS_RO(
- circuit->u.bc.adjdb[level - 1],
- anode, adj)) {
- if (adj->ipv4_address_count > 0)
- sr_adj_sid_add(adj, AF_INET);
- if (adj->ipv6_address_count > 0)
- sr_adj_sid_add(adj, AF_INET6);
- }
- }
- break;
- case CIRCUIT_T_P2P:
- adj = circuit->u.p2p.neighbor;
- if (adj && adj->ipv4_address_count > 0)
- sr_adj_sid_add(adj, AF_INET);
- if (adj && adj->ipv6_address_count > 0)
- sr_adj_sid_add(adj, AF_INET6);
- break;
- default:
- break;
- }
+ for (ALL_LIST_ELEMENTS_RO(area->adjacency_list, node, adj)) {
+ if (adj->ipv4_address_count > 0)
+ sr_adj_sid_add(adj, AF_INET);
+ if (adj->ipv6_address_count > 0)
+ sr_adj_sid_add(adj, AF_INET6);
}
area->srdb.enabled = true;