]> git.puffer.fish Git - mirror/frr.git/commitdiff
isisd: update struct isis_sr_psid_info with nh context
authorHiroki Shirokura <hiroki.shirokura@linecorp.com>
Tue, 4 Jan 2022 08:15:56 +0000 (08:15 +0000)
committerLouis Scalbert <louis.scalbert@6wind.com>
Tue, 18 Apr 2023 08:11:53 +0000 (10:11 +0200)
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>
isisd/isis_route.c
isisd/isis_sr.h
isisd/isis_zebra.c
isisd/isis_zebra.h

index 9a12df2fae9f438079285f3e5aae3a54aa233642..20d30a148c5011d9f575ba90e1f1d52190a8eb2e 100644 (file)
@@ -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.
index 7c02224011c92031e6492d65bbb165c4f80b87bf..f5f0adf241e28f7f31873a2862adfb7c87313fec 100644 (file)
@@ -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 */
index c1f02361bdc0d96a2b9ee0131ea0e5422732301b..59b80c1e20a1c5d31970abd5dd508ebef2d09481 100644 (file)
@@ -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)
index 359e39b59dd03ca7a3516680e35718a5068feb98..045c75874a26f015b894b01295e54afb92af91ad 100644 (file)
@@ -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,