4 #include <linux/types.h>
6 /* All of the structures in this file may not change size as they are
7 * passed into the kernel from userspace via netlink sockets.
10 /* Structure to encapsulate addresses. I do not want to use
11 * "standard" structure. My apologies.
19 /* Ident of a specific xfrm_state. It is used on input to lookup
20 * the state by (spi,daddr,ah/esp) or to store information about
21 * spi, protocol and tunnel address on output.
30 /* Selector, used as selector both on policy rules (SPD) and SAs. */
48 #define XFRM_INF (~(__u64)0)
50 struct xfrm_lifetime_cfg
52 __u64 soft_byte_limit
;
53 __u64 hard_byte_limit
;
54 __u64 soft_packet_limit
;
55 __u64 hard_packet_limit
;
56 __u64 soft_add_expires_seconds
;
57 __u64 hard_add_expires_seconds
;
58 __u64 soft_use_expires_seconds
;
59 __u64 hard_use_expires_seconds
;
62 struct xfrm_lifetime_cur
70 struct xfrm_replay_state
79 int alg_key_len
; /* in bits */
86 __u32 integrity_failed
;
99 XFRM_SHARE_ANY
, /* No limitations */
100 XFRM_SHARE_SESSION
, /* For this session only */
101 XFRM_SHARE_USER
, /* For this user only */
102 XFRM_SHARE_UNIQUE
/* Use once */
105 /* Netlink configuration messages. */
107 XFRM_MSG_BASE
= 0x10,
109 XFRM_MSG_NEWSA
= 0x10,
110 #define XFRM_MSG_NEWSA XFRM_MSG_NEWSA
112 #define XFRM_MSG_DELSA XFRM_MSG_DELSA
114 #define XFRM_MSG_GETSA XFRM_MSG_GETSA
117 #define XFRM_MSG_NEWPOLICY XFRM_MSG_NEWPOLICY
119 #define XFRM_MSG_DELPOLICY XFRM_MSG_DELPOLICY
121 #define XFRM_MSG_GETPOLICY XFRM_MSG_GETPOLICY
124 #define XFRM_MSG_ALLOCSPI XFRM_MSG_ALLOCSPI
126 #define XFRM_MSG_ACQUIRE XFRM_MSG_ACQUIRE
128 #define XFRM_MSG_EXPIRE XFRM_MSG_EXPIRE
131 #define XFRM_MSG_UPDPOLICY XFRM_MSG_UPDPOLICY
133 #define XFRM_MSG_UPDSA XFRM_MSG_UPDSA
136 #define XFRM_MSG_POLEXPIRE XFRM_MSG_POLEXPIRE
139 #define XFRM_MSG_FLUSHSA XFRM_MSG_FLUSHSA
140 XFRM_MSG_FLUSHPOLICY
,
141 #define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY
146 struct xfrm_user_tmpl
{
149 xfrm_address_t saddr
;
159 struct xfrm_encap_tmpl
{
163 xfrm_address_t encap_oa
;
166 /* Netlink message attributes. */
167 enum xfrm_attr_type_t
{
169 XFRMA_ALG_AUTH
, /* struct xfrm_algo */
170 XFRMA_ALG_CRYPT
, /* struct xfrm_algo */
171 XFRMA_ALG_COMP
, /* struct xfrm_algo */
172 XFRMA_ENCAP
, /* struct xfrm_algo + struct xfrm_encap_tmpl */
173 XFRMA_TMPL
, /* 1 or more struct xfrm_user_tmpl */
176 #define XFRMA_MAX (__XFRMA_MAX - 1)
179 struct xfrm_usersa_info
{
180 struct xfrm_selector sel
;
182 xfrm_address_t saddr
;
183 struct xfrm_lifetime_cfg lft
;
184 struct xfrm_lifetime_cur curlft
;
185 struct xfrm_stats stats
;
189 __u8 mode
; /* 0=transport,1=tunnel */
192 #define XFRM_STATE_NOECN 1
193 #define XFRM_STATE_DECAP_DSCP 2
196 struct xfrm_usersa_id
{
197 xfrm_address_t daddr
;
203 struct xfrm_userspi_info
{
204 struct xfrm_usersa_info info
;
209 struct xfrm_userpolicy_info
{
210 struct xfrm_selector sel
;
211 struct xfrm_lifetime_cfg lft
;
212 struct xfrm_lifetime_cur curlft
;
217 #define XFRM_POLICY_ALLOW 0
218 #define XFRM_POLICY_BLOCK 1
220 #define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */
224 struct xfrm_userpolicy_id
{
225 struct xfrm_selector sel
;
230 struct xfrm_user_acquire
{
232 xfrm_address_t saddr
;
233 struct xfrm_selector sel
;
234 struct xfrm_userpolicy_info policy
;
241 struct xfrm_user_expire
{
242 struct xfrm_usersa_info state
;
246 struct xfrm_user_polexpire
{
247 struct xfrm_userpolicy_info pol
;
251 struct xfrm_usersa_flush
{
255 #define XFRMGRP_ACQUIRE 1
256 #define XFRMGRP_EXPIRE 2
258 #endif /* _LINUX_XFRM_H */