]> git.proxmox.com Git - mirror_frr.git/blobdiff - isisd/isis_spf_private.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / isisd / isis_spf_private.h
index 9cb1a39b827253152eb2a49eacd1c070df87788d..d8293727020908ed3c1fa5b304da4f1dfa98e4ce 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * IS-IS Rout(e)ing protocol                  - isis_spf_private.h
  *
@@ -5,20 +6,6 @@
  *                           Tampere University of Technology
  *                           Institute of Communications Engineering
  * Copyright (C) 2017        Christian Franke <chris@opensourcerouting.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public Licenseas 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
  */
 #ifndef ISIS_SPF_PRIVATE_H
 #define ISIS_SPF_PRIVATE_H
@@ -54,6 +41,7 @@ struct isis_vertex_adj {
        struct isis_spf_adj *sadj;
        struct isis_sr_psid_info sr;
        struct mpls_label_stack *label_stack;
+       uint32_t lfa_metric;
 };
 
 /*
@@ -66,6 +54,7 @@ struct isis_vertex {
                struct {
                        struct prefix_pair p;
                        struct isis_sr_psid_info sr;
+                       enum spf_prefix_priority priority;
                } ip;
        } N;
        uint32_t d_N;     /* d(N) Distance from this IS      */
@@ -74,7 +63,9 @@ struct isis_vertex {
        struct list *parents;  /* list of parents for ECMP */
        struct hash *firsthops; /* first two hops to neighbor */
        uint64_t insert_counter;
+       uint8_t flags;
 };
+#define F_ISIS_VERTEX_LFA_PROTECTED    0x01
 
 /* Vertex Queue and associated functions */
 
@@ -175,24 +166,16 @@ static void isis_vertex_queue_init(struct isis_vertex_queue *queue,
                                  isis_vertex_queue_hash_cmp, name);
 }
 
-__attribute__((__unused__))
-static void isis_vertex_del(struct isis_vertex *vertex)
-{
-       list_delete(&vertex->Adj_N);
-       list_delete(&vertex->parents);
-       if (vertex->firsthops) {
-               hash_clean(vertex->firsthops, NULL);
-               hash_free(vertex->firsthops);
-               vertex->firsthops = NULL;
-       }
-
-       memset(vertex, 0, sizeof(struct isis_vertex));
-       XFREE(MTYPE_ISIS_VERTEX, vertex);
-}
+void isis_vertex_del(struct isis_vertex *vertex);
 
 bool isis_vertex_adj_exists(const struct isis_spftree *spftree,
                            const struct isis_vertex *vertex,
                            const struct isis_spf_adj *sadj);
+void isis_vertex_adj_free(void *arg);
+struct isis_vertex_adj *
+isis_vertex_adj_add(struct isis_spftree *spftree, struct isis_vertex *vertex,
+                   struct list *vadj_list, struct isis_spf_adj *sadj,
+                   struct isis_prefix_sid *psid, bool last_hop);
 
 __attribute__((__unused__))
 static void isis_vertex_queue_clear(struct isis_vertex_queue *queue)
@@ -341,6 +324,30 @@ struct isis_spftree {
                /* P-space and Q-space. */
                struct isis_spf_nodes p_space;
                struct isis_spf_nodes q_space;
+
+               /* Remote LFA related information. */
+               struct {
+                       /* List of RLFAs eligible to be installed. */
+                       struct rlfa_tree_head rlfas;
+
+                       /*
+                        * RLFA post-convergence SPTs (needed to activate RLFAs
+                        * once label information is received from LDP).
+                        */
+                       struct list *pc_spftrees;
+
+                       /* RLFA maximum metric (or zero if absent). */
+                       uint32_t max_metric;
+               } remote;
+
+               /* Protection counters. */
+               struct {
+                       uint32_t lfa[SPF_PREFIX_PRIO_MAX];
+                       uint32_t rlfa[SPF_PREFIX_PRIO_MAX];
+                       uint32_t tilfa[SPF_PREFIX_PRIO_MAX];
+                       uint32_t ecmp[SPF_PREFIX_PRIO_MAX];
+                       uint32_t total[SPF_PREFIX_PRIO_MAX];
+               } protection_counters;
        } lfa;
        uint8_t flags;
 };