]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/rfapi/rfapi_rib.h
Merge pull request #486 from LabNConsulting/working/3.0/patch/issue483
[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
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 */
21
22 /*
23 * File: rfapi_rib.h
24 * Purpose: per-nve rib
25 */
26
27 #ifndef QUAGGA_HGP_RFAPI_RIB_H
28 #define QUAGGA_HGP_RFAPI_RIB_H
29
30 /*
31 * Key for indexing RIB and Pending RIB skiplists. For L3 RIBs,
32 * the VN address is sufficient because it represents the actual next hop.
33 *
34 * For L2 RIBs, it is possible to have multiple routes to a given L2
35 * prefix via a given VN address, but each route having a unique aux_prefix.
36 */
37 struct rfapi_rib_key
38 {
39 struct prefix vn;
40 struct prefix_rd rd;
41
42 /*
43 * for L2 routes: optional IP addr
44 * .family == 0 means "none"
45 */
46 struct prefix aux_prefix;
47 };
48 #include "rfapi.h"
49
50 /*
51 * RFAPI Advertisement Data Block
52 *
53 * Holds NVE prefix advertisement information
54 */
55 struct rfapi_adb
56 {
57 union {
58 struct {
59 struct prefix prefix_ip;
60 struct prefix_rd prd;
61 struct prefix prefix_eth;
62 } s; /* mainly for legacy use */
63 struct rfapi_rib_key key;
64 } u;
65 uint32_t lifetime;
66 uint8_t cost;
67 struct rfapi_l2address_option l2o;
68 };
69
70 struct rfapi_info
71 {
72 struct rfapi_rib_key rk; /* NVE VN addr + aux addr */
73 struct prefix un;
74 uint8_t cost;
75 uint32_t lifetime;
76 time_t last_sent_time;
77 uint32_t rsp_counter; /* dedup initial responses */
78 struct bgp_tea_options *tea_options;
79 struct rfapi_un_option *un_options;
80 struct rfapi_vn_option *vn_options;
81 void *timer;
82 };
83
84 /*
85 * Work item for updated responses queue
86 */
87 struct rfapi_updated_responses_queue
88 {
89 struct rfapi_descriptor *rfd;
90 afi_t afi;
91 };
92
93
94 extern void
95 rfapiRibClear (struct rfapi_descriptor *rfd);
96
97 extern void
98 rfapiRibFree (struct rfapi_descriptor *rfd);
99
100 extern void
101 rfapiRibUpdatePendingNode (
102 struct bgp *bgp,
103 struct rfapi_descriptor *rfd,
104 struct rfapi_import_table *it,
105 struct route_node *it_node,
106 uint32_t lifetime);
107
108 extern void
109 rfapiRibUpdatePendingNodeSubtree (
110 struct bgp *bgp,
111 struct rfapi_descriptor *rfd,
112 struct rfapi_import_table *it,
113 struct route_node *it_node,
114 struct route_node *omit_subtree,
115 uint32_t lifetime);
116
117 extern int
118 rfapiRibPreloadBi(
119 struct route_node *rfd_rib_node,
120 struct prefix *pfx_vn,
121 struct prefix *pfx_un,
122 uint32_t lifetime,
123 struct bgp_info *bi);
124
125 extern struct rfapi_next_hop_entry *
126 rfapiRibPreload (
127 struct bgp *bgp,
128 struct rfapi_descriptor *rfd,
129 struct rfapi_next_hop_entry *response,
130 int use_eth_resolution);
131
132 extern void
133 rfapiRibPendingDeleteRoute (
134 struct bgp *bgp,
135 struct rfapi_import_table *it,
136 afi_t afi,
137 struct route_node *it_node);
138
139 extern void
140 rfapiRibShowResponsesSummary (void *stream);
141
142 extern void
143 rfapiRibShowResponsesSummaryClear (void);
144
145 extern void
146 rfapiRibShowResponses (
147 void *stream,
148 struct prefix *pfx_match,
149 int show_removed);
150
151 extern int
152 rfapiRibFTDFilterRecentPrefix(
153 struct rfapi_descriptor *rfd,
154 struct route_node *it_rn, /* import table node */
155 struct prefix *pfx_target_original); /* query target */
156
157 extern void
158 rfapiFreeRfapiUnOptionChain (struct rfapi_un_option *p);
159
160 extern void
161 rfapiFreeRfapiVnOptionChain (struct rfapi_vn_option *p);
162
163 extern void
164 rfapiRibCheckCounts (
165 int checkstats, /* validate rfd & global counts */
166 unsigned int offset); /* number of ri's held separately */
167
168 /* enable for debugging; disable for performance */
169 #if 0
170 #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset) rfapiRibCheckCounts(checkstats, offset)
171 #else
172 #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset)
173 #endif
174
175 extern void
176 rfapi_rib_key_init (struct prefix *prefix, /* may be NULL */
177 struct prefix_rd *rd, /* may be NULL */
178 struct prefix *aux, /* may be NULL */
179 struct rfapi_rib_key *rk);
180
181 extern int
182 rfapi_rib_key_cmp (void *k1, void *k2);
183
184 extern void
185 rfapiAdbFree (struct rfapi_adb *adb);
186
187 #endif /* QUAGGA_HGP_RFAPI_RIB_H */