]> git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_static.h
adc2efff585cb52bf48fd27d5c6f062b638040cd
[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
19 * along with Quagga; see the file COPYING. If not, write to the Free
20 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 * 02111-1307, USA.
22 */
23 #ifndef __ZEBRA_STATIC_H__
24 #define __ZEBRA_STATIC_H__
25
26 /* Static route label information */
27 struct static_nh_label
28 {
29 u_int8_t num_labels;
30 u_int8_t reserved[3];
31 mpls_label_t label[2];
32 };
33
34 typedef enum {
35 STATIC_IFINDEX,
36 STATIC_IPV4_GATEWAY,
37 STATIC_BLACKHOLE,
38 STATIC_IPV6_GATEWAY,
39 STATIC_IPV6_GATEWAY_IFINDEX,
40 } zebra_static_types;
41
42 /* Static route information. */
43 struct static_route
44 {
45 /* For linked list. */
46 struct static_route *prev;
47 struct static_route *next;
48
49 /* VRF identifier. */
50 vrf_id_t vrf_id;
51
52 /* Administrative distance. */
53 u_char distance;
54
55 /* Tag */
56 route_tag_t tag;
57
58 /* Flag for this static route's type. */
59 zebra_static_types type;
60
61 /*
62 * Nexthop value.
63 *
64 * Under IPv4 addr and ifindex are
65 * used independentyly.
66 * STATIC_IPV4_GATEWAY uses addr
67 * STATIC_IFINDEX uses ifindex
68 */
69 union g_addr addr;
70 ifindex_t ifindex;
71
72 char ifname[INTERFACE_NAMSIZ + 1];
73
74 /* bit flags */
75 u_char flags;
76 /*
77 see ZEBRA_FLAG_REJECT
78 ZEBRA_FLAG_BLACKHOLE
79 */
80
81 /* Label information */
82 struct static_nh_label snh_label;
83 };
84
85 extern void
86 static_install_route (afi_t afi, safi_t safi, struct prefix *p,
87 struct prefix_ipv6 *src_p, struct static_route *si);
88 extern void
89 static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p,
90 struct prefix_ipv6 *src_p, struct static_route *si);
91
92 extern int
93 static_add_route (afi_t, safi_t safi, u_char type, struct prefix *p,
94 struct prefix_ipv6 *src_p,
95 union g_addr *gate, ifindex_t ifindex,
96 const char *ifname, u_char flags, route_tag_t tag,
97 u_char distance, struct zebra_vrf *zvrf,
98 struct static_nh_label *snh_label);
99
100 extern int
101 static_delete_route (afi_t, safi_t safi, u_char type, struct prefix *p,
102 struct prefix_ipv6 *src_p,
103 union g_addr *gate, ifindex_t ifindex, route_tag_t tag,
104 u_char distance, struct zebra_vrf *zvrf,
105 struct static_nh_label *snh_label);
106
107 int
108 zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
109 const char *dest_str, const char *mask_str,
110 const char *gate_str, const char *flag_str,
111 const char *tag_str, const char *distance_str,
112 const char *vrf_id_str, const char *label_str);
113
114 int
115 static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
116 const char *src_str,
117 const char *gate_str, const char *ifname,
118 const char *flag_str, const char *tag_str,
119 const char *distance_str, const char *vrf_id_str,
120 const char *label_str);
121
122 #endif