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
145 #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
147 #define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE)
149 struct xfrm_user_tmpl
{
152 xfrm_address_t saddr
;
162 struct xfrm_encap_tmpl
{
166 xfrm_address_t encap_oa
;
169 /* Netlink message attributes. */
170 enum xfrm_attr_type_t
{
172 XFRMA_ALG_AUTH
, /* struct xfrm_algo */
173 XFRMA_ALG_CRYPT
, /* struct xfrm_algo */
174 XFRMA_ALG_COMP
, /* struct xfrm_algo */
175 XFRMA_ENCAP
, /* struct xfrm_algo + struct xfrm_encap_tmpl */
176 XFRMA_TMPL
, /* 1 or more struct xfrm_user_tmpl */
181 #define XFRMA_MAX (__XFRMA_MAX - 1)
184 struct xfrm_usersa_info
{
185 struct xfrm_selector sel
;
187 xfrm_address_t saddr
;
188 struct xfrm_lifetime_cfg lft
;
189 struct xfrm_lifetime_cur curlft
;
190 struct xfrm_stats stats
;
194 __u8 mode
; /* 0=transport,1=tunnel */
197 #define XFRM_STATE_NOECN 1
198 #define XFRM_STATE_DECAP_DSCP 2
199 #define XFRM_STATE_NOPMTUDISC 4
202 struct xfrm_usersa_id
{
203 xfrm_address_t daddr
;
209 struct xfrm_userspi_info
{
210 struct xfrm_usersa_info info
;
215 struct xfrm_userpolicy_info
{
216 struct xfrm_selector sel
;
217 struct xfrm_lifetime_cfg lft
;
218 struct xfrm_lifetime_cur curlft
;
223 #define XFRM_POLICY_ALLOW 0
224 #define XFRM_POLICY_BLOCK 1
226 #define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */
230 struct xfrm_userpolicy_id
{
231 struct xfrm_selector sel
;
236 struct xfrm_user_acquire
{
238 xfrm_address_t saddr
;
239 struct xfrm_selector sel
;
240 struct xfrm_userpolicy_info policy
;
247 struct xfrm_user_expire
{
248 struct xfrm_usersa_info state
;
252 struct xfrm_user_polexpire
{
253 struct xfrm_userpolicy_info pol
;
257 struct xfrm_usersa_flush
{
262 /* backwards compatibility for userspace */
263 #define XFRMGRP_ACQUIRE 1
264 #define XFRMGRP_EXPIRE 2
266 #define XFRMGRP_POLICY 8
271 #define XFRMNLGRP_NONE XFRMNLGRP_NONE
273 #define XFRMNLGRP_ACQUIRE XFRMNLGRP_ACQUIRE
275 #define XFRMNLGRP_EXPIRE XFRMNLGRP_EXPIRE
277 #define XFRMNLGRP_SA XFRMNLGRP_SA
279 #define XFRMNLGRP_POLICY XFRMNLGRP_POLICY
282 #define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1)
284 #endif /* _LINUX_XFRM_H */