diff options
author | Alexander Aring <alex.aring@gmail.com> | 2020-03-27 18:00:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-03-29 22:30:57 -0700 |
commit | 8610c7c6e3bd647ff98d21c8bc0580e77bc2f8b3 (patch) | |
tree | 638528cb15fa478b0532b882f76a8212acfb2e66 /include/net | |
parent | f37c6059363403d528acf8d530bb6e8a5666a875 (diff) | |
download | linux-8610c7c6e3bd647ff98d21c8bc0580e77bc2f8b3.tar.gz linux-8610c7c6e3bd647ff98d21c8bc0580e77bc2f8b3.tar.bz2 linux-8610c7c6e3bd647ff98d21c8bc0580e77bc2f8b3.zip |
net: ipv6: add support for rpl sr exthdr
This patch adds rpl source routing receive handling. Everything works
only if sysconf "rpl_seg_enabled" and source routing is enabled. Mostly
the same behaviour as IPv6 segmentation routing. To handle compression
and uncompression a rpl.c file is created which contains the necessary
functionality. The receive handling will also care about IPv6
encapsulated so far it's specified as possible nexthdr in RFC 6554.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/rpl.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/net/rpl.h b/include/net/rpl.h new file mode 100644 index 000000000000..d694d49a61db --- /dev/null +++ b/include/net/rpl.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * RPL implementation + * + * Author: + * (C) 2020 Alexander Aring <alex.aring@gmail.com> + */ + +#ifndef _NET_RPL_H +#define _NET_RPL_H + +#include <linux/rpl.h> + +/* Worst decompression memory usage ipv6 address (16) + pad 7 */ +#define IPV6_RPL_SRH_WORST_SWAP_SIZE (sizeof(struct in6_addr) + 7) + +static inline size_t ipv6_rpl_srh_alloc_size(unsigned char n) +{ + return sizeof(struct ipv6_rpl_sr_hdr) + + ((n + 1) * sizeof(struct in6_addr)); +} + +size_t ipv6_rpl_srh_size(unsigned char n, unsigned char cmpri, + unsigned char cmpre); + +void ipv6_rpl_srh_decompress(struct ipv6_rpl_sr_hdr *outhdr, + const struct ipv6_rpl_sr_hdr *inhdr, + const struct in6_addr *daddr, unsigned char n); + +void ipv6_rpl_srh_compress(struct ipv6_rpl_sr_hdr *outhdr, + const struct ipv6_rpl_sr_hdr *inhdr, + const struct in6_addr *daddr, unsigned char n); + +#endif /* _NET_RPL_H */ |