Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27db730c authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'basic-mpls-support'



Eric W. Biederman says:

====================
Basic MPLS support take 2

On top of my two pending neighbour table prep patches here is the mpls
support refactored to use them, and edited to not drop routes when
an interface goes down.  Additionally the addition of RTA_LLGATEWAY
has been replaced with the addtion of RTA_VIA.  RTA_VIA being an
attribute that includes the address family as well as the address
of the next hop.

MPLS is at it's heart simple and I have endeavoured to maintain that
simplicity in my implemenation.

This is an implementation of a RFC3032 forwarding engine, and basic MPLS
egress logic.  Which should make linux sufficient to be a mpls
forwarding node or to be a LSA (Label Switched Router) as it says in all
of the MPLS documents.  The ingress support will follow but it deserves
it's own discussion so I am pushing it separately.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents ee23393b 8de147dc
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
/proc/sys/net/mpls/* Variables:

platform_labels - INTEGER
	Number of entries in the platform label table.  It is not
	possible to configure forwarding for label values equal to or
	greater than the number of platform labels.

	A dense utliziation of the entries in the platform label table
	is possible and expected aas the platform labels are locally
	allocated.

	If the number of platform label table entries is set to 0 no
	label will be recognized by the kernel and mpls forwarding
	will be disabled.

	Reducing this value will remove all label routing entries that
	no longer fit in the table.

	Possible values: 0 - 1048575
	Default: 0
+2 −0
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@ struct ucred {
#define AF_WANPIPE	25	/* Wanpipe API Sockets */
#define AF_LLC		26	/* Linux LLC			*/
#define AF_IB		27	/* Native InfiniBand address	*/
#define AF_MPLS		28	/* MPLS */
#define AF_CAN		29	/* Controller Area Network      */
#define AF_TIPC		30	/* TIPC sockets			*/
#define AF_BLUETOOTH	31	/* Bluetooth sockets 		*/
@@ -226,6 +227,7 @@ struct ucred {
#define PF_WANPIPE	AF_WANPIPE
#define PF_LLC		AF_LLC
#define PF_IB		AF_IB
#define PF_MPLS		AF_MPLS
#define PF_CAN		AF_CAN
#define PF_TIPC		AF_TIPC
#define PF_BLUETOOTH	AF_BLUETOOTH
+4 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#endif
#include <net/netns/nftables.h>
#include <net/netns/xfrm.h>
#include <net/netns/mpls.h>
#include <linux/ns_common.h>

struct user_namespace;
@@ -129,6 +130,9 @@ struct net {
#endif
#if IS_ENABLED(CONFIG_IP_VS)
	struct netns_ipvs	*ipvs;
#endif
#if IS_ENABLED(CONFIG_MPLS)
	struct netns_mpls	mpls;
#endif
	struct sock		*diag_nlsk;
	atomic_t		fnhe_genid;
+17 −0
Original line number Diff line number Diff line
/*
 * mpls in net namespaces
 */

#ifndef __NETNS_MPLS_H__
#define __NETNS_MPLS_H__

struct mpls_route;
struct ctl_table_header;

struct netns_mpls {
	size_t platform_labels;
	struct mpls_route __rcu * __rcu *platform_label;
	struct ctl_table_header *ctl;
};

#endif /* __NETNS_MPLS_H__ */
+10 −0
Original line number Diff line number Diff line
@@ -303,6 +303,8 @@ enum rtattr_type_t {
	RTA_TABLE,
	RTA_MARK,
	RTA_MFC_STATS,
	RTA_VIA,
	RTA_NEWDST,
	__RTA_MAX
};

@@ -344,6 +346,12 @@ struct rtnexthop {
#define RTNH_SPACE(len)	RTNH_ALIGN(RTNH_LENGTH(len))
#define RTNH_DATA(rtnh)   ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0)))

/* RTA_VIA */
struct rtvia {
	__kernel_sa_family_t	rtvia_family;
	__u8			rtvia_addr[0];
};

/* RTM_CACHEINFO */

struct rta_cacheinfo {
@@ -623,6 +631,8 @@ enum rtnetlink_groups {
#define RTNLGRP_IPV6_NETCONF	RTNLGRP_IPV6_NETCONF
	RTNLGRP_MDB,
#define RTNLGRP_MDB		RTNLGRP_MDB
	RTNLGRP_MPLS_ROUTE,
#define RTNLGRP_MPLS_ROUTE	RTNLGRP_MPLS_ROUTE
	__RTNLGRP_MAX
};
#define RTNLGRP_MAX	(__RTNLGRP_MAX - 1)
Loading