diff options
Diffstat (limited to 'isisd/isis_sr.c')
| -rw-r--r-- | isisd/isis_sr.c | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c index f928185ffb..af22f56f8b 100644 --- a/isisd/isis_sr.c +++ b/isisd/isis_sr.c @@ -462,8 +462,7 @@ void isis_area_delete_backup_adj_sids(struct isis_area *area, int level) struct listnode *node, *nnode; for (ALL_LIST_ELEMENTS(area->srdb.adj_sids, node, nnode, sra)) - if (sra->type == ISIS_SR_LAN_BACKUP - && (sra->adj->level & level)) + if (sra->type == ISIS_SR_ADJ_BACKUP && (sra->adj->level & level)) sr_adj_sid_del(sra); } @@ -689,7 +688,7 @@ void sr_adj_sid_add_single(struct isis_adjacency *adj, int family, bool backup, circuit->ext = isis_alloc_ext_subtlvs(); sra = XCALLOC(MTYPE_ISIS_SR_INFO, sizeof(*sra)); - sra->type = backup ? ISIS_SR_LAN_BACKUP : ISIS_SR_ADJ_NORMAL; + sra->type = backup ? ISIS_SR_ADJ_BACKUP : ISIS_SR_ADJ_NORMAL; sra->input_label = input_label; sra->nexthop.family = family; sra->nexthop.address = nexthop; @@ -819,7 +818,7 @@ static void sr_adj_sid_del(struct sr_adjacency *sra) exit(1); } - if (sra->type == ISIS_SR_LAN_BACKUP && sra->backup_nexthops) { + if (sra->type == ISIS_SR_ADJ_BACKUP && sra->backup_nexthops) { sra->backup_nexthops->del = (void (*)(void *))isis_nexthop_delete; list_delete(&sra->backup_nexthops); @@ -923,19 +922,19 @@ static int sr_adj_ip_disabled(struct isis_adjacency *adj, int family, } /** - * Activate local Prefix-SID when loopback interface goes up for IS-IS. + * Update the Node-SID flag of the configured Prefix-SID mappings in response + * to an address addition or removal event. * - * @param ifp Loopback Interface + * @param ifp Interface * * @return 0 */ -static int sr_if_new_hook(struct interface *ifp) +int sr_if_addr_update(struct interface *ifp) { struct sr_prefix_cfg *pcfgs[SR_ALGORITHM_COUNT] = {NULL}; struct isis_circuit *circuit; struct isis_area *area; struct connected *connected; - struct listnode *node; bool need_lsp_regenerate = false; /* Get corresponding circuit */ @@ -947,13 +946,7 @@ static int sr_if_new_hook(struct interface *ifp) if (!area) return 0; - /* - * Update the Node-SID flag of the configured Prefix-SID mappings if - * necessary. This needs to be done here since isisd reads the startup - * configuration before receiving interface information from zebra. - */ - FOR_ALL_INTERFACES_ADDRESSES (ifp, connected, node) { - + frr_each (if_connected, ifp->connected, connected) { for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { pcfgs[i] = isis_sr_cfg_prefix_find( area, connected->address, i); @@ -1080,7 +1073,7 @@ DEFUN(show_sr_node, show_sr_node_cmd, "show " PROTO_NAME " segment-routing node" #ifndef FABRICD - " [algorithm (128-255)]" + " [algorithm [(128-255)]]" #endif /* ifndef FABRICD */ , SHOW_STR PROTO_HELP @@ -1094,13 +1087,18 @@ DEFUN(show_sr_node, show_sr_node_cmd, { struct listnode *node, *inode; struct isis_area *area; - uint8_t algorithm = SR_ALGORITHM_SPF; + uint16_t algorithm = SR_ALGORITHM_SPF; + bool all_algorithm = false; struct isis *isis; #ifndef FABRICD int idx = 0; - if (argv_find(argv, argc, "algorithm", &idx)) - algorithm = (uint8_t)strtoul(argv[idx + 1]->arg, NULL, 10); + if (argv_find(argv, argc, "algorithm", &idx)) { + if (argv_find(argv, argc, "(128-255)", &idx)) + algorithm = (uint16_t)strtoul(argv[idx]->arg, NULL, 10); + else + all_algorithm = true; + } #endif /* ifndef FABRICD */ for (ALL_LIST_ELEMENTS_RO(im->isis, inode, isis)) { @@ -1112,8 +1110,17 @@ DEFUN(show_sr_node, show_sr_node_cmd, continue; } for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; - level++) - show_node(vty, area, level, algorithm); + level++) { + if (all_algorithm) { + for (algorithm = SR_ALGORITHM_FLEX_MIN; + algorithm <= SR_ALGORITHM_FLEX_MAX; + algorithm++) + show_node(vty, area, level, + (uint8_t)algorithm); + } else + show_node(vty, area, level, + (uint8_t)algorithm); + } } } @@ -1313,7 +1320,6 @@ void isis_sr_init(void) hook_register(isis_adj_state_change_hook, sr_adj_state_change); hook_register(isis_adj_ip_enabled_hook, sr_adj_ip_enabled); hook_register(isis_adj_ip_disabled_hook, sr_adj_ip_disabled); - hook_register(isis_if_new_hook, sr_if_new_hook); } /** @@ -1325,5 +1331,4 @@ void isis_sr_term(void) hook_unregister(isis_adj_state_change_hook, sr_adj_state_change); hook_unregister(isis_adj_ip_enabled_hook, sr_adj_ip_enabled); hook_unregister(isis_adj_ip_disabled_hook, sr_adj_ip_disabled); - hook_unregister(isis_if_new_hook, sr_if_new_hook); } |
