From 333ddd4f981b90d5d3dff166b6abf9bf40bede9f Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Thu, 15 Sep 2022 01:38:18 +0200 Subject: 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. --- lib/ip.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/ip.h b/lib/ip.h index 0e232f97..f2650d3f 100644 --- a/lib/ip.h +++ b/lib/ip.h @@ -385,6 +385,8 @@ static inline ip6_addr ip6_hton(ip6_addr a) static inline ip6_addr ip6_ntoh(ip6_addr a) { return _MI6(ntohl(_I0(a)), ntohl(_I1(a)), ntohl(_I2(a)), ntohl(_I3(a))); } +#define MPLS_MAX_LABEL 0x100000 + #define MPLS_MAX_LABEL_STACK 8 typedef struct mpls_label_stack { uint len; -- cgit v1.2.3