]> git.proxmox.com Git - mirror_frr.git/blobdiff - isisd/isis_sr.c
Merge pull request #12698 from Orange-OpenSource/isisd
[mirror_frr.git] / isisd / isis_sr.c
index 107fa71d71ebb0caf990f2fafef21188c827c784..e43b84ab2e4d5385c20457cd31b801297a29d8b3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * This is an implementation of Segment Routing for IS-IS as per RFC 8667
  *
@@ -5,20 +6,6 @@
  *
  * Author: Olivier Dugeon <olivier.dugeon@orange.com>
  * Contributor: Renato Westphal <renato@opensourcerouting.org> for NetDEF
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <zebra.h>
@@ -1035,14 +1022,14 @@ static void show_node(struct vty *vty, struct isis_area *area, int level)
                if (!cap)
                        continue;
 
-               ttable_add_row(
-                       tt, "%s|%u - %u|%u - %u|%s|%u",
-                       sysid_print(lsp->hdr.lsp_id), cap->srgb.lower_bound,
-                       cap->srgb.lower_bound + cap->srgb.range_size - 1,
-                       cap->srlb.lower_bound,
-                       cap->srlb.lower_bound + cap->srlb.range_size - 1,
-                       cap->algo[0] == SR_ALGORITHM_SPF ? "SPF" : "S-SPF",
-                       cap->msd);
+               ttable_add_row(tt, "%pSY|%u - %u|%u - %u|%s|%u",
+                              lsp->hdr.lsp_id, cap->srgb.lower_bound,
+                              cap->srgb.lower_bound + cap->srgb.range_size - 1,
+                              cap->srlb.lower_bound,
+                              cap->srlb.lower_bound + cap->srlb.range_size - 1,
+                              cap->algo[0] == SR_ALGORITHM_SPF ? "SPF"
+                                                               : "S-SPF",
+                              cap->msd);
        }
 
        /* Dump the generated table. */
@@ -1057,8 +1044,9 @@ static void show_node(struct vty *vty, struct isis_area *area, int level)
 }
 
 DEFUN(show_sr_node, show_sr_node_cmd,
-      "show isis segment-routing node",
-      SHOW_STR PROTO_HELP
+      "show " PROTO_NAME " segment-routing node",
+      SHOW_STR
+      PROTO_HELP
       "Segment-Routing\n"
       "Segment-Routing node\n")
 {
@@ -1093,11 +1081,11 @@ DEFUN(show_sr_node, show_sr_node_cmd,
  *
  * @return             1 on success
  */
-static void sr_start_label_manager(struct thread *start)
+static void sr_start_label_manager(struct event *start)
 {
        struct isis_area *area;
 
-       area = THREAD_ARG(start);
+       area = EVENT_ARG(start);
 
        /* re-attempt to start SR & Label Manager connection */
        isis_sr_start(area);
@@ -1120,8 +1108,8 @@ int isis_sr_start(struct isis_area *area)
        if (!isis_zebra_label_manager_ready())
                if (isis_zebra_label_manager_connect() < 0) {
                        /* Re-attempt to connect to Label Manager in 1 sec. */
-                       thread_add_timer(master, sr_start_label_manager, area,
-                                        1, &srdb->t_start_lm);
+                       event_add_timer(master, sr_start_label_manager, area, 1,
+                                       &srdb->t_start_lm);
                        return -1;
                }
 
@@ -1180,7 +1168,7 @@ void isis_sr_stop(struct isis_area *area)
                 area->area_tag);
 
        /* Disable any re-attempt to connect to Label Manager */
-       thread_cancel(&srdb->t_start_lm);
+       EVENT_OFF(srdb->t_start_lm);
 
        /* Uninstall all local Adjacency-SIDs. */
        for (ALL_LIST_ELEMENTS(area->srdb.adj_sids, node, nnode, sra))
@@ -1253,6 +1241,9 @@ void isis_sr_area_term(struct isis_area *area)
        if (area->srdb.enabled)
                isis_sr_stop(area);
 
+       /* Free Adjacency SID list */
+       list_delete(&srdb->adj_sids);
+
        /* Clear Prefix-SID configuration. */
        while (srdb_prefix_cfg_count(&srdb->config.prefix_sids) > 0) {
                struct sr_prefix_cfg *pcfg;