From ae27101e6ff8b636f02254ba0aa2217239d896e1 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Thu, 25 Jul 2024 09:34:10 +0200 Subject: [PATCH] isisd: fix building asla at first flex-algo config When an color affinity is set on an interface before configuring the flex-algorithm, the ASLA (Application Specific Link-Attribute) sub-TLV is not build. Flex-algo fails to build the paths when a affinity constraint is required because of the lacking of information contained in ASLA. There are no problems when the configuration order is reversed. For example: > affinity-map red bit-position 1 > > interface eth2 > link-params > affinity red > > router isis 1 > mpls-te on > flex-algo 129 > dataplane sr-mpls > advertise-definition > affinity include-any green In isis_link_params_update_asla(), the ASLA sub-TLV is not build when the list of flex-algos is empty. Update ASLA when the first flex-algorithm is configured. Fixes: 893882ee20 ("isisd: add isis flex-algo configuration backend") Signed-off-by: Louis Scalbert --- isisd/isis_nb_config.c | 11 ++++++++++- isisd/isis_te.c | 4 ++-- isisd/isis_te.h | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c index f67b28cd7cfa..66b66194c881 100644 --- a/isisd/isis_nb_config.c +++ b/isisd/isis_nb_config.c @@ -2838,7 +2838,9 @@ int isis_instance_flex_algo_create(struct nb_cb_create_args *args) { struct isis_area *area; struct flex_algo *fa; - bool advertise; + bool advertise, update_te; + struct isis_circuit *circuit; + struct listnode *node; uint32_t algorithm; uint32_t priority = FLEX_ALGO_PRIO_DEFAULT; struct isis_flex_algo_alloc_arg arg; @@ -2851,6 +2853,7 @@ int isis_instance_flex_algo_create(struct nb_cb_create_args *args) area = nb_running_get_entry(args->dnode, NULL, true); arg.algorithm = algorithm; arg.area = area; + update_te = list_isempty(area->flex_algos->flex_algos); fa = flex_algo_alloc(area->flex_algos, algorithm, &arg); fa->priority = priority; fa->advertise_definition = advertise; @@ -2862,6 +2865,12 @@ int isis_instance_flex_algo_create(struct nb_cb_create_args *args) admin_group_allow_explicit_zero( &fa->admin_group_include_all); } + if (update_te) { + for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, + circuit)) + isis_link_params_update_asla(circuit, + circuit->interface); + } lsp_regenerate_schedule(area, area->is_type, 0); break; case NB_EV_VALIDATE: diff --git a/isisd/isis_te.c b/isisd/isis_te.c index 3683f7455821..fead826fcdca 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -164,8 +164,8 @@ void isis_mpls_te_term(struct isis_area *area) XFREE(MTYPE_ISIS_MPLS_TE, area->mta); } -static void isis_link_params_update_asla(struct isis_circuit *circuit, - struct interface *ifp) +void isis_link_params_update_asla(struct isis_circuit *circuit, + struct interface *ifp) { struct isis_asla_subtlvs *asla; struct listnode *node, *nnode; diff --git a/isisd/isis_te.h b/isisd/isis_te.h index bf1dc2b9bbbd..326e50479df0 100644 --- a/isisd/isis_te.h +++ b/isisd/isis_te.h @@ -112,6 +112,8 @@ void isis_mpls_te_init(void); void isis_mpls_te_create(struct isis_area *area); void isis_mpls_te_disable(struct isis_area *area); void isis_mpls_te_term(struct isis_area *area); +void isis_link_params_update_asla(struct isis_circuit *circuit, + struct interface *ifp); void isis_link_params_update(struct isis_circuit *, struct interface *); int isis_mpls_te_update(struct interface *); void isis_te_lsp_event(struct isis_lsp *lsp, enum lsp_event event);