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. */
47 #define XFRM_INF (~(__u64)0)
49 struct xfrm_lifetime_cfg
51 __u64 soft_byte_limit;
52 __u64 hard_byte_limit;
53 __u64 soft_packet_limit;
54 __u64 hard_packet_limit;
55 __u64 soft_add_expires_seconds;
56 __u64 hard_add_expires_seconds;
57 __u64 soft_use_expires_seconds;
58 __u64 hard_use_expires_seconds;
61 struct xfrm_lifetime_cur
69 struct xfrm_replay_state
78 int alg_key_len; /* in bits */
85 __u32 integrity_failed;
98 XFRM_SHARE_ANY, /* No limitations */
99 XFRM_SHARE_SESSION, /* For this session only */
100 XFRM_SHARE_USER, /* For this user only */
101 XFRM_SHARE_UNIQUE /* Use once */
104 /* Netlink configuration messages. */
105 #define XFRM_MSG_BASE 0x10
107 #define XFRM_MSG_NEWSA (XFRM_MSG_BASE + 0)
108 #define XFRM_MSG_DELSA (XFRM_MSG_BASE + 1)
109 #define XFRM_MSG_GETSA (XFRM_MSG_BASE + 2)
111 #define XFRM_MSG_NEWPOLICY (XFRM_MSG_BASE + 3)
112 #define XFRM_MSG_DELPOLICY (XFRM_MSG_BASE + 4)
113 #define XFRM_MSG_GETPOLICY (XFRM_MSG_BASE + 5)
115 #define XFRM_MSG_ALLOCSPI (XFRM_MSG_BASE + 6)
116 #define XFRM_MSG_ACQUIRE (XFRM_MSG_BASE + 7)
117 #define XFRM_MSG_EXPIRE (XFRM_MSG_BASE + 8)
119 #define XFRM_MSG_UPDPOLICY (XFRM_MSG_BASE + 9)
120 #define XFRM_MSG_UPDSA (XFRM_MSG_BASE + 10)
122 #define XFRM_MSG_POLEXPIRE (XFRM_MSG_BASE + 11)
124 #define XFRM_MSG_MAX (XFRM_MSG_POLEXPIRE+1)
126 struct xfrm_user_tmpl {
128 xfrm_address_t saddr;
138 struct xfrm_encap_tmpl {
142 xfrm_address_t encap_oa;
145 /* Netlink message attributes. */
146 enum xfrm_attr_type_t {
148 XFRMA_ALG_AUTH, /* struct xfrm_algo */
149 XFRMA_ALG_CRYPT, /* struct xfrm_algo */
150 XFRMA_ALG_COMP, /* struct xfrm_algo */
151 XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */
152 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */
154 #define XFRMA_MAX XFRMA_TMPL
157 struct xfrm_usersa_info {
158 struct xfrm_selector sel;
160 xfrm_address_t saddr;
161 struct xfrm_lifetime_cfg lft;
162 struct xfrm_lifetime_cur curlft;
163 struct xfrm_stats stats;
167 __u8 mode; /* 0=transport,1=tunnel */
171 struct xfrm_usersa_id {
172 xfrm_address_t daddr;
178 struct xfrm_userspi_info {
179 struct xfrm_usersa_info info;
184 struct xfrm_userpolicy_info {
185 struct xfrm_selector sel;
186 struct xfrm_lifetime_cfg lft;
187 struct xfrm_lifetime_cur curlft;
193 #define XFRM_POLICY_ALLOW 0
194 #define XFRM_POLICY_BLOCK 1
196 #define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */
200 struct xfrm_userpolicy_id {
201 struct xfrm_selector sel;
206 struct xfrm_user_acquire {
208 xfrm_address_t saddr;
209 struct xfrm_selector sel;
210 struct xfrm_userpolicy_info policy;
217 struct xfrm_user_expire {
218 struct xfrm_usersa_info state;
222 struct xfrm_user_polexpire {
223 struct xfrm_userpolicy_info pol;
227 #define XFRMGRP_ACQUIRE 1
228 #define XFRMGRP_EXPIRE 2
230 #endif /* _LINUX_XFRM_H */