summaryrefslogtreecommitdiff
path: root/nest/route.h
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2022-09-15 01:38:18 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2023-10-04 13:01:21 +0200
commit333ddd4f981b90d5d3dff166b6abf9bf40bede9f (patch)
treecfe873631d254b9198d7040a7f922f65d158f15d /nest/route.h
parente55696a4f88b63c622bb3a0360f9114d01253e53 (diff)
MPLS subsystem
The MPLS subsystem manages MPLS labels and handles their allocation to MPLS-aware routing protocols. These labels are then attached to IP or VPN routes representing label switched paths -- LSPs. There was already a preliminary MPLS support consisting of MPLS label net_addr, MPLS routing tables with static MPLS routes, remote labels in next hops, and kernel protocol support. This patch adds the MPLS domain as a basic structure representing local label space with dynamic label allocator and configurable label ranges. To represent LSPs, allocated local labels can be attached as route attributes to IP or VPN routes with local labels as attributes. There are several steps for handling LSP routes in routing protocols -- deciding to which forwarding equivalence class (FEC) the LSP route belongs, allocating labels for new FECs, announcing MPLS routes for new FECs, attaching labels to LSP routes. The FEC map structure implements basic code for managing FECs in routing protocols, therefore existing protocols can be made MPLS-aware by adding FEC map and delegating most work related to local label management to it.
Diffstat (limited to 'nest/route.h')
-rw-r--r--nest/route.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/nest/route.h b/nest/route.h
index 4fe43e6f..694e3c5d 100644
--- a/nest/route.h
+++ b/nest/route.h
@@ -200,6 +200,7 @@ typedef struct rtable {
struct timer *settle_timer; /* Settle time for notifications */
list flowspec_links; /* List of flowspec links, src for NET_IPx and dst for NET_FLOWx */
struct f_trie *flowspec_trie; /* Trie for evaluation of flowspec notifications */
+ // struct mpls_domain *mpls_domain; /* Label allocator for MPLS */
} rtable;
struct rt_subscription {
@@ -527,7 +528,10 @@ typedef struct eattr {
const char *ea_custom_name(uint ea);
-#define EA_GEN_IGP_METRIC EA_CODE(PROTOCOL_NONE, 0)
+#define EA_GEN_IGP_METRIC EA_CODE(PROTOCOL_NONE, 0)
+#define EA_MPLS_LABEL EA_CODE(PROTOCOL_NONE, 1)
+#define EA_MPLS_POLICY EA_CODE(PROTOCOL_NONE, 2)
+#define EA_MPLS_CLASS EA_CODE(PROTOCOL_NONE, 3)
#define EA_CODE_MASK 0xffff
#define EA_CUSTOM_BIT 0x8000
@@ -687,7 +691,7 @@ static inline int nexthop_same(struct nexthop *x, struct nexthop *y)
{ return (x == y) || nexthop__same(x, y); }
struct nexthop *nexthop_merge(struct nexthop *x, struct nexthop *y, int rx, int ry, int max, linpool *lp);
struct nexthop *nexthop_sort(struct nexthop *x);
-static inline void nexthop_link(struct rta *a, struct nexthop *from)
+static inline void nexthop_link(struct rta *a, const struct nexthop *from)
{ memcpy(&a->nh, from, nexthop_size(from)); }
void nexthop_insert(struct nexthop **n, struct nexthop *y);
int nexthop_is_sorted(struct nexthop *x);