2 * Zebra MPLS Data structures and definitions
3 * Copyright (C) 2015 Cumulus Networks, Inc.
5 * This file is part of GNU Zebra.
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
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.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Zebra; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
35 #include "zebra/zserv.h"
38 /* Definitions and macros. */
40 #define NHLFE_FAMILY(nhlfe) \
41 (((nhlfe)->nexthop->type == NEXTHOP_TYPE_IPV6 || \
42 (nhlfe)->nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX) ? AF_INET6 : AF_INET)
47 typedef struct zebra_ile_t_ zebra_ile_t
;
48 typedef struct zebra_snhlfe_t_ zebra_snhlfe_t
;
49 typedef struct zebra_slsp_t_ zebra_slsp_t
;
50 typedef struct zebra_nhlfe_t_ zebra_nhlfe_t
;
51 typedef struct zebra_lsp_t_ zebra_lsp_t
;
56 ZEBRA_LSP_INVALID
= 0, /* Invalid. */
57 ZEBRA_LSP_STATIC
= 1, /* Static LSP. */
61 * (Outgoing) nexthop label forwarding entry configuration
63 struct zebra_snhlfe_t_
65 /* Nexthop information */
66 enum nexthop_types_t gtype
;
72 mpls_label_t out_label
;
74 /* Backpointer to base entry. */
77 /* Pointers to more outgoing information for same in-label */
83 * (Outgoing) nexthop label forwarding entry
87 /* Type of entry - static etc. */
88 enum lsp_types_t type
;
90 /* Nexthop information (with outgoing label) */
91 struct nexthop
*nexthop
;
93 /* Backpointer to base entry. */
96 /* Runtime info - flags, pointers etc. */
98 #define NHLFE_FLAG_CHANGED (1 << 0)
99 #define NHLFE_FLAG_SELECTED (1 << 1)
100 #define NHLFE_FLAG_MULTIPATH (1 << 2)
101 #define NHLFE_FLAG_DELETED (1 << 3)
102 #define NHLFE_FLAG_INSTALLED (1 << 4)
110 * Incoming label entry
114 mpls_label_t in_label
;
118 * Label swap entry static configuration.
125 /* List of outgoing nexthop static configuration */
126 zebra_snhlfe_t
*snhlfe_list
;
131 * Label swap entry (ile -> list of nhlfes)
138 /* List of NHLFE, pointer to best and num equal-cost. */
139 zebra_nhlfe_t
*nhlfe_list
;
140 zebra_nhlfe_t
*best_nhlfe
;
145 #define LSP_FLAG_SCHEDULED (1 << 0)
146 #define LSP_FLAG_INSTALLED (1 << 1)
147 #define LSP_FLAG_CHANGED (1 << 2)
149 /* Address-family of NHLFE - saved here for delete. All NHLFEs */
150 /* have to be of the same AF */
155 /* Function declarations. */
158 * Check that the label values used in LSP creation are consistent. The
159 * main criteria is that if there is ECMP, the label operation must still
160 * be consistent - i.e., all paths either do a swap or do PHP. This is due
161 * to current HW restrictions.
164 zebra_mpls_lsp_label_consistent (struct zebra_vrf
*zvrf
, mpls_label_t in_label
,
165 mpls_label_t out_label
, enum nexthop_types_t gtype
,
166 union g_addr
*gate
, char *ifname
, ifindex_t ifindex
);
169 * Add static LSP entry. This may be the first entry for this incoming label
170 * or an additional nexthop; an existing entry may also have outgoing label
172 * Note: The label operation (swap or PHP) is common for the LSP entry (all
176 zebra_mpls_static_lsp_add (struct zebra_vrf
*zvrf
, mpls_label_t in_label
,
177 mpls_label_t out_label
, enum nexthop_types_t gtype
,
178 union g_addr
*gate
, char *ifname
, ifindex_t ifindex
);
181 * Delete static LSP entry. This may be the delete of one particular
182 * NHLFE for this incoming label or the delete of the entire entry (i.e.,
184 * NOTE: Delete of the only NHLFE will also end up deleting the entire
188 zebra_mpls_static_lsp_del (struct zebra_vrf
*zvrf
, mpls_label_t in_label
,
189 enum nexthop_types_t gtype
, union g_addr
*gate
,
190 char *ifname
, ifindex_t ifindex
);
193 * Display MPLS LSP configuration of all static LSPs (VTY command handler).
196 zebra_mpls_write_lsp_config (struct vty
*vty
, struct zebra_vrf
*zvrf
);
199 * Allocate MPLS tables for this VRF.
200 * NOTE: Currently supported only for default VRF.
203 zebra_mpls_init_tables (struct zebra_vrf
*zvrf
);
206 * Global MPLS initialization.
209 zebra_mpls_init (void);
211 #endif /*_ZEBRA_MPLS_H */