blob: e40b7e3381537d654bddfb1198fdcb15ef63aee7 [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _LINUX_XFRM_H
20#define _LINUX_XFRM_H
Christopher Ferris05d08e92016-02-04 13:16:38 -080021#include <linux/in6.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070022#include <linux/types.h>
Christopher Ferris05d08e92016-02-04 13:16:38 -080023typedef union {
Tao Baod7db5942015-01-28 10:07:51 -080024 __be32 a4;
25 __be32 a6[4];
Christopher Ferris05d08e92016-02-04 13:16:38 -080026 struct in6_addr in6;
Ben Cheng655a7c02013-10-16 16:09:24 -070027} xfrm_address_t;
28struct xfrm_id {
Tao Baod7db5942015-01-28 10:07:51 -080029 xfrm_address_t daddr;
30 __be32 spi;
31 __u8 proto;
Ben Cheng655a7c02013-10-16 16:09:24 -070032};
Ben Cheng655a7c02013-10-16 16:09:24 -070033struct xfrm_sec_ctx {
Tao Baod7db5942015-01-28 10:07:51 -080034 __u8 ctx_doi;
35 __u8 ctx_alg;
36 __u16 ctx_len;
Tao Baod7db5942015-01-28 10:07:51 -080037 __u32 ctx_sid;
38 char ctx_str[0];
Ben Cheng655a7c02013-10-16 16:09:24 -070039};
40#define XFRM_SC_DOI_RESERVED 0
Ben Cheng655a7c02013-10-16 16:09:24 -070041#define XFRM_SC_DOI_LSM 1
42#define XFRM_SC_ALG_RESERVED 0
43#define XFRM_SC_ALG_SELINUX 1
44struct xfrm_selector {
Tao Baod7db5942015-01-28 10:07:51 -080045 xfrm_address_t daddr;
46 xfrm_address_t saddr;
47 __be16 dport;
48 __be16 dport_mask;
Tao Baod7db5942015-01-28 10:07:51 -080049 __be16 sport;
50 __be16 sport_mask;
51 __u16 family;
52 __u8 prefixlen_d;
Tao Baod7db5942015-01-28 10:07:51 -080053 __u8 prefixlen_s;
54 __u8 proto;
55 int ifindex;
56 __kernel_uid32_t user;
Ben Cheng655a7c02013-10-16 16:09:24 -070057};
Tao Baod7db5942015-01-28 10:07:51 -080058#define XFRM_INF (~(__u64) 0)
Ben Cheng655a7c02013-10-16 16:09:24 -070059struct xfrm_lifetime_cfg {
Tao Baod7db5942015-01-28 10:07:51 -080060 __u64 soft_byte_limit;
Tao Baod7db5942015-01-28 10:07:51 -080061 __u64 hard_byte_limit;
62 __u64 soft_packet_limit;
63 __u64 hard_packet_limit;
64 __u64 soft_add_expires_seconds;
Tao Baod7db5942015-01-28 10:07:51 -080065 __u64 hard_add_expires_seconds;
66 __u64 soft_use_expires_seconds;
67 __u64 hard_use_expires_seconds;
Ben Cheng655a7c02013-10-16 16:09:24 -070068};
Ben Cheng655a7c02013-10-16 16:09:24 -070069struct xfrm_lifetime_cur {
Tao Baod7db5942015-01-28 10:07:51 -080070 __u64 bytes;
71 __u64 packets;
72 __u64 add_time;
Tao Baod7db5942015-01-28 10:07:51 -080073 __u64 use_time;
Ben Cheng655a7c02013-10-16 16:09:24 -070074};
75struct xfrm_replay_state {
Tao Baod7db5942015-01-28 10:07:51 -080076 __u32 oseq;
Tao Baod7db5942015-01-28 10:07:51 -080077 __u32 seq;
78 __u32 bitmap;
Ben Cheng655a7c02013-10-16 16:09:24 -070079};
80#define XFRMA_REPLAY_ESN_MAX 4096
Ben Cheng655a7c02013-10-16 16:09:24 -070081struct xfrm_replay_state_esn {
Tao Baod7db5942015-01-28 10:07:51 -080082 unsigned int bmp_len;
83 __u32 oseq;
84 __u32 seq;
Tao Baod7db5942015-01-28 10:07:51 -080085 __u32 oseq_hi;
86 __u32 seq_hi;
87 __u32 replay_window;
88 __u32 bmp[0];
Ben Cheng655a7c02013-10-16 16:09:24 -070089};
90struct xfrm_algo {
Tao Baod7db5942015-01-28 10:07:51 -080091 char alg_name[64];
92 unsigned int alg_key_len;
Tao Baod7db5942015-01-28 10:07:51 -080093 char alg_key[0];
Ben Cheng655a7c02013-10-16 16:09:24 -070094};
95struct xfrm_algo_auth {
Tao Baod7db5942015-01-28 10:07:51 -080096 char alg_name[64];
Tao Baod7db5942015-01-28 10:07:51 -080097 unsigned int alg_key_len;
98 unsigned int alg_trunc_len;
99 char alg_key[0];
Ben Cheng655a7c02013-10-16 16:09:24 -0700100};
Ben Cheng655a7c02013-10-16 16:09:24 -0700101struct xfrm_algo_aead {
Tao Baod7db5942015-01-28 10:07:51 -0800102 char alg_name[64];
103 unsigned int alg_key_len;
104 unsigned int alg_icv_len;
Tao Baod7db5942015-01-28 10:07:51 -0800105 char alg_key[0];
Ben Cheng655a7c02013-10-16 16:09:24 -0700106};
107struct xfrm_stats {
Tao Baod7db5942015-01-28 10:07:51 -0800108 __u32 replay_window;
Tao Baod7db5942015-01-28 10:07:51 -0800109 __u32 replay;
110 __u32 integrity_failed;
Ben Cheng655a7c02013-10-16 16:09:24 -0700111};
112enum {
Tao Baod7db5942015-01-28 10:07:51 -0800113 XFRM_POLICY_TYPE_MAIN = 0,
114 XFRM_POLICY_TYPE_SUB = 1,
115 XFRM_POLICY_TYPE_MAX = 2,
116 XFRM_POLICY_TYPE_ANY = 255
Ben Cheng655a7c02013-10-16 16:09:24 -0700117};
118enum {
Tao Baod7db5942015-01-28 10:07:51 -0800119 XFRM_POLICY_IN = 0,
120 XFRM_POLICY_OUT = 1,
Tao Baod7db5942015-01-28 10:07:51 -0800121 XFRM_POLICY_FWD = 2,
122 XFRM_POLICY_MASK = 3,
123 XFRM_POLICY_MAX = 3
Ben Cheng655a7c02013-10-16 16:09:24 -0700124};
Ben Cheng655a7c02013-10-16 16:09:24 -0700125enum {
Tao Baod7db5942015-01-28 10:07:51 -0800126 XFRM_SHARE_ANY,
127 XFRM_SHARE_SESSION,
128 XFRM_SHARE_USER,
Tao Baod7db5942015-01-28 10:07:51 -0800129 XFRM_SHARE_UNIQUE
Ben Cheng655a7c02013-10-16 16:09:24 -0700130};
131#define XFRM_MODE_TRANSPORT 0
132#define XFRM_MODE_TUNNEL 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700133#define XFRM_MODE_ROUTEOPTIMIZATION 2
134#define XFRM_MODE_IN_TRIGGER 3
135#define XFRM_MODE_BEET 4
136#define XFRM_MODE_MAX 5
Ben Cheng655a7c02013-10-16 16:09:24 -0700137enum {
Tao Baod7db5942015-01-28 10:07:51 -0800138 XFRM_MSG_BASE = 0x10,
139 XFRM_MSG_NEWSA = 0x10,
Ben Cheng655a7c02013-10-16 16:09:24 -0700140#define XFRM_MSG_NEWSA XFRM_MSG_NEWSA
Tao Baod7db5942015-01-28 10:07:51 -0800141 XFRM_MSG_DELSA,
Ben Cheng655a7c02013-10-16 16:09:24 -0700142#define XFRM_MSG_DELSA XFRM_MSG_DELSA
Tao Baod7db5942015-01-28 10:07:51 -0800143 XFRM_MSG_GETSA,
Ben Cheng655a7c02013-10-16 16:09:24 -0700144#define XFRM_MSG_GETSA XFRM_MSG_GETSA
Tao Baod7db5942015-01-28 10:07:51 -0800145 XFRM_MSG_NEWPOLICY,
Ben Cheng655a7c02013-10-16 16:09:24 -0700146#define XFRM_MSG_NEWPOLICY XFRM_MSG_NEWPOLICY
Tao Baod7db5942015-01-28 10:07:51 -0800147 XFRM_MSG_DELPOLICY,
Ben Cheng655a7c02013-10-16 16:09:24 -0700148#define XFRM_MSG_DELPOLICY XFRM_MSG_DELPOLICY
Tao Baod7db5942015-01-28 10:07:51 -0800149 XFRM_MSG_GETPOLICY,
Ben Cheng655a7c02013-10-16 16:09:24 -0700150#define XFRM_MSG_GETPOLICY XFRM_MSG_GETPOLICY
Tao Baod7db5942015-01-28 10:07:51 -0800151 XFRM_MSG_ALLOCSPI,
Ben Cheng655a7c02013-10-16 16:09:24 -0700152#define XFRM_MSG_ALLOCSPI XFRM_MSG_ALLOCSPI
Tao Baod7db5942015-01-28 10:07:51 -0800153 XFRM_MSG_ACQUIRE,
Ben Cheng655a7c02013-10-16 16:09:24 -0700154#define XFRM_MSG_ACQUIRE XFRM_MSG_ACQUIRE
Tao Baod7db5942015-01-28 10:07:51 -0800155 XFRM_MSG_EXPIRE,
Ben Cheng655a7c02013-10-16 16:09:24 -0700156#define XFRM_MSG_EXPIRE XFRM_MSG_EXPIRE
Tao Baod7db5942015-01-28 10:07:51 -0800157 XFRM_MSG_UPDPOLICY,
Ben Cheng655a7c02013-10-16 16:09:24 -0700158#define XFRM_MSG_UPDPOLICY XFRM_MSG_UPDPOLICY
Tao Baod7db5942015-01-28 10:07:51 -0800159 XFRM_MSG_UPDSA,
Ben Cheng655a7c02013-10-16 16:09:24 -0700160#define XFRM_MSG_UPDSA XFRM_MSG_UPDSA
Tao Baod7db5942015-01-28 10:07:51 -0800161 XFRM_MSG_POLEXPIRE,
Ben Cheng655a7c02013-10-16 16:09:24 -0700162#define XFRM_MSG_POLEXPIRE XFRM_MSG_POLEXPIRE
Tao Baod7db5942015-01-28 10:07:51 -0800163 XFRM_MSG_FLUSHSA,
Ben Cheng655a7c02013-10-16 16:09:24 -0700164#define XFRM_MSG_FLUSHSA XFRM_MSG_FLUSHSA
Tao Baod7db5942015-01-28 10:07:51 -0800165 XFRM_MSG_FLUSHPOLICY,
Ben Cheng655a7c02013-10-16 16:09:24 -0700166#define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY
Tao Baod7db5942015-01-28 10:07:51 -0800167 XFRM_MSG_NEWAE,
Ben Cheng655a7c02013-10-16 16:09:24 -0700168#define XFRM_MSG_NEWAE XFRM_MSG_NEWAE
Tao Baod7db5942015-01-28 10:07:51 -0800169 XFRM_MSG_GETAE,
Ben Cheng655a7c02013-10-16 16:09:24 -0700170#define XFRM_MSG_GETAE XFRM_MSG_GETAE
Tao Baod7db5942015-01-28 10:07:51 -0800171 XFRM_MSG_REPORT,
Ben Cheng655a7c02013-10-16 16:09:24 -0700172#define XFRM_MSG_REPORT XFRM_MSG_REPORT
Tao Baod7db5942015-01-28 10:07:51 -0800173 XFRM_MSG_MIGRATE,
Ben Cheng655a7c02013-10-16 16:09:24 -0700174#define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE
Tao Baod7db5942015-01-28 10:07:51 -0800175 XFRM_MSG_NEWSADINFO,
Ben Cheng655a7c02013-10-16 16:09:24 -0700176#define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO
Tao Baod7db5942015-01-28 10:07:51 -0800177 XFRM_MSG_GETSADINFO,
Ben Cheng655a7c02013-10-16 16:09:24 -0700178#define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO
Tao Baod7db5942015-01-28 10:07:51 -0800179 XFRM_MSG_NEWSPDINFO,
Ben Cheng655a7c02013-10-16 16:09:24 -0700180#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO
Tao Baod7db5942015-01-28 10:07:51 -0800181 XFRM_MSG_GETSPDINFO,
Ben Cheng655a7c02013-10-16 16:09:24 -0700182#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO
Tao Baod7db5942015-01-28 10:07:51 -0800183 XFRM_MSG_MAPPING,
Ben Cheng655a7c02013-10-16 16:09:24 -0700184#define XFRM_MSG_MAPPING XFRM_MSG_MAPPING
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700185 XFRM_MSG_SETDEFAULT,
186#define XFRM_MSG_SETDEFAULT XFRM_MSG_SETDEFAULT
187 XFRM_MSG_GETDEFAULT,
188#define XFRM_MSG_GETDEFAULT XFRM_MSG_GETDEFAULT
Tao Baod7db5942015-01-28 10:07:51 -0800189 __XFRM_MSG_MAX
Ben Cheng655a7c02013-10-16 16:09:24 -0700190};
191#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
192#define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE)
Ben Cheng655a7c02013-10-16 16:09:24 -0700193struct xfrm_user_sec_ctx {
Tao Baod7db5942015-01-28 10:07:51 -0800194 __u16 len;
195 __u16 exttype;
196 __u8 ctx_alg;
Tao Baod7db5942015-01-28 10:07:51 -0800197 __u8 ctx_doi;
198 __u16 ctx_len;
Ben Cheng655a7c02013-10-16 16:09:24 -0700199};
200struct xfrm_user_tmpl {
Tao Baod7db5942015-01-28 10:07:51 -0800201 struct xfrm_id id;
202 __u16 family;
203 xfrm_address_t saddr;
204 __u32 reqid;
Tao Baod7db5942015-01-28 10:07:51 -0800205 __u8 mode;
206 __u8 share;
207 __u8 optional;
208 __u32 aalgos;
Tao Baod7db5942015-01-28 10:07:51 -0800209 __u32 ealgos;
210 __u32 calgos;
Ben Cheng655a7c02013-10-16 16:09:24 -0700211};
212struct xfrm_encap_tmpl {
Tao Baod7db5942015-01-28 10:07:51 -0800213 __u16 encap_type;
214 __be16 encap_sport;
215 __be16 encap_dport;
216 xfrm_address_t encap_oa;
Ben Cheng655a7c02013-10-16 16:09:24 -0700217};
218enum xfrm_ae_ftype_t {
Tao Baod7db5942015-01-28 10:07:51 -0800219 XFRM_AE_UNSPEC,
220 XFRM_AE_RTHR = 1,
Tao Baod7db5942015-01-28 10:07:51 -0800221 XFRM_AE_RVAL = 2,
222 XFRM_AE_LVAL = 4,
223 XFRM_AE_ETHR = 8,
224 XFRM_AE_CR = 16,
Tao Baod7db5942015-01-28 10:07:51 -0800225 XFRM_AE_CE = 32,
226 XFRM_AE_CU = 64,
227 __XFRM_AE_MAX
Ben Cheng655a7c02013-10-16 16:09:24 -0700228#define XFRM_AE_MAX (__XFRM_AE_MAX - 1)
Ben Cheng655a7c02013-10-16 16:09:24 -0700229};
230struct xfrm_userpolicy_type {
Tao Baod7db5942015-01-28 10:07:51 -0800231 __u8 type;
232 __u16 reserved1;
Tao Baod7db5942015-01-28 10:07:51 -0800233 __u8 reserved2;
Ben Cheng655a7c02013-10-16 16:09:24 -0700234};
235enum xfrm_attr_type_t {
Tao Baod7db5942015-01-28 10:07:51 -0800236 XFRMA_UNSPEC,
Tao Baod7db5942015-01-28 10:07:51 -0800237 XFRMA_ALG_AUTH,
238 XFRMA_ALG_CRYPT,
239 XFRMA_ALG_COMP,
240 XFRMA_ENCAP,
Tao Baod7db5942015-01-28 10:07:51 -0800241 XFRMA_TMPL,
242 XFRMA_SA,
243 XFRMA_POLICY,
244 XFRMA_SEC_CTX,
Tao Baod7db5942015-01-28 10:07:51 -0800245 XFRMA_LTIME_VAL,
246 XFRMA_REPLAY_VAL,
247 XFRMA_REPLAY_THRESH,
248 XFRMA_ETIMER_THRESH,
Tao Baod7db5942015-01-28 10:07:51 -0800249 XFRMA_SRCADDR,
250 XFRMA_COADDR,
251 XFRMA_LASTUSED,
252 XFRMA_POLICY_TYPE,
Tao Baod7db5942015-01-28 10:07:51 -0800253 XFRMA_MIGRATE,
254 XFRMA_ALG_AEAD,
255 XFRMA_KMADDRESS,
256 XFRMA_ALG_AUTH_TRUNC,
Tao Baod7db5942015-01-28 10:07:51 -0800257 XFRMA_MARK,
258 XFRMA_TFCPAD,
259 XFRMA_REPLAY_ESN_VAL,
260 XFRMA_SA_EXTRA_FLAGS,
Tao Baod7db5942015-01-28 10:07:51 -0800261 XFRMA_PROTO,
262 XFRMA_ADDRESS_FILTER,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700263 XFRMA_PAD,
Christopher Ferris525ce912017-07-26 13:12:53 -0700264 XFRMA_OFFLOAD_DEV,
Christopher Ferris9ce28842018-10-25 12:11:39 -0700265 XFRMA_SET_MARK,
266 XFRMA_SET_MARK_MASK,
267 XFRMA_IF_ID,
Tao Baod7db5942015-01-28 10:07:51 -0800268 __XFRMA_MAX
Christopher Ferris9ce28842018-10-25 12:11:39 -0700269#define XFRMA_OUTPUT_MARK XFRMA_SET_MARK
Ben Cheng655a7c02013-10-16 16:09:24 -0700270#define XFRMA_MAX (__XFRMA_MAX - 1)
271};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700272struct xfrm_mark {
Tao Baod7db5942015-01-28 10:07:51 -0800273 __u32 v;
274 __u32 m;
Ben Cheng655a7c02013-10-16 16:09:24 -0700275};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700276enum xfrm_sadattr_type_t {
Tao Baod7db5942015-01-28 10:07:51 -0800277 XFRMA_SAD_UNSPEC,
278 XFRMA_SAD_CNT,
Tao Baod7db5942015-01-28 10:07:51 -0800279 XFRMA_SAD_HINFO,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700280 __XFRMA_SAD_MAX
Ben Cheng655a7c02013-10-16 16:09:24 -0700281#define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1)
282};
283struct xfrmu_sadhinfo {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700284 __u32 sadhcnt;
Tao Baod7db5942015-01-28 10:07:51 -0800285 __u32 sadhmcnt;
Ben Cheng655a7c02013-10-16 16:09:24 -0700286};
287enum xfrm_spdattr_type_t {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700288 XFRMA_SPD_UNSPEC,
Tao Baod7db5942015-01-28 10:07:51 -0800289 XFRMA_SPD_INFO,
290 XFRMA_SPD_HINFO,
Tao Baod7db5942015-01-28 10:07:51 -0800291 XFRMA_SPD_IPV4_HTHRESH,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700292 XFRMA_SPD_IPV6_HTHRESH,
Tao Baod7db5942015-01-28 10:07:51 -0800293 __XFRMA_SPD_MAX
Ben Cheng655a7c02013-10-16 16:09:24 -0700294#define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1)
Ben Cheng655a7c02013-10-16 16:09:24 -0700295};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700296struct xfrmu_spdinfo {
Tao Baod7db5942015-01-28 10:07:51 -0800297 __u32 incnt;
298 __u32 outcnt;
Tao Baod7db5942015-01-28 10:07:51 -0800299 __u32 fwdcnt;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700300 __u32 inscnt;
Tao Baod7db5942015-01-28 10:07:51 -0800301 __u32 outscnt;
302 __u32 fwdscnt;
Ben Cheng655a7c02013-10-16 16:09:24 -0700303};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700304struct xfrmu_spdhinfo {
Tao Baod7db5942015-01-28 10:07:51 -0800305 __u32 spdhcnt;
306 __u32 spdhmcnt;
Christopher Ferris82d75042015-01-26 10:57:07 -0800307};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700308struct xfrmu_spdhthresh {
Tao Baod7db5942015-01-28 10:07:51 -0800309 __u8 lbits;
310 __u8 rbits;
Ben Cheng655a7c02013-10-16 16:09:24 -0700311};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700312struct xfrm_usersa_info {
Tao Baod7db5942015-01-28 10:07:51 -0800313 struct xfrm_selector sel;
314 struct xfrm_id id;
Tao Baod7db5942015-01-28 10:07:51 -0800315 xfrm_address_t saddr;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700316 struct xfrm_lifetime_cfg lft;
Tao Baod7db5942015-01-28 10:07:51 -0800317 struct xfrm_lifetime_cur curlft;
318 struct xfrm_stats stats;
Tao Baod7db5942015-01-28 10:07:51 -0800319 __u32 seq;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700320 __u32 reqid;
Tao Baod7db5942015-01-28 10:07:51 -0800321 __u16 family;
322 __u8 mode;
Tao Baod7db5942015-01-28 10:07:51 -0800323 __u8 replay_window;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700324 __u8 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -0700325#define XFRM_STATE_NOECN 1
326#define XFRM_STATE_DECAP_DSCP 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700327#define XFRM_STATE_NOPMTUDISC 4
Christopher Ferris106b3a82016-08-24 12:15:38 -0700328#define XFRM_STATE_WILDRECV 8
Ben Cheng655a7c02013-10-16 16:09:24 -0700329#define XFRM_STATE_ICMP 16
330#define XFRM_STATE_AF_UNSPEC 32
Ben Cheng655a7c02013-10-16 16:09:24 -0700331#define XFRM_STATE_ALIGN4 64
Christopher Ferris106b3a82016-08-24 12:15:38 -0700332#define XFRM_STATE_ESN 128
Ben Cheng655a7c02013-10-16 16:09:24 -0700333};
334#define XFRM_SA_XFLAG_DONT_ENCAP_DSCP 1
Christopher Ferris25c18d42020-10-14 17:42:58 -0700335#define XFRM_SA_XFLAG_OSEQ_MAY_WRAP 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700336struct xfrm_usersa_id {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700337 xfrm_address_t daddr;
Tao Baod7db5942015-01-28 10:07:51 -0800338 __be32 spi;
339 __u16 family;
Tao Baod7db5942015-01-28 10:07:51 -0800340 __u8 proto;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700341};
Ben Cheng655a7c02013-10-16 16:09:24 -0700342struct xfrm_aevent_id {
Tao Baod7db5942015-01-28 10:07:51 -0800343 struct xfrm_usersa_id sa_id;
Tao Baod7db5942015-01-28 10:07:51 -0800344 xfrm_address_t saddr;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700345 __u32 flags;
Tao Baod7db5942015-01-28 10:07:51 -0800346 __u32 reqid;
Ben Cheng655a7c02013-10-16 16:09:24 -0700347};
Ben Cheng655a7c02013-10-16 16:09:24 -0700348struct xfrm_userspi_info {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700349 struct xfrm_usersa_info info;
Tao Baod7db5942015-01-28 10:07:51 -0800350 __u32 min;
351 __u32 max;
Ben Cheng655a7c02013-10-16 16:09:24 -0700352};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700353struct xfrm_userpolicy_info {
Tao Baod7db5942015-01-28 10:07:51 -0800354 struct xfrm_selector sel;
355 struct xfrm_lifetime_cfg lft;
Tao Baod7db5942015-01-28 10:07:51 -0800356 struct xfrm_lifetime_cur curlft;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700357 __u32 priority;
Tao Baod7db5942015-01-28 10:07:51 -0800358 __u32 index;
359 __u8 dir;
Tao Baod7db5942015-01-28 10:07:51 -0800360 __u8 action;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700361#define XFRM_POLICY_ALLOW 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700362#define XFRM_POLICY_BLOCK 1
Tao Baod7db5942015-01-28 10:07:51 -0800363 __u8 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -0700364#define XFRM_POLICY_LOCALOK 1
Christopher Ferris106b3a82016-08-24 12:15:38 -0700365#define XFRM_POLICY_ICMP 2
Tao Baod7db5942015-01-28 10:07:51 -0800366 __u8 share;
Ben Cheng655a7c02013-10-16 16:09:24 -0700367};
Ben Cheng655a7c02013-10-16 16:09:24 -0700368struct xfrm_userpolicy_id {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700369 struct xfrm_selector sel;
Tao Baod7db5942015-01-28 10:07:51 -0800370 __u32 index;
371 __u8 dir;
Ben Cheng655a7c02013-10-16 16:09:24 -0700372};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700373struct xfrm_user_acquire {
Tao Baod7db5942015-01-28 10:07:51 -0800374 struct xfrm_id id;
375 xfrm_address_t saddr;
Tao Baod7db5942015-01-28 10:07:51 -0800376 struct xfrm_selector sel;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700377 struct xfrm_userpolicy_info policy;
Tao Baod7db5942015-01-28 10:07:51 -0800378 __u32 aalgos;
379 __u32 ealgos;
Tao Baod7db5942015-01-28 10:07:51 -0800380 __u32 calgos;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700381 __u32 seq;
Ben Cheng655a7c02013-10-16 16:09:24 -0700382};
383struct xfrm_user_expire {
Tao Baod7db5942015-01-28 10:07:51 -0800384 struct xfrm_usersa_info state;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700385 __u8 hard;
Ben Cheng655a7c02013-10-16 16:09:24 -0700386};
387struct xfrm_user_polexpire {
Tao Baod7db5942015-01-28 10:07:51 -0800388 struct xfrm_userpolicy_info pol;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700389 __u8 hard;
Ben Cheng655a7c02013-10-16 16:09:24 -0700390};
391struct xfrm_usersa_flush {
Tao Baod7db5942015-01-28 10:07:51 -0800392 __u8 proto;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700393};
Ben Cheng655a7c02013-10-16 16:09:24 -0700394struct xfrm_user_report {
Tao Baod7db5942015-01-28 10:07:51 -0800395 __u8 proto;
Tao Baod7db5942015-01-28 10:07:51 -0800396 struct xfrm_selector sel;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700397};
Ben Cheng655a7c02013-10-16 16:09:24 -0700398struct xfrm_user_kmaddress {
Tao Baod7db5942015-01-28 10:07:51 -0800399 xfrm_address_t local;
Tao Baod7db5942015-01-28 10:07:51 -0800400 xfrm_address_t remote;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700401 __u32 reserved;
Tao Baod7db5942015-01-28 10:07:51 -0800402 __u16 family;
Ben Cheng655a7c02013-10-16 16:09:24 -0700403};
Ben Cheng655a7c02013-10-16 16:09:24 -0700404struct xfrm_user_migrate {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700405 xfrm_address_t old_daddr;
Tao Baod7db5942015-01-28 10:07:51 -0800406 xfrm_address_t old_saddr;
407 xfrm_address_t new_daddr;
Tao Baod7db5942015-01-28 10:07:51 -0800408 xfrm_address_t new_saddr;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700409 __u8 proto;
Tao Baod7db5942015-01-28 10:07:51 -0800410 __u8 mode;
411 __u16 reserved;
Tao Baod7db5942015-01-28 10:07:51 -0800412 __u32 reqid;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700413 __u16 old_family;
Tao Baod7db5942015-01-28 10:07:51 -0800414 __u16 new_family;
Ben Cheng655a7c02013-10-16 16:09:24 -0700415};
Ben Cheng655a7c02013-10-16 16:09:24 -0700416struct xfrm_user_mapping {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700417 struct xfrm_usersa_id id;
Tao Baod7db5942015-01-28 10:07:51 -0800418 __u32 reqid;
419 xfrm_address_t old_saddr;
Tao Baod7db5942015-01-28 10:07:51 -0800420 xfrm_address_t new_saddr;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700421 __be16 old_sport;
Tao Baod7db5942015-01-28 10:07:51 -0800422 __be16 new_sport;
Ben Cheng655a7c02013-10-16 16:09:24 -0700423};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700424struct xfrm_address_filter {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700425 xfrm_address_t saddr;
Tao Baod7db5942015-01-28 10:07:51 -0800426 xfrm_address_t daddr;
427 __u16 family;
Tao Baod7db5942015-01-28 10:07:51 -0800428 __u8 splen;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700429 __u8 dplen;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700430};
Christopher Ferris525ce912017-07-26 13:12:53 -0700431struct xfrm_user_offload {
432 int ifindex;
433 __u8 flags;
434};
435#define XFRM_OFFLOAD_IPV6 1
436#define XFRM_OFFLOAD_INBOUND 2
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700437struct xfrm_userpolicy_default {
438#define XFRM_USERPOLICY_UNSPEC 0
439#define XFRM_USERPOLICY_BLOCK 1
440#define XFRM_USERPOLICY_ACCEPT 2
441 __u8 in;
442 __u8 fwd;
443 __u8 out;
444};
Ben Cheng655a7c02013-10-16 16:09:24 -0700445#define XFRMGRP_ACQUIRE 1
446#define XFRMGRP_EXPIRE 2
Christopher Ferris106b3a82016-08-24 12:15:38 -0700447#define XFRMGRP_SA 4
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700448#define XFRMGRP_POLICY 8
Ben Cheng655a7c02013-10-16 16:09:24 -0700449#define XFRMGRP_REPORT 0x20
450enum xfrm_nlgroups {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700451 XFRMNLGRP_NONE,
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700452#define XFRMNLGRP_NONE XFRMNLGRP_NONE
Tao Baod7db5942015-01-28 10:07:51 -0800453 XFRMNLGRP_ACQUIRE,
Ben Cheng655a7c02013-10-16 16:09:24 -0700454#define XFRMNLGRP_ACQUIRE XFRMNLGRP_ACQUIRE
Christopher Ferris106b3a82016-08-24 12:15:38 -0700455 XFRMNLGRP_EXPIRE,
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700456#define XFRMNLGRP_EXPIRE XFRMNLGRP_EXPIRE
Tao Baod7db5942015-01-28 10:07:51 -0800457 XFRMNLGRP_SA,
Ben Cheng655a7c02013-10-16 16:09:24 -0700458#define XFRMNLGRP_SA XFRMNLGRP_SA
Christopher Ferris106b3a82016-08-24 12:15:38 -0700459 XFRMNLGRP_POLICY,
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700460#define XFRMNLGRP_POLICY XFRMNLGRP_POLICY
Tao Baod7db5942015-01-28 10:07:51 -0800461 XFRMNLGRP_AEVENTS,
Ben Cheng655a7c02013-10-16 16:09:24 -0700462#define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS
Christopher Ferris106b3a82016-08-24 12:15:38 -0700463 XFRMNLGRP_REPORT,
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700464#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT
Tao Baod7db5942015-01-28 10:07:51 -0800465 XFRMNLGRP_MIGRATE,
Ben Cheng655a7c02013-10-16 16:09:24 -0700466#define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE
Christopher Ferris106b3a82016-08-24 12:15:38 -0700467 XFRMNLGRP_MAPPING,
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700468#define XFRMNLGRP_MAPPING XFRMNLGRP_MAPPING
Tao Baod7db5942015-01-28 10:07:51 -0800469 __XFRMNLGRP_MAX
Ben Cheng655a7c02013-10-16 16:09:24 -0700470};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700471#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700472#endif