]> git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_static.h
Merge branch 'stable/3.0'
[mirror_frr.git] / zebra / zebra_static.h
1 /*
2 * Static Routing Information header
3 * Copyright (C) 2016 Cumulus Networks
4 * Donald Sharp
5 *
6 * This file is part of Quagga.
7 *
8 * Quagga is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * Quagga is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22 #ifndef __ZEBRA_STATIC_H__
23 #define __ZEBRA_STATIC_H__
24
25 /* Static route label information */
26 struct static_nh_label
27 {
28 u_int8_t num_labels;
29 u_int8_t reserved[3];
30 mpls_label_t label[2];
31 };
32
33 typedef enum {
34 STATIC_IFINDEX,
35 STATIC_IPV4_GATEWAY,
36 STATIC_BLACKHOLE,
37 STATIC_IPV6_GATEWAY,
38 STATIC_IPV6_GATEWAY_IFINDEX,
39 } zebra_static_types;
40
41 /* Static route information. */
42 struct static_route
43 {
44 /* For linked list. */
45 struct static_route *prev;
46 struct static_route *next;
47
48 /* VRF identifier. */
49 vrf_id_t vrf_id;
50
51 /* Administrative distance. */
52 u_char distance;
53
54 /* Tag */
55 route_tag_t tag;
56
57 /* Flag for this static route's type. */
58 zebra_static_types type;
59
60 /*
61 * Nexthop value.
62 *
63 * Under IPv4 addr and ifindex are
64 * used independentyly.
65 * STATIC_IPV4_GATEWAY uses addr
66 * STATIC_IFINDEX uses ifindex
67 */
68 union g_addr addr;
69 ifindex_t ifindex;
70
71 char ifname[INTERFACE_NAMSIZ + 1];
72
73 /* bit flags */
74 u_char flags;
75 /*
76 see ZEBRA_FLAG_REJECT
77 ZEBRA_FLAG_BLACKHOLE
78 */
79
80 /* Label information */
81 struct static_nh_label snh_label;
82 };
83
84 extern void
85 static_install_route (afi_t afi, safi_t safi, struct prefix *p,
86 struct prefix_ipv6 *src_p, struct static_route *si);
87 extern void
88 static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p,
89 struct prefix_ipv6 *src_p, struct static_route *si);
90
91 extern int
92 static_add_route (afi_t, safi_t safi, u_char type, struct prefix *p,
93 struct prefix_ipv6 *src_p,
94 union g_addr *gate, ifindex_t ifindex,
95 const char *ifname, u_char flags, route_tag_t tag,
96 u_char distance, struct zebra_vrf *zvrf,
97 struct static_nh_label *snh_label);
98
99 extern int
100 static_delete_route (afi_t, safi_t safi, u_char type, struct prefix *p,
101 struct prefix_ipv6 *src_p,
102 union g_addr *gate, ifindex_t ifindex, route_tag_t tag,
103 u_char distance, struct zebra_vrf *zvrf,
104 struct static_nh_label *snh_label);
105
106 int
107 zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
108 const char *dest_str, const char *mask_str,
109 const char *gate_str, const char *flag_str,
110 const char *tag_str, const char *distance_str,
111 const char *vrf_id_str, const char *label_str);
112
113 int
114 static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
115 const char *src_str,
116 const char *gate_str, const char *ifname,
117 const char *flag_str, const char *tag_str,
118 const char *distance_str, const char *vrf_id_str,
119 const char *label_str);
120
121 #endif