/* Definitions and macros. */
-#define MPLS_MAX_LABELS 2 /* Maximum # labels that can be pushed. */
-
#define NHLFE_FAMILY(nhlfe) \
(((nhlfe)->nexthop->type == NEXTHOP_TYPE_IPV6 \
|| (nhlfe)->nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX) \
*/
void mpls_ldp_ftn_uninstall_all(struct zebra_vrf *zvrf, int afi);
+/*
+ * Uninstall all Segment Routing NHLFEs for a particular LSP forwarding entry.
+ * If no other NHLFEs exist, the entry would be deleted.
+ */
+void mpls_sr_lsp_uninstall_all(struct hash_backet *backet, void *ctxt);
+
#if defined(HAVE_CUMULUS)
/*
* Check that the label values used in LSP creation are consistent. The
*/
static inline u_char lsp_distance(enum lsp_types_t type)
{
- if (type == ZEBRA_LSP_STATIC)
+ switch (type) {
+ case ZEBRA_LSP_STATIC:
return (route_distance(ZEBRA_ROUTE_STATIC));
-
- return 150;
+ case ZEBRA_LSP_LDP:
+ return (route_distance(ZEBRA_ROUTE_LDP));
+ case ZEBRA_LSP_BGP:
+ return (route_distance(ZEBRA_ROUTE_BGP));
+ default:
+ return 150;
+ }
}
/*
}
}
+/*
+ * Map LSP type to RIB type.
+ */
+static inline int re_type_from_lsp_type(enum lsp_types_t lsp_type)
+{
+ switch (lsp_type) {
+ case ZEBRA_LSP_STATIC:
+ return ZEBRA_ROUTE_STATIC;
+ case ZEBRA_LSP_LDP:
+ return ZEBRA_ROUTE_LDP;
+ case ZEBRA_LSP_BGP:
+ return ZEBRA_ROUTE_BGP;
+ case ZEBRA_LSP_SR:
+ return ZEBRA_ROUTE_OSPF;
+ case ZEBRA_LSP_NONE:
+ default:
+ return ZEBRA_ROUTE_KERNEL;
+ }
+}
+
/* NHLFE type as printable string. */
static inline const char *nhlfe_type2str(enum lsp_types_t lsp_type)
{
return "LDP";
case ZEBRA_LSP_BGP:
return "BGP";
+ case ZEBRA_LSP_SR:
+ return "SR";
default:
return "Unknown";
}