]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/rfapi/rfapi_rib.h
Merge branch 'stable/3.0'
[mirror_frr.git] / bgpd / rfapi / rfapi_rib.h
1 /*
2 *
3 * Copyright 2009-2016, LabN Consulting, L.L.C.
4 *
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
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
21 /*
22 * File: rfapi_rib.h
23 * Purpose: per-nve rib
24 */
25
26 #ifndef QUAGGA_HGP_RFAPI_RIB_H
27 #define QUAGGA_HGP_RFAPI_RIB_H
28
29 /*
30 * Key for indexing RIB and Pending RIB skiplists. For L3 RIBs,
31 * the VN address is sufficient because it represents the actual next hop.
32 *
33 * For L2 RIBs, it is possible to have multiple routes to a given L2
34 * prefix via a given VN address, but each route having a unique aux_prefix.
35 */
36 struct rfapi_rib_key
37 {
38 struct prefix vn;
39 struct prefix_rd rd;
40
41 /*
42 * for L2 routes: optional IP addr
43 * .family == 0 means "none"
44 */
45 struct prefix aux_prefix;
46 };
47 #include "rfapi.h"
48
49 /*
50 * RFAPI Advertisement Data Block
51 *
52 * Holds NVE prefix advertisement information
53 */
54 struct rfapi_adb
55 {
56 union {
57 struct {
58 struct prefix prefix_ip;
59 struct prefix_rd prd;
60 struct prefix prefix_eth;
61 } s; /* mainly for legacy use */
62 struct rfapi_rib_key key;
63 } u;
64 uint32_t lifetime;
65 uint8_t cost;
66 struct rfapi_l2address_option l2o;
67 };
68
69 struct rfapi_info
70 {
71 struct rfapi_rib_key rk; /* NVE VN addr + aux addr */
72 struct prefix un;
73 uint8_t cost;
74 uint32_t lifetime;
75 time_t last_sent_time;
76 uint32_t rsp_counter; /* dedup initial responses */
77 struct bgp_tea_options *tea_options;
78 struct rfapi_un_option *un_options;
79 struct rfapi_vn_option *vn_options;
80 struct thread *timer;
81 };
82
83 /*
84 * Work item for updated responses queue
85 */
86 struct rfapi_updated_responses_queue
87 {
88 struct rfapi_descriptor *rfd;
89 afi_t afi;
90 };
91
92
93 extern void
94 rfapiRibClear (struct rfapi_descriptor *rfd);
95
96 extern void
97 rfapiRibFree (struct rfapi_descriptor *rfd);
98
99 extern void
100 rfapiRibUpdatePendingNode (
101 struct bgp *bgp,
102 struct rfapi_descriptor *rfd,
103 struct rfapi_import_table *it,
104 struct route_node *it_node,
105 uint32_t lifetime);
106
107 extern void
108 rfapiRibUpdatePendingNodeSubtree (
109 struct bgp *bgp,
110 struct rfapi_descriptor *rfd,
111 struct rfapi_import_table *it,
112 struct route_node *it_node,
113 struct route_node *omit_subtree,
114 uint32_t lifetime);
115
116 extern int
117 rfapiRibPreloadBi(
118 struct route_node *rfd_rib_node,
119 struct prefix *pfx_vn,
120 struct prefix *pfx_un,
121 uint32_t lifetime,
122 struct bgp_info *bi);
123
124 extern struct rfapi_next_hop_entry *
125 rfapiRibPreload (
126 struct bgp *bgp,
127 struct rfapi_descriptor *rfd,
128 struct rfapi_next_hop_entry *response,
129 int use_eth_resolution);
130
131 extern void
132 rfapiRibPendingDeleteRoute (
133 struct bgp *bgp,
134 struct rfapi_import_table *it,
135 afi_t afi,
136 struct route_node *it_node);
137
138 extern void
139 rfapiRibShowResponsesSummary (void *stream);
140
141 extern void
142 rfapiRibShowResponsesSummaryClear (void);
143
144 extern void
145 rfapiRibShowResponses (
146 void *stream,
147 struct prefix *pfx_match,
148 int show_removed);
149
150 extern int
151 rfapiRibFTDFilterRecentPrefix(
152 struct rfapi_descriptor *rfd,
153 struct route_node *it_rn, /* import table node */
154 struct prefix *pfx_target_original); /* query target */
155
156 extern void
157 rfapiFreeRfapiUnOptionChain (struct rfapi_un_option *p);
158
159 extern void
160 rfapiFreeRfapiVnOptionChain (struct rfapi_vn_option *p);
161
162 extern void
163 rfapiRibCheckCounts (
164 int checkstats, /* validate rfd & global counts */
165 unsigned int offset); /* number of ri's held separately */
166
167 /* enable for debugging; disable for performance */
168 #if 0
169 #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset) rfapiRibCheckCounts(checkstats, offset)
170 #else
171 #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset)
172 #endif
173
174 extern void
175 rfapi_rib_key_init (struct prefix *prefix, /* may be NULL */
176 struct prefix_rd *rd, /* may be NULL */
177 struct prefix *aux, /* may be NULL */
178 struct rfapi_rib_key *rk);
179
180 extern int
181 rfapi_rib_key_cmp (void *k1, void *k2);
182
183 extern void
184 rfapiAdbFree (struct rfapi_adb *adb);
185
186 #endif /* QUAGGA_HGP_RFAPI_RIB_H */