blob: 4053ff651817a327ce27db47f58250f51c6be735 [file] [log] [blame]
Neale Ranns0bfe5d82016-08-25 15:29:12 +01001/*
2 * Copyright (c) 2016 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef __FIB_ENTRY_H__
17#define __FIB_ENTRY_H__
18
19#include <vnet/fib/fib_node.h>
Neale Ranns3bab8f92019-12-04 06:11:00 +000020#include <vnet/fib/fib_source.h>
Neale Ranns0bfe5d82016-08-25 15:29:12 +010021#include <vnet/adj/adj.h>
22#include <vnet/ip/ip.h>
23#include <vnet/dpo/dpo.h>
24
25/**
26 * The different sources that can create a route.
Lijian.Zhang33af8c12019-09-16 16:22:36 +080027 * The sources are defined here with their relative priority order.
Neale Ranns0bfe5d82016-08-25 15:29:12 +010028 * The lower the value the higher the priority
29 */
Neale Ranns0bfe5d82016-08-25 15:29:12 +010030typedef enum fib_entry_attribute_t_ {
31 /**
32 * Marker. Add new values after this one.
33 */
34 FIB_ENTRY_ATTRIBUTE_FIRST,
35 /**
36 * Connected. The prefix is configured on an interface.
37 */
38 FIB_ENTRY_ATTRIBUTE_CONNECTED = FIB_ENTRY_ATTRIBUTE_FIRST,
39 /**
40 * Attached. The prefix is attached to an interface.
41 */
42 FIB_ENTRY_ATTRIBUTE_ATTACHED,
43 /**
44 * The route is an explicit drop.
45 */
46 FIB_ENTRY_ATTRIBUTE_DROP,
47 /**
48 * The route is exclusive. The client creating the route is
49 * providing an exclusive adjacency.
50 */
51 FIB_ENTRY_ATTRIBUTE_EXCLUSIVE,
52 /**
53 * The route is attached cross tables and thus imports covered
54 * prefixes from the other table.
55 */
56 FIB_ENTRY_ATTRIBUTE_IMPORT,
57 /**
58 * The prefix/address is local to this device
59 */
60 FIB_ENTRY_ATTRIBUTE_LOCAL,
61 /**
Neale Ranns0f26c5a2017-03-01 15:12:11 -080062 * The prefix/address is a multicast prefix.
63 * this aplies only to MPLS. IP multicast is handled by mfib
64 */
65 FIB_ENTRY_ATTRIBUTE_MULTICAST,
66 /**
Shwetha Bhandari78372a92017-01-18 12:43:54 +053067 * The prefix/address exempted from loose uRPF check
68 * To be used with caution
69 */
70 FIB_ENTRY_ATTRIBUTE_URPF_EXEMPT,
71 /**
Neale Ranns53da2212018-02-24 02:11:19 -080072 * The prefix/address exempted from attached export
73 */
74 FIB_ENTRY_ATTRIBUTE_NO_ATTACHED_EXPORT,
75 /**
Neale Ranns89541992017-04-06 04:41:02 -070076 * This FIB entry imposes its source information on all prefixes
77 * that is covers
78 */
79 FIB_ENTRY_ATTRIBUTE_COVERED_INHERIT,
80 /**
Neale Ranns2303cb12018-02-21 04:57:17 -080081 * The interpose attribute.
82 * place the forwarding provided by the source infront of the forwarding
83 * provided by the best source, or failing that, by the cover.
84 */
85 FIB_ENTRY_ATTRIBUTE_INTERPOSE,
86 /**
Neale Ranns0bfe5d82016-08-25 15:29:12 +010087 * Marker. add new entries before this one.
88 */
Neale Ranns2303cb12018-02-21 04:57:17 -080089 FIB_ENTRY_ATTRIBUTE_LAST = FIB_ENTRY_ATTRIBUTE_INTERPOSE,
Neale Ranns0bfe5d82016-08-25 15:29:12 +010090} fib_entry_attribute_t;
91
Neale Ranns0bfe5d82016-08-25 15:29:12 +010092#define FIB_ENTRY_ATTRIBUTES { \
93 [FIB_ENTRY_ATTRIBUTE_CONNECTED] = "connected", \
94 [FIB_ENTRY_ATTRIBUTE_ATTACHED] = "attached", \
95 [FIB_ENTRY_ATTRIBUTE_IMPORT] = "import", \
96 [FIB_ENTRY_ATTRIBUTE_DROP] = "drop", \
97 [FIB_ENTRY_ATTRIBUTE_EXCLUSIVE] = "exclusive", \
98 [FIB_ENTRY_ATTRIBUTE_LOCAL] = "local", \
Neale Ranns0f26c5a2017-03-01 15:12:11 -080099 [FIB_ENTRY_ATTRIBUTE_URPF_EXEMPT] = "uRPF-exempt", \
100 [FIB_ENTRY_ATTRIBUTE_MULTICAST] = "multicast", \
Neale Ranns53da2212018-02-24 02:11:19 -0800101 [FIB_ENTRY_ATTRIBUTE_NO_ATTACHED_EXPORT] = "no-attached-export", \
Neale Ranns89541992017-04-06 04:41:02 -0700102 [FIB_ENTRY_ATTRIBUTE_COVERED_INHERIT] = "covered-inherit", \
Neale Ranns2303cb12018-02-21 04:57:17 -0800103 [FIB_ENTRY_ATTRIBUTE_INTERPOSE] = "interpose", \
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100104}
105
106#define FOR_EACH_FIB_ATTRIBUTE(_item) \
107 for (_item = FIB_ENTRY_ATTRIBUTE_FIRST; \
Neale Ranns808c5b22017-08-02 05:15:07 -0700108 _item <= FIB_ENTRY_ATTRIBUTE_LAST; \
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100109 _item++)
110
111typedef enum fib_entry_flag_t_ {
112 FIB_ENTRY_FLAG_NONE = 0,
113 FIB_ENTRY_FLAG_CONNECTED = (1 << FIB_ENTRY_ATTRIBUTE_CONNECTED),
114 FIB_ENTRY_FLAG_ATTACHED = (1 << FIB_ENTRY_ATTRIBUTE_ATTACHED),
115 FIB_ENTRY_FLAG_DROP = (1 << FIB_ENTRY_ATTRIBUTE_DROP),
116 FIB_ENTRY_FLAG_EXCLUSIVE = (1 << FIB_ENTRY_ATTRIBUTE_EXCLUSIVE),
117 FIB_ENTRY_FLAG_LOCAL = (1 << FIB_ENTRY_ATTRIBUTE_LOCAL),
118 FIB_ENTRY_FLAG_IMPORT = (1 << FIB_ENTRY_ATTRIBUTE_IMPORT),
Neale Ranns53da2212018-02-24 02:11:19 -0800119 FIB_ENTRY_FLAG_NO_ATTACHED_EXPORT = (1 << FIB_ENTRY_ATTRIBUTE_NO_ATTACHED_EXPORT),
Shwetha Bhandari78372a92017-01-18 12:43:54 +0530120 FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT = (1 << FIB_ENTRY_ATTRIBUTE_URPF_EXEMPT),
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800121 FIB_ENTRY_FLAG_MULTICAST = (1 << FIB_ENTRY_ATTRIBUTE_MULTICAST),
Neale Ranns89541992017-04-06 04:41:02 -0700122 FIB_ENTRY_FLAG_COVERED_INHERIT = (1 << FIB_ENTRY_ATTRIBUTE_COVERED_INHERIT),
Neale Ranns2303cb12018-02-21 04:57:17 -0800123 FIB_ENTRY_FLAG_INTERPOSE = (1 << FIB_ENTRY_ATTRIBUTE_INTERPOSE),
Neale Ranns32e1c012016-11-22 17:07:28 +0000124} __attribute__((packed)) fib_entry_flag_t;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100125
Neale Ranns710071b2018-09-24 12:36:26 +0000126extern u8 * format_fib_entry_flags(u8 *s, va_list *args);
127
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100128/**
129 * Flags for the source data
130 */
131typedef enum fib_entry_src_attribute_t_ {
132 /**
133 * Marker. Add new values after this one.
134 */
135 FIB_ENTRY_SRC_ATTRIBUTE_FIRST,
136 /**
137 * the source has been added to the entry
138 */
139 FIB_ENTRY_SRC_ATTRIBUTE_ADDED = FIB_ENTRY_SRC_ATTRIBUTE_FIRST,
140 /**
Neale Ranns2303cb12018-02-21 04:57:17 -0800141 * the source is contributing forwarding
142 */
143 FIB_ENTRY_SRC_ATTRIBUTE_CONTRIBUTING,
144 /**
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100145 * the source is active/best
146 */
147 FIB_ENTRY_SRC_ATTRIBUTE_ACTIVE,
148 /**
Neale Ranns9db6ada2019-11-08 12:42:31 +0000149 * the source is stale
150 */
151 FIB_ENTRY_SRC_ATTRIBUTE_STALE,
152 /**
Neale Ranns89541992017-04-06 04:41:02 -0700153 * the source is inherited from its cover
154 */
155 FIB_ENTRY_SRC_ATTRIBUTE_INHERITED,
156 /**
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100157 * Marker. add new entries before this one.
158 */
Neale Ranns89541992017-04-06 04:41:02 -0700159 FIB_ENTRY_SRC_ATTRIBUTE_LAST = FIB_ENTRY_SRC_ATTRIBUTE_INHERITED,
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100160} fib_entry_src_attribute_t;
161
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100162
163#define FIB_ENTRY_SRC_ATTRIBUTES { \
164 [FIB_ENTRY_SRC_ATTRIBUTE_ADDED] = "added", \
Neale Ranns2303cb12018-02-21 04:57:17 -0800165 [FIB_ENTRY_SRC_ATTRIBUTE_CONTRIBUTING] = "contributing", \
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100166 [FIB_ENTRY_SRC_ATTRIBUTE_ACTIVE] = "active", \
Neale Ranns9db6ada2019-11-08 12:42:31 +0000167 [FIB_ENTRY_SRC_ATTRIBUTE_STALE] = "stale", \
Neale Ranns89541992017-04-06 04:41:02 -0700168 [FIB_ENTRY_SRC_ATTRIBUTE_INHERITED] = "inherited", \
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100169}
170
Neale Ranns89541992017-04-06 04:41:02 -0700171#define FOR_EACH_FIB_SRC_ATTRIBUTE(_item) \
172 for (_item = FIB_ENTRY_SRC_ATTRIBUTE_FIRST; \
Neale Ranns2303cb12018-02-21 04:57:17 -0800173 _item <= FIB_ENTRY_SRC_ATTRIBUTE_LAST; \
Neale Ranns89541992017-04-06 04:41:02 -0700174 _item++)
175
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100176typedef enum fib_entry_src_flag_t_ {
177 FIB_ENTRY_SRC_FLAG_NONE = 0,
178 FIB_ENTRY_SRC_FLAG_ADDED = (1 << FIB_ENTRY_SRC_ATTRIBUTE_ADDED),
Neale Ranns2303cb12018-02-21 04:57:17 -0800179 FIB_ENTRY_SRC_FLAG_CONTRIBUTING = (1 << FIB_ENTRY_SRC_ATTRIBUTE_CONTRIBUTING),
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100180 FIB_ENTRY_SRC_FLAG_ACTIVE = (1 << FIB_ENTRY_SRC_ATTRIBUTE_ACTIVE),
Neale Ranns9db6ada2019-11-08 12:42:31 +0000181 FIB_ENTRY_SRC_FLAG_STALE = (1 << FIB_ENTRY_SRC_ATTRIBUTE_STALE),
Neale Ranns89541992017-04-06 04:41:02 -0700182 FIB_ENTRY_SRC_FLAG_INHERITED = (1 << FIB_ENTRY_SRC_ATTRIBUTE_INHERITED),
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100183} __attribute__ ((packed)) fib_entry_src_flag_t;
184
Neale Ranns710071b2018-09-24 12:36:26 +0000185extern u8 * format_fib_entry_src_flags(u8 *s, va_list *args);
186
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100187/*
188 * Keep the size of the flags field to 2 bytes, so it
189 * can be placed next to the 2 bytes reference count
190 */
Damjan Marioncf478942016-11-07 14:57:50 +0100191STATIC_ASSERT (sizeof(fib_entry_src_flag_t) <= 2,
192 "FIB entry flags field size too big");
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100193
194/**
195 * Information related to the source of a FIB entry
196 */
197typedef struct fib_entry_src_t_ {
198 /**
Neale Ranns6c3ebcc2016-10-02 21:20:15 +0100199 * A vector of path extensions
200 */
Neale Ranns81424992017-05-18 03:03:22 -0700201 fib_path_ext_list_t fes_path_exts;
Neale Ranns6c3ebcc2016-10-02 21:20:15 +0100202
203 /**
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100204 * The path-list created by the source
205 */
206 fib_node_index_t fes_pl;
Neale Ranns2303cb12018-02-21 04:57:17 -0800207
208 /**
209 * Flags the source contributes to the entry
210 */
211 fib_entry_flag_t fes_entry_flags;
212
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100213 /**
214 * Which source this info block is for
215 */
216 fib_source_t fes_src;
Neale Ranns2303cb12018-02-21 04:57:17 -0800217
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100218 /**
219 * Flags on the source
220 */
221 fib_entry_src_flag_t fes_flags;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100222
223 /**
224 * 1 bytes ref count. This is not the number of users of the Entry
225 * (which is itself not large, due to path-list sharing), but the number
226 * of times a given source has been added. Which is even fewer
227 */
228 u8 fes_ref_count;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100229
230 /**
231 * Source specific info
232 */
233 union {
234 struct {
235 /**
236 * the index of the FIB entry that is the covering entry
237 */
238 fib_node_index_t fesr_cover;
239 /**
240 * This source's index in the cover's list
241 */
242 u32 fesr_sibling;
243 } rr;
244 struct {
245 /**
246 * the index of the FIB entry that is the covering entry
247 */
Neale Ranns2303cb12018-02-21 04:57:17 -0800248 fib_node_index_t fesi_cover;
249 /**
250 * This source's index in the cover's list
251 */
252 u32 fesi_sibling;
253 /**
254 * DPO type to interpose. The dpo type needs to have registered
255 * it's 'contribute interpose' callback function.
256 */
257 dpo_id_t fesi_dpo;
258 } interpose;
259 struct {
260 /**
261 * the index of the FIB entry that is the covering entry
262 */
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100263 fib_node_index_t fesa_cover;
264 /**
265 * This source's index in the cover's list
266 */
267 u32 fesa_sibling;
268 } adj;
269 struct {
270 /**
271 * the index of the FIB entry that is the covering entry
272 */
273 fib_node_index_t fesi_cover;
274 /**
275 * This source's index in the cover's list
276 */
277 u32 fesi_sibling;
278 } interface;
279 struct {
280 /**
281 * This MPLS local label associated with the prefix.
282 */
283 mpls_label_t fesm_label;
284
285 /**
286 * the indicies of the LFIB entries created
287 */
288 fib_node_index_t fesm_lfes[2];
289 } mpls;
290 struct {
291 /**
292 * The source FIB index.
293 */
294 fib_node_index_t fesl_fib_index;
295 } lisp;
Neale Ranns2303cb12018-02-21 04:57:17 -0800296 } u;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100297} fib_entry_src_t;
298
299/**
300 * An entry in a FIB table.
301 *
302 * This entry represents a route added to the FIB that is stored
303 * in one of the FIB tables.
304 */
305typedef struct fib_entry_t_ {
306 /**
307 * Base class. The entry's node representation in the graph.
308 */
309 fib_node_t fe_node;
310 /**
Neale Rannsad422ed2016-11-02 14:20:04 +0000311 * The prefix of the route. this is const just to be sure.
312 * It is the entry's key/identity and so should never change.
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100313 */
Neale Rannsad422ed2016-11-02 14:20:04 +0000314 const fib_prefix_t fe_prefix;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100315 /**
316 * The index of the FIB table this entry is in
317 */
318 u32 fe_fib_index;
319 /**
320 * The load-balance used for forwarding.
321 *
322 * We don't share the EOS and non-EOS even in case when they could be
323 * because:
324 * - complexity & reliability v. memory
325 * determining the conditions where sharing is possible is non-trivial.
326 * - separate LBs means we can get the EOS bit right in the MPLS label DPO
327 * and so save a few clock cycles in the DP imposition node since we can
328 * paint the header straight on without the need to check the packet
329 * type to derive the EOS bit value.
330 */
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800331 dpo_id_t fe_lb;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100332 /**
Neale Rannsa4e77662017-12-04 20:00:30 +0000333 * Vector of source infos.
334 * Most entries will only have 1 source. So we optimise for memory usage,
335 * which is preferable since we have many entries.
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100336 */
Neale Rannsa4e77662017-12-04 20:00:30 +0000337 fib_entry_src_t *fe_srcs;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100338 /**
339 * the path-list for which this entry is a child. This is also the path-list
340 * that is contributing forwarding for this entry.
341 */
342 fib_node_index_t fe_parent;
343 /**
344 * index of this entry in the parent's child list.
345 * This is set when this entry is added as a child, but can also
346 * be changed by the parent as it manages its list.
347 */
348 u32 fe_sibling;
Neale Rannsad422ed2016-11-02 14:20:04 +0000349
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100350 /**
Neale Ranns1f50bf82019-07-16 15:28:52 +0000351 * A vector of delegate indices.
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100352 */
Neale Ranns1f50bf82019-07-16 15:28:52 +0000353 index_t *fe_delegates;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100354} fib_entry_t;
355
356#define FOR_EACH_FIB_ENTRY_FLAG(_item) \
357 for (_item = FIB_ENTRY_FLAG_FIRST; _item < FIB_ENTRY_FLAG_MAX; _item++)
358
359#define FIB_ENTRY_FORMAT_BRIEF (0x0)
360#define FIB_ENTRY_FORMAT_DETAIL (0x1)
361#define FIB_ENTRY_FORMAT_DETAIL2 (0x2)
362
363extern u8 *format_fib_entry (u8 * s, va_list * args);
Neale Ranns15002542017-09-10 04:39:11 -0700364extern u8 *format_fib_source (u8 * s, va_list * args);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100365
366extern fib_node_index_t fib_entry_create_special(u32 fib_index,
367 const fib_prefix_t *prefix,
368 fib_source_t source,
369 fib_entry_flag_t flags,
370 const dpo_id_t *dpo);
371
372extern fib_node_index_t fib_entry_create (u32 fib_index,
373 const fib_prefix_t *prefix,
374 fib_source_t source,
375 fib_entry_flag_t flags,
376 const fib_route_path_t *paths);
377extern void fib_entry_update (fib_node_index_t fib_entry_index,
378 fib_source_t source,
379 fib_entry_flag_t flags,
380 const fib_route_path_t *paths);
381
382extern void fib_entry_path_add(fib_node_index_t fib_entry_index,
383 fib_source_t source,
384 fib_entry_flag_t flags,
Neale Ranns097fa662018-05-01 05:17:55 -0700385 const fib_route_path_t *rpaths);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100386extern void fib_entry_special_add(fib_node_index_t fib_entry_index,
387 fib_source_t source,
388 fib_entry_flag_t flags,
389 const dpo_id_t *dpo);
Neale Ranns948e00f2016-10-20 13:39:34 +0100390extern void fib_entry_special_update(fib_node_index_t fib_entry_index,
391 fib_source_t source,
392 fib_entry_flag_t flags,
393 const dpo_id_t *dpo);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100394extern fib_entry_src_flag_t fib_entry_special_remove(fib_node_index_t fib_entry_index,
395 fib_source_t source);
396
397extern fib_entry_src_flag_t fib_entry_path_remove(fib_node_index_t fib_entry_index,
398 fib_source_t source,
Neale Ranns097fa662018-05-01 05:17:55 -0700399 const fib_route_path_t *rpaths);
Neale Ranns89541992017-04-06 04:41:02 -0700400
401extern void fib_entry_inherit(fib_node_index_t cover,
402 fib_node_index_t covered);
403
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100404extern fib_entry_src_flag_t fib_entry_delete(fib_node_index_t fib_entry_index,
405 fib_source_t source);
406
Neale Ranns2303cb12018-02-21 04:57:17 -0800407extern void fib_entry_recalculate_forwarding(
408 fib_node_index_t fib_entry_index);
Neale Ranns3ee44042016-10-03 13:05:48 +0100409extern void fib_entry_contribute_urpf(fib_node_index_t path_index,
410 index_t urpf);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100411extern void fib_entry_contribute_forwarding(
412 fib_node_index_t fib_entry_index,
413 fib_forward_chain_type_t type,
414 dpo_id_t *dpo);
415extern const dpo_id_t * fib_entry_contribute_ip_forwarding(
416 fib_node_index_t fib_entry_index);
417extern adj_index_t fib_entry_get_adj_for_source(
418 fib_node_index_t fib_entry_index,
419 fib_source_t source);
420extern const int fib_entry_get_dpo_for_source (
421 fib_node_index_t fib_entry_index,
422 fib_source_t source,
423 dpo_id_t *dpo);
424
425extern adj_index_t fib_entry_get_adj(fib_node_index_t fib_entry_index);
426
427extern int fib_entry_cmp_for_sort(void *i1, void *i2);
428
429extern void fib_entry_cover_changed(fib_node_index_t fib_entry);
430extern void fib_entry_cover_updated(fib_node_index_t fib_entry);
431extern int fib_entry_recursive_loop_detect(fib_node_index_t entry_index,
432 fib_node_index_t **entry_indicies);
433
434extern void fib_entry_lock(fib_node_index_t fib_entry_index);
435extern void fib_entry_unlock(fib_node_index_t fib_entry_index);
436
437extern u32 fib_entry_child_add(fib_node_index_t fib_entry_index,
438 fib_node_type_t type,
439 fib_node_index_t child_index);
440extern void fib_entry_child_remove(fib_node_index_t fib_entry_index,
441 u32 sibling_index);
442extern u32 fib_entry_get_resolving_interface(fib_node_index_t fib_entry_index);
Neale Rannscc4f7e12020-10-26 10:44:54 +0000443extern u32 fib_entry_get_any_resolving_interface(fib_node_index_t fib_entry_index);
Neale Rannsdf089a82016-10-02 16:39:06 +0100444extern u32 fib_entry_get_resolving_interface_for_source(
445 fib_node_index_t fib_entry_index,
446 fib_source_t source);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100447
Neale Ranns097fa662018-05-01 05:17:55 -0700448extern fib_route_path_t* fib_entry_encode(fib_node_index_t fib_entry_index);
449extern const fib_prefix_t* fib_entry_get_prefix(fib_node_index_t fib_entry_index);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100450extern u32 fib_entry_get_fib_index(fib_node_index_t fib_entry_index);
451extern void fib_entry_set_source_data(fib_node_index_t fib_entry_index,
452 fib_source_t source,
453 const void *data);
454extern const void* fib_entry_get_source_data(fib_node_index_t fib_entry_index,
455 fib_source_t source);
456
457extern fib_entry_flag_t fib_entry_get_flags(fib_node_index_t fib_entry_index);
Neale Rannsdf089a82016-10-02 16:39:06 +0100458extern fib_entry_flag_t fib_entry_get_flags_for_source(
459 fib_node_index_t fib_entry_index,
460 fib_source_t source);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100461extern fib_source_t fib_entry_get_best_source(fib_node_index_t fib_entry_index);
462extern int fib_entry_is_sourced(fib_node_index_t fib_entry_index,
463 fib_source_t source);
464
465extern fib_node_index_t fib_entry_get_path_list(fib_node_index_t fib_entry_index);
Neale Ranns88fc83e2017-04-05 08:11:14 -0700466extern int fib_entry_is_resolved(fib_node_index_t fib_entry_index);
Neale Ranns56f949b2018-04-25 01:41:24 -0700467extern int fib_entry_is_host(fib_node_index_t fib_entry_index);
Neale Ranns9db6ada2019-11-08 12:42:31 +0000468extern int fib_entry_is_marked(fib_node_index_t fib_entry_index, fib_source_t source);
469extern void fib_entry_mark(fib_node_index_t fib_entry_index, fib_source_t source);
Neale Ranns227038a2017-04-21 01:07:59 -0700470extern void fib_entry_set_flow_hash_config(fib_node_index_t fib_entry_index,
471 flow_hash_config_t hash_config);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100472
473extern void fib_entry_module_init(void);
474
Neale Ranns008dbe12018-09-07 09:32:36 -0700475extern u32 fib_entry_get_stats_index(fib_node_index_t fib_entry_index);
476
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100477/*
478 * unsafe... beware the raw pointer.
479 */
480extern fib_node_index_t fib_entry_get_index(const fib_entry_t * fib_entry);
481extern fib_entry_t * fib_entry_get(fib_node_index_t fib_entry_index);
482
483/*
484 * for testing purposes.
485 */
486extern u32 fib_entry_pool_size(void);
487
488#endif