]>
Commit | Line | Data |
---|---|---|
7c551956 DS |
1 | /* |
2 | * Zebra Vrf Header | |
3 | * Copyright (C) 2016 Cumulus Networks | |
4 | * Donald Sahrp | |
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 | |
7c551956 DS |
21 | */ |
22 | #if !defined(__ZEBRA_RIB_H__) | |
23 | #define __ZEBRA_RIB_H__ | |
24 | ||
25 | #include <zebra/zebra_ns.h> | |
26 | ||
1b6d5c7e | 27 | /* MPLS (Segment Routing) global block */ |
d62a17ae | 28 | typedef struct mpls_srgb_t_ { |
29 | u_int32_t start_label; | |
30 | u_int32_t end_label; | |
1b6d5c7e VV |
31 | } mpls_srgb_t; |
32 | ||
7c551956 | 33 | /* Routing table instance. */ |
d62a17ae | 34 | struct zebra_vrf { |
35 | /* Back pointer */ | |
36 | struct vrf *vrf; | |
7c551956 | 37 | |
d62a17ae | 38 | /* Description. */ |
39 | char *desc; | |
7c551956 | 40 | |
d62a17ae | 41 | /* FIB identifier. */ |
42 | u_char fib_id; | |
7c551956 | 43 | |
d62a17ae | 44 | /* Flags. */ |
45 | u_int16_t flags; | |
7c551956 | 46 | #define ZEBRA_VRF_RIB_SCHEDULED (1 << 0) |
5a8dfcd8 | 47 | #define ZEBRA_VRF_RETAIN (2 << 0) |
7c551956 | 48 | |
d62a17ae | 49 | u_int32_t table_id; |
7c551956 | 50 | |
d62a17ae | 51 | /* Routing table. */ |
52 | struct route_table *table[AFI_MAX][SAFI_MAX]; | |
7c551956 | 53 | |
d62a17ae | 54 | /* Static route configuration. */ |
55 | struct route_table *stable[AFI_MAX][SAFI_MAX]; | |
7c551956 | 56 | |
d62a17ae | 57 | /* Recursive Nexthop table */ |
58 | struct route_table *rnh_table[AFI_MAX]; | |
7c551956 | 59 | |
d62a17ae | 60 | /* Import check table (used mostly by BGP */ |
61 | struct route_table *import_check_table[AFI_MAX]; | |
7c551956 | 62 | |
d62a17ae | 63 | /* Routing tables off of main table for redistribute table */ |
64 | struct route_table *other_table[AFI_MAX][ZEBRA_KERNEL_TABLE_MAX]; | |
7c551956 | 65 | |
d62a17ae | 66 | /* 2nd pointer type used primarily to quell a warning on |
67 | * ALL_LIST_ELEMENTS_RO | |
68 | */ | |
69 | struct list _rid_all_sorted_list; | |
70 | struct list _rid_lo_sorted_list; | |
71 | struct list *rid_all_sorted_list; | |
72 | struct list *rid_lo_sorted_list; | |
73 | struct prefix rid_user_assigned; | |
7c551956 | 74 | |
d62a17ae | 75 | /* |
76 | * Back pointer to the owning namespace. | |
77 | */ | |
78 | struct zebra_ns *zns; | |
54d48ea1 | 79 | |
d62a17ae | 80 | /* MPLS static LSP config table */ |
81 | struct hash *slsp_table; | |
54d48ea1 | 82 | |
d62a17ae | 83 | /* MPLS label forwarding table */ |
84 | struct hash *lsp_table; | |
939fba27 | 85 | |
d62a17ae | 86 | /* MPLS FEC binding table */ |
87 | struct route_table *fec_table[AFI_MAX]; | |
f31e084c | 88 | |
d62a17ae | 89 | /* MPLS Segment Routing Global block */ |
90 | mpls_srgb_t mpls_srgb; | |
1b6d5c7e | 91 | |
d62a17ae | 92 | /* MPLS processing flags */ |
93 | u_int16_t mpls_flags; | |
939fba27 | 94 | #define MPLS_FLAG_SCHEDULE_LSPS (1 << 0) |
57282a31 | 95 | |
d62a17ae | 96 | /* |
97 | * VNI hash table (for EVPN). Only in default instance. | |
98 | */ | |
99 | struct hash *vni_table; | |
100 | /* | |
101 | * Whether EVPN is enabled or not. | |
102 | */ | |
103 | int advertise_all_vni; | |
104 | ||
105 | /* Route Installs */ | |
106 | uint64_t installs; | |
107 | uint64_t removals; | |
108 | uint64_t neigh_updates; | |
109 | uint64_t lsp_installs; | |
110 | uint64_t lsp_removals; | |
7c551956 DS |
111 | }; |
112 | ||
d62a17ae | 113 | static inline vrf_id_t zvrf_id(struct zebra_vrf *zvrf) |
661512bf | 114 | { |
d62a17ae | 115 | return zvrf->vrf->vrf_id; |
661512bf RW |
116 | } |
117 | ||
d62a17ae | 118 | static inline const char *zvrf_name(struct zebra_vrf *zvrf) |
661512bf | 119 | { |
d62a17ae | 120 | return zvrf->vrf->name; |
661512bf RW |
121 | } |
122 | ||
d62a17ae | 123 | struct route_table *zebra_vrf_table_with_table_id(afi_t afi, safi_t safi, |
124 | vrf_id_t vrf_id, | |
125 | u_int32_t table_id); | |
126 | ||
d62a17ae | 127 | extern void zebra_vrf_update_all(struct zserv *client); |
128 | extern struct zebra_vrf *zebra_vrf_lookup_by_id(vrf_id_t vrf_id); | |
129 | extern struct zebra_vrf *zebra_vrf_lookup_by_name(const char *); | |
130 | extern struct zebra_vrf *zebra_vrf_alloc(void); | |
131 | extern struct route_table *zebra_vrf_table(afi_t, safi_t, vrf_id_t); | |
132 | extern struct route_table *zebra_vrf_static_table(afi_t, safi_t, | |
133 | struct zebra_vrf *zvrf); | |
134 | extern struct route_table * | |
135 | zebra_vrf_other_route_table(afi_t afi, u_int32_t table_id, vrf_id_t vrf_id); | |
136 | extern void zebra_vrf_init(void); | |
7c551956 | 137 | #endif |