summaryrefslogtreecommitdiff
path: root/nest/protocol.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/protocol.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/protocol.h')
-rw-r--r--nest/protocol.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/nest/protocol.h b/nest/protocol.h
index 596e810e..81139c33 100644
--- a/nest/protocol.h
+++ b/nest/protocol.h
@@ -31,6 +31,7 @@ struct channel;
struct ea_list;
struct eattr;
struct symbol;
+struct mpls_fec_map;
/*
@@ -172,6 +173,8 @@ struct proto {
struct channel *main_channel; /* Primary channel */
struct rte_src *main_source; /* Primary route source */
struct iface *vrf; /* Related VRF instance, NULL if global */
+ struct channel *mpls_channel; /* MPLS channel, when used */
+ struct mpls_fec_map *mpls_map; /* Maps protocol routes to FECs / labels */
const char *name; /* Name of this instance (== cf->name) */
u32 debug; /* Debugging flags */
@@ -619,12 +622,16 @@ struct channel {
struct channel_config *proto_cf_find_channel(struct proto_config *p, uint net_type);
static inline struct channel_config *proto_cf_main_channel(struct proto_config *pc)
{ return proto_cf_find_channel(pc, pc->net_type); }
+static inline struct channel_config *proto_cf_mpls_channel(struct proto_config *pc)
+{ return proto_cf_find_channel(pc, NET_MPLS); }
struct channel *proto_find_channel_by_table(struct proto *p, struct rtable *t);
struct channel *proto_find_channel_by_name(struct proto *p, const char *n);
struct channel *proto_add_channel(struct proto *p, struct channel_config *cf);
void proto_remove_channel(struct proto *p, struct channel *c);
int proto_configure_channel(struct proto *p, struct channel **c, struct channel_config *cf);
+void proto_setup_mpls_map(struct proto *p, uint rts, int hooks);
+void proto_shutdown_mpls_map(struct proto *p, int hooks);
void channel_set_state(struct channel *c, uint state);
void channel_setup_in_table(struct channel *c);