]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* |
2 | * Routing Information Base header | |
3 | * Copyright (C) 1997 Kunihiro Ishiguro | |
4 | * | |
5 | * This file is part of GNU Zebra. | |
6 | * | |
7 | * GNU Zebra is free software; you can redistribute it and/or modify it | |
8 | * under the terms of the GNU General Public License as published by the | |
9 | * Free Software Foundation; either version 2, or (at your option) any | |
10 | * later version. | |
11 | * | |
12 | * GNU Zebra is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
896014f4 DL |
17 | * You should have received a copy of the GNU General Public License along |
18 | * with this program; see the file COPYING; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
718e3744 | 20 | */ |
21 | ||
22 | #ifndef _ZEBRA_RIB_H | |
23 | #define _ZEBRA_RIB_H | |
24 | ||
dc9ffce8 | 25 | #include "zebra.h" |
4f8ea50c | 26 | #include "hook.h" |
aa57abfb | 27 | #include "typesafe.h" |
c6ffe645 | 28 | #include "linklist.h" |
ec1a4283 | 29 | #include "prefix.h" |
9fd92e3c | 30 | #include "table.h" |
5adc2528 | 31 | #include "queue.h" |
fb018d25 | 32 | #include "nexthop.h" |
7ee30f28 | 33 | #include "nexthop_group.h" |
244a59d2 | 34 | #include "vrf.h" |
fb148af4 | 35 | #include "if.h" |
40c7bdb0 | 36 | #include "mpls.h" |
05737783 | 37 | #include "srcdest_table.h" |
5463ce26 | 38 | #include "zebra/zebra_nhg.h" |
ec1a4283 | 39 | |
51e94aa7 EDP |
40 | #ifdef __cplusplus |
41 | extern "C" { | |
42 | #endif | |
43 | ||
aa57abfb DS |
44 | typedef enum { RNH_NEXTHOP_TYPE, RNH_IMPORT_CHECK_TYPE } rnh_type_t; |
45 | ||
46 | PREDECL_LIST(rnh_list) | |
47 | ||
48 | /* Nexthop structure. */ | |
49 | struct rnh { | |
50 | uint8_t flags; | |
51 | ||
52 | #define ZEBRA_NHT_CONNECTED 0x1 | |
53 | #define ZEBRA_NHT_DELETED 0x2 | |
54 | #define ZEBRA_NHT_EXACT_MATCH 0x4 | |
55 | ||
56 | /* VRF identifier. */ | |
57 | vrf_id_t vrf_id; | |
58 | ||
59 | afi_t afi; | |
60 | ||
61 | rnh_type_t type; | |
62 | ||
63 | uint32_t seqno; | |
64 | ||
65 | struct route_entry *state; | |
66 | struct prefix resolved_route; | |
67 | struct list *client_list; | |
68 | ||
69 | /* pseudowires dependent on this nh */ | |
70 | struct list *zebra_pseudowire_list; | |
71 | ||
72 | struct route_node *node; | |
73 | ||
74 | /* | |
75 | * if this has been filtered for the client | |
76 | */ | |
77 | int filtered[ZEBRA_ROUTE_MAX]; | |
78 | ||
79 | struct rnh_list_item rnh_list_item; | |
80 | }; | |
81 | ||
718e3744 | 82 | #define DISTANCE_INFINITY 255 |
7a4bb9c5 | 83 | #define ZEBRA_KERNEL_TABLE_MAX 252 /* support for no more than this rt tables */ |
718e3744 | 84 | |
045207e2 DS |
85 | PREDECL_LIST(re_list) |
86 | ||
d62a17ae | 87 | struct route_entry { |
88 | /* Link list. */ | |
045207e2 | 89 | struct re_list_item next; |
d62a17ae | 90 | |
0eb97b86 MS |
91 | /* Nexthop group, shared/refcounted, based on the nexthop(s) |
92 | * provided by the owner of the route | |
93 | */ | |
94 | struct nhg_hash_entry *nhe; | |
d62a17ae | 95 | |
0eb97b86 MS |
96 | /* Nexthop group from FIB (optional), reflecting what is actually |
97 | * installed in the FIB if that differs. | |
98 | */ | |
ee5e8a48 MS |
99 | struct nexthop_group fib_ng; |
100 | ||
8e766379 SW |
101 | /* Nexthop group hash entry ID */ |
102 | uint32_t nhe_id; | |
f0cb8e16 | 103 | |
d62a17ae | 104 | /* Tag */ |
105 | route_tag_t tag; | |
106 | ||
107 | /* Uptime. */ | |
108 | time_t uptime; | |
109 | ||
110 | /* Type fo this route. */ | |
111 | int type; | |
112 | ||
d62a17ae | 113 | /* VRF identifier. */ |
114 | vrf_id_t vrf_id; | |
115 | ||
116 | /* Which routing table */ | |
117 | uint32_t table; | |
118 | ||
119 | /* Metric */ | |
d7c0a89a | 120 | uint32_t metric; |
d62a17ae | 121 | |
122 | /* MTU */ | |
d7c0a89a QY |
123 | uint32_t mtu; |
124 | uint32_t nexthop_mtu; | |
d62a17ae | 125 | |
d62a17ae | 126 | /* Flags of this route. |
127 | * This flag's definition is in lib/zebra.h ZEBRA_FLAG_* and is exposed | |
128 | * to clients via Zserv | |
129 | */ | |
d7c0a89a | 130 | uint32_t flags; |
d62a17ae | 131 | |
132 | /* RIB internal status */ | |
88f7ea31 | 133 | uint32_t status; |
f0f77c9a | 134 | #define ROUTE_ENTRY_REMOVED 0x1 |
88f7ea31 | 135 | /* The Route Entry has changed */ |
42fc558e | 136 | #define ROUTE_ENTRY_CHANGED 0x2 |
88f7ea31 | 137 | /* The Label has changed on the Route entry */ |
42fc558e | 138 | #define ROUTE_ENTRY_LABELS_CHANGED 0x4 |
88f7ea31 | 139 | /* Route is queued for Installation into the Data Plane */ |
42fc558e | 140 | #define ROUTE_ENTRY_QUEUED 0x8 |
88f7ea31 | 141 | /* Route is installed into the Data Plane */ |
42fc558e | 142 | #define ROUTE_ENTRY_INSTALLED 0x10 |
88f7ea31 | 143 | /* Route has Failed installation into the Data Plane in some manner */ |
42fc558e | 144 | #define ROUTE_ENTRY_FAILED 0x20 |
6d691129 | 145 | |
7cdb1a84 MS |
146 | /* Sequence value incremented for each dataplane operation */ |
147 | uint32_t dplane_sequence; | |
7a741326 DS |
148 | |
149 | /* Source protocol instance */ | |
150 | uint16_t instance; | |
151 | ||
152 | /* Distance. */ | |
153 | uint8_t distance; | |
718e3744 | 154 | }; |
155 | ||
66cb1845 | 156 | #define RIB_SYSTEM_ROUTE(R) RSYSTEM_ROUTE((R)->type) |
84340a15 | 157 | |
66cb1845 | 158 | #define RIB_KERNEL_ROUTE(R) RKERNEL_ROUTE((R)->type) |
84340a15 | 159 | |
e96f9203 | 160 | /* meta-queue structure: |
e22e8001 SW |
161 | * sub-queue 0: nexthop group objects |
162 | * sub-queue 1: connected, kernel | |
163 | * sub-queue 2: static | |
164 | * sub-queue 3: RIP, RIPng, OSPF, OSPF6, IS-IS, EIGRP, NHRP | |
165 | * sub-queue 4: iBGP, eBGP | |
166 | * sub-queue 5: any other origin (if any) | |
e96f9203 | 167 | */ |
e22e8001 | 168 | #define MQ_SIZE 6 |
d62a17ae | 169 | struct meta_queue { |
170 | struct list *subq[MQ_SIZE]; | |
d7c0a89a | 171 | uint32_t size; /* sum of lengths of all subqueues */ |
e96f9203 DO |
172 | }; |
173 | ||
9fd92e3c AS |
174 | /* |
175 | * Structure that represents a single destination (prefix). | |
176 | */ | |
d62a17ae | 177 | typedef struct rib_dest_t_ { |
9fd92e3c | 178 | |
d62a17ae | 179 | /* |
180 | * Back pointer to the route node for this destination. This helps | |
181 | * us get to the prefix that this structure is for. | |
182 | */ | |
183 | struct route_node *rnode; | |
9fd92e3c | 184 | |
d62a17ae | 185 | /* |
186 | * Doubly-linked list of routes for this prefix. | |
187 | */ | |
045207e2 | 188 | struct re_list_head routes; |
9fd92e3c | 189 | |
5f7a4718 DS |
190 | struct route_entry *selected_fib; |
191 | ||
d62a17ae | 192 | /* |
193 | * Flags, see below. | |
194 | */ | |
d7c0a89a | 195 | uint32_t flags; |
9fd92e3c | 196 | |
699dae23 DS |
197 | /* |
198 | * The list of nht prefixes that have ended up | |
199 | * depending on this route node. | |
200 | * After route processing is returned from | |
201 | * the data plane we will run evaluate_rnh | |
202 | * on these prefixes. | |
203 | */ | |
aa57abfb | 204 | struct rnh_list_head nht; |
699dae23 | 205 | |
d62a17ae | 206 | /* |
207 | * Linkage to put dest on the FPM processing queue. | |
208 | */ | |
209 | TAILQ_ENTRY(rib_dest_t_) fpm_q_entries; | |
5adc2528 | 210 | |
9fd92e3c AS |
211 | } rib_dest_t; |
212 | ||
aa57abfb | 213 | DECLARE_LIST(rnh_list, struct rnh, rnh_list_item); |
045207e2 | 214 | DECLARE_LIST(re_list, struct route_entry, next); |
aa57abfb | 215 | |
9fd92e3c | 216 | #define RIB_ROUTE_QUEUED(x) (1 << (x)) |
1ca60f2c | 217 | // If MQ_SIZE is modified this value needs to be updated. |
e22e8001 | 218 | #define RIB_ROUTE_ANY_QUEUED 0x3F |
9fd92e3c AS |
219 | |
220 | /* | |
221 | * The maximum qindex that can be used. | |
222 | */ | |
223 | #define ZEBRA_MAX_QINDEX (MQ_SIZE - 1) | |
224 | ||
5adc2528 AS |
225 | /* |
226 | * This flag indicates that a given prefix has been 'advertised' to | |
227 | * the FPM to be installed in the forwarding plane. | |
228 | */ | |
229 | #define RIB_DEST_SENT_TO_FPM (1 << (ZEBRA_MAX_QINDEX + 1)) | |
230 | ||
231 | /* | |
232 | * This flag is set when we need to send an update to the FPM about a | |
233 | * dest. | |
234 | */ | |
235 | #define RIB_DEST_UPDATE_FPM (1 << (ZEBRA_MAX_QINDEX + 2)) | |
236 | ||
a1494c25 DS |
237 | #define RIB_DEST_UPDATE_LSPS (1 << (ZEBRA_MAX_QINDEX + 3)) |
238 | ||
9fd92e3c AS |
239 | /* |
240 | * Macro to iterate over each route for a destination (prefix). | |
241 | */ | |
d62a17ae | 242 | #define RE_DEST_FOREACH_ROUTE(dest, re) \ |
045207e2 DS |
243 | for ((re) = (dest) ? re_list_first(&((dest)->routes)) : NULL; (re); \ |
244 | (re) = re_list_next(&((dest)->routes), (re))) | |
9fd92e3c AS |
245 | |
246 | /* | |
247 | * Same as above, but allows the current node to be unlinked. | |
248 | */ | |
d62a17ae | 249 | #define RE_DEST_FOREACH_ROUTE_SAFE(dest, re, next) \ |
045207e2 DS |
250 | for ((re) = (dest) ? re_list_first(&((dest)->routes)) : NULL; \ |
251 | (re) && ((next) = re_list_next(&((dest)->routes), (re)), 1); \ | |
252 | (re) = (next)) | |
9fd92e3c | 253 | |
d62a17ae | 254 | #define RNODE_FOREACH_RE(rn, re) \ |
996c9314 | 255 | RE_DEST_FOREACH_ROUTE (rib_dest_from_rnode(rn), re) |
9fd92e3c | 256 | |
d62a17ae | 257 | #define RNODE_FOREACH_RE_SAFE(rn, re, next) \ |
996c9314 | 258 | RE_DEST_FOREACH_ROUTE_SAFE (rib_dest_from_rnode(rn), re, next) |
9fd92e3c | 259 | |
d62a17ae | 260 | #if defined(HAVE_RTADV) |
cd80d74f | 261 | /* Structure which hold status of router advertisement. */ |
d62a17ae | 262 | struct rtadv { |
263 | int sock; | |
cd80d74f | 264 | |
d62a17ae | 265 | int adv_if_count; |
266 | int adv_msec_if_count; | |
cd80d74f | 267 | |
d62a17ae | 268 | struct thread *ra_read; |
269 | struct thread *ra_timer; | |
cd80d74f | 270 | }; |
8da4e946 | 271 | #endif /* HAVE_RTADV */ |
cd80d74f | 272 | |
1b5ed1b0 AS |
273 | /* |
274 | * rib_table_info_t | |
275 | * | |
276 | * Structure that is hung off of a route_table that holds information about | |
277 | * the table. | |
278 | */ | |
d62a17ae | 279 | typedef struct rib_table_info_t_ { |
1b5ed1b0 | 280 | |
d62a17ae | 281 | /* |
282 | * Back pointer to zebra_vrf. | |
283 | */ | |
284 | struct zebra_vrf *zvrf; | |
285 | afi_t afi; | |
286 | safi_t safi; | |
1b5ed1b0 AS |
287 | |
288 | } rib_table_info_t; | |
289 | ||
d62a17ae | 290 | typedef enum { |
291 | RIB_TABLES_ITER_S_INIT, | |
292 | RIB_TABLES_ITER_S_ITERATING, | |
293 | RIB_TABLES_ITER_S_DONE | |
0915bb0c AS |
294 | } rib_tables_iter_state_t; |
295 | ||
296 | /* | |
297 | * Structure that holds state for iterating over all tables in the | |
298 | * Routing Information Base. | |
299 | */ | |
d62a17ae | 300 | typedef struct rib_tables_iter_t_ { |
301 | vrf_id_t vrf_id; | |
302 | int afi_safi_ix; | |
0915bb0c | 303 | |
d62a17ae | 304 | rib_tables_iter_state_t state; |
0915bb0c AS |
305 | } rib_tables_iter_t; |
306 | ||
1c848137 | 307 | /* Events/reasons triggering a RIB update. */ |
d62a17ae | 308 | typedef enum { |
2a99ab95 | 309 | RIB_UPDATE_KERNEL, |
d62a17ae | 310 | RIB_UPDATE_RMAP_CHANGE, |
2a99ab95 SW |
311 | RIB_UPDATE_OTHER, |
312 | RIB_UPDATE_MAX | |
1c848137 | 313 | } rib_update_event_t; |
314 | ||
d62a17ae | 315 | extern void route_entry_copy_nexthops(struct route_entry *re, |
316 | struct nexthop *nh); | |
5463ce26 | 317 | int route_entry_update_nhe(struct route_entry *re, struct nhg_hash_entry *new); |
f0f77c9a DS |
318 | |
319 | #define route_entry_dump(prefix, src, re) _route_entry_dump(__func__, prefix, src, re) | |
072834ca DS |
320 | extern void _route_entry_dump(const char *func, union prefixconstptr pp, |
321 | union prefixconstptr src_pp, | |
322 | const struct route_entry *re); | |
4623d897 | 323 | |
072834ca DS |
324 | extern void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id); |
325 | extern void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id); | |
f0f77c9a | 326 | |
dc95824a DO |
327 | #define ZEBRA_RIB_LOOKUP_ERROR -1 |
328 | #define ZEBRA_RIB_FOUND_EXACT 0 | |
329 | #define ZEBRA_RIB_FOUND_NOGATE 1 | |
330 | #define ZEBRA_RIB_FOUND_CONNECTED 2 | |
331 | #define ZEBRA_RIB_NOTFOUND 3 | |
332 | ||
d7c0a89a QY |
333 | extern int is_zebra_valid_kernel_table(uint32_t table_id); |
334 | extern int is_zebra_main_routing_table(uint32_t table_id); | |
86391e56 | 335 | extern int zebra_check_addr(const struct prefix *p); |
718e3744 | 336 | |
d62a17ae | 337 | extern void rib_delnode(struct route_node *rn, struct route_entry *re); |
0c555cc6 DS |
338 | extern void rib_install_kernel(struct route_node *rn, struct route_entry *re, |
339 | struct route_entry *old); | |
340 | extern void rib_uninstall_kernel(struct route_node *rn, struct route_entry *re); | |
28f6dde8 | 341 | |
d24af186 | 342 | /* NOTE: |
b4c034b0 | 343 | * All rib_add function will not just add prefix into RIB, but |
d24af186 | 344 | * also implicitly withdraw equal prefix of same type. */ |
4a7371e9 | 345 | extern int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, |
d7c0a89a | 346 | unsigned short instance, int flags, struct prefix *p, |
fd36be7e | 347 | struct prefix_ipv6 *src_p, const struct nexthop *nh, |
8032b717 SW |
348 | uint32_t nhe_id, uint32_t table_id, uint32_t metric, |
349 | uint32_t mtu, uint8_t distance, route_tag_t tag); | |
d62a17ae | 350 | |
072834ca | 351 | extern int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, |
0eb97b86 MS |
352 | struct prefix_ipv6 *src_p, struct route_entry *re, |
353 | struct nexthop_group *ng); | |
d62a17ae | 354 | |
355 | extern void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, | |
d7c0a89a | 356 | unsigned short instance, int flags, struct prefix *p, |
fd36be7e | 357 | struct prefix_ipv6 *src_p, const struct nexthop *nh, |
bc541126 SW |
358 | uint32_t nhe_id, uint32_t table_id, uint32_t metric, |
359 | uint8_t distance, bool fromkernel); | |
d62a17ae | 360 | |
072834ca DS |
361 | extern struct route_entry *rib_match(afi_t afi, safi_t safi, vrf_id_t vrf_id, |
362 | union g_addr *addr, | |
d62a17ae | 363 | struct route_node **rn_out); |
364 | extern struct route_entry *rib_match_ipv4_multicast(vrf_id_t vrf_id, | |
365 | struct in_addr addr, | |
366 | struct route_node **rn_out); | |
367 | ||
072834ca DS |
368 | extern struct route_entry *rib_lookup_ipv4(struct prefix_ipv4 *p, |
369 | vrf_id_t vrf_id); | |
d62a17ae | 370 | |
2a99ab95 SW |
371 | extern void rib_update(rib_update_event_t event); |
372 | extern void rib_update_vrf(vrf_id_t vrf_id, rib_update_event_t event); | |
d5b8c216 | 373 | extern void rib_update_table(struct route_table *table, |
374 | rib_update_event_t event); | |
d4644d41 | 375 | extern int rib_sweep_route(struct thread *t); |
072834ca DS |
376 | extern void rib_sweep_table(struct route_table *table); |
377 | extern void rib_close_table(struct route_table *table); | |
d62a17ae | 378 | extern void rib_init(void); |
d7c0a89a QY |
379 | extern unsigned long rib_score_proto(uint8_t proto, unsigned short instance); |
380 | extern unsigned long rib_score_proto_table(uint8_t proto, | |
381 | unsigned short instance, | |
47a08aa9 | 382 | struct route_table *table); |
e22e8001 SW |
383 | |
384 | extern int rib_queue_add(struct route_node *rn); | |
385 | ||
386 | struct nhg_ctx; /* Forward declaration */ | |
387 | ||
388 | extern int rib_queue_nhg_add(struct nhg_ctx *ctx); | |
389 | ||
d62a17ae | 390 | extern void meta_queue_free(struct meta_queue *mq); |
391 | extern int zebra_rib_labeled_unicast(struct route_entry *re); | |
718e3744 | 392 | extern struct route_table *rib_table_ipv6; |
393 | ||
072834ca | 394 | extern void rib_unlink(struct route_node *rn, struct route_entry *re); |
d62a17ae | 395 | extern int rib_gc_dest(struct route_node *rn); |
396 | extern struct route_table *rib_tables_iter_next(rib_tables_iter_t *iter); | |
9fd92e3c | 397 | |
fd289fc8 | 398 | extern uint8_t route_distance(int type); |
40c7bdb0 | 399 | |
699dae23 DS |
400 | extern void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq); |
401 | ||
9fd92e3c AS |
402 | /* |
403 | * Inline functions. | |
404 | */ | |
405 | ||
1b5ed1b0 AS |
406 | /* |
407 | * rib_table_info | |
408 | */ | |
d62a17ae | 409 | static inline rib_table_info_t *rib_table_info(struct route_table *table) |
1b5ed1b0 | 410 | { |
6ca30e9e | 411 | return (rib_table_info_t *)route_table_get_info(table); |
1b5ed1b0 AS |
412 | } |
413 | ||
9fd92e3c AS |
414 | /* |
415 | * rib_dest_from_rnode | |
416 | */ | |
d62a17ae | 417 | static inline rib_dest_t *rib_dest_from_rnode(struct route_node *rn) |
9fd92e3c | 418 | { |
d62a17ae | 419 | return (rib_dest_t *)rn->info; |
9fd92e3c AS |
420 | } |
421 | ||
422 | /* | |
423 | * rnode_to_ribs | |
424 | * | |
425 | * Returns a pointer to the list of routes corresponding to the given | |
426 | * route_node. | |
427 | */ | |
d62a17ae | 428 | static inline struct route_entry *rnode_to_ribs(struct route_node *rn) |
9fd92e3c | 429 | { |
d62a17ae | 430 | rib_dest_t *dest; |
9fd92e3c | 431 | |
d62a17ae | 432 | dest = rib_dest_from_rnode(rn); |
433 | if (!dest) | |
434 | return NULL; | |
9fd92e3c | 435 | |
045207e2 | 436 | return re_list_first(&dest->routes); |
9fd92e3c AS |
437 | } |
438 | ||
439 | /* | |
440 | * rib_dest_prefix | |
441 | */ | |
d62a17ae | 442 | static inline struct prefix *rib_dest_prefix(rib_dest_t *dest) |
9fd92e3c | 443 | { |
d62a17ae | 444 | return &dest->rnode->p; |
9fd92e3c AS |
445 | } |
446 | ||
447 | /* | |
448 | * rib_dest_af | |
449 | * | |
450 | * Returns the address family that the destination is for. | |
451 | */ | |
d7c0a89a | 452 | static inline uint8_t rib_dest_af(rib_dest_t *dest) |
9fd92e3c | 453 | { |
d62a17ae | 454 | return dest->rnode->p.family; |
9fd92e3c AS |
455 | } |
456 | ||
457 | /* | |
458 | * rib_dest_table | |
459 | */ | |
d62a17ae | 460 | static inline struct route_table *rib_dest_table(rib_dest_t *dest) |
9fd92e3c | 461 | { |
d62a17ae | 462 | return srcdest_rnode_table(dest->rnode); |
9fd92e3c AS |
463 | } |
464 | ||
1b5ed1b0 AS |
465 | /* |
466 | * rib_dest_vrf | |
467 | */ | |
d62a17ae | 468 | static inline struct zebra_vrf *rib_dest_vrf(rib_dest_t *dest) |
1b5ed1b0 | 469 | { |
d62a17ae | 470 | return rib_table_info(rib_dest_table(dest))->zvrf; |
1b5ed1b0 AS |
471 | } |
472 | ||
434434f7 DS |
473 | /* |
474 | * Create the rib_dest_t and attach it to the specified node | |
475 | */ | |
476 | extern rib_dest_t *zebra_rib_create_dest(struct route_node *rn); | |
477 | ||
0915bb0c AS |
478 | /* |
479 | * rib_tables_iter_init | |
480 | */ | |
d62a17ae | 481 | static inline void rib_tables_iter_init(rib_tables_iter_t *iter) |
0915bb0c AS |
482 | |
483 | { | |
d62a17ae | 484 | memset(iter, 0, sizeof(*iter)); |
485 | iter->state = RIB_TABLES_ITER_S_INIT; | |
0915bb0c AS |
486 | } |
487 | ||
488 | /* | |
489 | * rib_tables_iter_started | |
490 | * | |
2951a7a4 | 491 | * Returns true if this iterator has started iterating over the set of |
0915bb0c AS |
492 | * tables. |
493 | */ | |
d62a17ae | 494 | static inline int rib_tables_iter_started(rib_tables_iter_t *iter) |
0915bb0c | 495 | { |
d62a17ae | 496 | return iter->state != RIB_TABLES_ITER_S_INIT; |
0915bb0c AS |
497 | } |
498 | ||
499 | /* | |
500 | * rib_tables_iter_cleanup | |
501 | */ | |
d62a17ae | 502 | static inline void rib_tables_iter_cleanup(rib_tables_iter_t *iter) |
0915bb0c | 503 | { |
d62a17ae | 504 | iter->state = RIB_TABLES_ITER_S_DONE; |
0915bb0c AS |
505 | } |
506 | ||
d62a17ae | 507 | DECLARE_HOOK(rib_update, (struct route_node * rn, const char *reason), |
508 | (rn, reason)) | |
4f8ea50c | 509 | |
ee5e8a48 MS |
510 | /* |
511 | * Access active nexthop-group, either RIB or FIB version | |
512 | */ | |
513 | static inline struct nexthop_group *rib_active_nhg(struct route_entry *re) | |
514 | { | |
515 | if (re->fib_ng.nexthop) | |
516 | return &(re->fib_ng); | |
517 | else | |
0eb97b86 | 518 | return re->nhe->nhg; |
ee5e8a48 | 519 | } |
05f7f5db DS |
520 | |
521 | extern void zebra_vty_init(void); | |
4060008b | 522 | |
05f7f5db DS |
523 | extern pid_t pid; |
524 | ||
6b093863 | 525 | extern bool v6_rr_semantics; |
51e94aa7 EDP |
526 | |
527 | #ifdef __cplusplus | |
528 | } | |
529 | #endif | |
530 | ||
718e3744 | 531 | #endif /*_ZEBRA_RIB_H */ |