]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zebra_static.h
Merge pull request #1938 from donaldsharp/vpn_peer_withdrawal
[mirror_frr.git] / zebra / zebra_static.h
index 9f76ab5f550d15ede16e47498615ecb46696f3b7..234e3e4036060f0e4927a8bfdbed5e86f055bd20 100644 (file)
 #ifndef __ZEBRA_STATIC_H__
 #define __ZEBRA_STATIC_H__
 
+#include "zebra/zebra_mpls.h"
+
 /* Static route label information */
-struct static_nh_label
-{
-  u_int8_t num_labels;
-  u_int8_t reserved[3];
-  mpls_label_t label[2];
+struct static_nh_label {
+       u_int8_t num_labels;
+       u_int8_t reserved[3];
+       mpls_label_t label[MPLS_MAX_LABELS];
+};
+
+enum static_blackhole_type {
+       STATIC_BLACKHOLE_DROP = 0,
+       STATIC_BLACKHOLE_NULL,
+       STATIC_BLACKHOLE_REJECT
 };
 
 typedef enum {
-  STATIC_IFINDEX,
-  STATIC_IPV4_GATEWAY,
-  STATIC_BLACKHOLE,
-  STATIC_IPV6_GATEWAY,
-  STATIC_IPV6_GATEWAY_IFINDEX,
+       STATIC_IFNAME,
+       STATIC_IPV4_GATEWAY,
+       STATIC_IPV4_GATEWAY_IFNAME,
+       STATIC_BLACKHOLE,
+       STATIC_IPV6_GATEWAY,
+       STATIC_IPV6_GATEWAY_IFNAME,
 } zebra_static_types;
 
 /* Static route information. */
-struct static_route
-{
-  /* For linked list. */
-  struct static_route *prev;
-  struct static_route *next;
-
-  /* VRF identifier. */
-  vrf_id_t vrf_id;
-
-  /* Administrative distance. */
-  u_char distance;
-
-  /* Tag */
-  route_tag_t tag;
-
-  /* Flag for this static route's type. */
-  zebra_static_types type;
-
-  /*
-   * Nexthop value.
-   *
-   * Under IPv4 addr and ifindex are
-   * used independentyly.
-   * STATIC_IPV4_GATEWAY uses addr
-   * STATIC_IFINDEX uses ifindex
-   */
-  union g_addr addr;
-  ifindex_t ifindex;
-
-  char ifname[INTERFACE_NAMSIZ + 1];
-
-  /* bit flags */
-  u_char flags;
-/*
- see ZEBRA_FLAG_REJECT
-     ZEBRA_FLAG_BLACKHOLE
- */
+struct static_route {
+       /* For linked list. */
+       struct static_route *prev;
+       struct static_route *next;
+
+       /* VRF identifier. */
+       vrf_id_t vrf_id;
+       vrf_id_t nh_vrf_id;
+
+       /* Administrative distance. */
+       u_char distance;
+
+       /* Tag */
+       route_tag_t tag;
+
+       /* Flag for this static route's type. */
+       zebra_static_types type;
+
+       /*
+        * Nexthop value.
+        */
+       enum static_blackhole_type bh_type;
+       union g_addr addr;
+       ifindex_t ifindex;
+
+       char ifname[INTERFACE_NAMSIZ + 1];
 
-  /* Label information */
-  struct static_nh_label snh_label;
+       /* Label information */
+       struct static_nh_label snh_label;
 };
 
-extern void
-static_install_route (afi_t afi, safi_t safi, struct prefix *p,
-                      struct prefix_ipv6 *src_p, struct static_route *si);
-extern void
-static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p,
-                        struct prefix_ipv6 *src_p, struct static_route *si);
-
-extern int
-static_add_route (afi_t, safi_t safi, u_char type, struct prefix *p,
-                 struct prefix_ipv6 *src_p,
-                 union g_addr *gate, ifindex_t ifindex,
-                 const char *ifname, u_char flags, route_tag_t tag,
-                 u_char distance, struct zebra_vrf *zvrf,
-                 struct static_nh_label *snh_label);
-
-extern int
-static_delete_route (afi_t, safi_t safi, u_char type, struct prefix *p,
-                    struct prefix_ipv6 *src_p,
-                    union g_addr *gate, ifindex_t ifindex, route_tag_t tag,
-                    u_char distance, struct zebra_vrf *zvrf,
-                    struct static_nh_label *snh_label);
-
-int
-zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
-                  const char *dest_str, const char *mask_str,
-                  const char *gate_str, const char *flag_str,
-                  const char *tag_str, const char *distance_str,
-                  const char *vrf_id_str, const char *label_str);
-
-int
-static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
-                 const char *src_str,
-                 const char *gate_str, const char *ifname,
-                 const char *flag_str, const char *tag_str,
-                  const char *distance_str, const char *vrf_id_str,
-                 const char *label_str);
+extern void static_install_route(afi_t afi, safi_t safi, struct prefix *p,
+                                struct prefix_ipv6 *src_p,
+                                struct static_route *si);
+extern void static_uninstall_route(afi_t afi, safi_t safi, struct prefix *p,
+                                  struct prefix_ipv6 *src_p,
+                                  struct static_route *si);
+
+extern int static_add_route(afi_t, safi_t safi, u_char type, struct prefix *p,
+                           struct prefix_ipv6 *src_p, union g_addr *gate,
+                           const char *ifname,
+                           enum static_blackhole_type bh_type, route_tag_t tag,
+                           u_char distance, struct zebra_vrf *zvrf,
+                           struct zebra_vrf *nh_zvrf,
+                           struct static_nh_label *snh_label);
+
+extern int static_delete_route(afi_t, safi_t safi, u_char type,
+                              struct prefix *p, struct prefix_ipv6 *src_p,
+                              union g_addr *gate, const char *ifname,
+                              route_tag_t tag, u_char distance,
+                              struct zebra_vrf *zvrf,
+                              struct static_nh_label *snh_label);
+
+extern void static_ifindex_update(struct interface *ifp, bool up);
 
 #endif