1*607ca46eSDavid Howells #ifndef _LINUX_XFRM_H 2*607ca46eSDavid Howells #define _LINUX_XFRM_H 3*607ca46eSDavid Howells 4*607ca46eSDavid Howells #include <linux/types.h> 5*607ca46eSDavid Howells 6*607ca46eSDavid Howells /* All of the structures in this file may not change size as they are 7*607ca46eSDavid Howells * passed into the kernel from userspace via netlink sockets. 8*607ca46eSDavid Howells */ 9*607ca46eSDavid Howells 10*607ca46eSDavid Howells /* Structure to encapsulate addresses. I do not want to use 11*607ca46eSDavid Howells * "standard" structure. My apologies. 12*607ca46eSDavid Howells */ 13*607ca46eSDavid Howells typedef union { 14*607ca46eSDavid Howells __be32 a4; 15*607ca46eSDavid Howells __be32 a6[4]; 16*607ca46eSDavid Howells } xfrm_address_t; 17*607ca46eSDavid Howells 18*607ca46eSDavid Howells /* Ident of a specific xfrm_state. It is used on input to lookup 19*607ca46eSDavid Howells * the state by (spi,daddr,ah/esp) or to store information about 20*607ca46eSDavid Howells * spi, protocol and tunnel address on output. 21*607ca46eSDavid Howells */ 22*607ca46eSDavid Howells struct xfrm_id { 23*607ca46eSDavid Howells xfrm_address_t daddr; 24*607ca46eSDavid Howells __be32 spi; 25*607ca46eSDavid Howells __u8 proto; 26*607ca46eSDavid Howells }; 27*607ca46eSDavid Howells 28*607ca46eSDavid Howells struct xfrm_sec_ctx { 29*607ca46eSDavid Howells __u8 ctx_doi; 30*607ca46eSDavid Howells __u8 ctx_alg; 31*607ca46eSDavid Howells __u16 ctx_len; 32*607ca46eSDavid Howells __u32 ctx_sid; 33*607ca46eSDavid Howells char ctx_str[0]; 34*607ca46eSDavid Howells }; 35*607ca46eSDavid Howells 36*607ca46eSDavid Howells /* Security Context Domains of Interpretation */ 37*607ca46eSDavid Howells #define XFRM_SC_DOI_RESERVED 0 38*607ca46eSDavid Howells #define XFRM_SC_DOI_LSM 1 39*607ca46eSDavid Howells 40*607ca46eSDavid Howells /* Security Context Algorithms */ 41*607ca46eSDavid Howells #define XFRM_SC_ALG_RESERVED 0 42*607ca46eSDavid Howells #define XFRM_SC_ALG_SELINUX 1 43*607ca46eSDavid Howells 44*607ca46eSDavid Howells /* Selector, used as selector both on policy rules (SPD) and SAs. */ 45*607ca46eSDavid Howells 46*607ca46eSDavid Howells struct xfrm_selector { 47*607ca46eSDavid Howells xfrm_address_t daddr; 48*607ca46eSDavid Howells xfrm_address_t saddr; 49*607ca46eSDavid Howells __be16 dport; 50*607ca46eSDavid Howells __be16 dport_mask; 51*607ca46eSDavid Howells __be16 sport; 52*607ca46eSDavid Howells __be16 sport_mask; 53*607ca46eSDavid Howells __u16 family; 54*607ca46eSDavid Howells __u8 prefixlen_d; 55*607ca46eSDavid Howells __u8 prefixlen_s; 56*607ca46eSDavid Howells __u8 proto; 57*607ca46eSDavid Howells int ifindex; 58*607ca46eSDavid Howells __kernel_uid32_t user; 59*607ca46eSDavid Howells }; 60*607ca46eSDavid Howells 61*607ca46eSDavid Howells #define XFRM_INF (~(__u64)0) 62*607ca46eSDavid Howells 63*607ca46eSDavid Howells struct xfrm_lifetime_cfg { 64*607ca46eSDavid Howells __u64 soft_byte_limit; 65*607ca46eSDavid Howells __u64 hard_byte_limit; 66*607ca46eSDavid Howells __u64 soft_packet_limit; 67*607ca46eSDavid Howells __u64 hard_packet_limit; 68*607ca46eSDavid Howells __u64 soft_add_expires_seconds; 69*607ca46eSDavid Howells __u64 hard_add_expires_seconds; 70*607ca46eSDavid Howells __u64 soft_use_expires_seconds; 71*607ca46eSDavid Howells __u64 hard_use_expires_seconds; 72*607ca46eSDavid Howells }; 73*607ca46eSDavid Howells 74*607ca46eSDavid Howells struct xfrm_lifetime_cur { 75*607ca46eSDavid Howells __u64 bytes; 76*607ca46eSDavid Howells __u64 packets; 77*607ca46eSDavid Howells __u64 add_time; 78*607ca46eSDavid Howells __u64 use_time; 79*607ca46eSDavid Howells }; 80*607ca46eSDavid Howells 81*607ca46eSDavid Howells struct xfrm_replay_state { 82*607ca46eSDavid Howells __u32 oseq; 83*607ca46eSDavid Howells __u32 seq; 84*607ca46eSDavid Howells __u32 bitmap; 85*607ca46eSDavid Howells }; 86*607ca46eSDavid Howells 87*607ca46eSDavid Howells #define XFRMA_REPLAY_ESN_MAX 4096 88*607ca46eSDavid Howells 89*607ca46eSDavid Howells struct xfrm_replay_state_esn { 90*607ca46eSDavid Howells unsigned int bmp_len; 91*607ca46eSDavid Howells __u32 oseq; 92*607ca46eSDavid Howells __u32 seq; 93*607ca46eSDavid Howells __u32 oseq_hi; 94*607ca46eSDavid Howells __u32 seq_hi; 95*607ca46eSDavid Howells __u32 replay_window; 96*607ca46eSDavid Howells __u32 bmp[0]; 97*607ca46eSDavid Howells }; 98*607ca46eSDavid Howells 99*607ca46eSDavid Howells struct xfrm_algo { 100*607ca46eSDavid Howells char alg_name[64]; 101*607ca46eSDavid Howells unsigned int alg_key_len; /* in bits */ 102*607ca46eSDavid Howells char alg_key[0]; 103*607ca46eSDavid Howells }; 104*607ca46eSDavid Howells 105*607ca46eSDavid Howells struct xfrm_algo_auth { 106*607ca46eSDavid Howells char alg_name[64]; 107*607ca46eSDavid Howells unsigned int alg_key_len; /* in bits */ 108*607ca46eSDavid Howells unsigned int alg_trunc_len; /* in bits */ 109*607ca46eSDavid Howells char alg_key[0]; 110*607ca46eSDavid Howells }; 111*607ca46eSDavid Howells 112*607ca46eSDavid Howells struct xfrm_algo_aead { 113*607ca46eSDavid Howells char alg_name[64]; 114*607ca46eSDavid Howells unsigned int alg_key_len; /* in bits */ 115*607ca46eSDavid Howells unsigned int alg_icv_len; /* in bits */ 116*607ca46eSDavid Howells char alg_key[0]; 117*607ca46eSDavid Howells }; 118*607ca46eSDavid Howells 119*607ca46eSDavid Howells struct xfrm_stats { 120*607ca46eSDavid Howells __u32 replay_window; 121*607ca46eSDavid Howells __u32 replay; 122*607ca46eSDavid Howells __u32 integrity_failed; 123*607ca46eSDavid Howells }; 124*607ca46eSDavid Howells 125*607ca46eSDavid Howells enum { 126*607ca46eSDavid Howells XFRM_POLICY_TYPE_MAIN = 0, 127*607ca46eSDavid Howells XFRM_POLICY_TYPE_SUB = 1, 128*607ca46eSDavid Howells XFRM_POLICY_TYPE_MAX = 2, 129*607ca46eSDavid Howells XFRM_POLICY_TYPE_ANY = 255 130*607ca46eSDavid Howells }; 131*607ca46eSDavid Howells 132*607ca46eSDavid Howells enum { 133*607ca46eSDavid Howells XFRM_POLICY_IN = 0, 134*607ca46eSDavid Howells XFRM_POLICY_OUT = 1, 135*607ca46eSDavid Howells XFRM_POLICY_FWD = 2, 136*607ca46eSDavid Howells XFRM_POLICY_MASK = 3, 137*607ca46eSDavid Howells XFRM_POLICY_MAX = 3 138*607ca46eSDavid Howells }; 139*607ca46eSDavid Howells 140*607ca46eSDavid Howells enum { 141*607ca46eSDavid Howells XFRM_SHARE_ANY, /* No limitations */ 142*607ca46eSDavid Howells XFRM_SHARE_SESSION, /* For this session only */ 143*607ca46eSDavid Howells XFRM_SHARE_USER, /* For this user only */ 144*607ca46eSDavid Howells XFRM_SHARE_UNIQUE /* Use once */ 145*607ca46eSDavid Howells }; 146*607ca46eSDavid Howells 147*607ca46eSDavid Howells #define XFRM_MODE_TRANSPORT 0 148*607ca46eSDavid Howells #define XFRM_MODE_TUNNEL 1 149*607ca46eSDavid Howells #define XFRM_MODE_ROUTEOPTIMIZATION 2 150*607ca46eSDavid Howells #define XFRM_MODE_IN_TRIGGER 3 151*607ca46eSDavid Howells #define XFRM_MODE_BEET 4 152*607ca46eSDavid Howells #define XFRM_MODE_MAX 5 153*607ca46eSDavid Howells 154*607ca46eSDavid Howells /* Netlink configuration messages. */ 155*607ca46eSDavid Howells enum { 156*607ca46eSDavid Howells XFRM_MSG_BASE = 0x10, 157*607ca46eSDavid Howells 158*607ca46eSDavid Howells XFRM_MSG_NEWSA = 0x10, 159*607ca46eSDavid Howells #define XFRM_MSG_NEWSA XFRM_MSG_NEWSA 160*607ca46eSDavid Howells XFRM_MSG_DELSA, 161*607ca46eSDavid Howells #define XFRM_MSG_DELSA XFRM_MSG_DELSA 162*607ca46eSDavid Howells XFRM_MSG_GETSA, 163*607ca46eSDavid Howells #define XFRM_MSG_GETSA XFRM_MSG_GETSA 164*607ca46eSDavid Howells 165*607ca46eSDavid Howells XFRM_MSG_NEWPOLICY, 166*607ca46eSDavid Howells #define XFRM_MSG_NEWPOLICY XFRM_MSG_NEWPOLICY 167*607ca46eSDavid Howells XFRM_MSG_DELPOLICY, 168*607ca46eSDavid Howells #define XFRM_MSG_DELPOLICY XFRM_MSG_DELPOLICY 169*607ca46eSDavid Howells XFRM_MSG_GETPOLICY, 170*607ca46eSDavid Howells #define XFRM_MSG_GETPOLICY XFRM_MSG_GETPOLICY 171*607ca46eSDavid Howells 172*607ca46eSDavid Howells XFRM_MSG_ALLOCSPI, 173*607ca46eSDavid Howells #define XFRM_MSG_ALLOCSPI XFRM_MSG_ALLOCSPI 174*607ca46eSDavid Howells XFRM_MSG_ACQUIRE, 175*607ca46eSDavid Howells #define XFRM_MSG_ACQUIRE XFRM_MSG_ACQUIRE 176*607ca46eSDavid Howells XFRM_MSG_EXPIRE, 177*607ca46eSDavid Howells #define XFRM_MSG_EXPIRE XFRM_MSG_EXPIRE 178*607ca46eSDavid Howells 179*607ca46eSDavid Howells XFRM_MSG_UPDPOLICY, 180*607ca46eSDavid Howells #define XFRM_MSG_UPDPOLICY XFRM_MSG_UPDPOLICY 181*607ca46eSDavid Howells XFRM_MSG_UPDSA, 182*607ca46eSDavid Howells #define XFRM_MSG_UPDSA XFRM_MSG_UPDSA 183*607ca46eSDavid Howells 184*607ca46eSDavid Howells XFRM_MSG_POLEXPIRE, 185*607ca46eSDavid Howells #define XFRM_MSG_POLEXPIRE XFRM_MSG_POLEXPIRE 186*607ca46eSDavid Howells 187*607ca46eSDavid Howells XFRM_MSG_FLUSHSA, 188*607ca46eSDavid Howells #define XFRM_MSG_FLUSHSA XFRM_MSG_FLUSHSA 189*607ca46eSDavid Howells XFRM_MSG_FLUSHPOLICY, 190*607ca46eSDavid Howells #define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY 191*607ca46eSDavid Howells 192*607ca46eSDavid Howells XFRM_MSG_NEWAE, 193*607ca46eSDavid Howells #define XFRM_MSG_NEWAE XFRM_MSG_NEWAE 194*607ca46eSDavid Howells XFRM_MSG_GETAE, 195*607ca46eSDavid Howells #define XFRM_MSG_GETAE XFRM_MSG_GETAE 196*607ca46eSDavid Howells 197*607ca46eSDavid Howells XFRM_MSG_REPORT, 198*607ca46eSDavid Howells #define XFRM_MSG_REPORT XFRM_MSG_REPORT 199*607ca46eSDavid Howells 200*607ca46eSDavid Howells XFRM_MSG_MIGRATE, 201*607ca46eSDavid Howells #define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE 202*607ca46eSDavid Howells 203*607ca46eSDavid Howells XFRM_MSG_NEWSADINFO, 204*607ca46eSDavid Howells #define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO 205*607ca46eSDavid Howells XFRM_MSG_GETSADINFO, 206*607ca46eSDavid Howells #define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO 207*607ca46eSDavid Howells 208*607ca46eSDavid Howells XFRM_MSG_NEWSPDINFO, 209*607ca46eSDavid Howells #define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO 210*607ca46eSDavid Howells XFRM_MSG_GETSPDINFO, 211*607ca46eSDavid Howells #define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO 212*607ca46eSDavid Howells 213*607ca46eSDavid Howells XFRM_MSG_MAPPING, 214*607ca46eSDavid Howells #define XFRM_MSG_MAPPING XFRM_MSG_MAPPING 215*607ca46eSDavid Howells __XFRM_MSG_MAX 216*607ca46eSDavid Howells }; 217*607ca46eSDavid Howells #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) 218*607ca46eSDavid Howells 219*607ca46eSDavid Howells #define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) 220*607ca46eSDavid Howells 221*607ca46eSDavid Howells /* 222*607ca46eSDavid Howells * Generic LSM security context for comunicating to user space 223*607ca46eSDavid Howells * NOTE: Same format as sadb_x_sec_ctx 224*607ca46eSDavid Howells */ 225*607ca46eSDavid Howells struct xfrm_user_sec_ctx { 226*607ca46eSDavid Howells __u16 len; 227*607ca46eSDavid Howells __u16 exttype; 228*607ca46eSDavid Howells __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */ 229*607ca46eSDavid Howells __u8 ctx_doi; 230*607ca46eSDavid Howells __u16 ctx_len; 231*607ca46eSDavid Howells }; 232*607ca46eSDavid Howells 233*607ca46eSDavid Howells struct xfrm_user_tmpl { 234*607ca46eSDavid Howells struct xfrm_id id; 235*607ca46eSDavid Howells __u16 family; 236*607ca46eSDavid Howells xfrm_address_t saddr; 237*607ca46eSDavid Howells __u32 reqid; 238*607ca46eSDavid Howells __u8 mode; 239*607ca46eSDavid Howells __u8 share; 240*607ca46eSDavid Howells __u8 optional; 241*607ca46eSDavid Howells __u32 aalgos; 242*607ca46eSDavid Howells __u32 ealgos; 243*607ca46eSDavid Howells __u32 calgos; 244*607ca46eSDavid Howells }; 245*607ca46eSDavid Howells 246*607ca46eSDavid Howells struct xfrm_encap_tmpl { 247*607ca46eSDavid Howells __u16 encap_type; 248*607ca46eSDavid Howells __be16 encap_sport; 249*607ca46eSDavid Howells __be16 encap_dport; 250*607ca46eSDavid Howells xfrm_address_t encap_oa; 251*607ca46eSDavid Howells }; 252*607ca46eSDavid Howells 253*607ca46eSDavid Howells /* AEVENT flags */ 254*607ca46eSDavid Howells enum xfrm_ae_ftype_t { 255*607ca46eSDavid Howells XFRM_AE_UNSPEC, 256*607ca46eSDavid Howells XFRM_AE_RTHR=1, /* replay threshold*/ 257*607ca46eSDavid Howells XFRM_AE_RVAL=2, /* replay value */ 258*607ca46eSDavid Howells XFRM_AE_LVAL=4, /* lifetime value */ 259*607ca46eSDavid Howells XFRM_AE_ETHR=8, /* expiry timer threshold */ 260*607ca46eSDavid Howells XFRM_AE_CR=16, /* Event cause is replay update */ 261*607ca46eSDavid Howells XFRM_AE_CE=32, /* Event cause is timer expiry */ 262*607ca46eSDavid Howells XFRM_AE_CU=64, /* Event cause is policy update */ 263*607ca46eSDavid Howells __XFRM_AE_MAX 264*607ca46eSDavid Howells 265*607ca46eSDavid Howells #define XFRM_AE_MAX (__XFRM_AE_MAX - 1) 266*607ca46eSDavid Howells }; 267*607ca46eSDavid Howells 268*607ca46eSDavid Howells struct xfrm_userpolicy_type { 269*607ca46eSDavid Howells __u8 type; 270*607ca46eSDavid Howells __u16 reserved1; 271*607ca46eSDavid Howells __u8 reserved2; 272*607ca46eSDavid Howells }; 273*607ca46eSDavid Howells 274*607ca46eSDavid Howells /* Netlink message attributes. */ 275*607ca46eSDavid Howells enum xfrm_attr_type_t { 276*607ca46eSDavid Howells XFRMA_UNSPEC, 277*607ca46eSDavid Howells XFRMA_ALG_AUTH, /* struct xfrm_algo */ 278*607ca46eSDavid Howells XFRMA_ALG_CRYPT, /* struct xfrm_algo */ 279*607ca46eSDavid Howells XFRMA_ALG_COMP, /* struct xfrm_algo */ 280*607ca46eSDavid Howells XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ 281*607ca46eSDavid Howells XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ 282*607ca46eSDavid Howells XFRMA_SA, /* struct xfrm_usersa_info */ 283*607ca46eSDavid Howells XFRMA_POLICY, /*struct xfrm_userpolicy_info */ 284*607ca46eSDavid Howells XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ 285*607ca46eSDavid Howells XFRMA_LTIME_VAL, 286*607ca46eSDavid Howells XFRMA_REPLAY_VAL, 287*607ca46eSDavid Howells XFRMA_REPLAY_THRESH, 288*607ca46eSDavid Howells XFRMA_ETIMER_THRESH, 289*607ca46eSDavid Howells XFRMA_SRCADDR, /* xfrm_address_t */ 290*607ca46eSDavid Howells XFRMA_COADDR, /* xfrm_address_t */ 291*607ca46eSDavid Howells XFRMA_LASTUSED, /* unsigned long */ 292*607ca46eSDavid Howells XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ 293*607ca46eSDavid Howells XFRMA_MIGRATE, 294*607ca46eSDavid Howells XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ 295*607ca46eSDavid Howells XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ 296*607ca46eSDavid Howells XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ 297*607ca46eSDavid Howells XFRMA_MARK, /* struct xfrm_mark */ 298*607ca46eSDavid Howells XFRMA_TFCPAD, /* __u32 */ 299*607ca46eSDavid Howells XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */ 300*607ca46eSDavid Howells __XFRMA_MAX 301*607ca46eSDavid Howells 302*607ca46eSDavid Howells #define XFRMA_MAX (__XFRMA_MAX - 1) 303*607ca46eSDavid Howells }; 304*607ca46eSDavid Howells 305*607ca46eSDavid Howells struct xfrm_mark { 306*607ca46eSDavid Howells __u32 v; /* value */ 307*607ca46eSDavid Howells __u32 m; /* mask */ 308*607ca46eSDavid Howells }; 309*607ca46eSDavid Howells 310*607ca46eSDavid Howells enum xfrm_sadattr_type_t { 311*607ca46eSDavid Howells XFRMA_SAD_UNSPEC, 312*607ca46eSDavid Howells XFRMA_SAD_CNT, 313*607ca46eSDavid Howells XFRMA_SAD_HINFO, 314*607ca46eSDavid Howells __XFRMA_SAD_MAX 315*607ca46eSDavid Howells 316*607ca46eSDavid Howells #define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1) 317*607ca46eSDavid Howells }; 318*607ca46eSDavid Howells 319*607ca46eSDavid Howells struct xfrmu_sadhinfo { 320*607ca46eSDavid Howells __u32 sadhcnt; /* current hash bkts */ 321*607ca46eSDavid Howells __u32 sadhmcnt; /* max allowed hash bkts */ 322*607ca46eSDavid Howells }; 323*607ca46eSDavid Howells 324*607ca46eSDavid Howells enum xfrm_spdattr_type_t { 325*607ca46eSDavid Howells XFRMA_SPD_UNSPEC, 326*607ca46eSDavid Howells XFRMA_SPD_INFO, 327*607ca46eSDavid Howells XFRMA_SPD_HINFO, 328*607ca46eSDavid Howells __XFRMA_SPD_MAX 329*607ca46eSDavid Howells 330*607ca46eSDavid Howells #define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1) 331*607ca46eSDavid Howells }; 332*607ca46eSDavid Howells 333*607ca46eSDavid Howells struct xfrmu_spdinfo { 334*607ca46eSDavid Howells __u32 incnt; 335*607ca46eSDavid Howells __u32 outcnt; 336*607ca46eSDavid Howells __u32 fwdcnt; 337*607ca46eSDavid Howells __u32 inscnt; 338*607ca46eSDavid Howells __u32 outscnt; 339*607ca46eSDavid Howells __u32 fwdscnt; 340*607ca46eSDavid Howells }; 341*607ca46eSDavid Howells 342*607ca46eSDavid Howells struct xfrmu_spdhinfo { 343*607ca46eSDavid Howells __u32 spdhcnt; 344*607ca46eSDavid Howells __u32 spdhmcnt; 345*607ca46eSDavid Howells }; 346*607ca46eSDavid Howells 347*607ca46eSDavid Howells struct xfrm_usersa_info { 348*607ca46eSDavid Howells struct xfrm_selector sel; 349*607ca46eSDavid Howells struct xfrm_id id; 350*607ca46eSDavid Howells xfrm_address_t saddr; 351*607ca46eSDavid Howells struct xfrm_lifetime_cfg lft; 352*607ca46eSDavid Howells struct xfrm_lifetime_cur curlft; 353*607ca46eSDavid Howells struct xfrm_stats stats; 354*607ca46eSDavid Howells __u32 seq; 355*607ca46eSDavid Howells __u32 reqid; 356*607ca46eSDavid Howells __u16 family; 357*607ca46eSDavid Howells __u8 mode; /* XFRM_MODE_xxx */ 358*607ca46eSDavid Howells __u8 replay_window; 359*607ca46eSDavid Howells __u8 flags; 360*607ca46eSDavid Howells #define XFRM_STATE_NOECN 1 361*607ca46eSDavid Howells #define XFRM_STATE_DECAP_DSCP 2 362*607ca46eSDavid Howells #define XFRM_STATE_NOPMTUDISC 4 363*607ca46eSDavid Howells #define XFRM_STATE_WILDRECV 8 364*607ca46eSDavid Howells #define XFRM_STATE_ICMP 16 365*607ca46eSDavid Howells #define XFRM_STATE_AF_UNSPEC 32 366*607ca46eSDavid Howells #define XFRM_STATE_ALIGN4 64 367*607ca46eSDavid Howells #define XFRM_STATE_ESN 128 368*607ca46eSDavid Howells }; 369*607ca46eSDavid Howells 370*607ca46eSDavid Howells struct xfrm_usersa_id { 371*607ca46eSDavid Howells xfrm_address_t daddr; 372*607ca46eSDavid Howells __be32 spi; 373*607ca46eSDavid Howells __u16 family; 374*607ca46eSDavid Howells __u8 proto; 375*607ca46eSDavid Howells }; 376*607ca46eSDavid Howells 377*607ca46eSDavid Howells struct xfrm_aevent_id { 378*607ca46eSDavid Howells struct xfrm_usersa_id sa_id; 379*607ca46eSDavid Howells xfrm_address_t saddr; 380*607ca46eSDavid Howells __u32 flags; 381*607ca46eSDavid Howells __u32 reqid; 382*607ca46eSDavid Howells }; 383*607ca46eSDavid Howells 384*607ca46eSDavid Howells struct xfrm_userspi_info { 385*607ca46eSDavid Howells struct xfrm_usersa_info info; 386*607ca46eSDavid Howells __u32 min; 387*607ca46eSDavid Howells __u32 max; 388*607ca46eSDavid Howells }; 389*607ca46eSDavid Howells 390*607ca46eSDavid Howells struct xfrm_userpolicy_info { 391*607ca46eSDavid Howells struct xfrm_selector sel; 392*607ca46eSDavid Howells struct xfrm_lifetime_cfg lft; 393*607ca46eSDavid Howells struct xfrm_lifetime_cur curlft; 394*607ca46eSDavid Howells __u32 priority; 395*607ca46eSDavid Howells __u32 index; 396*607ca46eSDavid Howells __u8 dir; 397*607ca46eSDavid Howells __u8 action; 398*607ca46eSDavid Howells #define XFRM_POLICY_ALLOW 0 399*607ca46eSDavid Howells #define XFRM_POLICY_BLOCK 1 400*607ca46eSDavid Howells __u8 flags; 401*607ca46eSDavid Howells #define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */ 402*607ca46eSDavid Howells /* Automatically expand selector to include matching ICMP payloads. */ 403*607ca46eSDavid Howells #define XFRM_POLICY_ICMP 2 404*607ca46eSDavid Howells __u8 share; 405*607ca46eSDavid Howells }; 406*607ca46eSDavid Howells 407*607ca46eSDavid Howells struct xfrm_userpolicy_id { 408*607ca46eSDavid Howells struct xfrm_selector sel; 409*607ca46eSDavid Howells __u32 index; 410*607ca46eSDavid Howells __u8 dir; 411*607ca46eSDavid Howells }; 412*607ca46eSDavid Howells 413*607ca46eSDavid Howells struct xfrm_user_acquire { 414*607ca46eSDavid Howells struct xfrm_id id; 415*607ca46eSDavid Howells xfrm_address_t saddr; 416*607ca46eSDavid Howells struct xfrm_selector sel; 417*607ca46eSDavid Howells struct xfrm_userpolicy_info policy; 418*607ca46eSDavid Howells __u32 aalgos; 419*607ca46eSDavid Howells __u32 ealgos; 420*607ca46eSDavid Howells __u32 calgos; 421*607ca46eSDavid Howells __u32 seq; 422*607ca46eSDavid Howells }; 423*607ca46eSDavid Howells 424*607ca46eSDavid Howells struct xfrm_user_expire { 425*607ca46eSDavid Howells struct xfrm_usersa_info state; 426*607ca46eSDavid Howells __u8 hard; 427*607ca46eSDavid Howells }; 428*607ca46eSDavid Howells 429*607ca46eSDavid Howells struct xfrm_user_polexpire { 430*607ca46eSDavid Howells struct xfrm_userpolicy_info pol; 431*607ca46eSDavid Howells __u8 hard; 432*607ca46eSDavid Howells }; 433*607ca46eSDavid Howells 434*607ca46eSDavid Howells struct xfrm_usersa_flush { 435*607ca46eSDavid Howells __u8 proto; 436*607ca46eSDavid Howells }; 437*607ca46eSDavid Howells 438*607ca46eSDavid Howells struct xfrm_user_report { 439*607ca46eSDavid Howells __u8 proto; 440*607ca46eSDavid Howells struct xfrm_selector sel; 441*607ca46eSDavid Howells }; 442*607ca46eSDavid Howells 443*607ca46eSDavid Howells /* Used by MIGRATE to pass addresses IKE should use to perform 444*607ca46eSDavid Howells * SA negotiation with the peer */ 445*607ca46eSDavid Howells struct xfrm_user_kmaddress { 446*607ca46eSDavid Howells xfrm_address_t local; 447*607ca46eSDavid Howells xfrm_address_t remote; 448*607ca46eSDavid Howells __u32 reserved; 449*607ca46eSDavid Howells __u16 family; 450*607ca46eSDavid Howells }; 451*607ca46eSDavid Howells 452*607ca46eSDavid Howells struct xfrm_user_migrate { 453*607ca46eSDavid Howells xfrm_address_t old_daddr; 454*607ca46eSDavid Howells xfrm_address_t old_saddr; 455*607ca46eSDavid Howells xfrm_address_t new_daddr; 456*607ca46eSDavid Howells xfrm_address_t new_saddr; 457*607ca46eSDavid Howells __u8 proto; 458*607ca46eSDavid Howells __u8 mode; 459*607ca46eSDavid Howells __u16 reserved; 460*607ca46eSDavid Howells __u32 reqid; 461*607ca46eSDavid Howells __u16 old_family; 462*607ca46eSDavid Howells __u16 new_family; 463*607ca46eSDavid Howells }; 464*607ca46eSDavid Howells 465*607ca46eSDavid Howells struct xfrm_user_mapping { 466*607ca46eSDavid Howells struct xfrm_usersa_id id; 467*607ca46eSDavid Howells __u32 reqid; 468*607ca46eSDavid Howells xfrm_address_t old_saddr; 469*607ca46eSDavid Howells xfrm_address_t new_saddr; 470*607ca46eSDavid Howells __be16 old_sport; 471*607ca46eSDavid Howells __be16 new_sport; 472*607ca46eSDavid Howells }; 473*607ca46eSDavid Howells 474*607ca46eSDavid Howells #ifndef __KERNEL__ 475*607ca46eSDavid Howells /* backwards compatibility for userspace */ 476*607ca46eSDavid Howells #define XFRMGRP_ACQUIRE 1 477*607ca46eSDavid Howells #define XFRMGRP_EXPIRE 2 478*607ca46eSDavid Howells #define XFRMGRP_SA 4 479*607ca46eSDavid Howells #define XFRMGRP_POLICY 8 480*607ca46eSDavid Howells #define XFRMGRP_REPORT 0x20 481*607ca46eSDavid Howells #endif 482*607ca46eSDavid Howells 483*607ca46eSDavid Howells enum xfrm_nlgroups { 484*607ca46eSDavid Howells XFRMNLGRP_NONE, 485*607ca46eSDavid Howells #define XFRMNLGRP_NONE XFRMNLGRP_NONE 486*607ca46eSDavid Howells XFRMNLGRP_ACQUIRE, 487*607ca46eSDavid Howells #define XFRMNLGRP_ACQUIRE XFRMNLGRP_ACQUIRE 488*607ca46eSDavid Howells XFRMNLGRP_EXPIRE, 489*607ca46eSDavid Howells #define XFRMNLGRP_EXPIRE XFRMNLGRP_EXPIRE 490*607ca46eSDavid Howells XFRMNLGRP_SA, 491*607ca46eSDavid Howells #define XFRMNLGRP_SA XFRMNLGRP_SA 492*607ca46eSDavid Howells XFRMNLGRP_POLICY, 493*607ca46eSDavid Howells #define XFRMNLGRP_POLICY XFRMNLGRP_POLICY 494*607ca46eSDavid Howells XFRMNLGRP_AEVENTS, 495*607ca46eSDavid Howells #define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS 496*607ca46eSDavid Howells XFRMNLGRP_REPORT, 497*607ca46eSDavid Howells #define XFRMNLGRP_REPORT XFRMNLGRP_REPORT 498*607ca46eSDavid Howells XFRMNLGRP_MIGRATE, 499*607ca46eSDavid Howells #define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE 500*607ca46eSDavid Howells XFRMNLGRP_MAPPING, 501*607ca46eSDavid Howells #define XFRMNLGRP_MAPPING XFRMNLGRP_MAPPING 502*607ca46eSDavid Howells __XFRMNLGRP_MAX 503*607ca46eSDavid Howells }; 504*607ca46eSDavid Howells #define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) 505*607ca46eSDavid Howells 506*607ca46eSDavid Howells #endif /* _LINUX_XFRM_H */ 507