Commit | Line | Data |
---|---|---|
6f52b16c | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
1da177e4 LT |
2 | #ifndef _LINUX_XFRM_H |
3 | #define _LINUX_XFRM_H | |
4 | ||
15e318bd | 5 | #include <linux/in6.h> |
1da177e4 | 6 | #include <linux/types.h> |
1d495f1c | 7 | #include <linux/stddef.h> |
1da177e4 LT |
8 | |
9 | /* All of the structures in this file may not change size as they are | |
10 | * passed into the kernel from userspace via netlink sockets. | |
11 | */ | |
12 | ||
13 | /* Structure to encapsulate addresses. I do not want to use | |
14 | * "standard" structure. My apologies. | |
15 | */ | |
d94d9fee | 16 | typedef union { |
737b5761 AV |
17 | __be32 a4; |
18 | __be32 a6[4]; | |
15e318bd | 19 | struct in6_addr in6; |
1da177e4 LT |
20 | } xfrm_address_t; |
21 | ||
22 | /* Ident of a specific xfrm_state. It is used on input to lookup | |
23 | * the state by (spi,daddr,ah/esp) or to store information about | |
24 | * spi, protocol and tunnel address on output. | |
25 | */ | |
d94d9fee | 26 | struct xfrm_id { |
1da177e4 | 27 | xfrm_address_t daddr; |
e037c39b | 28 | __be32 spi; |
1da177e4 LT |
29 | __u8 proto; |
30 | }; | |
31 | ||
df71837d TJ |
32 | struct xfrm_sec_ctx { |
33 | __u8 ctx_doi; | |
34 | __u8 ctx_alg; | |
35 | __u16 ctx_len; | |
36 | __u32 ctx_sid; | |
1d495f1c | 37 | char ctx_str[] __counted_by(ctx_len); |
df71837d TJ |
38 | }; |
39 | ||
40 | /* Security Context Domains of Interpretation */ | |
41 | #define XFRM_SC_DOI_RESERVED 0 | |
42 | #define XFRM_SC_DOI_LSM 1 | |
43 | ||
44 | /* Security Context Algorithms */ | |
45 | #define XFRM_SC_ALG_RESERVED 0 | |
46 | #define XFRM_SC_ALG_SELINUX 1 | |
47 | ||
1da177e4 LT |
48 | /* Selector, used as selector both on policy rules (SPD) and SAs. */ |
49 | ||
d94d9fee | 50 | struct xfrm_selector { |
1da177e4 LT |
51 | xfrm_address_t daddr; |
52 | xfrm_address_t saddr; | |
8f83f23e AV |
53 | __be16 dport; |
54 | __be16 dport_mask; | |
55 | __be16 sport; | |
56 | __be16 sport_mask; | |
1da177e4 LT |
57 | __u16 family; |
58 | __u8 prefixlen_d; | |
59 | __u8 prefixlen_s; | |
60 | __u8 proto; | |
61 | int ifindex; | |
85efde6f | 62 | __kernel_uid32_t user; |
1da177e4 LT |
63 | }; |
64 | ||
65 | #define XFRM_INF (~(__u64)0) | |
66 | ||
d94d9fee | 67 | struct xfrm_lifetime_cfg { |
1da177e4 LT |
68 | __u64 soft_byte_limit; |
69 | __u64 hard_byte_limit; | |
70 | __u64 soft_packet_limit; | |
71 | __u64 hard_packet_limit; | |
72 | __u64 soft_add_expires_seconds; | |
73 | __u64 hard_add_expires_seconds; | |
74 | __u64 soft_use_expires_seconds; | |
75 | __u64 hard_use_expires_seconds; | |
76 | }; | |
77 | ||
d94d9fee | 78 | struct xfrm_lifetime_cur { |
1da177e4 LT |
79 | __u64 bytes; |
80 | __u64 packets; | |
81 | __u64 add_time; | |
82 | __u64 use_time; | |
83 | }; | |
84 | ||
d94d9fee | 85 | struct xfrm_replay_state { |
1da177e4 LT |
86 | __u32 oseq; |
87 | __u32 seq; | |
88 | __u32 bitmap; | |
89 | }; | |
90 | ||
ecd79187 MK |
91 | #define XFRMA_REPLAY_ESN_MAX 4096 |
92 | ||
9736acf3 SK |
93 | struct xfrm_replay_state_esn { |
94 | unsigned int bmp_len; | |
95 | __u32 oseq; | |
96 | __u32 seq; | |
97 | __u32 oseq_hi; | |
98 | __u32 seq_hi; | |
99 | __u32 replay_window; | |
94dfc73e | 100 | __u32 bmp[]; |
9736acf3 SK |
101 | }; |
102 | ||
1da177e4 | 103 | struct xfrm_algo { |
3f4afb64 | 104 | char alg_name[64]; |
ba749ae9 | 105 | unsigned int alg_key_len; /* in bits */ |
94dfc73e | 106 | char alg_key[]; |
1da177e4 LT |
107 | }; |
108 | ||
4e242d16 MW |
109 | struct xfrm_algo_auth { |
110 | char alg_name[64]; | |
111 | unsigned int alg_key_len; /* in bits */ | |
112 | unsigned int alg_trunc_len; /* in bits */ | |
94dfc73e | 113 | char alg_key[]; |
4e242d16 MW |
114 | }; |
115 | ||
1a6509d9 | 116 | struct xfrm_algo_aead { |
461e6c85 ED |
117 | char alg_name[64]; |
118 | unsigned int alg_key_len; /* in bits */ | |
119 | unsigned int alg_icv_len; /* in bits */ | |
94dfc73e | 120 | char alg_key[]; |
1a6509d9 HX |
121 | }; |
122 | ||
1da177e4 LT |
123 | struct xfrm_stats { |
124 | __u32 replay_window; | |
125 | __u32 replay; | |
126 | __u32 integrity_failed; | |
127 | }; | |
128 | ||
d94d9fee | 129 | enum { |
4e81bb83 MN |
130 | XFRM_POLICY_TYPE_MAIN = 0, |
131 | XFRM_POLICY_TYPE_SUB = 1, | |
4c563f76 TT |
132 | XFRM_POLICY_TYPE_MAX = 2, |
133 | XFRM_POLICY_TYPE_ANY = 255 | |
4e81bb83 MN |
134 | }; |
135 | ||
d94d9fee | 136 | enum { |
1da177e4 LT |
137 | XFRM_POLICY_IN = 0, |
138 | XFRM_POLICY_OUT = 1, | |
139 | XFRM_POLICY_FWD = 2, | |
d5422efe | 140 | XFRM_POLICY_MASK = 3, |
1da177e4 LT |
141 | XFRM_POLICY_MAX = 3 |
142 | }; | |
143 | ||
a4a87fa4 AA |
144 | enum xfrm_sa_dir { |
145 | XFRM_SA_DIR_IN = 1, | |
146 | XFRM_SA_DIR_OUT = 2 | |
147 | }; | |
148 | ||
d94d9fee | 149 | enum { |
1da177e4 LT |
150 | XFRM_SHARE_ANY, /* No limitations */ |
151 | XFRM_SHARE_SESSION, /* For this session only */ | |
152 | XFRM_SHARE_USER, /* For this user only */ | |
153 | XFRM_SHARE_UNIQUE /* Use once */ | |
154 | }; | |
155 | ||
b59f45d0 HX |
156 | #define XFRM_MODE_TRANSPORT 0 |
157 | #define XFRM_MODE_TUNNEL 1 | |
7e49e6de MN |
158 | #define XFRM_MODE_ROUTEOPTIMIZATION 2 |
159 | #define XFRM_MODE_IN_TRIGGER 3 | |
0a69452c DB |
160 | #define XFRM_MODE_BEET 4 |
161 | #define XFRM_MODE_MAX 5 | |
b59f45d0 | 162 | |
1da177e4 LT |
163 | /* Netlink configuration messages. */ |
164 | enum { | |
165 | XFRM_MSG_BASE = 0x10, | |
166 | ||
167 | XFRM_MSG_NEWSA = 0x10, | |
168 | #define XFRM_MSG_NEWSA XFRM_MSG_NEWSA | |
169 | XFRM_MSG_DELSA, | |
170 | #define XFRM_MSG_DELSA XFRM_MSG_DELSA | |
171 | XFRM_MSG_GETSA, | |
172 | #define XFRM_MSG_GETSA XFRM_MSG_GETSA | |
173 | ||
174 | XFRM_MSG_NEWPOLICY, | |
175 | #define XFRM_MSG_NEWPOLICY XFRM_MSG_NEWPOLICY | |
176 | XFRM_MSG_DELPOLICY, | |
177 | #define XFRM_MSG_DELPOLICY XFRM_MSG_DELPOLICY | |
178 | XFRM_MSG_GETPOLICY, | |
179 | #define XFRM_MSG_GETPOLICY XFRM_MSG_GETPOLICY | |
180 | ||
181 | XFRM_MSG_ALLOCSPI, | |
182 | #define XFRM_MSG_ALLOCSPI XFRM_MSG_ALLOCSPI | |
183 | XFRM_MSG_ACQUIRE, | |
184 | #define XFRM_MSG_ACQUIRE XFRM_MSG_ACQUIRE | |
185 | XFRM_MSG_EXPIRE, | |
186 | #define XFRM_MSG_EXPIRE XFRM_MSG_EXPIRE | |
187 | ||
188 | XFRM_MSG_UPDPOLICY, | |
189 | #define XFRM_MSG_UPDPOLICY XFRM_MSG_UPDPOLICY | |
190 | XFRM_MSG_UPDSA, | |
191 | #define XFRM_MSG_UPDSA XFRM_MSG_UPDSA | |
192 | ||
193 | XFRM_MSG_POLEXPIRE, | |
194 | #define XFRM_MSG_POLEXPIRE XFRM_MSG_POLEXPIRE | |
195 | ||
196 | XFRM_MSG_FLUSHSA, | |
197 | #define XFRM_MSG_FLUSHSA XFRM_MSG_FLUSHSA | |
198 | XFRM_MSG_FLUSHPOLICY, | |
199 | #define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY | |
200 | ||
f8cd5488 JHS |
201 | XFRM_MSG_NEWAE, |
202 | #define XFRM_MSG_NEWAE XFRM_MSG_NEWAE | |
203 | XFRM_MSG_GETAE, | |
204 | #define XFRM_MSG_GETAE XFRM_MSG_GETAE | |
97a64b45 MN |
205 | |
206 | XFRM_MSG_REPORT, | |
207 | #define XFRM_MSG_REPORT XFRM_MSG_REPORT | |
208 | ||
80c9abaa SS |
209 | XFRM_MSG_MIGRATE, |
210 | #define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE | |
211 | ||
28d8909b JHS |
212 | XFRM_MSG_NEWSADINFO, |
213 | #define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO | |
214 | XFRM_MSG_GETSADINFO, | |
215 | #define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO | |
ecfd6b18 JHS |
216 | |
217 | XFRM_MSG_NEWSPDINFO, | |
218 | #define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO | |
219 | XFRM_MSG_GETSPDINFO, | |
220 | #define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO | |
3a2dfbe8 | 221 | |
844f7eaa ES |
222 | XFRM_MSG_MAPPING, |
223 | #define XFRM_MSG_MAPPING XFRM_MSG_MAPPING | |
224 | ||
2d151d39 SK |
225 | XFRM_MSG_SETDEFAULT, |
226 | #define XFRM_MSG_SETDEFAULT XFRM_MSG_SETDEFAULT | |
227 | XFRM_MSG_GETDEFAULT, | |
228 | #define XFRM_MSG_GETDEFAULT XFRM_MSG_GETDEFAULT | |
526bdb80 | 229 | __XFRM_MSG_MAX |
1da177e4 | 230 | }; |
526bdb80 | 231 | #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) |
1da177e4 | 232 | |
492b558b TG |
233 | #define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) |
234 | ||
df71837d | 235 | /* |
b6d2e438 | 236 | * Generic LSM security context for communicating to user space |
df71837d TJ |
237 | * NOTE: Same format as sadb_x_sec_ctx |
238 | */ | |
239 | struct xfrm_user_sec_ctx { | |
240 | __u16 len; | |
241 | __u16 exttype; | |
242 | __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */ | |
243 | __u8 ctx_doi; | |
244 | __u16 ctx_len; | |
245 | }; | |
246 | ||
1da177e4 LT |
247 | struct xfrm_user_tmpl { |
248 | struct xfrm_id id; | |
249 | __u16 family; | |
250 | xfrm_address_t saddr; | |
251 | __u32 reqid; | |
252 | __u8 mode; | |
253 | __u8 share; | |
254 | __u8 optional; | |
255 | __u32 aalgos; | |
256 | __u32 ealgos; | |
257 | __u32 calgos; | |
258 | }; | |
259 | ||
260 | struct xfrm_encap_tmpl { | |
261 | __u16 encap_type; | |
d5a0a1e3 AV |
262 | __be16 encap_sport; |
263 | __be16 encap_dport; | |
1da177e4 LT |
264 | xfrm_address_t encap_oa; |
265 | }; | |
266 | ||
f8cd5488 JHS |
267 | /* AEVENT flags */ |
268 | enum xfrm_ae_ftype_t { | |
269 | XFRM_AE_UNSPEC, | |
270 | XFRM_AE_RTHR=1, /* replay threshold*/ | |
271 | XFRM_AE_RVAL=2, /* replay value */ | |
272 | XFRM_AE_LVAL=4, /* lifetime value */ | |
273 | XFRM_AE_ETHR=8, /* expiry timer threshold */ | |
274 | XFRM_AE_CR=16, /* Event cause is replay update */ | |
275 | XFRM_AE_CE=32, /* Event cause is timer expiry */ | |
276 | XFRM_AE_CU=64, /* Event cause is policy update */ | |
277 | __XFRM_AE_MAX | |
278 | ||
279 | #define XFRM_AE_MAX (__XFRM_AE_MAX - 1) | |
280 | }; | |
281 | ||
f7b6983f MN |
282 | struct xfrm_userpolicy_type { |
283 | __u8 type; | |
284 | __u16 reserved1; | |
285 | __u8 reserved2; | |
286 | }; | |
287 | ||
1da177e4 LT |
288 | /* Netlink message attributes. */ |
289 | enum xfrm_attr_type_t { | |
290 | XFRMA_UNSPEC, | |
291 | XFRMA_ALG_AUTH, /* struct xfrm_algo */ | |
292 | XFRMA_ALG_CRYPT, /* struct xfrm_algo */ | |
293 | XFRMA_ALG_COMP, /* struct xfrm_algo */ | |
294 | XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ | |
295 | XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ | |
bf825f81 JHS |
296 | XFRMA_SA, /* struct xfrm_usersa_info */ |
297 | XFRMA_POLICY, /*struct xfrm_userpolicy_info */ | |
df71837d | 298 | XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ |
f8cd5488 JHS |
299 | XFRMA_LTIME_VAL, |
300 | XFRMA_REPLAY_VAL, | |
301 | XFRMA_REPLAY_THRESH, | |
302 | XFRMA_ETIMER_THRESH, | |
eb2971b6 | 303 | XFRMA_SRCADDR, /* xfrm_address_t */ |
060f02a3 | 304 | XFRMA_COADDR, /* xfrm_address_t */ |
36d76350 | 305 | XFRMA_LASTUSED, /* __u64 */ |
f7b6983f | 306 | XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ |
80c9abaa | 307 | XFRMA_MIGRATE, |
1a6509d9 | 308 | XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ |
13c1d189 | 309 | XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ |
4e242d16 | 310 | XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ |
bf825f81 | 311 | XFRMA_MARK, /* struct xfrm_mark */ |
35d2856b | 312 | XFRMA_TFCPAD, /* __u32 */ |
34a3d4b2 | 313 | XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_state_esn */ |
a947b0a9 | 314 | XFRMA_SA_EXTRA_FLAGS, /* __u32 */ |
d3623099 | 315 | XFRMA_PROTO, /* __u8 */ |
870a2df4 | 316 | XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */ |
de95c4a4 | 317 | XFRMA_PAD, |
29e42766 | 318 | XFRMA_OFFLOAD_DEV, /* struct xfrm_user_offload */ |
9b42c1f1 SK |
319 | XFRMA_SET_MARK, /* __u32 */ |
320 | XFRMA_SET_MARK_MASK, /* __u32 */ | |
7e652640 | 321 | XFRMA_IF_ID, /* __u32 */ |
4e484b3e | 322 | XFRMA_MTIMER_THRESH, /* __u32 in seconds for input SA */ |
a4a87fa4 | 323 | XFRMA_SA_DIR, /* __u8 */ |
1da177e4 LT |
324 | __XFRMA_MAX |
325 | ||
9b42c1f1 | 326 | #define XFRMA_OUTPUT_MARK XFRMA_SET_MARK /* Compatibility */ |
1da177e4 LT |
327 | #define XFRMA_MAX (__XFRMA_MAX - 1) |
328 | }; | |
329 | ||
bf825f81 JHS |
330 | struct xfrm_mark { |
331 | __u32 v; /* value */ | |
332 | __u32 m; /* mask */ | |
333 | }; | |
334 | ||
28d8909b JHS |
335 | enum xfrm_sadattr_type_t { |
336 | XFRMA_SAD_UNSPEC, | |
af11e316 JHS |
337 | XFRMA_SAD_CNT, |
338 | XFRMA_SAD_HINFO, | |
28d8909b JHS |
339 | __XFRMA_SAD_MAX |
340 | ||
341 | #define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1) | |
342 | }; | |
343 | ||
af11e316 JHS |
344 | struct xfrmu_sadhinfo { |
345 | __u32 sadhcnt; /* current hash bkts */ | |
346 | __u32 sadhmcnt; /* max allowed hash bkts */ | |
347 | }; | |
348 | ||
ecfd6b18 JHS |
349 | enum xfrm_spdattr_type_t { |
350 | XFRMA_SPD_UNSPEC, | |
5a6d3416 JHS |
351 | XFRMA_SPD_INFO, |
352 | XFRMA_SPD_HINFO, | |
880a6fab CG |
353 | XFRMA_SPD_IPV4_HTHRESH, |
354 | XFRMA_SPD_IPV6_HTHRESH, | |
ecfd6b18 JHS |
355 | __XFRMA_SPD_MAX |
356 | ||
357 | #define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1) | |
358 | }; | |
359 | ||
5a6d3416 JHS |
360 | struct xfrmu_spdinfo { |
361 | __u32 incnt; | |
362 | __u32 outcnt; | |
363 | __u32 fwdcnt; | |
364 | __u32 inscnt; | |
365 | __u32 outscnt; | |
366 | __u32 fwdscnt; | |
367 | }; | |
368 | ||
369 | struct xfrmu_spdhinfo { | |
370 | __u32 spdhcnt; | |
371 | __u32 spdhmcnt; | |
372 | }; | |
373 | ||
880a6fab CG |
374 | struct xfrmu_spdhthresh { |
375 | __u8 lbits; | |
376 | __u8 rbits; | |
377 | }; | |
378 | ||
1da177e4 LT |
379 | struct xfrm_usersa_info { |
380 | struct xfrm_selector sel; | |
381 | struct xfrm_id id; | |
382 | xfrm_address_t saddr; | |
383 | struct xfrm_lifetime_cfg lft; | |
384 | struct xfrm_lifetime_cur curlft; | |
385 | struct xfrm_stats stats; | |
386 | __u32 seq; | |
387 | __u32 reqid; | |
388 | __u16 family; | |
7e49e6de | 389 | __u8 mode; /* XFRM_MODE_xxx */ |
1da177e4 LT |
390 | __u8 replay_window; |
391 | __u8 flags; | |
392 | #define XFRM_STATE_NOECN 1 | |
393 | #define XFRM_STATE_DECAP_DSCP 2 | |
dd87147e | 394 | #define XFRM_STATE_NOPMTUDISC 4 |
fbd9a5b4 | 395 | #define XFRM_STATE_WILDRECV 8 |
8b7817f3 | 396 | #define XFRM_STATE_ICMP 16 |
ccf9b3b8 | 397 | #define XFRM_STATE_AF_UNSPEC 32 |
fa9921e4 | 398 | #define XFRM_STATE_ALIGN4 64 |
9736acf3 | 399 | #define XFRM_STATE_ESN 128 |
1da177e4 LT |
400 | }; |
401 | ||
a947b0a9 | 402 | #define XFRM_SA_XFLAG_DONT_ENCAP_DSCP 1 |
428d2459 | 403 | #define XFRM_SA_XFLAG_OSEQ_MAY_WRAP 2 |
a947b0a9 | 404 | |
1da177e4 LT |
405 | struct xfrm_usersa_id { |
406 | xfrm_address_t daddr; | |
9916ecb0 | 407 | __be32 spi; |
1da177e4 LT |
408 | __u16 family; |
409 | __u8 proto; | |
410 | }; | |
411 | ||
f8cd5488 | 412 | struct xfrm_aevent_id { |
f8cd5488 | 413 | struct xfrm_usersa_id sa_id; |
2b5f6dcc | 414 | xfrm_address_t saddr; |
4bf07ef3 | 415 | __u32 flags; |
2b5f6dcc | 416 | __u32 reqid; |
f8cd5488 JHS |
417 | }; |
418 | ||
1da177e4 LT |
419 | struct xfrm_userspi_info { |
420 | struct xfrm_usersa_info info; | |
421 | __u32 min; | |
422 | __u32 max; | |
423 | }; | |
424 | ||
425 | struct xfrm_userpolicy_info { | |
426 | struct xfrm_selector sel; | |
427 | struct xfrm_lifetime_cfg lft; | |
428 | struct xfrm_lifetime_cur curlft; | |
429 | __u32 priority; | |
430 | __u32 index; | |
431 | __u8 dir; | |
432 | __u8 action; | |
433 | #define XFRM_POLICY_ALLOW 0 | |
434 | #define XFRM_POLICY_BLOCK 1 | |
435 | __u8 flags; | |
436 | #define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */ | |
8b7817f3 HX |
437 | /* Automatically expand selector to include matching ICMP payloads. */ |
438 | #define XFRM_POLICY_ICMP 2 | |
1da177e4 LT |
439 | __u8 share; |
440 | }; | |
441 | ||
442 | struct xfrm_userpolicy_id { | |
443 | struct xfrm_selector sel; | |
444 | __u32 index; | |
445 | __u8 dir; | |
446 | }; | |
447 | ||
448 | struct xfrm_user_acquire { | |
449 | struct xfrm_id id; | |
450 | xfrm_address_t saddr; | |
451 | struct xfrm_selector sel; | |
452 | struct xfrm_userpolicy_info policy; | |
453 | __u32 aalgos; | |
454 | __u32 ealgos; | |
455 | __u32 calgos; | |
456 | __u32 seq; | |
457 | }; | |
458 | ||
459 | struct xfrm_user_expire { | |
460 | struct xfrm_usersa_info state; | |
461 | __u8 hard; | |
462 | }; | |
463 | ||
464 | struct xfrm_user_polexpire { | |
465 | struct xfrm_userpolicy_info pol; | |
466 | __u8 hard; | |
467 | }; | |
468 | ||
469 | struct xfrm_usersa_flush { | |
470 | __u8 proto; | |
471 | }; | |
472 | ||
97a64b45 MN |
473 | struct xfrm_user_report { |
474 | __u8 proto; | |
475 | struct xfrm_selector sel; | |
476 | }; | |
477 | ||
13c1d189 AE |
478 | /* Used by MIGRATE to pass addresses IKE should use to perform |
479 | * SA negotiation with the peer */ | |
480 | struct xfrm_user_kmaddress { | |
481 | xfrm_address_t local; | |
482 | xfrm_address_t remote; | |
483 | __u32 reserved; | |
484 | __u16 family; | |
485 | }; | |
486 | ||
80c9abaa SS |
487 | struct xfrm_user_migrate { |
488 | xfrm_address_t old_daddr; | |
489 | xfrm_address_t old_saddr; | |
490 | xfrm_address_t new_daddr; | |
491 | xfrm_address_t new_saddr; | |
492 | __u8 proto; | |
493 | __u8 mode; | |
494 | __u16 reserved; | |
495 | __u32 reqid; | |
496 | __u16 old_family; | |
497 | __u16 new_family; | |
498 | }; | |
499 | ||
3a2dfbe8 MW |
500 | struct xfrm_user_mapping { |
501 | struct xfrm_usersa_id id; | |
502 | __u32 reqid; | |
503 | xfrm_address_t old_saddr; | |
504 | xfrm_address_t new_saddr; | |
505 | __be16 old_sport; | |
506 | __be16 new_sport; | |
507 | }; | |
508 | ||
870a2df4 | 509 | struct xfrm_address_filter { |
d3623099 ND |
510 | xfrm_address_t saddr; |
511 | xfrm_address_t daddr; | |
512 | __u16 family; | |
513 | __u8 splen; | |
514 | __u8 dplen; | |
515 | }; | |
516 | ||
d77e38e6 SK |
517 | struct xfrm_user_offload { |
518 | int ifindex; | |
519 | __u8 flags; | |
520 | }; | |
5e25c25a PV |
521 | /* This flag was exposed without any kernel code that supports it. |
522 | * Unfortunately, strongswan has the code that sets this flag, | |
523 | * which makes it impossible to reuse this bit. | |
7c76ecd9 LR |
524 | * |
525 | * So leave it here to make sure that it won't be reused by mistake. | |
526 | */ | |
d77e38e6 SK |
527 | #define XFRM_OFFLOAD_IPV6 1 |
528 | #define XFRM_OFFLOAD_INBOUND 2 | |
d14f28b8 LR |
529 | /* Two bits above are relevant for state path only, while |
530 | * offload is used for both policy and state flows. | |
531 | * | |
532 | * In policy offload mode, they are free and can be safely reused. | |
533 | */ | |
534 | #define XFRM_OFFLOAD_PACKET 4 | |
d77e38e6 | 535 | |
2d151d39 | 536 | struct xfrm_userpolicy_default { |
f8d858e6 ND |
537 | #define XFRM_USERPOLICY_UNSPEC 0 |
538 | #define XFRM_USERPOLICY_BLOCK 1 | |
539 | #define XFRM_USERPOLICY_ACCEPT 2 | |
540 | __u8 in; | |
541 | __u8 fwd; | |
542 | __u8 out; | |
2d151d39 SK |
543 | }; |
544 | ||
ac6d439d PM |
545 | #ifndef __KERNEL__ |
546 | /* backwards compatibility for userspace */ | |
1da177e4 LT |
547 | #define XFRMGRP_ACQUIRE 1 |
548 | #define XFRMGRP_EXPIRE 2 | |
26b15dad JHS |
549 | #define XFRMGRP_SA 4 |
550 | #define XFRMGRP_POLICY 8 | |
93366c53 | 551 | #define XFRMGRP_REPORT 0x20 |
ac6d439d PM |
552 | #endif |
553 | ||
554 | enum xfrm_nlgroups { | |
555 | XFRMNLGRP_NONE, | |
556 | #define XFRMNLGRP_NONE XFRMNLGRP_NONE | |
557 | XFRMNLGRP_ACQUIRE, | |
558 | #define XFRMNLGRP_ACQUIRE XFRMNLGRP_ACQUIRE | |
559 | XFRMNLGRP_EXPIRE, | |
560 | #define XFRMNLGRP_EXPIRE XFRMNLGRP_EXPIRE | |
561 | XFRMNLGRP_SA, | |
562 | #define XFRMNLGRP_SA XFRMNLGRP_SA | |
563 | XFRMNLGRP_POLICY, | |
564 | #define XFRMNLGRP_POLICY XFRMNLGRP_POLICY | |
f8cd5488 JHS |
565 | XFRMNLGRP_AEVENTS, |
566 | #define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS | |
97a64b45 MN |
567 | XFRMNLGRP_REPORT, |
568 | #define XFRMNLGRP_REPORT XFRMNLGRP_REPORT | |
80c9abaa SS |
569 | XFRMNLGRP_MIGRATE, |
570 | #define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE | |
3a2dfbe8 MW |
571 | XFRMNLGRP_MAPPING, |
572 | #define XFRMNLGRP_MAPPING XFRMNLGRP_MAPPING | |
ac6d439d PM |
573 | __XFRMNLGRP_MAX |
574 | }; | |
575 | #define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) | |
1da177e4 LT |
576 | |
577 | #endif /* _LINUX_XFRM_H */ |