1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _IP6T_SRH_H
3 #define _IP6T_SRH_H
4 
5 #include <linux/types.h>
6 #include <linux/netfilter.h>
7 
8 /* Values for "mt_flags" field in struct ip6t_srh */
9 #define IP6T_SRH_NEXTHDR        0x0001
10 #define IP6T_SRH_LEN_EQ         0x0002
11 #define IP6T_SRH_LEN_GT         0x0004
12 #define IP6T_SRH_LEN_LT         0x0008
13 #define IP6T_SRH_SEGS_EQ        0x0010
14 #define IP6T_SRH_SEGS_GT        0x0020
15 #define IP6T_SRH_SEGS_LT        0x0040
16 #define IP6T_SRH_LAST_EQ        0x0080
17 #define IP6T_SRH_LAST_GT        0x0100
18 #define IP6T_SRH_LAST_LT        0x0200
19 #define IP6T_SRH_TAG            0x0400
20 #define IP6T_SRH_PSID           0x0800
21 #define IP6T_SRH_NSID           0x1000
22 #define IP6T_SRH_LSID           0x2000
23 #define IP6T_SRH_MASK           0x3FFF
24 
25 /* Values for "mt_invflags" field in struct ip6t_srh */
26 #define IP6T_SRH_INV_NEXTHDR    0x0001
27 #define IP6T_SRH_INV_LEN_EQ     0x0002
28 #define IP6T_SRH_INV_LEN_GT     0x0004
29 #define IP6T_SRH_INV_LEN_LT     0x0008
30 #define IP6T_SRH_INV_SEGS_EQ    0x0010
31 #define IP6T_SRH_INV_SEGS_GT    0x0020
32 #define IP6T_SRH_INV_SEGS_LT    0x0040
33 #define IP6T_SRH_INV_LAST_EQ    0x0080
34 #define IP6T_SRH_INV_LAST_GT    0x0100
35 #define IP6T_SRH_INV_LAST_LT    0x0200
36 #define IP6T_SRH_INV_TAG        0x0400
37 #define IP6T_SRH_INV_PSID       0x0800
38 #define IP6T_SRH_INV_NSID       0x1000
39 #define IP6T_SRH_INV_LSID       0x2000
40 #define IP6T_SRH_INV_MASK       0x3FFF
41 
42 /**
43  *      struct ip6t_srh - SRH match options
44  *      @ next_hdr: Next header field of SRH
45  *      @ hdr_len: Extension header length field of SRH
46  *      @ segs_left: Segments left field of SRH
47  *      @ last_entry: Last entry field of SRH
48  *      @ tag: Tag field of SRH
49  *      @ mt_flags: match options
50  *      @ mt_invflags: Invert the sense of match options
51  */
52 
53 struct ip6t_srh {
54 	__u8                    next_hdr;
55 	__u8                    hdr_len;
56 	__u8                    segs_left;
57 	__u8                    last_entry;
58 	__u16                   tag;
59 	__u16                   mt_flags;
60 	__u16                   mt_invflags;
61 };
62 
63 /**
64  *      struct ip6t_srh1 - SRH match options (revision 1)
65  *      @ next_hdr: Next header field of SRH
66  *      @ hdr_len: Extension header length field of SRH
67  *      @ segs_left: Segments left field of SRH
68  *      @ last_entry: Last entry field of SRH
69  *      @ tag: Tag field of SRH
70  *      @ psid_addr: Address of previous SID in SRH SID list
71  *      @ nsid_addr: Address of NEXT SID in SRH SID list
72  *      @ lsid_addr: Address of LAST SID in SRH SID list
73  *      @ psid_msk: Mask of previous SID in SRH SID list
74  *      @ nsid_msk: Mask of next SID in SRH SID list
75  *      @ lsid_msk: MAsk of last SID in SRH SID list
76  *      @ mt_flags: match options
77  *      @ mt_invflags: Invert the sense of match options
78  */
79 
80 struct ip6t_srh1 {
81 	__u8                    next_hdr;
82 	__u8                    hdr_len;
83 	__u8                    segs_left;
84 	__u8                    last_entry;
85 	__u16                   tag;
86 	struct in6_addr         psid_addr;
87 	struct in6_addr         nsid_addr;
88 	struct in6_addr         lsid_addr;
89 	struct in6_addr         psid_msk;
90 	struct in6_addr         nsid_msk;
91 	struct in6_addr         lsid_msk;
92 	__u16                   mt_flags;
93 	__u16                   mt_invflags;
94 };
95 
96 #endif /*_IP6T_SRH_H*/
97