summaryrefslogtreecommitdiff
path: root/nest/rt-attr.c
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/rt-attr.c
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/rt-attr.c')
-rw-r--r--nest/rt-attr.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index 9e29abc8..367a08ef 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -803,13 +803,27 @@ ea_free(ea_list *o)
static int
get_generic_attr(const eattr *a, byte **buf, int buflen UNUSED)
{
- if (a->id == EA_GEN_IGP_METRIC)
- {
- *buf += bsprintf(*buf, "igp_metric");
- return GA_NAME;
- }
+ switch (a->id)
+ {
+ case EA_GEN_IGP_METRIC:
+ *buf += bsprintf(*buf, "igp_metric");
+ return GA_NAME;
+
+ case EA_MPLS_LABEL:
+ *buf += bsprintf(*buf, "mpls_label");
+ return GA_NAME;
- return GA_UNKNOWN;
+ case EA_MPLS_POLICY:
+ *buf += bsprintf(*buf, "mpls_policy");
+ return GA_NAME;
+
+ case EA_MPLS_CLASS:
+ *buf += bsprintf(*buf, "mpls_class");
+ return GA_NAME;
+
+ default:
+ return GA_UNKNOWN;
+ }
}
void