diff options
Diffstat (limited to 'isisd/isis_sr.c')
| -rw-r--r-- | isisd/isis_sr.c | 103 |
1 files changed, 56 insertions, 47 deletions
diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c index 59f00a73f5..bdbdc30b4a 100644 --- a/isisd/isis_sr.c +++ b/isisd/isis_sr.c @@ -1055,7 +1055,7 @@ static void parse_prefix_sid_subtlvs(struct sr_node *srn, || srp->sid.value != psid->value) { srp->sid = *psid; srp->state = SRDB_STATE_MODIFIED; - } else + } else if (srp->state == SRDB_STATE_VALIDATED) srp->state = SRDB_STATE_UNCHANGED; sr_debug(" |- Found %s Prefix-SID %pFX", srp->state == SRDB_STATE_MODIFIED @@ -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: @@ -1980,20 +1980,48 @@ static void show_prefix_sids(struct vty *vty, struct isis_area *area, int level) * Declaration of new show commands. */ DEFUN(show_sr_prefix_sids, show_sr_prefix_sids_cmd, - "show isis segment-routing prefix-sids", - SHOW_STR PROTO_HELP + "show isis [vrf <NAME|all>] segment-routing prefix-sids", + SHOW_STR PROTO_HELP VRF_CMD_HELP_STR + "All VRFs\n" "Segment-Routing\n" "Segment-Routing Prefix-SIDs\n") { - struct listnode *node; + struct listnode *node, *inode, *nnode; struct isis_area *area; - - for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { - vty_out(vty, "Area %s:\n", - area->area_tag ? area->area_tag : "null"); - - for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) - show_prefix_sids(vty, area, level); + struct isis *isis = NULL; + const char *vrf_name = VRF_DEFAULT_NAME; + bool all_vrf = false; + int idx_vrf = 0; + + ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); + if (vrf_name) { + if (all_vrf) { + for (ALL_LIST_ELEMENTS(im->isis, nnode, inode, isis)) { + for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, + area)) { + vty_out(vty, "Area %s:\n", + area->area_tag ? area->area_tag + : "null"); + for (int level = ISIS_LEVEL1; + level <= ISIS_LEVELS; level++) + show_prefix_sids(vty, area, + level); + } + } + return 0; + } + isis = isis_lookup_by_vrfname(vrf_name); + if (isis != NULL) { + for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, + area)) { + vty_out(vty, "Area %s:\n", + area->area_tag ? area->area_tag + : "null"); + for (int level = ISIS_LEVEL1; + level <= ISIS_LEVELS; level++) + show_prefix_sids(vty, area, level); + } + } } return CMD_SUCCESS; @@ -2056,15 +2084,19 @@ DEFUN(show_sr_node, show_sr_node_cmd, "Segment-Routing\n" "Segment-Routing node\n") { - struct listnode *node; + struct listnode *node, *inode, *nnode; struct isis_area *area; + struct isis *isis = NULL; - for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { - vty_out(vty, "Area %s:\n", - area->area_tag ? area->area_tag : "null"); + for (ALL_LIST_ELEMENTS(im->isis, inode, nnode, isis)) { + for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { + vty_out(vty, "Area %s:\n", + area->area_tag ? area->area_tag : "null"); - for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) - show_node(vty, area, level); + for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; + level++) + show_node(vty, area, level); + } } return CMD_SUCCESS; @@ -2103,7 +2135,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 +2172,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; |
