Commit a7a29f9c authored by Alexander Aring's avatar Alexander Aring Committed by David S. Miller
Browse files

net: ipv6: add rpl sr tunnel



This patch adds functionality to configure routes for RPL source routing
functionality. There is no IPIP functionality yet implemented which can
be added later when the cases when to use IPv6 encapuslation comes more
clear.

Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent faee6769
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -11,6 +11,18 @@

#include <linux/rpl.h>

#if IS_ENABLED(CONFIG_IPV6_RPL_LWTUNNEL)
extern int rpl_init(void);
extern void rpl_exit(void);
#else
static inline int rpl_init(void)
{
	return 0;
}

static inline void rpl_exit(void) {}
#endif

/* Worst decompression memory usage ipv6 address (16) + pad 7 */
#define IPV6_RPL_SRH_WORST_SWAP_SIZE (sizeof(struct in6_addr) + 7)

+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ enum lwtunnel_encap_types {
	LWTUNNEL_ENCAP_SEG6,
	LWTUNNEL_ENCAP_BPF,
	LWTUNNEL_ENCAP_SEG6_LOCAL,
	LWTUNNEL_ENCAP_RPL,
	__LWTUNNEL_ENCAP_MAX,
};

+21 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
 *  IPv6 RPL-SR implementation
 *
 *  Author:
 *  (C) 2020 Alexander Aring <alex.aring@gmail.com>
 */

#ifndef _UAPI_LINUX_RPL_IPTUNNEL_H
#define _UAPI_LINUX_RPL_IPTUNNEL_H

enum {
	RPL_IPTUNNEL_UNSPEC,
	RPL_IPTUNNEL_SRH,
	__RPL_IPTUNNEL_MAX,
};
#define RPL_IPTUNNEL_MAX (__RPL_IPTUNNEL_MAX - 1)

#define RPL_IPTUNNEL_SRH_SIZE(srh) (((srh)->hdrlen + 1) << 3)

#endif
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ static const char *lwtunnel_encap_str(enum lwtunnel_encap_types encap_type)
		return "BPF";
	case LWTUNNEL_ENCAP_SEG6_LOCAL:
		return "SEG6LOCAL";
	case LWTUNNEL_ENCAP_RPL:
		return "RPL";
	case LWTUNNEL_ENCAP_IP6:
	case LWTUNNEL_ENCAP_IP:
	case LWTUNNEL_ENCAP_NONE:
+10 −0
Original line number Diff line number Diff line
@@ -303,4 +303,14 @@ config IPV6_SEG6_BPF
	depends on IPV6_SEG6_LWTUNNEL
	depends on IPV6 = y

config IPV6_RPL_LWTUNNEL
	bool "IPv6: RPL Source Routing Header support"
	depends on IPV6
	select LWTUNNEL
	---help---
	  Support for RFC6554 RPL Source Routing Header using the lightweight
	  tunnels mechanism.

	  If unsure, say N.

endif # IPV6
Loading