]> git.proxmox.com Git - mirror_frr.git/blobdiff - staticd/static_routes.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / staticd / static_routes.h
index 2211384916a35866f2b6ac94e48c954b54814410..eb7953db2cfb79dab27c097b0cc2b541a7eaa4f9 100644 (file)
@@ -1,25 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * STATICd - static routes header
  * Copyright (C) 2018 Cumulus Networks, Inc.
  *               Donald Sharp
- *
- * 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
  */
 #ifndef __STATIC_ROUTES_H__
 #define __STATIC_ROUTES_H__
 
+#include "lib/bfd.h"
 #include "lib/mpls.h"
 #include "table.h"
 #include "memory.h"
@@ -30,6 +18,8 @@ extern "C" {
 
 DECLARE_MGROUP(STATIC);
 
+#include "staticd/static_vrf.h"
+
 /* Static route label information */
 struct static_nh_label {
        uint8_t num_labels;
@@ -47,14 +37,14 @@ enum static_blackhole_type {
  * The order for below macros should be in sync with
  * yang model typedef nexthop-type
  */
-typedef enum {
+enum static_nh_type {
        STATIC_IFNAME = 1,
        STATIC_IPV4_GATEWAY,
        STATIC_IPV4_GATEWAY_IFNAME,
        STATIC_IPV6_GATEWAY,
        STATIC_IPV6_GATEWAY_IFNAME,
        STATIC_BLACKHOLE,
-} static_types;
+};
 
 /*
  * Route Creation gives us:
@@ -123,7 +113,7 @@ struct static_nexthop {
        enum static_install_states state;
 
        /* Flag for this static route's type. */
-       static_types type;
+       enum static_nh_type type;
 
        /*
         * Nexthop value.
@@ -148,6 +138,13 @@ struct static_nexthop {
 
        /* SR-TE color */
        uint32_t color;
+
+       /** BFD integration data. */
+       struct bfd_session_params *bsp;
+       /** Back pointer for route node. */
+       struct route_node *rn;
+       /** Path connection status. */
+       bool path_down;
 };
 
 DECLARE_DLIST(static_nexthop_list, struct static_nexthop, list);
@@ -163,13 +160,14 @@ static_route_info_from_rnode(struct route_node *rn)
 }
 
 extern bool mpls_enabled;
+extern uint32_t zebra_ecmp_count;
 
 extern struct zebra_privs_t static_privs;
 
 void static_fixup_vrf_ids(struct static_vrf *svrf);
 
 extern struct static_nexthop *
-static_add_nexthop(struct static_path *pn, static_types type,
+static_add_nexthop(struct static_path *pn, enum static_nh_type type,
                   struct ipaddr *ipaddr, const char *ifname,
                   const char *nh_vrf, uint32_t color);
 extern void static_install_nexthop(struct static_nexthop *nh);
@@ -194,9 +192,10 @@ extern struct static_path *static_add_path(struct route_node *rn,
                                           uint32_t table_id, uint8_t distance);
 extern void static_del_path(struct static_path *pn);
 
-extern void static_get_nh_type(static_types stype, char *type, size_t size);
+extern void static_get_nh_type(enum static_nh_type stype, char *type,
+                              size_t size);
 extern bool static_add_nexthop_validate(const char *nh_vrf_name,
-                                       static_types type,
+                                       enum static_nh_type type,
                                        struct ipaddr *ipaddr);
 extern struct stable_info *static_get_stable_info(struct route_node *rn);
 
@@ -216,6 +215,24 @@ extern void zebra_stable_node_cleanup(struct route_table *table,
 extern void static_get_nh_str(struct static_nexthop *nh, char *nexthop,
                              size_t size);
 
+/*
+ * BFD integration.
+ */
+extern void static_next_hop_bfd_source(struct static_nexthop *sn,
+                                      const struct ipaddr *source);
+extern void static_next_hop_bfd_auto_source(struct static_nexthop *sn);
+extern void static_next_hop_bfd_monitor_enable(struct static_nexthop *sn,
+                                              const struct lyd_node *dnode);
+extern void static_next_hop_bfd_monitor_disable(struct static_nexthop *sn);
+extern void static_next_hop_bfd_profile(struct static_nexthop *sn,
+                                       const char *name);
+extern void static_next_hop_bfd_multi_hop(struct static_nexthop *sn, bool mhop);
+
+/** Call this function after zebra client initialization. */
+extern void static_bfd_initialize(struct zclient *zc, struct thread_master *tm);
+
+extern void static_bfd_show(struct vty *vty, bool isjson);
+
 #ifdef __cplusplus
 }
 #endif