]> git.proxmox.com Git - mirror_frr.git/blame - zebra/zebra_mpls.h
tools: config clang-format to allow aligned macros
[mirror_frr.git] / zebra / zebra_mpls.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
54d48ea1 2/*
3 * Zebra MPLS Data structures and definitions
4 * Copyright (C) 2015 Cumulus Networks, Inc.
54d48ea1 5 */
6
7#ifndef _ZEBRA_MPLS_H
8#define _ZEBRA_MPLS_H
9
10#include "prefix.h"
11#include "table.h"
12#include "queue.h"
13#include "hash.h"
14#include "jhash.h"
15#include "nexthop.h"
16#include "vty.h"
17#include "memory.h"
18#include "mpls.h"
19#include "zebra/zserv.h"
939fba27 20#include "zebra/zebra_vrf.h"
31f937fb 21#include "hook.h"
54d48ea1 22
51e94aa7
EDP
23#ifdef __cplusplus
24extern "C" {
25#endif
54d48ea1 26
27/* Definitions and macros. */
28
d62a17ae 29#define NHLFE_FAMILY(nhlfe) \
30 (((nhlfe)->nexthop->type == NEXTHOP_TYPE_IPV6 \
31 || (nhlfe)->nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX) \
32 ? AF_INET6 \
33 : AF_INET)
54d48ea1 34
ee70f629 35/* Declare LSP nexthop list types */
ee70f629
MS
36PREDECL_DLIST(nhlfe_list);
37
54d48ea1 38/*
39 * (Outgoing) nexthop label forwarding entry
40 */
f2595bd5 41struct zebra_nhlfe {
d62a17ae 42 /* Type of entry - static etc. */
43 enum lsp_types_t type;
54d48ea1 44
d62a17ae 45 /* Nexthop information (with outgoing label) */
46 struct nexthop *nexthop;
54d48ea1 47
d62a17ae 48 /* Backpointer to base entry. */
8f74a383 49 struct zebra_lsp *lsp;
54d48ea1 50
d62a17ae 51 /* Runtime info - flags, pointers etc. */
d7c0a89a 52 uint32_t flags;
54d48ea1 53#define NHLFE_FLAG_CHANGED (1 << 0)
54#define NHLFE_FLAG_SELECTED (1 << 1)
55#define NHLFE_FLAG_MULTIPATH (1 << 2)
56#define NHLFE_FLAG_DELETED (1 << 3)
57#define NHLFE_FLAG_INSTALLED (1 << 4)
cd4bb96f 58#define NHLFE_FLAG_IS_BACKUP (1 << 5)
54d48ea1 59
d7c0a89a 60 uint8_t distance;
ee70f629
MS
61
62 /* Linkage for LSPs' lists */
63 struct nhlfe_list_item list;
54d48ea1 64};
65
66/*
67 * Incoming label entry
68 */
a7d2146a 69struct zebra_ile {
d62a17ae 70 mpls_label_t in_label;
54d48ea1 71};
72
54d48ea1 73/*
74 * Label swap entry (ile -> list of nhlfes)
75 */
8f74a383 76struct zebra_lsp {
d62a17ae 77 /* Incoming label */
a7d2146a 78 struct zebra_ile ile;
54d48ea1 79
ee70f629
MS
80 /* List of NHLFEs, pointer to best, and num equal-cost. */
81 struct nhlfe_list_head nhlfe_list;
82
f2595bd5 83 struct zebra_nhlfe *best_nhlfe;
d7c0a89a 84 uint32_t num_ecmp;
54d48ea1 85
cd4bb96f
MS
86 /* Backup nhlfes, if present. The nexthop in a primary/active nhlfe
87 * refers to its backup (if any) by index, so the order of this list
88 * is significant.
89 */
90 struct nhlfe_list_head backup_nhlfe_list;
91
d62a17ae 92 /* Flags */
d7c0a89a 93 uint32_t flags;
54d48ea1 94#define LSP_FLAG_SCHEDULED (1 << 0)
95#define LSP_FLAG_INSTALLED (1 << 1)
96#define LSP_FLAG_CHANGED (1 << 2)
f9bf1ecc 97#define LSP_FLAG_FPM (1 << 3)
54d48ea1 98
d62a17ae 99 /* Address-family of NHLFE - saved here for delete. All NHLFEs */
100 /* have to be of the same AF */
d7c0a89a 101 uint8_t addr_family;
54d48ea1 102};
103
f31e084c
DS
104/*
105 * FEC to label binding.
106 */
60e36561 107struct zebra_fec {
d62a17ae 108 /* FEC (prefix) */
109 struct route_node *rn;
f31e084c 110
d62a17ae 111 /* In-label - either statically bound or derived from label block. */
112 mpls_label_t label;
f31e084c 113
d62a17ae 114 /* Label index (into global label block), if valid */
d7c0a89a 115 uint32_t label_index;
28d58fd7 116
d62a17ae 117 /* Flags. */
d7c0a89a 118 uint32_t flags;
f31e084c 119#define FEC_FLAG_CONFIGURED (1 << 0)
5aba114a 120
d62a17ae 121 /* Clients interested in this FEC. */
122 struct list *client_list;
f31e084c 123};
54d48ea1 124
ee70f629 125/* Declare typesafe list apis/macros */
f2595bd5 126DECLARE_DLIST(nhlfe_list, struct zebra_nhlfe, list);
ee70f629 127
7758e3f3 128/* Function declarations. */
129
1b6d5c7e
VV
130/*
131 * Add/update global label block.
132 */
d7c0a89a
QY
133int zebra_mpls_label_block_add(struct zebra_vrf *zvrf, uint32_t start_label,
134 uint32_t end_label);
1b6d5c7e
VV
135
136/*
137 * Delete global label block.
138 */
d62a17ae 139int zebra_mpls_label_block_del(struct zebra_vrf *vrf);
1b6d5c7e
VV
140
141/*
142 * Display MPLS global label block configuration (VTY command handler).
143 */
d62a17ae 144int zebra_mpls_write_label_block_config(struct vty *vty, struct zebra_vrf *vrf);
1b6d5c7e 145
a64448ba
DS
146/*
147 * Install dynamic LSP entry.
148 */
d62a17ae 149int zebra_mpls_lsp_install(struct zebra_vrf *zvrf, struct route_node *rn,
150 struct route_entry *re);
a64448ba
DS
151
152/*
d62a17ae 153 * Uninstall dynamic LSP entry, if any.
a64448ba 154 */
d62a17ae 155int zebra_mpls_lsp_uninstall(struct zebra_vrf *zvrf, struct route_node *rn,
156 struct route_entry *re);
a64448ba 157
d4cb23d7 158/* Add an NHLFE to an LSP, return the newly-added object */
f2595bd5 159struct zebra_nhlfe *
8f74a383 160zebra_mpls_lsp_add_nhlfe(struct zebra_lsp *lsp, enum lsp_types_t lsp_type,
f2595bd5
DS
161 enum nexthop_types_t gtype, const union g_addr *gate,
162 ifindex_t ifindex, uint8_t num_labels,
163 const mpls_label_t *out_labels);
cd4bb96f
MS
164
165/* Add or update a backup NHLFE for an LSP; return the object */
f2595bd5 166struct zebra_nhlfe *zebra_mpls_lsp_add_backup_nhlfe(
8f74a383
DS
167 struct zebra_lsp *lsp, enum lsp_types_t lsp_type,
168 enum nexthop_types_t gtype, const union g_addr *gate, ifindex_t ifindex,
169 uint8_t num_labels, const mpls_label_t *out_labels);
cd4bb96f
MS
170
171/*
172 * Add NHLFE or backup NHLFE to an LSP based on a nexthop. These just maintain
173 * the LSP and NHLFE objects; nothing is scheduled for processing.
174 * Return: the newly-added object
175 */
8f74a383 176struct zebra_nhlfe *zebra_mpls_lsp_add_nh(struct zebra_lsp *lsp,
f2595bd5
DS
177 enum lsp_types_t lsp_type,
178 const struct nexthop *nh);
8f74a383 179struct zebra_nhlfe *zebra_mpls_lsp_add_backup_nh(struct zebra_lsp *lsp,
f2595bd5
DS
180 enum lsp_types_t lsp_type,
181 const struct nexthop *nh);
d4cb23d7
MS
182
183/* Free an allocated NHLFE */
f2595bd5 184void zebra_mpls_nhlfe_free(struct zebra_nhlfe *nhlfe);
d4cb23d7 185
d62a17ae 186int zebra_mpls_fec_register(struct zebra_vrf *zvrf, struct prefix *p,
57592a53
AD
187 uint32_t label, uint32_t label_index,
188 struct zserv *client);
5aba114a
DS
189
190/*
191 * Deregistration from a client for the label binding for a FEC. The FEC
192 * itself is deleted if no other registered clients exist and there is no
193 * label bound to the FEC.
194 */
d62a17ae 195int zebra_mpls_fec_unregister(struct zebra_vrf *zvrf, struct prefix *p,
196 struct zserv *client);
5aba114a 197
f31e084c
DS
198/*
199 * Return FEC (if any) to which this label is bound.
200 * Note: Only works for per-prefix binding and when the label is not
201 * implicit-null.
202 * TODO: Currently walks entire table, can optimize later with another
203 * hash..
204 */
60e36561
DS
205struct zebra_fec *zebra_mpls_fec_for_label(struct zebra_vrf *zvrf,
206 mpls_label_t label);
f31e084c
DS
207
208/*
209 * Inform if specified label is currently bound to a FEC or not.
210 */
d62a17ae 211int zebra_mpls_label_already_bound(struct zebra_vrf *zvrf, mpls_label_t label);
f31e084c
DS
212
213/*
5aba114a 214 * Add static FEC to label binding. If there are clients registered for this
a64448ba
DS
215 * FEC, notify them. If there are labeled routes for this FEC, install the
216 * label forwarding entry.
f31e084c 217 */
d62a17ae 218int zebra_mpls_static_fec_add(struct zebra_vrf *zvrf, struct prefix *p,
219 mpls_label_t in_label);
f31e084c
DS
220
221/*
5aba114a
DS
222 * Remove static FEC to label binding. If there are no clients registered
223 * for this FEC, delete the FEC; else notify clients.
28d58fd7
VV
224 * Note: Upon delete of static binding, if label index exists for this FEC,
225 * client may need to be updated with derived label.
f31e084c 226 */
d62a17ae 227int zebra_mpls_static_fec_del(struct zebra_vrf *zvrf, struct prefix *p);
f31e084c
DS
228
229/*
230 * Display MPLS FEC to label binding configuration (VTY command handler).
231 */
d62a17ae 232int zebra_mpls_write_fec_config(struct vty *vty, struct zebra_vrf *zvrf);
f31e084c
DS
233
234/*
235 * Display MPLS FEC to label binding (VTY command handler).
236 */
d62a17ae 237void zebra_mpls_print_fec_table(struct vty *vty, struct zebra_vrf *zvrf);
f31e084c
DS
238
239/*
240 * Display MPLS FEC to label binding for a specific FEC (VTY command handler).
241 */
d62a17ae 242void zebra_mpls_print_fec(struct vty *vty, struct zebra_vrf *zvrf,
243 struct prefix *p);
f31e084c 244
ce549947 245/*
f2e7f4eb
MS
246 * Handle zapi request to install/uninstall LSP and
247 * (optionally) FEC-To-NHLFE (FTN) bindings.
53216dff
DS
248 *
249 * mpls_zapi_labels_process -> Installs for future processing
250 * in the meta-q
251 * zebra_mpls_labels_process -> called by the meta-q
ce549947 252 */
1548fbbc
DS
253void mpls_zapi_labels_process(bool add_p, struct zebra_vrf *zvrf,
254 const struct zapi_labels *zl);
53216dff
DS
255void zebra_mpls_zapi_labels_process(bool add_p, struct zebra_vrf *zvrf,
256 const struct zapi_labels *zl);
ce549947 257
ea6b290b
RW
258/*
259 * Uninstall all NHLFEs bound to a single FEC.
53216dff
DS
260 *
261 * mpls_ftn_uninstall -> Called to enqueue into early label processing
262 * via the metaq
263 * zebra_mpls_ftn_uninstall -> Called when we process the meta q
264 * for this item
ea6b290b 265 */
1548fbbc
DS
266void mpls_ftn_uninstall(struct zebra_vrf *zvrf, enum lsp_types_t type,
267 struct prefix *prefix, uint8_t route_type,
53216dff
DS
268 uint8_t route_instance);
269void zebra_mpls_ftn_uninstall(struct zebra_vrf *zvrf, enum lsp_types_t type,
270 struct prefix *prefix, uint8_t route_type,
271 uint8_t route_instance);
ce549947
RW
272/*
273 * Install/update a NHLFE for an LSP in the forwarding table. This may be
274 * a new LSP entry or a new NHLFE for an existing in-label or an update of
5065db0a 275 * the out-label(s) for an existing NHLFE (update case).
ce549947 276 */
d62a17ae 277int mpls_lsp_install(struct zebra_vrf *zvrf, enum lsp_types_t type,
5065db0a 278 mpls_label_t in_label, uint8_t num_out_labels,
cd4bb96f 279 const mpls_label_t *out_labels, enum nexthop_types_t gtype,
e4a1ec74 280 const union g_addr *gate, ifindex_t ifindex);
ce549947 281
31f937fb
SM
282/*
283 * Lookup LSP by its input label.
284 */
8f74a383 285struct zebra_lsp *mpls_lsp_find(struct zebra_vrf *zvrf, mpls_label_t in_label);
31f937fb 286
ce549947
RW
287/*
288 * Uninstall a particular NHLFE in the forwarding table. If this is
289 * the only NHLFE, the entire LSP forwarding entry has to be deleted.
290 */
d62a17ae 291int mpls_lsp_uninstall(struct zebra_vrf *zvrf, enum lsp_types_t type,
292 mpls_label_t in_label, enum nexthop_types_t gtype,
cc1b9746
MS
293 const union g_addr *gate, ifindex_t ifindex,
294 bool backup_p);
ce549947
RW
295
296/*
ea6b290b 297 * Uninstall all NHLFEs for a particular LSP forwarding entry.
ce549947 298 */
ea6b290b
RW
299int mpls_lsp_uninstall_all_vrf(struct zebra_vrf *zvrf, enum lsp_types_t type,
300 mpls_label_t in_label);
ce549947 301
1c1cf002 302#if defined(HAVE_CUMULUS)
7758e3f3 303/*
304 * Check that the label values used in LSP creation are consistent. The
305 * main criteria is that if there is ECMP, the label operation must still
306 * be consistent - i.e., all paths either do a swap or do PHP. This is due
307 * to current HW restrictions.
308 */
d62a17ae 309int zebra_mpls_lsp_label_consistent(struct zebra_vrf *zvrf,
310 mpls_label_t in_label,
311 mpls_label_t out_label,
312 enum nexthop_types_t gtype,
313 union g_addr *gate, ifindex_t ifindex);
1c1cf002 314#endif /* HAVE_CUMULUS */
7758e3f3 315
316/*
317 * Add static LSP entry. This may be the first entry for this incoming label
318 * or an additional nexthop; an existing entry may also have outgoing label
319 * changed.
320 * Note: The label operation (swap or PHP) is common for the LSP entry (all
321 * NHLFEs).
322 */
d62a17ae 323int zebra_mpls_static_lsp_add(struct zebra_vrf *zvrf, mpls_label_t in_label,
324 mpls_label_t out_label,
325 enum nexthop_types_t gtype, union g_addr *gate,
326 ifindex_t ifindex);
7758e3f3 327
328/*
329 * Delete static LSP entry. This may be the delete of one particular
330 * NHLFE for this incoming label or the delete of the entire entry (i.e.,
331 * all NHLFEs).
332 * NOTE: Delete of the only NHLFE will also end up deleting the entire
333 * LSP configuration.
334 */
d62a17ae 335int zebra_mpls_static_lsp_del(struct zebra_vrf *zvrf, mpls_label_t in_label,
336 enum nexthop_types_t gtype, union g_addr *gate,
337 ifindex_t ifindex);
7758e3f3 338
d37f4d6c
MS
339/*
340 * Process LSP update results from zebra dataplane.
341 */
342/* Forward ref of dplane update context type */
343struct zebra_dplane_ctx;
344
345void zebra_mpls_lsp_dplane_result(struct zebra_dplane_ctx *ctx);
346
104e3ad9
MS
347/* Process async dplane notifications. */
348void zebra_mpls_process_dplane_notify(struct zebra_dplane_ctx *ctx);
349
40c7bdb0 350/*
351 * Schedule all MPLS label forwarding entries for processing.
352 * Called upon changes that may affect one or more of them such as
353 * interface or nexthop state changes.
354 */
d62a17ae 355void zebra_mpls_lsp_schedule(struct zebra_vrf *zvrf);
40c7bdb0 356
3ab18ff2 357/*
358 * Display MPLS label forwarding table for a specific LSP
359 * (VTY command handler).
360 */
d62a17ae 361void zebra_mpls_print_lsp(struct vty *vty, struct zebra_vrf *zvrf,
9f049418 362 mpls_label_t label, bool use_json);
3ab18ff2 363
364/*
365 * Display MPLS label forwarding table (VTY command handler).
366 */
d62a17ae 367void zebra_mpls_print_lsp_table(struct vty *vty, struct zebra_vrf *zvrf,
9f049418 368 bool use_json);
3ab18ff2 369
7758e3f3 370/*
371 * Display MPLS LSP configuration of all static LSPs (VTY command handler).
372 */
d62a17ae 373int zebra_mpls_write_lsp_config(struct vty *vty, struct zebra_vrf *zvrf);
7758e3f3 374
84915b0a 375/*
376 * Called when VRF becomes inactive, cleans up information but keeps
377 * the table itself.
378 * NOTE: Currently supported only for default VRF.
379 */
380void zebra_mpls_cleanup_tables(struct zebra_vrf *zvrf);
381
40c7bdb0 382/*
383 * Called upon process exiting, need to delete LSP forwarding
384 * entries from the kernel.
385 * NOTE: Currently supported only for default VRF.
386 */
d62a17ae 387void zebra_mpls_close_tables(struct zebra_vrf *zvrf);
40c7bdb0 388
7758e3f3 389/*
390 * Allocate MPLS tables for this VRF.
391 * NOTE: Currently supported only for default VRF.
392 */
d62a17ae 393void zebra_mpls_init_tables(struct zebra_vrf *zvrf);
7758e3f3 394
c87f5c23
DS
395/*
396 * If mpls is turned on *after* FRR is brought
397 * up let's actually notice this and turn on
398 * the relevant bits to make it work.
399 */
400void zebra_mpls_turned_on(void);
401
7758e3f3 402/*
403 * Global MPLS initialization.
404 */
d62a17ae 405void zebra_mpls_init(void);
7758e3f3 406
fe6c7157
RW
407/*
408 * MPLS VTY.
409 */
d62a17ae 410void zebra_mpls_vty_init(void);
fe6c7157 411
06302ecb
DS
412/*
413 * When cleaning up a client connection ensure that there are no
414 * vrf labels that need cleaning up too
415 */
416void zebra_mpls_client_cleanup_vrf_label(uint8_t proto);
417
40c7bdb0 418/* Inline functions. */
419
420/*
421 * Distance (priority) definition for LSP NHLFE.
422 */
d7c0a89a 423static inline uint8_t lsp_distance(enum lsp_types_t type)
40c7bdb0 424{
0492eea0
RW
425 switch (type) {
426 case ZEBRA_LSP_STATIC:
d62a17ae 427 return (route_distance(ZEBRA_ROUTE_STATIC));
0492eea0
RW
428 case ZEBRA_LSP_LDP:
429 return (route_distance(ZEBRA_ROUTE_LDP));
430 case ZEBRA_LSP_BGP:
431 return (route_distance(ZEBRA_ROUTE_BGP));
339e36d2
DS
432 case ZEBRA_LSP_NONE:
433 case ZEBRA_LSP_SHARP:
4645cb6b 434 case ZEBRA_LSP_EVPN:
635a039e 435 case ZEBRA_LSP_OSPF_SR:
26f6acaf 436 case ZEBRA_LSP_ISIS_SR:
31f937fb 437 case ZEBRA_LSP_SRTE:
0492eea0
RW
438 return 150;
439 }
339e36d2
DS
440
441 /*
442 * For some reason certain compilers do not believe
443 * that all the cases have been handled. And
444 * WTF does this work differently than when I removed
445 * the default case????
446 */
447 return 150;
40c7bdb0 448}
449
450/*
451 * Map RIB type to LSP type. Used when labeled-routes from BGP
452 * are converted into LSPs.
453 */
d62a17ae 454static inline enum lsp_types_t lsp_type_from_re_type(int re_type)
40c7bdb0 455{
d62a17ae 456 switch (re_type) {
457 case ZEBRA_ROUTE_STATIC:
458 return ZEBRA_LSP_STATIC;
635a039e
RW
459 case ZEBRA_ROUTE_LDP:
460 return ZEBRA_LSP_LDP;
d62a17ae 461 case ZEBRA_ROUTE_BGP:
462 return ZEBRA_LSP_BGP;
635a039e
RW
463 case ZEBRA_ROUTE_OSPF:
464 return ZEBRA_LSP_OSPF_SR;
26f6acaf
RW
465 case ZEBRA_ROUTE_ISIS:
466 return ZEBRA_LSP_ISIS_SR;
339e36d2
DS
467 case ZEBRA_ROUTE_SHARP:
468 return ZEBRA_LSP_SHARP;
31f937fb
SM
469 case ZEBRA_ROUTE_SRTE:
470 return ZEBRA_LSP_SRTE;
d62a17ae 471 default:
472 return ZEBRA_LSP_NONE;
473 }
40c7bdb0 474}
475
805444ce
RW
476/*
477 * Map LSP type to RIB type.
478 */
479static inline int re_type_from_lsp_type(enum lsp_types_t lsp_type)
480{
481 switch (lsp_type) {
482 case ZEBRA_LSP_STATIC:
483 return ZEBRA_ROUTE_STATIC;
484 case ZEBRA_LSP_LDP:
485 return ZEBRA_ROUTE_LDP;
486 case ZEBRA_LSP_BGP:
4645cb6b 487 case ZEBRA_LSP_EVPN:
805444ce 488 return ZEBRA_ROUTE_BGP;
635a039e 489 case ZEBRA_LSP_OSPF_SR:
7726c479 490 return ZEBRA_ROUTE_OSPF;
26f6acaf
RW
491 case ZEBRA_LSP_ISIS_SR:
492 return ZEBRA_ROUTE_ISIS;
805444ce 493 case ZEBRA_LSP_NONE:
805444ce 494 return ZEBRA_ROUTE_KERNEL;
339e36d2
DS
495 case ZEBRA_LSP_SHARP:
496 return ZEBRA_ROUTE_SHARP;
31f937fb
SM
497 case ZEBRA_LSP_SRTE:
498 return ZEBRA_ROUTE_SRTE;
805444ce 499 }
339e36d2
DS
500
501 /*
502 * For some reason certain compilers do not believe
503 * that all the cases have been handled. And
504 * WTF does this work differently than when I removed
505 * the default case????
506 */
507 return ZEBRA_ROUTE_KERNEL;
805444ce
RW
508}
509
3ab18ff2 510/* NHLFE type as printable string. */
d62a17ae 511static inline const char *nhlfe_type2str(enum lsp_types_t lsp_type)
3ab18ff2 512{
d62a17ae 513 switch (lsp_type) {
514 case ZEBRA_LSP_STATIC:
515 return "Static";
516 case ZEBRA_LSP_LDP:
517 return "LDP";
518 case ZEBRA_LSP_BGP:
519 return "BGP";
635a039e
RW
520 case ZEBRA_LSP_OSPF_SR:
521 return "SR (OSPF)";
26f6acaf
RW
522 case ZEBRA_LSP_ISIS_SR:
523 return "SR (IS-IS)";
339e36d2
DS
524 case ZEBRA_LSP_SHARP:
525 return "SHARP";
31f937fb
SM
526 case ZEBRA_LSP_SRTE:
527 return "SR-TE";
4645cb6b
SW
528 case ZEBRA_LSP_EVPN:
529 return "EVPN";
339e36d2 530 case ZEBRA_LSP_NONE:
d62a17ae 531 return "Unknown";
532 }
339e36d2
DS
533
534 /*
535 * For some reason certain compilers do not believe
536 * that all the cases have been handled. And
537 * WTF does this work differently than when I removed
538 * the default case????
539 */
540 return "Unknown";
3ab18ff2 541}
542
a1494c25
DS
543static inline void mpls_mark_lsps_for_processing(struct zebra_vrf *zvrf,
544 struct prefix *p)
939fba27 545{
a1494c25
DS
546 struct route_table *table;
547 struct route_node *rn;
548 rib_dest_t *dest;
549
d62a17ae 550 if (!zvrf)
551 return;
939fba27 552
a1494c25
DS
553 table = zvrf->table[family2afi(p->family)][SAFI_UNICAST];
554 if (!table)
555 return;
556
557 rn = route_node_match(table, p);
558 if (!rn)
559 return;
560
561
562 dest = rib_dest_from_rnode(rn);
563 SET_FLAG(dest->flags, RIB_DEST_UPDATE_LSPS);
939fba27 564}
565
a1494c25 566static inline void mpls_unmark_lsps_for_processing(struct route_node *rn)
939fba27 567{
a1494c25 568 rib_dest_t *dest = rib_dest_from_rnode(rn);
939fba27 569
a1494c25 570 UNSET_FLAG(dest->flags, RIB_DEST_UPDATE_LSPS);
939fba27 571}
572
a1494c25 573static inline int mpls_should_lsps_be_processed(struct route_node *rn)
939fba27 574{
a1494c25 575 rib_dest_t *dest = rib_dest_from_rnode(rn);
939fba27 576
a1494c25 577 return !!CHECK_FLAG(dest->flags, RIB_DEST_UPDATE_LSPS);
939fba27 578}
579
fe6c7157 580/* Global variables. */
c87f5c23 581extern bool mpls_enabled;
6fb35808 582extern bool mpls_pw_reach_strict; /* Strict pseudowire reachability checking */
fe6c7157 583
51e94aa7
EDP
584#ifdef __cplusplus
585}
586#endif
587
54d48ea1 588#endif /*_ZEBRA_MPLS_H */