]>
Commit | Line | Data |
---|---|---|
7e24fdf3 DS |
1 | /* |
2 | * STATICd - static routes header | |
3 | * Copyright (C) 2018 Cumulus Networks, Inc. | |
4 | * Donald Sharp | |
5 | * | |
8d5cbee9 DS |
6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of the GNU General Public License as published by the Free | |
8 | * Software Foundation; either version 2 of the License, or (at your option) | |
9 | * any later version. | |
7e24fdf3 | 10 | * |
8d5cbee9 DS |
11 | * This program is distributed in the hope that it will be useful, but WITHOUT |
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
14 | * more details. | |
7e24fdf3 DS |
15 | * |
16 | * You should have received a copy of the GNU General Public License along | |
17 | * with this program; see the file COPYING; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | */ | |
20 | #ifndef __STATIC_ROUTES_H__ | |
21 | #define __STATIC_ROUTES_H__ | |
22 | ||
23 | #include "lib/mpls.h" | |
24 | ||
25 | /* Static route label information */ | |
26 | struct static_nh_label { | |
27 | uint8_t num_labels; | |
28 | uint8_t reserved[3]; | |
29 | mpls_label_t label[MPLS_MAX_LABELS]; | |
30 | }; | |
31 | ||
32 | enum static_blackhole_type { | |
33 | STATIC_BLACKHOLE_DROP = 0, | |
34 | STATIC_BLACKHOLE_NULL, | |
35 | STATIC_BLACKHOLE_REJECT | |
36 | }; | |
37 | ||
38 | typedef enum { | |
39 | STATIC_IFNAME, | |
40 | STATIC_IPV4_GATEWAY, | |
41 | STATIC_IPV4_GATEWAY_IFNAME, | |
42 | STATIC_BLACKHOLE, | |
43 | STATIC_IPV6_GATEWAY, | |
44 | STATIC_IPV6_GATEWAY_IFNAME, | |
45 | } static_types; | |
46 | ||
47 | /* Static route information. */ | |
48 | struct static_route { | |
49 | /* For linked list. */ | |
50 | struct static_route *prev; | |
51 | struct static_route *next; | |
52 | ||
53 | /* VRF identifier. */ | |
54 | vrf_id_t vrf_id; | |
55 | vrf_id_t nh_vrf_id; | |
56 | char nh_vrfname[VRF_NAMSIZ + 1]; | |
57 | ||
58 | /* Administrative distance. */ | |
59 | uint8_t distance; | |
60 | ||
61 | /* Tag */ | |
62 | route_tag_t tag; | |
63 | ||
64 | /* Flag for this static route's type. */ | |
65 | static_types type; | |
66 | ||
67 | /* | |
68 | * Nexthop value. | |
69 | */ | |
70 | enum static_blackhole_type bh_type; | |
71 | union g_addr addr; | |
72 | ifindex_t ifindex; | |
73 | bool nh_registered; | |
74 | bool nh_valid; | |
75 | ||
76 | char ifname[INTERFACE_NAMSIZ + 1]; | |
77 | ||
78 | /* Label information */ | |
79 | struct static_nh_label snh_label; | |
80 | ||
81 | uint32_t table_id; | |
02dc8ba3 QY |
82 | |
83 | /* | |
84 | * Whether to pretend the nexthop is directly attached to the specified | |
85 | * link. Only meaningful when both a gateway address and interface name | |
86 | * are specified. | |
87 | */ | |
88 | bool onlink; | |
7e24fdf3 DS |
89 | }; |
90 | ||
91 | extern bool mpls_enabled; | |
92 | ||
93 | extern struct zebra_privs_t static_privs; | |
94 | ||
95 | void static_fixup_vrf_ids(struct static_vrf *svrf); | |
96 | ||
97 | extern int static_add_route(afi_t afi, safi_t safi, uint8_t type, | |
98 | struct prefix *p, struct prefix_ipv6 *src_p, | |
99 | union g_addr *gate, const char *ifname, | |
100 | enum static_blackhole_type bh_type, route_tag_t tag, | |
101 | uint8_t distance, struct static_vrf *svrf, | |
102 | struct static_vrf *nh_svrf, | |
103 | struct static_nh_label *snh_label, | |
02dc8ba3 | 104 | uint32_t table_id, bool onlink); |
7e24fdf3 DS |
105 | |
106 | extern int static_delete_route(afi_t afi, safi_t safi, uint8_t type, | |
107 | struct prefix *p, struct prefix_ipv6 *src_p, | |
108 | union g_addr *gate, const char *ifname, | |
109 | route_tag_t tag, uint8_t distance, | |
110 | struct static_vrf *svrf, | |
111 | struct static_nh_label *snh_label, | |
112 | uint32_t table_id); | |
113 | ||
114 | extern void static_cleanup_vrf_ids(struct static_vrf *disable_svrf); | |
115 | ||
a9be49bc DS |
116 | extern void static_install_intf_nh(struct interface *ifp); |
117 | ||
7e24fdf3 DS |
118 | extern void static_ifindex_update(struct interface *ifp, bool up); |
119 | #endif |