Skip to contentSkip to conversation

lwtunnels: basic infra for light weight tunnels like mpls

RFC PATCH In review Roopa Prabhu 1 participant 1 message Jun 3, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/3 lwtunnels: basic infra for light weight tunnels like mpls

From: Roopa Prabhu <[email protected]>

Still in the works. Not fully functional.
And in some cases me going back and forth on a
few things.

Started with thinking the tunnel hdr can be shared and refcounted. Its somewhere mid way now.

---
 include/linux/if_lwtunnel.h      |    8 ++
 include/net/lwtunnel.h           |   61 +++++++++++++
 include/uapi/linux/if_lwtunnel.h |   12 +++
 include/uapi/linux/rtnetlink.h   |    8 +-
 net/Makefile                     |    2 +-
 net/lwtunnel.c                   |  177 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 266 insertions(+), 2 deletions(-)
 create mode 100644 include/linux/if_lwtunnel.h
 create mode 100644 include/net/lwtunnel.h
 create mode 100644 include/uapi/linux/if_lwtunnel.h
 create mode 100644 net/lwtunnel.c
include/linux/if_lwtunnel.h new file +8 -0
new file mode 100644
index 0000000..5fa7ca2
@@ -0,0 +1,8 @@
+#ifndef _IF_LWTUNNEL_H_
+#define _IF_LWTUNNEL_H_
+
+#include <linux/ip.h>
+#include <linux/in6.h>
+#include <uapi/linux/if_lwtunnel.h>
+
+#endif /* _IF_LWTUNNEL_H_ */
include/net/lwtunnel.h new file +61 -0

61 lines not on this page · raw message

include/uapi/linux/if_lwtunnel.h new file +12 -0
new file mode 100644
index 0000000..28b8497
@@ -0,0 +1,12 @@
+#ifndef _UAPI_IF_LW_TUNNEL_H_
+#define _UAPI_IF_LW_TUNNEL_H_
+
+#include <linux/types.h>
+#include <asm/byteorder.h>
+
+enum tunnel_encap_types {
+	LW_TUNNEL_ENCAP_NONE,
+	LW_TUNNEL_ENCAP_MPLS,
+};
+
+#endif /* _UAPI_IF_LW_TUNNEL_H_ */
include/uapi/linux/rtnetlink.h +7 -1
index 17fb02f..47e5de1 100644
@@ -308,6 +308,7 @@ enum rtattr_type_t {
 	RTA_VIA,
 	RTA_NEWDST,
 	RTA_PREF,
+	RTA_ENCAP,
 	__RTA_MAX
 };
 
@@ -356,8 +357,13 @@ struct rtvia {
 	__u8			rtvia_addr[0];
 };
 
-/* RTM_CACHEINFO */
+/* RTA_ENCAP */
+struct rtencap {
+	__u16	type;
+	__u8	dst[0];
+};
 
+/* RTM_CACHEINFO */
 struct rta_cacheinfo {
 	__u32	rta_clntref;
 	__u32	rta_lastuse;
net/Makefile +1 -1
index 3995613..6d51a9d 100644
@@ -5,7 +5,7 @@
 # Rewritten to use lists instead of if-statements.
 #
 
-obj-$(CONFIG_NET)		:= socket.o core/
+obj-$(CONFIG_NET)		:= socket.o lwtunnel.o core/
 
 tmp-$(CONFIG_COMPAT) 		:= compat.o
 obj-$(CONFIG_NET)		+= $(tmp-y)
net/lwtunnel.c new file +177 -0

177 lines not on this page · raw message

Signature · 1 line
1.7.10.4