Skip to content

Commit bdaafbf

Browse files
slankdevlouis-6wind
authored andcommitted
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 <[email protected]> Signed-off-by: Louis Scalbert <[email protected]>
1 parent 484ab40 commit bdaafbf

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

isisd/isis_route.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p,
239239
rinfo->cost = cost;
240240
rinfo->depth = depth;
241241
rinfo->sr = *sr;
242+
rinfo->sr.nexthops = rinfo->nexthops;
243+
rinfo->sr.nexthops_backup =
244+
rinfo->backup ? rinfo->backup->nexthops : NULL;
242245

243246
return rinfo;
244247
}
@@ -489,8 +492,9 @@ static void isis_route_update(struct isis_area *area, struct prefix *prefix,
489492
route_info);
490493
/* Install/reinstall Prefix-SID label. */
491494
if (route_info->sr.present)
492-
isis_zebra_prefix_sid_install(area, prefix, route_info,
495+
isis_zebra_prefix_sid_install(area, prefix,
493496
&route_info->sr);
497+
494498
hook_call(isis_route_update_hook, area, prefix, route_info);
495499

496500
SET_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
@@ -541,10 +545,13 @@ static void _isis_route_verify_table(struct isis_area *area,
541545
src_p);
542546
if (rnode_bck) {
543547
rinfo->backup = rnode_bck->info;
548+
rinfo->sr.nexthops_backup =
549+
rinfo->backup->nexthops;
544550
UNSET_FLAG(rinfo->flag,
545551
ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
546552
} else if (rinfo->backup) {
547553
rinfo->backup = NULL;
554+
rinfo->sr.nexthops_backup = NULL;
548555
UNSET_FLAG(rinfo->flag,
549556
ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
550557
}
@@ -658,10 +665,13 @@ void isis_route_verify_merge(struct isis_area *area,
658665
tables_backup[level - 1], prefix, src_p);
659666
if (rnode_bck) {
660667
rinfo->backup = rnode_bck->info;
668+
rinfo->sr.nexthops_backup =
669+
rinfo->backup->nexthops;
661670
UNSET_FLAG(rinfo->flag,
662671
ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
663672
} else if (rinfo->backup) {
664673
rinfo->backup = NULL;
674+
rinfo->sr.nexthops_backup = NULL;
665675
UNSET_FLAG(rinfo->flag,
666676
ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
667677
}
@@ -720,6 +730,7 @@ void isis_route_invalidate_table(struct isis_area *area,
720730

721731
if (rinfo->backup) {
722732
rinfo->backup = NULL;
733+
rinfo->sr.nexthops_backup = NULL;
723734
/*
724735
* For now, always force routes that have backup
725736
* nexthops to be reinstalled.

isisd/isis_sr.h

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ struct isis_sr_psid_info {
6363
bool present;
6464

6565
uint8_t algorithm;
66+
67+
struct list *nexthops;
68+
struct list *nexthops_backup;
6669
};
6770

6871
/* Segment Routing Local Block allocation */

isisd/isis_zebra.c

+4-5
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ void isis_zebra_route_del_route(struct isis *isis,
327327
*/
328328
void isis_zebra_prefix_sid_install(struct isis_area *area,
329329
struct prefix *prefix,
330-
struct isis_route_info *rinfo,
331330
struct isis_sr_psid_info *psid)
332331
{
333332
struct zapi_labels zl;
@@ -342,7 +341,7 @@ void isis_zebra_prefix_sid_install(struct isis_area *area,
342341
zl.local_label = psid->label;
343342

344343
/* Local routes don't have any nexthop and require special handling. */
345-
if (list_isempty(rinfo->nexthops)) {
344+
if (list_isempty(psid->nexthops)) {
346345
struct zapi_nexthop *znh;
347346
struct interface *ifp;
348347

@@ -361,9 +360,9 @@ void isis_zebra_prefix_sid_install(struct isis_area *area,
361360
znh->labels[0] = MPLS_LABEL_IMPLICIT_NULL;
362361
} else {
363362
/* Add backup nexthops first. */
364-
if (rinfo->backup) {
363+
if (psid->nexthops_backup) {
365364
count = isis_zebra_add_nexthops(
366-
area->isis, rinfo->backup->nexthops,
365+
area->isis, psid->nexthops_backup,
367366
zl.backup_nexthops, ISIS_NEXTHOP_BACKUP, true,
368367
0);
369368
if (count > 0) {
@@ -373,7 +372,7 @@ void isis_zebra_prefix_sid_install(struct isis_area *area,
373372
}
374373

375374
/* Add primary nexthops. */
376-
count = isis_zebra_add_nexthops(area->isis, rinfo->nexthops,
375+
count = isis_zebra_add_nexthops(area->isis, psid->nexthops,
377376
zl.nexthops, ISIS_NEXTHOP_MAIN,
378377
true, count);
379378
if (!count)

isisd/isis_zebra.h

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ void isis_zebra_route_del_route(struct isis *isis,
3636
struct isis_route_info *route_info);
3737
void isis_zebra_prefix_sid_install(struct isis_area *area,
3838
struct prefix *prefix,
39-
struct isis_route_info *rinfo,
4039
struct isis_sr_psid_info *psid);
4140
void isis_zebra_prefix_sid_uninstall(struct isis_area *area,
4241
struct prefix *prefix,

0 commit comments

Comments
 (0)