Skip to content

Commit cfa933d

Browse files
alexaringdavem330
authored andcommitted
include: uapi: linux: add rpl sr header definition
This patch adds a uapi header for rpl struct definition. The segments data can be accessed over rpl_segaddr or rpl_segdata macros. In case of compri and compre is zero the segment data is not compressed and can be accessed by rpl_segaddr. In the other case the compressed data can be accessed by rpl_segdata and interpreted as byte array. Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c189b54 commit cfa933d

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

include/uapi/linux/rpl.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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 _UAPI_LINUX_RPL_H
10+
#define _UAPI_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 reserved:20,
32+
pad:4,
33+
cmpri:4,
34+
cmpre:4;
35+
#else
36+
#error "Please fix <asm/byteorder.h>"
37+
#endif
38+
39+
union {
40+
struct in6_addr addr[0];
41+
__u8 data[0];
42+
} segments;
43+
} __attribute__((packed));
44+
45+
#define rpl_segaddr segments.addr
46+
#define rpl_segdata segments.data
47+
48+
#endif

0 commit comments

Comments
 (0)