mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-11 01:40:33 +00:00
isisd: update struct isis_sr_psid_info with nh context
Prefix-SID nexthops and backup nexthops are stored respectively in isis_route_info->nexthops and isis_route_info->backup->nexthops. With Flex-Algo, there are multiple Prefix-SIDs for a single prefix in different algorithms. Each of these Prefix-SIDs performs SPF calculation with a separate contract and sets a nexthops, so it is necessary to store a different set nexthops for each Prefix-SID. Add a nexthops and backup nethops list into the Prefix-SID isis_sr_psid_info struct and use these lists instead of the when needed After this commit, the nexthops for each Prefix-SID is not taken from route_info, but the nexthop set inside the Prefix-SID is taken. This works for backup nexthops as well. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
parent
484ab40511
commit
bdaafbf834
@ -239,6 +239,9 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p,
|
||||
rinfo->cost = cost;
|
||||
rinfo->depth = depth;
|
||||
rinfo->sr = *sr;
|
||||
rinfo->sr.nexthops = rinfo->nexthops;
|
||||
rinfo->sr.nexthops_backup =
|
||||
rinfo->backup ? rinfo->backup->nexthops : NULL;
|
||||
|
||||
return rinfo;
|
||||
}
|
||||
@ -489,8 +492,9 @@ static void isis_route_update(struct isis_area *area, struct prefix *prefix,
|
||||
route_info);
|
||||
/* Install/reinstall Prefix-SID label. */
|
||||
if (route_info->sr.present)
|
||||
isis_zebra_prefix_sid_install(area, prefix, route_info,
|
||||
isis_zebra_prefix_sid_install(area, prefix,
|
||||
&route_info->sr);
|
||||
|
||||
hook_call(isis_route_update_hook, area, prefix, route_info);
|
||||
|
||||
SET_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
|
||||
@ -541,10 +545,13 @@ static void _isis_route_verify_table(struct isis_area *area,
|
||||
src_p);
|
||||
if (rnode_bck) {
|
||||
rinfo->backup = rnode_bck->info;
|
||||
rinfo->sr.nexthops_backup =
|
||||
rinfo->backup->nexthops;
|
||||
UNSET_FLAG(rinfo->flag,
|
||||
ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
|
||||
} else if (rinfo->backup) {
|
||||
rinfo->backup = NULL;
|
||||
rinfo->sr.nexthops_backup = NULL;
|
||||
UNSET_FLAG(rinfo->flag,
|
||||
ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
|
||||
}
|
||||
@ -658,10 +665,13 @@ void isis_route_verify_merge(struct isis_area *area,
|
||||
tables_backup[level - 1], prefix, src_p);
|
||||
if (rnode_bck) {
|
||||
rinfo->backup = rnode_bck->info;
|
||||
rinfo->sr.nexthops_backup =
|
||||
rinfo->backup->nexthops;
|
||||
UNSET_FLAG(rinfo->flag,
|
||||
ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
|
||||
} else if (rinfo->backup) {
|
||||
rinfo->backup = NULL;
|
||||
rinfo->sr.nexthops_backup = NULL;
|
||||
UNSET_FLAG(rinfo->flag,
|
||||
ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
|
||||
}
|
||||
@ -720,6 +730,7 @@ void isis_route_invalidate_table(struct isis_area *area,
|
||||
|
||||
if (rinfo->backup) {
|
||||
rinfo->backup = NULL;
|
||||
rinfo->sr.nexthops_backup = NULL;
|
||||
/*
|
||||
* For now, always force routes that have backup
|
||||
* nexthops to be reinstalled.
|
||||
|
@ -63,6 +63,9 @@ struct isis_sr_psid_info {
|
||||
bool present;
|
||||
|
||||
uint8_t algorithm;
|
||||
|
||||
struct list *nexthops;
|
||||
struct list *nexthops_backup;
|
||||
};
|
||||
|
||||
/* Segment Routing Local Block allocation */
|
||||
|
@ -327,7 +327,6 @@ void isis_zebra_route_del_route(struct isis *isis,
|
||||
*/
|
||||
void isis_zebra_prefix_sid_install(struct isis_area *area,
|
||||
struct prefix *prefix,
|
||||
struct isis_route_info *rinfo,
|
||||
struct isis_sr_psid_info *psid)
|
||||
{
|
||||
struct zapi_labels zl;
|
||||
@ -342,7 +341,7 @@ void isis_zebra_prefix_sid_install(struct isis_area *area,
|
||||
zl.local_label = psid->label;
|
||||
|
||||
/* Local routes don't have any nexthop and require special handling. */
|
||||
if (list_isempty(rinfo->nexthops)) {
|
||||
if (list_isempty(psid->nexthops)) {
|
||||
struct zapi_nexthop *znh;
|
||||
struct interface *ifp;
|
||||
|
||||
@ -361,9 +360,9 @@ void isis_zebra_prefix_sid_install(struct isis_area *area,
|
||||
znh->labels[0] = MPLS_LABEL_IMPLICIT_NULL;
|
||||
} else {
|
||||
/* Add backup nexthops first. */
|
||||
if (rinfo->backup) {
|
||||
if (psid->nexthops_backup) {
|
||||
count = isis_zebra_add_nexthops(
|
||||
area->isis, rinfo->backup->nexthops,
|
||||
area->isis, psid->nexthops_backup,
|
||||
zl.backup_nexthops, ISIS_NEXTHOP_BACKUP, true,
|
||||
0);
|
||||
if (count > 0) {
|
||||
@ -373,7 +372,7 @@ void isis_zebra_prefix_sid_install(struct isis_area *area,
|
||||
}
|
||||
|
||||
/* Add primary nexthops. */
|
||||
count = isis_zebra_add_nexthops(area->isis, rinfo->nexthops,
|
||||
count = isis_zebra_add_nexthops(area->isis, psid->nexthops,
|
||||
zl.nexthops, ISIS_NEXTHOP_MAIN,
|
||||
true, count);
|
||||
if (!count)
|
||||
|
@ -36,7 +36,6 @@ void isis_zebra_route_del_route(struct isis *isis,
|
||||
struct isis_route_info *route_info);
|
||||
void isis_zebra_prefix_sid_install(struct isis_area *area,
|
||||
struct prefix *prefix,
|
||||
struct isis_route_info *rinfo,
|
||||
struct isis_sr_psid_info *psid);
|
||||
void isis_zebra_prefix_sid_uninstall(struct isis_area *area,
|
||||
struct prefix *prefix,
|
||||
|
Loading…
Reference in New Issue
Block a user