Skip to content

Commit 3b29663

Browse files
Zashasborkmann
authored andcommitted
selftests/bpf: missing headers test_lwt_seg6local
Previous patch "selftests/bpf: test for seg6local End.BPF action" lacks some UAPI headers in tools/. clang -I. -I./include/uapi -I../../../include/uapi -idirafter /usr/local/include -idirafter /data/users/yhs/work/llvm/build/install/lib/clang/7.0.0/include -idirafter /usr/include -Wno-compare-distinct-pointer-types \ -O2 -target bpf -emit-llvm -c test_lwt_seg6local.c -o - | \ llc -march=bpf -mcpu=generic -filetype=obj -o [...]/net-next/tools/testing/selftests/bpf/test_lwt_seg6local.o test_lwt_seg6local.c:4:10: fatal error: 'linux/seg6_local.h' file not found ^~~~~~~~~~~~~~~~~~~~ 1 error generated. make: Leaving directory `/data/users/yhs/work/net-next/tools/testing/selftests/bpf' v2: moving the headers to tools/include/uapi/. Reported-by: Y Song <ys114321@gmail.com> Signed-off-by: Mathieu Xhonneux <m.xhonneux@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent dc3b8ae commit 3b29663

File tree

2 files changed

+135
-0
lines changed

2 files changed

+135
-0
lines changed

tools/include/uapi/linux/seg6.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2+
/*
3+
* SR-IPv6 implementation
4+
*
5+
* Author:
6+
* David Lebrun <david.lebrun@uclouvain.be>
7+
*
8+
*
9+
* This program is free software; you can redistribute it and/or
10+
* modify it under the terms of the GNU General Public License
11+
* as published by the Free Software Foundation; either version
12+
* 2 of the License, or (at your option) any later version.
13+
*/
14+
15+
#ifndef _UAPI_LINUX_SEG6_H
16+
#define _UAPI_LINUX_SEG6_H
17+
18+
#include <linux/types.h>
19+
#include <linux/in6.h> /* For struct in6_addr. */
20+
21+
/*
22+
* SRH
23+
*/
24+
struct ipv6_sr_hdr {
25+
__u8 nexthdr;
26+
__u8 hdrlen;
27+
__u8 type;
28+
__u8 segments_left;
29+
__u8 first_segment; /* Represents the last_entry field of SRH */
30+
__u8 flags;
31+
__u16 tag;
32+
33+
struct in6_addr segments[0];
34+
};
35+
36+
#define SR6_FLAG1_PROTECTED (1 << 6)
37+
#define SR6_FLAG1_OAM (1 << 5)
38+
#define SR6_FLAG1_ALERT (1 << 4)
39+
#define SR6_FLAG1_HMAC (1 << 3)
40+
41+
#define SR6_TLV_INGRESS 1
42+
#define SR6_TLV_EGRESS 2
43+
#define SR6_TLV_OPAQUE 3
44+
#define SR6_TLV_PADDING 4
45+
#define SR6_TLV_HMAC 5
46+
47+
#define sr_has_hmac(srh) ((srh)->flags & SR6_FLAG1_HMAC)
48+
49+
struct sr6_tlv {
50+
__u8 type;
51+
__u8 len;
52+
__u8 data[0];
53+
};
54+
55+
#endif

tools/include/uapi/linux/seg6_local.h

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* SR-IPv6 implementation
3+
*
4+
* Author:
5+
* David Lebrun <david.lebrun@uclouvain.be>
6+
*
7+
*
8+
* This program is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU General Public License
10+
* as published by the Free Software Foundation; either version
11+
* 2 of the License, or (at your option) any later version.
12+
*/
13+
14+
#ifndef _UAPI_LINUX_SEG6_LOCAL_H
15+
#define _UAPI_LINUX_SEG6_LOCAL_H
16+
17+
#include <linux/seg6.h>
18+
19+
enum {
20+
SEG6_LOCAL_UNSPEC,
21+
SEG6_LOCAL_ACTION,
22+
SEG6_LOCAL_SRH,
23+
SEG6_LOCAL_TABLE,
24+
SEG6_LOCAL_NH4,
25+
SEG6_LOCAL_NH6,
26+
SEG6_LOCAL_IIF,
27+
SEG6_LOCAL_OIF,
28+
SEG6_LOCAL_BPF,
29+
__SEG6_LOCAL_MAX,
30+
};
31+
#define SEG6_LOCAL_MAX (__SEG6_LOCAL_MAX - 1)
32+
33+
enum {
34+
SEG6_LOCAL_ACTION_UNSPEC = 0,
35+
/* node segment */
36+
SEG6_LOCAL_ACTION_END = 1,
37+
/* adjacency segment (IPv6 cross-connect) */
38+
SEG6_LOCAL_ACTION_END_X = 2,
39+
/* lookup of next seg NH in table */
40+
SEG6_LOCAL_ACTION_END_T = 3,
41+
/* decap and L2 cross-connect */
42+
SEG6_LOCAL_ACTION_END_DX2 = 4,
43+
/* decap and IPv6 cross-connect */
44+
SEG6_LOCAL_ACTION_END_DX6 = 5,
45+
/* decap and IPv4 cross-connect */
46+
SEG6_LOCAL_ACTION_END_DX4 = 6,
47+
/* decap and lookup of DA in v6 table */
48+
SEG6_LOCAL_ACTION_END_DT6 = 7,
49+
/* decap and lookup of DA in v4 table */
50+
SEG6_LOCAL_ACTION_END_DT4 = 8,
51+
/* binding segment with insertion */
52+
SEG6_LOCAL_ACTION_END_B6 = 9,
53+
/* binding segment with encapsulation */
54+
SEG6_LOCAL_ACTION_END_B6_ENCAP = 10,
55+
/* binding segment with MPLS encap */
56+
SEG6_LOCAL_ACTION_END_BM = 11,
57+
/* lookup last seg in table */
58+
SEG6_LOCAL_ACTION_END_S = 12,
59+
/* forward to SR-unaware VNF with static proxy */
60+
SEG6_LOCAL_ACTION_END_AS = 13,
61+
/* forward to SR-unaware VNF with masquerading */
62+
SEG6_LOCAL_ACTION_END_AM = 14,
63+
/* custom BPF action */
64+
SEG6_LOCAL_ACTION_END_BPF = 15,
65+
66+
__SEG6_LOCAL_ACTION_MAX,
67+
};
68+
69+
#define SEG6_LOCAL_ACTION_MAX (__SEG6_LOCAL_ACTION_MAX - 1)
70+
71+
enum {
72+
SEG6_LOCAL_BPF_PROG_UNSPEC,
73+
SEG6_LOCAL_BPF_PROG,
74+
SEG6_LOCAL_BPF_PROG_NAME,
75+
__SEG6_LOCAL_BPF_PROG_MAX,
76+
};
77+
78+
#define SEG6_LOCAL_BPF_PROG_MAX (__SEG6_LOCAL_BPF_PROG_MAX - 1)
79+
80+
#endif

0 commit comments

Comments
 (0)