726 lines
25 KiB
C
726 lines
25 KiB
C
/*
|
|
******************************************************************************
|
|
* INTERPEAK API HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipipsec_pfkeyv2.h,v $ $Revision: 1.27.10.8 $
|
|
* $Source: /home/interpeak/CVSRoot/ipipsec2/include/ipipsec_pfkeyv2.h,v $
|
|
* $Author: yli10 $ $Date: 2018-11-23 08:09:53 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Lennart Bang <lob@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef __PFKEY_V2_H
|
|
#define __PFKEY_V2_H 1
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
* This file defines structures and symbols for the PF_KEY Version 2
|
|
* key management interface. It was written at the U.S. Naval Research
|
|
* Laboratory. This file is in the public domain. The authors ask that
|
|
* you leave this credit intact on any copies of this file.
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include "ipipsec_config.h"
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 REVISION
|
|
***************************************************************************
|
|
*/
|
|
#define PF_KEY_V2 2
|
|
#define PFKEYV2_REVISION 200901L
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include <ipcom_type.h>
|
|
#if !defined(IP_SYS_TYPES_H)
|
|
# include <stdint.h>
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#define SADB_SATYPE_UNSPEC 0
|
|
#define SADB_SATYPE_AH 2
|
|
#define SADB_SATYPE_ESP 3
|
|
#define SADB_SATYPE_RSVP 5
|
|
#define SADB_SATYPE_OSPFV2 6
|
|
#define SADB_SATYPE_RIPV2 7
|
|
#define SADB_SATYPE_MIP 8
|
|
#define SADB_X_SATYPE_IPCOMP 9
|
|
#define SADB_X_SATYPE_IPIP 10
|
|
#define SADB_X_SATYPE_TCPSIGNATURE 11
|
|
#define SADB_X_SATYPE_BYPASS 12
|
|
#define SADB_SATYPE_MAX 12
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* SADB_EXT_
|
|
*===========================================================================
|
|
*/
|
|
#define SADB_EXT_RESERVED 0 /* _Extension_data_type_ */
|
|
#define SADB_EXT_SA 1 /* struct sadb_sa */
|
|
#define SADB_EXT_LIFETIME_CURRENT 2 /* struct sadb_lifetime */
|
|
#define SADB_EXT_LIFETIME_HARD 3 /* struct sadb_lifetime */
|
|
#define SADB_EXT_LIFETIME_SOFT 4 /* struct sadb_lifetime */
|
|
#define SADB_EXT_ADDRESS_SRC 5 /* struct sadb_address */
|
|
#define SADB_EXT_ADDRESS_DST 6 /* struct sadb_address */
|
|
#define SADB_EXT_ADDRESS_PROXY 7 /* struct sadb_address */
|
|
#define SADB_EXT_KEY_AUTH 8 /* struct sadb_key */
|
|
#define SADB_EXT_KEY_ENCRYPT 9 /* struct sadb_key */
|
|
#define SADB_EXT_IDENTITY_SRC 10 /* struct sadb_ident */
|
|
#define SADB_EXT_IDENTITY_DST 11 /* struct sadb_ident */
|
|
#define SADB_EXT_SENSITIVITY 12 /* struct sadb_sens */
|
|
#define SADB_EXT_PROPOSAL 13 /* struct sadb_prop */
|
|
#define SADB_EXT_SUPPORTED 14 /* struct sadb_supported */
|
|
#define SADB_EXT_SUPPORTED_ENCRYPT 15 /* struct sadb_supported */
|
|
#define SADB_EXT_SPIRANGE 16 /* struct sadb_spirange */
|
|
/* Linux-API extensions (original values): */
|
|
#define SADB_X_EXT_KMPRIVATE 17
|
|
#define SADB_X_EXT_POLICY 18 /* struct sadb_x_policy */
|
|
#define SADB_LX_EXT_SA2 19 /* struct sadb_x_sa2 */
|
|
#define SADB_X_EXT_NAT_T_TYPE 20
|
|
#define SADB_X_EXT_NAT_T_SPORT 21
|
|
#define SADB_X_EXT_NAT_T_DPORT 22
|
|
#define SADB_X_EXT_NAT_T_OA 23
|
|
#define SADB_X_EXT_SEC_CTX 24
|
|
/* Old OpenBSD-API extensions (non-original values): */
|
|
#define SADB_X_EXT_SRC_MASK 33 /* struct sadb_address */
|
|
#define SADB_X_EXT_DST_MASK 34 /* struct sadb_address */
|
|
#define SADB_X_EXT_PROTOCOL 35 /* struct sadb_protocol */
|
|
#define SADB_X_EXT_SA2 36 /* struct sadb_sa */
|
|
#define SADB_X_EXT_SRC_FLOW 37 /* struct sadb_address */
|
|
#define SADB_X_EXT_DST_FLOW 38 /* struct sadb_address */
|
|
#define SADB_X_EXT_DST2 39 /* struct sadb_address */
|
|
#define SADB_X_EXT_FLOW_OPTIONS 40 /* struct sadb_x_flowopt */
|
|
#define SADB_X_EXT_UDPENCAP 41 /* struct sadb_x_udpencap */
|
|
#define SADB_X_EXT_SRCMAX_FLOW 42 /* struct sadb_address */
|
|
#define SADB_X_EXT_DSTMAX_FLOW 43 /* struct sadb_address */
|
|
#define SADB_X_EXT_SA_OPTIONS 44 /* struct sadb_x_saopt */
|
|
#define SADB_X_EXT_KMADDRESS 45 /* struct sadb_x_kmaddress */
|
|
/* Own extensions */
|
|
#define SADB_X_EXT_EVENT_INFO 46 /* struct sadb_x_event_info */
|
|
#define SADB_X_EXT_ROHC_PARAM 47 /* struct sadb_x_rohc_param */
|
|
#define SADB_X_EXT_ROHC_INTEG_KEY 48 /* struct sadb_key */
|
|
/* Max */
|
|
#define SADB_EXT_MAX 48
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_msg
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_msg
|
|
{
|
|
uint8_t sadb_msg_version; /* Set to PF_KEY_V2 */
|
|
uint8_t sadb_msg_type; /* See SADB_xxx types below */
|
|
uint8_t sadb_msg_errno;
|
|
uint8_t sadb_msg_satype; /* SADB_SATYPE_ESP, SADB_SATYPE_AH etc. */
|
|
uint16_t sadb_msg_len;
|
|
uint16_t sadb_msg_reserved; /* Must be set to 0 */
|
|
uint32_t sadb_msg_seq;
|
|
uint32_t sadb_msg_pid; /* Process ID, must be non-zero */
|
|
};
|
|
|
|
/* sadb_msg_type */ /* Mandatory extensions: */
|
|
#define SADB_RESERVED 0
|
|
#define SADB_GETSPI 1 /* base,spirange,address_src,address_dst */
|
|
#define SADB_UPDATE 2 /* sa,address_src,address_dst */
|
|
#define SADB_ADD 3 /* sa,address_src,address_dst,auth,encrypt,(lx_sa2) */
|
|
#define SADB_DELETE 4 /* sa,address_dst */
|
|
#define SADB_GET 5 /* sa,address_src,address_dst */
|
|
#define SADB_ACQUIRE 6
|
|
#define SADB_REGISTER 7
|
|
#define SADB_EXPIRE 8
|
|
#define SADB_FLUSH 9 /* - */
|
|
#define SADB_DUMP 10
|
|
/* Linux-API extensions (original values): */
|
|
#define SADB_LX_PROMISC 11
|
|
#define SADB_XX_PCHANGE 12
|
|
#define SADB_X_SPDUPDATE 13
|
|
#define SADB_X_SPDADD 14 /* x_policy,address_src,address_dst */
|
|
#define SADB_X_SPDDELETE 15
|
|
#define SADB_XX_SPDGET 16
|
|
#define SADB_XX_SPDACQUIRE 17
|
|
#define SADB_XX_SPDDUMP 18
|
|
#define SADB_X_SPDFLUSH 19 /* - */
|
|
#define SADB_XX_SPSETIDX 20
|
|
#define SADB_XX_SPDEXPIRE 21
|
|
#define SADB_XX_SPDDELETE2 22
|
|
#define SADB_XX_NAT_T_NEW_MAPPING 23
|
|
#define SADB_LX_MIGRATE 24
|
|
/* Old OpenBSD-API extensions (non-original values): */
|
|
#define SADB_X_PROMISC 33
|
|
#define SADB_X_ADDFLOW 34 /* src_mask,dst_mask,src_flow,dst_flow */
|
|
#define SADB_X_DELFLOW 35 /* src_mask,dst_mask,src_flow,dst_flow */
|
|
#define SADB_X_GRPSPIS 36 /* sa,sa2,dst,dst2,protocol */
|
|
#define SADB_X_BINDSA 37 /* sa,sa2,dst,dst2,protocol */
|
|
#define SADB_X_FINDFLOW 38 /* src_flow,dst_flow,protocol */
|
|
#define SADB_X_DUMPFLOW 39
|
|
#define SADB_X_MIGRATE 40 /* migrate message for MIP and IKE Com */
|
|
/* Own extensions */
|
|
#define SADB_X_EVENT 41 /* Event log messages */
|
|
#define SADB_X_ROHC 42 /* ROHC parameters */
|
|
/* Max */
|
|
#define SADB_MAX 42
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_ext
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_ext
|
|
{
|
|
uint16_t sadb_ext_len;
|
|
uint16_t sadb_ext_type;
|
|
};
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_sa
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_sa
|
|
{
|
|
uint16_t sadb_sa_len;
|
|
uint16_t sadb_sa_exttype;
|
|
uint32_t sadb_sa_spi;
|
|
uint8_t sadb_sa_replay;
|
|
uint8_t sadb_sa_state;
|
|
uint8_t sadb_sa_auth;
|
|
uint8_t sadb_sa_encrypt;
|
|
uint32_t sadb_sa_flags;
|
|
};
|
|
|
|
|
|
/* sadb_sa_state */
|
|
#define SADB_SASTATE_LARVAL 0
|
|
#define SADB_SASTATE_MATURE 1
|
|
#define SADB_SASTATE_DYING 2
|
|
#define SADB_SASTATE_DEAD 3
|
|
#define SADB_SASTATE_MAX 3
|
|
|
|
/* sadb_sa_auth */
|
|
#define SADB_AALG_NONE 0
|
|
#define SADB_AALG_MD5HMAC 2
|
|
#define SADB_AALG_SHA1HMAC 3
|
|
#define SADB_X_AALG_SHA2_256_HMAC 5
|
|
#define SADB_X_AALG_SHA2_384_HMAC 6
|
|
#define SADB_X_AALG_SHA2_512_HMAC 7
|
|
#define SADB_X_AALG_RIPEMD160HMAC 8
|
|
#define SADB_X_AALG_AES_XCBC_MAC 9
|
|
#define SADB_X_AALG_NULL 251 /* Not supported (kame) */
|
|
#define SADB_AALG_MAX 251
|
|
#define SADB_AALG_INVALID 255
|
|
#define SADB_AALG_NUM 7
|
|
/* old deprecated OpenBSD macros: */
|
|
#define SADB_AALG_MD5HMAC96 SADB_AALG_MD5HMAC
|
|
#define SADB_AALG_SHA1HMAC96 SADB_AALG_SHA1HMAC
|
|
#define SADB_X_AALG_RIPEMD160HMAC96 SADB_X_AALG_RIPEMD160HMAC
|
|
#define SADB_X_AALG_AESXCBCMAC96 SADB_X_AALG_AES_XCBC_MAC
|
|
|
|
/* sadb_sa_encrypt */
|
|
#define SADB_EALG_NONE 0
|
|
#define SADB_EALG_DESCBC 2
|
|
#define SADB_EALG_3DESCBC 3
|
|
#define SADB_X_EALG_CASTCBC 6
|
|
#define SADB_X_EALG_BLOWFISHCBC 7
|
|
#define SADB_EALG_NULL 11
|
|
#define SADB_X_EALG_AESCBC 12
|
|
#define SADB_X_EALG_AESCTR 13
|
|
#define SADB_X_EALG_AES SADB_X_EALG_AESCBC
|
|
#define SADB_EALG_MAX 13
|
|
#define SADB_EALG_NUM 7
|
|
/* old deprecated OpenBSD macros: */
|
|
#define SADB_X_EALG_BLF SADB_X_EALG_BLOWFISHCBC
|
|
#define SADB_X_EALG_CAST SADB_X_EALG_CASTCBC
|
|
|
|
/* sadb_sa_flags */
|
|
#define SADB_SAFLAGS_PFS 0x00000001L /* perfect forward secrecy */
|
|
/* Linux-API extensions (original values): */
|
|
#define SADB_SAFLAGS_NOECN 0x80000000L /*!!TODO: Disable ECN on SA */
|
|
/* Old OpenBSD-API extensions (non-original values): */
|
|
#define SADB_X_SAFLAGS_ROHC 0x00000100L /* Enable ROHC on SA */
|
|
#define SADB_X_SAFLAGS_ECN 0x00000200L /* Enable Explicit Congestion Control */
|
|
#define SADB_X_SAFLAGS_TUNNEL 0x00000400L /* Force tunneling */
|
|
#define SADB_X_SAFLAGS_CHAINDEL 0x00000800L /* Delete whole SA chain */
|
|
#define SADB_X_SAFLAGS_REPLACEFLOW 0x00002000L /* Replace existing flow */
|
|
#define SADB_X_SAFLAGS_INGRESS_FLOW 0x00004000L /* Ingress flow entry */
|
|
#define SADB_X_SAFLAGS_INGRESS_SA 0x00004000L /* Ingress SA entry */
|
|
#define SADB_X_SAFLAGS_RANDOMPADDING 0x00008000L /* Random ESP padding */
|
|
#define SADB_X_SAFLAGS_NOREPLAY 0x00010000L /* No replay counter */
|
|
#define SADB_X_SAFLAGS_UDPENCAP 0x00020000L /* ESP in UDP */
|
|
#define SADB_X_SAFLAGS_EGRESS_FLOW 0x00040000L /* Egress flow entry */
|
|
#define SADB_X_SAFLAGS_EGRESS_SA 0x00040000L /* Egress (output) SA entry */
|
|
#define SADB_X_SAFLAGS_TFC 0x00080000L /* Enable TFC on SA */
|
|
#define SADB_X_SAFLAGS_ESN 0x00100000L /* Enable ESN on SA */
|
|
#define SADB_X_SAFLAGS_SRCREQ 0x00200000L /* RFC4301p13: source IP must match */
|
|
#define SADB_X_SAFLAGS_CLRDF 0x00400000L /* Clear DF on outer IPv4 header */
|
|
#define SADB_X_SAFLAGS_SETDF 0x00800000L /* Set DF on outer IPv4 header */
|
|
|
|
#define SADB_KEY_FLAGS_MAX 0
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_lifetime
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_lifetime
|
|
{
|
|
uint16_t sadb_lifetime_len;
|
|
uint16_t sadb_lifetime_exttype;
|
|
uint32_t sadb_lifetime_allocations;
|
|
uint64_t sadb_lifetime_bytes;
|
|
uint64_t sadb_lifetime_addtime;
|
|
uint64_t sadb_lifetime_usetime;
|
|
};
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_address
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_address
|
|
{
|
|
uint16_t sadb_address_len;
|
|
uint16_t sadb_address_exttype;
|
|
uint8_t sadb_address_proto; /* unused, set to 0 */
|
|
uint8_t sadb_address_prefixlen; /* unused, set to 0 */
|
|
uint16_t sadb_address_reserved;
|
|
/* Followed by the IP address stored in a socket structure */
|
|
};
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_key
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_key
|
|
{
|
|
uint16_t sadb_key_len;
|
|
uint16_t sadb_key_exttype;
|
|
uint16_t sadb_key_bits;
|
|
uint16_t sadb_key_reserved;
|
|
};
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_ident
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_ident
|
|
{
|
|
uint16_t sadb_ident_len;
|
|
uint16_t sadb_ident_exttype;
|
|
uint16_t sadb_ident_type;
|
|
uint16_t sadb_ident_reserved;
|
|
uint64_t sadb_ident_id;
|
|
};
|
|
|
|
|
|
/* sadb_ident_type */
|
|
#define SADB_IDENTTYPE_RESERVED 0
|
|
#define SADB_IDENTTYPE_PREFIX 1
|
|
#define SADB_IDENTTYPE_FQDN 2
|
|
#define SADB_IDENTTYPE_USERFQDN 3
|
|
#define SADB_IDENTTYPE_MAX 3
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_sens
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_sens
|
|
{
|
|
uint16_t sadb_sens_len;
|
|
uint16_t sadb_sens_exttype;
|
|
uint32_t sadb_sens_dpd;
|
|
uint8_t sadb_sens_sens_level;
|
|
uint8_t sadb_sens_sens_len;
|
|
uint8_t sadb_sens_integ_level;
|
|
uint8_t sadb_sens_integ_len;
|
|
uint32_t sadb_sens_reserved;
|
|
};
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_prop
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_prop
|
|
{
|
|
uint16_t sadb_prop_len;
|
|
uint16_t sadb_prop_exttype;
|
|
uint8_t sadb_prop_replay;
|
|
uint8_t sadb_prop_reserved[3];
|
|
};
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_comb
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_comb
|
|
{
|
|
uint8_t sadb_comb_auth;
|
|
uint8_t sadb_comb_encrypt;
|
|
uint16_t sadb_comb_flags;
|
|
uint16_t sadb_comb_auth_minbits;
|
|
uint16_t sadb_comb_auth_maxbits;
|
|
uint16_t sadb_comb_encrypt_minbits;
|
|
uint16_t sadb_comb_encrypt_maxbits;
|
|
uint32_t sadb_comb_reserved;
|
|
uint32_t sadb_comb_soft_allocations;
|
|
uint32_t sadb_comb_hard_allocations;
|
|
uint64_t sadb_comb_soft_bytes;
|
|
uint64_t sadb_comb_hard_bytes;
|
|
uint64_t sadb_comb_soft_addtime;
|
|
uint64_t sadb_comb_hard_addtime;
|
|
uint64_t sadb_comb_soft_usetime;
|
|
uint64_t sadb_comb_hard_usetime;
|
|
};
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_suppported
|
|
*===========================================================================
|
|
* original sadb_supported struct:
|
|
* struct sadb_supported
|
|
* {
|
|
* uint16_t sadb_supported_len;
|
|
* uint16_t sadb_supported_exttype;
|
|
* uint32_t sadb_supported_reserved;
|
|
* };
|
|
*/
|
|
struct sadb_supported
|
|
{
|
|
uint16_t sadb_supported_len;
|
|
uint16_t sadb_supported_exttype;
|
|
uint8_t sadb_supported_nauth;
|
|
uint8_t sadb_supported_nencrypt;
|
|
uint16_t sadb_supported_reserved;
|
|
};
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_alg
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_alg
|
|
{
|
|
uint8_t sadb_alg_id;
|
|
uint8_t sadb_alg_ivlen;
|
|
uint16_t sadb_alg_minbits;
|
|
uint16_t sadb_alg_maxbits;
|
|
uint16_t sadb_alg_reserved;
|
|
};
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_spirange
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_spirange
|
|
{
|
|
uint16_t sadb_spirange_len;
|
|
uint16_t sadb_spirange_exttype;
|
|
uint32_t sadb_spirange_min;
|
|
uint32_t sadb_spirange_max;
|
|
uint32_t sadb_spirange_reserved;
|
|
};
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_protocol
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_protocol
|
|
{
|
|
uint16_t sadb_protocol_len;
|
|
uint16_t sadb_protocol_exttype;
|
|
uint8_t sadb_protocol_proto;
|
|
uint8_t sadb_protocol_ports0; /* See supported _ports0 below */
|
|
uint8_t sadb_protocol_ports1; /* See supported _ports1 below */
|
|
uint8_t sadb_protocol_reserved2;
|
|
};
|
|
|
|
/* Supported _ports0 and _ports1 selectors with _proto:
|
|
* proto = IP_IPPROTO_ICMP _ports0=ICMP type and _ports1=ICMP code
|
|
* proto = IP_IPPROTO_MH _ports0=Mobility Header type
|
|
*/
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_x_flowopt
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_x_flowopt
|
|
{
|
|
uint16_t sadb_flowopt_len;
|
|
uint16_t sadb_flowopt_exttype; /* SADB_X_EXT_FLOW_OPTIONS */
|
|
uint8_t sadb_flowopt_type; /* See SADB_X_FLOW_TYPE_xxx below */
|
|
uint8_t sadb_flowopt_direction; /* 0=any, 1=in, 2=out */
|
|
signed char sadb_flowopt_priority; /* Flow priority -128=highest, 127=lowest */
|
|
uint8_t sadb_flowopt_dscp; /* DSCP value */
|
|
uint32_t sadb_flowopt_id; /* Flow id != 0*/
|
|
uint32_t sadb_flowopt_reserved2;
|
|
};
|
|
|
|
/* SADB_X_EXT_FLOW_TYPE sadb_flowopt_type: */
|
|
#define SADB_X_FLOW_TYPE_UNSPEC 0
|
|
#define SADB_X_FLOW_TYPE_USE 1 /* Apply security (standard flow) */
|
|
#define SADB_X_FLOW_TYPE_ACQUIRE 2 /* Generate acquire message, send packet in cleartext */
|
|
#define SADB_X_FLOW_TYPE_REQUIRE 3 /* Generate require message, discard packet */
|
|
#define SADB_X_FLOW_TYPE_BYPASS 4 /* Send without applying security, i.e. cleartext */
|
|
#define SADB_X_FLOW_TYPE_DENY 5 /* Silent discard */
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_x_saopt
|
|
*===========================================================================
|
|
*/
|
|
struct sadb_x_saopt
|
|
{
|
|
uint16_t sadb_saopt_len;
|
|
uint16_t sadb_saopt_exttype; /* SADB_X_EXT_SA_OPTIONS */
|
|
signed char sadb_saopt_priority; /* Sa priority -128=highest, 127=lowest */
|
|
uint8_t sadb_saopt_reserved;
|
|
uint16_t sadb_saopt_reserved2;
|
|
};
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_x_udpencap
|
|
*===========================================================================
|
|
*/
|
|
|
|
struct sadb_x_udpencap
|
|
{
|
|
uint16_t sadb_x_udpencap_len;
|
|
uint16_t sadb_x_udpencap_exttype;
|
|
uint16_t sadb_x_udpencap_src_port; /* source port in network endian */
|
|
#define sadb_x_udpencap_port sadb_x_udpencap_src_port
|
|
uint16_t sadb_x_udpencap_dst_port; /* destination port in network endian */
|
|
#define sadb_x_udpencap_reserved sadb_x_udpencap_dst_port
|
|
};
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_x_kmaddress
|
|
*===========================================================================
|
|
*/
|
|
|
|
/* sizeof(struct sadb_x_kmaddress) == 8 */
|
|
struct sadb_x_kmaddress
|
|
{
|
|
uint16_t sadb_x_kmaddress_len;
|
|
uint16_t sadb_x_kmaddress_exttype;
|
|
uint32_t sadb_x_kmaddress_reserved;
|
|
};
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 LINUX TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_x_policy
|
|
*===========================================================================
|
|
*/
|
|
|
|
struct sadb_x_policy
|
|
{
|
|
uint16_t sadb_x_policy_len;
|
|
uint16_t sadb_x_policy_exttype;
|
|
uint16_t sadb_x_policy_type;
|
|
uint8_t sadb_x_policy_dir;
|
|
uint8_t sadb_x_policy_reserved;
|
|
uint32_t sadb_x_policy_id;
|
|
uint32_t sadb_x_policy_priority;
|
|
};
|
|
/* sizeof(struct sadb_x_policy) == 16 */
|
|
|
|
|
|
/* sadb_x_policy_type: */
|
|
enum {
|
|
IPSEC_POLICY_DISCARD = 0,
|
|
IPSEC_POLICY_NONE = 1,
|
|
IPSEC_POLICY_IPSEC = 2,
|
|
IPSEC_POLICY_ENTRUST = 3,
|
|
IPSEC_POLICY_BYPASS = 4
|
|
};
|
|
|
|
/* sadb_x_policy_dir; */
|
|
enum {
|
|
IPSEC_DIR_ANY = 0,
|
|
IPSEC_DIR_INBOUND = 1,
|
|
IPSEC_DIR_OUTBOUND = 2,
|
|
IPSEC_DIR_FWD = 3, /* It is our own */
|
|
IPSEC_DIR_MAX = 4,
|
|
IPSEC_DIR_INVALID = 5
|
|
};
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_x_ipsecrequest
|
|
*===========================================================================
|
|
* Passed after sadb_x_policy stucture in SADB_X_EXT_POLICY extension.
|
|
* sadb_x_ipsecrequest is followed by 0-2 sockaddr for tunnel endpoints
|
|
*/
|
|
|
|
struct sadb_x_ipsecrequest
|
|
{
|
|
uint16_t sadb_x_ipsecrequest_len; /* NOTE: In bytes, not in 8-bytes! */
|
|
uint16_t sadb_x_ipsecrequest_proto; /* ESP or AH */
|
|
uint8_t sadb_x_ipsecrequest_mode; /* Any, tunnel or transport */
|
|
uint8_t sadb_x_ipsecrequest_level;
|
|
uint16_t sadb_x_ipsecrequest_reserved1;
|
|
uint32_t sadb_x_ipsecrequest_reqid;
|
|
uint32_t sadb_x_ipsecrequest_reserved2;
|
|
};
|
|
/* sizeof(struct sadb_x_ipsecrequest) == 16 */
|
|
|
|
/* sadb_x_ipsecrequest_mode: */
|
|
enum {
|
|
IPSEC_MODE_ANY = 0, /* Not supported! */
|
|
IPSEC_MODE_TRANSPORT = 1,
|
|
IPSEC_MODE_TUNNEL = 2,
|
|
IPSEC_MODE_BEET = 3
|
|
};
|
|
|
|
/* sadb_x_ipsecrequest_level: */
|
|
enum {
|
|
IPSEC_LEVEL_DEFAULT = 0, /* same as 'use' in our kernel */
|
|
IPSEC_LEVEL_USE = 1, /* use SA if available, otherwise bypass */
|
|
IPSEC_LEVEL_REQUIRE = 2, /* SA required, discard pkt if no SA */
|
|
IPSEC_LEVEL_UNIQUE = 3 /* Specified SA required */
|
|
};
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_x_sa2
|
|
*===========================================================================
|
|
* SADB_LX_EXT_SA2 extension used with SADB_ADD
|
|
*/
|
|
|
|
struct sadb_x_sa2
|
|
{
|
|
uint16_t sadb_x_sa2_len;
|
|
uint16_t sadb_x_sa2_exttype;
|
|
uint8_t sadb_x_sa2_mode;
|
|
uint8_t sadb_x_sa2_reserved1;
|
|
uint16_t sadb_x_sa2_reserved2;
|
|
uint32_t sadb_x_sa2_sequence;
|
|
uint32_t sadb_x_sa2_reqid;
|
|
};
|
|
/* sizeof(struct sadb_x_sa2) == 16 */
|
|
|
|
|
|
#ifdef IPIPSEC_USE_EVENT_LOG
|
|
|
|
/*
|
|
*===========================================================================
|
|
* sadb_x_event_info
|
|
*===========================================================================
|
|
* Carries event information from IPsec up to IKE.
|
|
*/
|
|
struct sadb_x_event_info
|
|
{
|
|
uint16_t sadb_x_event_info_len; /* NOTE: In bytes, not in 8-bytes! */
|
|
uint16_t sadb_x_event_info_exttype;
|
|
/* Followed by an Ipike_event_msg structure */
|
|
};
|
|
/* sizeof(struct sadb_x_event_info) == 4 */
|
|
#endif /* IPIPSEC_USE_EVENT_LOG */
|
|
|
|
|
|
#ifdef IPIPSEC_USE_ROHC
|
|
/*
|
|
*===========================================================================
|
|
* sadb_x_rohc
|
|
*===========================================================================
|
|
* Contains ROHC channel parameter for an IPsec SA. An integrity key
|
|
* SADB_X_EXT_ROHC_INTEG_KEY will be sent separately if sadb_x_rohc_integ_alg
|
|
* is set.
|
|
*/
|
|
struct sadb_x_rohc
|
|
{
|
|
uint16_t sadb_x_rohc_len;
|
|
uint16_t sadb_x_rohc_exttype;
|
|
uint8_t sadb_x_rohc_icv_len;
|
|
uint8_t sadb_x_rohc_integ_alg;
|
|
uint16_t sadb_x_rohc_unsused;
|
|
char sadb_x_rohc_ifname[IP_IFNAMSIZ];
|
|
};
|
|
#endif /* IPIPSEC_USE_ROHC */
|
|
|
|
/* sizeof(struct sadb_x_rohc) == 24 */
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
/* __PFKEY_V2_H */
|
|
|