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