1 /**************************************************************************** 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 21 #include <linux/in6.h> 22 #include <linux/types.h> 23 typedef union { 24 __be32 a4; 25 __be32 a6[4]; 26 struct in6_addr in6; 27 } xfrm_address_t; 28 struct xfrm_id { 29 xfrm_address_t daddr; 30 __be32 spi; 31 __u8 proto; 32 }; 33 struct xfrm_sec_ctx { 34 __u8 ctx_doi; 35 __u8 ctx_alg; 36 __u16 ctx_len; 37 __u32 ctx_sid; 38 char ctx_str[0]; 39 }; 40 #define XFRM_SC_DOI_RESERVED 0 41 #define XFRM_SC_DOI_LSM 1 42 #define XFRM_SC_ALG_RESERVED 0 43 #define XFRM_SC_ALG_SELINUX 1 44 struct xfrm_selector { 45 xfrm_address_t daddr; 46 xfrm_address_t saddr; 47 __be16 dport; 48 __be16 dport_mask; 49 __be16 sport; 50 __be16 sport_mask; 51 __u16 family; 52 __u8 prefixlen_d; 53 __u8 prefixlen_s; 54 __u8 proto; 55 int ifindex; 56 __kernel_uid32_t user; 57 }; 58 #define XFRM_INF (~(__u64) 0) 59 struct xfrm_lifetime_cfg { 60 __u64 soft_byte_limit; 61 __u64 hard_byte_limit; 62 __u64 soft_packet_limit; 63 __u64 hard_packet_limit; 64 __u64 soft_add_expires_seconds; 65 __u64 hard_add_expires_seconds; 66 __u64 soft_use_expires_seconds; 67 __u64 hard_use_expires_seconds; 68 }; 69 struct xfrm_lifetime_cur { 70 __u64 bytes; 71 __u64 packets; 72 __u64 add_time; 73 __u64 use_time; 74 }; 75 struct xfrm_replay_state { 76 __u32 oseq; 77 __u32 seq; 78 __u32 bitmap; 79 }; 80 #define XFRMA_REPLAY_ESN_MAX 4096 81 struct xfrm_replay_state_esn { 82 unsigned int bmp_len; 83 __u32 oseq; 84 __u32 seq; 85 __u32 oseq_hi; 86 __u32 seq_hi; 87 __u32 replay_window; 88 __u32 bmp[0]; 89 }; 90 struct xfrm_algo { 91 char alg_name[64]; 92 unsigned int alg_key_len; 93 char alg_key[0]; 94 }; 95 struct xfrm_algo_auth { 96 char alg_name[64]; 97 unsigned int alg_key_len; 98 unsigned int alg_trunc_len; 99 char alg_key[0]; 100 }; 101 struct xfrm_algo_aead { 102 char alg_name[64]; 103 unsigned int alg_key_len; 104 unsigned int alg_icv_len; 105 char alg_key[0]; 106 }; 107 struct xfrm_stats { 108 __u32 replay_window; 109 __u32 replay; 110 __u32 integrity_failed; 111 }; 112 enum { 113 XFRM_POLICY_TYPE_MAIN = 0, 114 XFRM_POLICY_TYPE_SUB = 1, 115 XFRM_POLICY_TYPE_MAX = 2, 116 XFRM_POLICY_TYPE_ANY = 255 117 }; 118 enum { 119 XFRM_POLICY_IN = 0, 120 XFRM_POLICY_OUT = 1, 121 XFRM_POLICY_FWD = 2, 122 XFRM_POLICY_MASK = 3, 123 XFRM_POLICY_MAX = 3 124 }; 125 enum { 126 XFRM_SHARE_ANY, 127 XFRM_SHARE_SESSION, 128 XFRM_SHARE_USER, 129 XFRM_SHARE_UNIQUE 130 }; 131 #define XFRM_MODE_TRANSPORT 0 132 #define XFRM_MODE_TUNNEL 1 133 #define XFRM_MODE_ROUTEOPTIMIZATION 2 134 #define XFRM_MODE_IN_TRIGGER 3 135 #define XFRM_MODE_BEET 4 136 #define XFRM_MODE_MAX 5 137 enum { 138 XFRM_MSG_BASE = 0x10, 139 XFRM_MSG_NEWSA = 0x10, 140 #define XFRM_MSG_NEWSA XFRM_MSG_NEWSA 141 XFRM_MSG_DELSA, 142 #define XFRM_MSG_DELSA XFRM_MSG_DELSA 143 XFRM_MSG_GETSA, 144 #define XFRM_MSG_GETSA XFRM_MSG_GETSA 145 XFRM_MSG_NEWPOLICY, 146 #define XFRM_MSG_NEWPOLICY XFRM_MSG_NEWPOLICY 147 XFRM_MSG_DELPOLICY, 148 #define XFRM_MSG_DELPOLICY XFRM_MSG_DELPOLICY 149 XFRM_MSG_GETPOLICY, 150 #define XFRM_MSG_GETPOLICY XFRM_MSG_GETPOLICY 151 XFRM_MSG_ALLOCSPI, 152 #define XFRM_MSG_ALLOCSPI XFRM_MSG_ALLOCSPI 153 XFRM_MSG_ACQUIRE, 154 #define XFRM_MSG_ACQUIRE XFRM_MSG_ACQUIRE 155 XFRM_MSG_EXPIRE, 156 #define XFRM_MSG_EXPIRE XFRM_MSG_EXPIRE 157 XFRM_MSG_UPDPOLICY, 158 #define XFRM_MSG_UPDPOLICY XFRM_MSG_UPDPOLICY 159 XFRM_MSG_UPDSA, 160 #define XFRM_MSG_UPDSA XFRM_MSG_UPDSA 161 XFRM_MSG_POLEXPIRE, 162 #define XFRM_MSG_POLEXPIRE XFRM_MSG_POLEXPIRE 163 XFRM_MSG_FLUSHSA, 164 #define XFRM_MSG_FLUSHSA XFRM_MSG_FLUSHSA 165 XFRM_MSG_FLUSHPOLICY, 166 #define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY 167 XFRM_MSG_NEWAE, 168 #define XFRM_MSG_NEWAE XFRM_MSG_NEWAE 169 XFRM_MSG_GETAE, 170 #define XFRM_MSG_GETAE XFRM_MSG_GETAE 171 XFRM_MSG_REPORT, 172 #define XFRM_MSG_REPORT XFRM_MSG_REPORT 173 XFRM_MSG_MIGRATE, 174 #define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE 175 XFRM_MSG_NEWSADINFO, 176 #define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO 177 XFRM_MSG_GETSADINFO, 178 #define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO 179 XFRM_MSG_NEWSPDINFO, 180 #define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO 181 XFRM_MSG_GETSPDINFO, 182 #define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO 183 XFRM_MSG_MAPPING, 184 #define XFRM_MSG_MAPPING XFRM_MSG_MAPPING 185 __XFRM_MSG_MAX 186 }; 187 #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) 188 #define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) 189 struct xfrm_user_sec_ctx { 190 __u16 len; 191 __u16 exttype; 192 __u8 ctx_alg; 193 __u8 ctx_doi; 194 __u16 ctx_len; 195 }; 196 struct xfrm_user_tmpl { 197 struct xfrm_id id; 198 __u16 family; 199 xfrm_address_t saddr; 200 __u32 reqid; 201 __u8 mode; 202 __u8 share; 203 __u8 optional; 204 __u32 aalgos; 205 __u32 ealgos; 206 __u32 calgos; 207 }; 208 struct xfrm_encap_tmpl { 209 __u16 encap_type; 210 __be16 encap_sport; 211 __be16 encap_dport; 212 xfrm_address_t encap_oa; 213 }; 214 enum xfrm_ae_ftype_t { 215 XFRM_AE_UNSPEC, 216 XFRM_AE_RTHR = 1, 217 XFRM_AE_RVAL = 2, 218 XFRM_AE_LVAL = 4, 219 XFRM_AE_ETHR = 8, 220 XFRM_AE_CR = 16, 221 XFRM_AE_CE = 32, 222 XFRM_AE_CU = 64, 223 __XFRM_AE_MAX 224 #define XFRM_AE_MAX (__XFRM_AE_MAX - 1) 225 }; 226 struct xfrm_userpolicy_type { 227 __u8 type; 228 __u16 reserved1; 229 __u8 reserved2; 230 }; 231 enum xfrm_attr_type_t { 232 XFRMA_UNSPEC, 233 XFRMA_ALG_AUTH, 234 XFRMA_ALG_CRYPT, 235 XFRMA_ALG_COMP, 236 XFRMA_ENCAP, 237 XFRMA_TMPL, 238 XFRMA_SA, 239 XFRMA_POLICY, 240 XFRMA_SEC_CTX, 241 XFRMA_LTIME_VAL, 242 XFRMA_REPLAY_VAL, 243 XFRMA_REPLAY_THRESH, 244 XFRMA_ETIMER_THRESH, 245 XFRMA_SRCADDR, 246 XFRMA_COADDR, 247 XFRMA_LASTUSED, 248 XFRMA_POLICY_TYPE, 249 XFRMA_MIGRATE, 250 XFRMA_ALG_AEAD, 251 XFRMA_KMADDRESS, 252 XFRMA_ALG_AUTH_TRUNC, 253 XFRMA_MARK, 254 XFRMA_TFCPAD, 255 XFRMA_REPLAY_ESN_VAL, 256 XFRMA_SA_EXTRA_FLAGS, 257 XFRMA_PROTO, 258 XFRMA_ADDRESS_FILTER, 259 XFRMA_PAD, 260 XFRMA_OFFLOAD_DEV, 261 XFRMA_SET_MARK, 262 XFRMA_SET_MARK_MASK, 263 XFRMA_IF_ID, 264 __XFRMA_MAX 265 #define XFRMA_OUTPUT_MARK XFRMA_SET_MARK 266 #define XFRMA_MAX (__XFRMA_MAX - 1) 267 }; 268 struct xfrm_mark { 269 __u32 v; 270 __u32 m; 271 }; 272 enum xfrm_sadattr_type_t { 273 XFRMA_SAD_UNSPEC, 274 XFRMA_SAD_CNT, 275 XFRMA_SAD_HINFO, 276 __XFRMA_SAD_MAX 277 #define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1) 278 }; 279 struct xfrmu_sadhinfo { 280 __u32 sadhcnt; 281 __u32 sadhmcnt; 282 }; 283 enum xfrm_spdattr_type_t { 284 XFRMA_SPD_UNSPEC, 285 XFRMA_SPD_INFO, 286 XFRMA_SPD_HINFO, 287 XFRMA_SPD_IPV4_HTHRESH, 288 XFRMA_SPD_IPV6_HTHRESH, 289 __XFRMA_SPD_MAX 290 #define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1) 291 }; 292 struct xfrmu_spdinfo { 293 __u32 incnt; 294 __u32 outcnt; 295 __u32 fwdcnt; 296 __u32 inscnt; 297 __u32 outscnt; 298 __u32 fwdscnt; 299 }; 300 struct xfrmu_spdhinfo { 301 __u32 spdhcnt; 302 __u32 spdhmcnt; 303 }; 304 struct xfrmu_spdhthresh { 305 __u8 lbits; 306 __u8 rbits; 307 }; 308 struct xfrm_usersa_info { 309 struct xfrm_selector sel; 310 struct xfrm_id id; 311 xfrm_address_t saddr; 312 struct xfrm_lifetime_cfg lft; 313 struct xfrm_lifetime_cur curlft; 314 struct xfrm_stats stats; 315 __u32 seq; 316 __u32 reqid; 317 __u16 family; 318 __u8 mode; 319 __u8 replay_window; 320 __u8 flags; 321 #define XFRM_STATE_NOECN 1 322 #define XFRM_STATE_DECAP_DSCP 2 323 #define XFRM_STATE_NOPMTUDISC 4 324 #define XFRM_STATE_WILDRECV 8 325 #define XFRM_STATE_ICMP 16 326 #define XFRM_STATE_AF_UNSPEC 32 327 #define XFRM_STATE_ALIGN4 64 328 #define XFRM_STATE_ESN 128 329 }; 330 #define XFRM_SA_XFLAG_DONT_ENCAP_DSCP 1 331 struct xfrm_usersa_id { 332 xfrm_address_t daddr; 333 __be32 spi; 334 __u16 family; 335 __u8 proto; 336 }; 337 struct xfrm_aevent_id { 338 struct xfrm_usersa_id sa_id; 339 xfrm_address_t saddr; 340 __u32 flags; 341 __u32 reqid; 342 }; 343 struct xfrm_userspi_info { 344 struct xfrm_usersa_info info; 345 __u32 min; 346 __u32 max; 347 }; 348 struct xfrm_userpolicy_info { 349 struct xfrm_selector sel; 350 struct xfrm_lifetime_cfg lft; 351 struct xfrm_lifetime_cur curlft; 352 __u32 priority; 353 __u32 index; 354 __u8 dir; 355 __u8 action; 356 #define XFRM_POLICY_ALLOW 0 357 #define XFRM_POLICY_BLOCK 1 358 __u8 flags; 359 #define XFRM_POLICY_LOCALOK 1 360 #define XFRM_POLICY_ICMP 2 361 __u8 share; 362 }; 363 struct xfrm_userpolicy_id { 364 struct xfrm_selector sel; 365 __u32 index; 366 __u8 dir; 367 }; 368 struct xfrm_user_acquire { 369 struct xfrm_id id; 370 xfrm_address_t saddr; 371 struct xfrm_selector sel; 372 struct xfrm_userpolicy_info policy; 373 __u32 aalgos; 374 __u32 ealgos; 375 __u32 calgos; 376 __u32 seq; 377 }; 378 struct xfrm_user_expire { 379 struct xfrm_usersa_info state; 380 __u8 hard; 381 }; 382 struct xfrm_user_polexpire { 383 struct xfrm_userpolicy_info pol; 384 __u8 hard; 385 }; 386 struct xfrm_usersa_flush { 387 __u8 proto; 388 }; 389 struct xfrm_user_report { 390 __u8 proto; 391 struct xfrm_selector sel; 392 }; 393 struct xfrm_user_kmaddress { 394 xfrm_address_t local; 395 xfrm_address_t remote; 396 __u32 reserved; 397 __u16 family; 398 }; 399 struct xfrm_user_migrate { 400 xfrm_address_t old_daddr; 401 xfrm_address_t old_saddr; 402 xfrm_address_t new_daddr; 403 xfrm_address_t new_saddr; 404 __u8 proto; 405 __u8 mode; 406 __u16 reserved; 407 __u32 reqid; 408 __u16 old_family; 409 __u16 new_family; 410 }; 411 struct xfrm_user_mapping { 412 struct xfrm_usersa_id id; 413 __u32 reqid; 414 xfrm_address_t old_saddr; 415 xfrm_address_t new_saddr; 416 __be16 old_sport; 417 __be16 new_sport; 418 }; 419 struct xfrm_address_filter { 420 xfrm_address_t saddr; 421 xfrm_address_t daddr; 422 __u16 family; 423 __u8 splen; 424 __u8 dplen; 425 }; 426 struct xfrm_user_offload { 427 int ifindex; 428 __u8 flags; 429 }; 430 #define XFRM_OFFLOAD_IPV6 1 431 #define XFRM_OFFLOAD_INBOUND 2 432 #define XFRMGRP_ACQUIRE 1 433 #define XFRMGRP_EXPIRE 2 434 #define XFRMGRP_SA 4 435 #define XFRMGRP_POLICY 8 436 #define XFRMGRP_REPORT 0x20 437 enum xfrm_nlgroups { 438 XFRMNLGRP_NONE, 439 #define XFRMNLGRP_NONE XFRMNLGRP_NONE 440 XFRMNLGRP_ACQUIRE, 441 #define XFRMNLGRP_ACQUIRE XFRMNLGRP_ACQUIRE 442 XFRMNLGRP_EXPIRE, 443 #define XFRMNLGRP_EXPIRE XFRMNLGRP_EXPIRE 444 XFRMNLGRP_SA, 445 #define XFRMNLGRP_SA XFRMNLGRP_SA 446 XFRMNLGRP_POLICY, 447 #define XFRMNLGRP_POLICY XFRMNLGRP_POLICY 448 XFRMNLGRP_AEVENTS, 449 #define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS 450 XFRMNLGRP_REPORT, 451 #define XFRMNLGRP_REPORT XFRMNLGRP_REPORT 452 XFRMNLGRP_MIGRATE, 453 #define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE 454 XFRMNLGRP_MAPPING, 455 #define XFRMNLGRP_MAPPING XFRMNLGRP_MAPPING 456 __XFRMNLGRP_MAX 457 }; 458 #define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) 459 #endif 460