]>
Commit | Line | Data |
---|---|---|
28f6dde8 DS |
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 | * | |
896014f4 DL |
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 | |
28f6dde8 DS |
21 | */ |
22 | #ifndef __ZEBRA_STATIC_H__ | |
23 | #define __ZEBRA_STATIC_H__ | |
24 | ||
5e8c8947 RW |
25 | #include "zebra/zebra_mpls.h" |
26 | ||
a22f3f5d | 27 | /* Static route label information */ |
d62a17ae | 28 | struct static_nh_label { |
d7c0a89a QY |
29 | uint8_t num_labels; |
30 | uint8_t reserved[3]; | |
5e8c8947 | 31 | mpls_label_t label[MPLS_MAX_LABELS]; |
a22f3f5d | 32 | }; |
33 | ||
9aabb2ea RW |
34 | enum static_blackhole_type { |
35 | STATIC_BLACKHOLE_DROP = 0, | |
36 | STATIC_BLACKHOLE_NULL, | |
37 | STATIC_BLACKHOLE_REJECT | |
38 | }; | |
39 | ||
4b2792b5 | 40 | typedef enum { |
23443030 | 41 | STATIC_IFNAME, |
d62a17ae | 42 | STATIC_IPV4_GATEWAY, |
23443030 | 43 | STATIC_IPV4_GATEWAY_IFNAME, |
d62a17ae | 44 | STATIC_BLACKHOLE, |
45 | STATIC_IPV6_GATEWAY, | |
23443030 | 46 | STATIC_IPV6_GATEWAY_IFNAME, |
4b2792b5 DS |
47 | } zebra_static_types; |
48 | ||
28f6dde8 | 49 | /* Static route information. */ |
d62a17ae | 50 | struct static_route { |
51 | /* For linked list. */ | |
52 | struct static_route *prev; | |
53 | struct static_route *next; | |
54 | ||
55 | /* VRF identifier. */ | |
56 | vrf_id_t vrf_id; | |
cbb0dbf6 | 57 | vrf_id_t nh_vrf_id; |
90f86c0a | 58 | char nh_vrfname[VRF_NAMSIZ + 1]; |
d62a17ae | 59 | |
60 | /* Administrative distance. */ | |
d7c0a89a | 61 | uint8_t distance; |
d62a17ae | 62 | |
63 | /* Tag */ | |
64 | route_tag_t tag; | |
65 | ||
66 | /* Flag for this static route's type. */ | |
67 | zebra_static_types type; | |
68 | ||
69 | /* | |
70 | * Nexthop value. | |
d62a17ae | 71 | */ |
9aabb2ea | 72 | enum static_blackhole_type bh_type; |
d62a17ae | 73 | union g_addr addr; |
74 | ifindex_t ifindex; | |
75 | ||
76 | char ifname[INTERFACE_NAMSIZ + 1]; | |
77 | ||
d62a17ae | 78 | /* Label information */ |
79 | struct static_nh_label snh_label; | |
b3b08602 PG |
80 | |
81 | /* Table Information */ | |
82 | uint32_t table_id; | |
28f6dde8 DS |
83 | }; |
84 | ||
86391e56 MS |
85 | extern void static_install_route(afi_t afi, safi_t safi, const struct prefix *p, |
86 | const struct prefix_ipv6 *src_p, | |
d62a17ae | 87 | struct static_route *si); |
86391e56 MS |
88 | extern void static_uninstall_route(afi_t afi, safi_t safi, |
89 | const struct prefix *p, | |
90 | const struct prefix_ipv6 *src_p, | |
d62a17ae | 91 | struct static_route *si); |
92 | ||
d7c0a89a | 93 | extern int static_add_route(afi_t, safi_t safi, uint8_t type, struct prefix *p, |
d62a17ae | 94 | struct prefix_ipv6 *src_p, union g_addr *gate, |
9aabb2ea RW |
95 | const char *ifname, |
96 | enum static_blackhole_type bh_type, route_tag_t tag, | |
d7c0a89a | 97 | uint8_t distance, struct zebra_vrf *zvrf, |
cbb0dbf6 | 98 | struct zebra_vrf *nh_zvrf, |
b3b08602 PG |
99 | struct static_nh_label *snh_label, |
100 | uint32_t table_id); | |
d62a17ae | 101 | |
d7c0a89a | 102 | extern int static_delete_route(afi_t, safi_t safi, uint8_t type, |
d62a17ae | 103 | struct prefix *p, struct prefix_ipv6 *src_p, |
c3c04063 | 104 | union g_addr *gate, const char *ifname, |
d7c0a89a | 105 | route_tag_t tag, uint8_t distance, |
d62a17ae | 106 | struct zebra_vrf *zvrf, |
b3b08602 PG |
107 | struct static_nh_label *snh_label, |
108 | uint32_t table_id); | |
d62a17ae | 109 | |
c3c04063 DL |
110 | extern void static_ifindex_update(struct interface *ifp, bool up); |
111 | ||
90f86c0a DS |
112 | extern void static_cleanup_vrf_ids(struct zebra_vrf *zvrf); |
113 | extern void static_fixup_vrf_ids(struct zebra_vrf *zvrf); | |
28f6dde8 | 114 | #endif |