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

Commit e3e4712e authored by Roopa Prabhu's avatar Roopa Prabhu Committed by David S. Miller
Browse files

mpls: ip tunnel support



This implementation uses lwtunnel infrastructure to register
hooks for mpls tunnel encaps.

It picks cues from iptunnel_encaps infrastructure and previous
mpls iptunnel RFC patches from Eric W. Biederman and Robert Shearman

Signed-off-by: default avatarRoopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent face0188
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
#ifndef _LINUX_MPLS_IPTUNNEL_H
#define _LINUX_MPLS_IPTUNNEL_H

#include <uapi/linux/mpls_iptunnel.h>

#endif  /* _LINUX_MPLS_IPTUNNEL_H */
+29 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015 Cumulus Networks, Inc.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 */

#ifndef _NET_MPLS_IPTUNNEL_H
#define _NET_MPLS_IPTUNNEL_H 1

#define MAX_NEW_LABELS 2

struct mpls_iptunnel_encap {
	u32	label[MAX_NEW_LABELS];
	u32	labels;
};

static inline struct mpls_iptunnel_encap *mpls_lwtunnel_encap(struct lwtunnel_state *lwtstate)
{
	return (struct mpls_iptunnel_encap *)lwtstate->data;
}

#endif
+28 −0
Original line number Diff line number Diff line
/*
 *	mpls tunnel api
 *
 *	Authors:
 *		Roopa Prabhu <roopa@cumulusnetworks.com>
 *
 *	This program is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU General Public License
 *	as published by the Free Software Foundation; either version
 *	2 of the License, or (at your option) any later version.
 */

#ifndef _UAPI_LINUX_MPLS_IPTUNNEL_H
#define _UAPI_LINUX_MPLS_IPTUNNEL_H

/* MPLS tunnel attributes
 * [RTA_ENCAP] = {
 *     [MPLS_IPTUNNEL_DST]
 * }
 */
enum {
	MPLS_IPTUNNEL_UNSPEC,
	MPLS_IPTUNNEL_DST,
	__MPLS_IPTUNNEL_MAX,
};
#define MPLS_IPTUNNEL_MAX (__MPLS_IPTUNNEL_MAX - 1)

#endif /* _UAPI_LINUX_MPLS_IPTUNNEL_H */
+7 −1
Original line number Diff line number Diff line
@@ -24,7 +24,13 @@ config NET_MPLS_GSO

config MPLS_ROUTING
	tristate "MPLS: routing support"
	help
	---help---
	 Add support for forwarding of mpls packets.

config MPLS_IPTUNNEL
	tristate "MPLS: IP over MPLS tunnel support"
	depends on LWTUNNEL && MPLS_ROUTING
	---help---
	 mpls ip tunnel support.

endif # MPLS
+1 −0
Original line number Diff line number Diff line
@@ -3,5 +3,6 @@
#
obj-$(CONFIG_NET_MPLS_GSO) += mpls_gso.o
obj-$(CONFIG_MPLS_ROUTING) += mpls_router.o
obj-$(CONFIG_MPLS_IPTUNNEL) += mpls_iptunnel.o

mpls_router-y := af_mpls.o
Loading