| 1 |
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ |
| 2 |
/* |
| 3 |
* IPv6 RPL-SR implementation |
| 4 |
* |
| 5 |
* Author: |
| 6 |
* (C) 2020 Alexander Aring <[email protected]> |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef _LINUX_RPL_H |
| 10 |
#define _LINUX_RPL_H |
| 11 |
|
| 12 |
#include <asm/byteorder.h> |
| 13 |
#include <linux/types.h> |
| 14 |
#include <linux/in6.h> |
| 15 |
|
| 16 |
/* |
| 17 |
* RPL SR Header |
| 18 |
*/ |
| 19 |
struct ipv6_rpl_sr_hdr { |
| 20 |
__u8 nexthdr; |
| 21 |
__u8 hdrlen; |
| 22 |
__u8 type; |
| 23 |
__u8 segments_left; |
| 24 |
#if defined(__LITTLE_ENDIAN_BITFIELD) |
| 25 |
__u32 cmpre:4, |
| 26 |
cmpri:4, |
| 27 |
reserved:4, |
| 28 |
pad:4, |
| 29 |
reserved1:16; |
| 30 |
#elif defined(__BIG_ENDIAN_BITFIELD) |
| 31 |
__u32 cmpri:4, |
| 32 |
cmpre:4, |
| 33 |
pad:4, |
| 34 |
reserved:20; |
| 35 |
#else |
| 36 |
#error "Please fix <asm/byteorder.h>" |
| 37 |
#endif |
| 38 |
|
| 39 |
union { |
| 40 |
__DECLARE_FLEX_ARRAY(struct in6_addr, addr); |
| 41 |
__DECLARE_FLEX_ARRAY(__u8, data); |
| 42 |
} segments; |
| 43 |
} __attribute__((packed)); |
| 44 |
|
| 45 |
#define rpl_segaddr segments.addr |
| 46 |
#define rpl_segdata segments.data |
| 47 |
|
| 48 |
#endif |