Print this page
First attempt at further IPsec cluster cleanup
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/net/pfkeyv2.h
+++ new/usr/src/uts/common/net/pfkeyv2.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 #ifndef _NET_PFKEYV2_H
27 27 #define _NET_PFKEYV2_H
28 28
29 29 /*
30 30 * Definitions and structures for PF_KEY version 2. See RFC 2367 for
31 31 * more details. SA == Security Association, which is what PF_KEY provides
32 32 * an API for managing.
33 33 */
34 34
35 35 #ifdef __cplusplus
36 36 extern "C" {
37 37 #endif
38 38
39 39 #define PF_KEY_V2 2
40 40 #define PFKEYV2_REVISION 200109L
41 41
42 42 /*
43 43 * Base PF_KEY message.
44 44 */
45 45
46 46 typedef struct sadb_msg {
47 47 uint8_t sadb_msg_version; /* Version, currently PF_KEY_V2 */
48 48 uint8_t sadb_msg_type; /* ADD, UPDATE, etc. */
49 49 uint8_t sadb_msg_errno; /* Error number from UNIX errno space */
50 50 uint8_t sadb_msg_satype; /* ESP, AH, etc. */
51 51 uint16_t sadb_msg_len; /* Length in 64-bit words. */
52 52 uint16_t sadb_msg_reserved; /* must be zero */
53 53 /*
54 54 * Use the reserved field for extended diagnostic information on errno
55 55 * responses.
56 56 */
57 57 #define sadb_x_msg_diagnostic sadb_msg_reserved
58 58 /* Union is for guaranteeing 64-bit alignment. */
59 59 union {
60 60 struct {
61 61 uint32_t sadb_x_msg_useq; /* Set by originator */
62 62 uint32_t sadb_x_msg_upid; /* Set by originator */
63 63 } sadb_x_msg_actual;
64 64 uint64_t sadb_x_msg_alignment;
65 65 } sadb_x_msg_u;
66 66 #define sadb_msg_seq sadb_x_msg_u.sadb_x_msg_actual.sadb_x_msg_useq
67 67 #define sadb_msg_pid sadb_x_msg_u.sadb_x_msg_actual.sadb_x_msg_upid
68 68 } sadb_msg_t;
69 69
70 70 /*
71 71 * Generic extension header.
72 72 */
73 73
74 74 typedef struct sadb_ext {
75 75 union {
76 76 /* Union is for guaranteeing 64-bit alignment. */
77 77 struct {
78 78 uint16_t sadb_x_ext_ulen; /* In 64s, inclusive */
79 79 uint16_t sadb_x_ext_utype; /* 0 is reserved */
80 80 } sadb_x_ext_actual;
81 81 uint64_t sadb_x_ext_alignment;
82 82 } sadb_x_ext_u;
83 83 #define sadb_ext_len sadb_x_ext_u.sadb_x_ext_actual.sadb_x_ext_ulen
84 84 #define sadb_ext_type sadb_x_ext_u.sadb_x_ext_actual.sadb_x_ext_utype
85 85 } sadb_ext_t;
86 86
87 87 /*
88 88 * Security Association information extension.
89 89 */
90 90
91 91 typedef struct sadb_sa {
92 92 /* Union is for guaranteeing 64-bit alignment. */
93 93 union {
94 94 struct {
95 95 uint16_t sadb_x_sa_ulen;
96 96 uint16_t sadb_x_sa_uexttype; /* ASSOCIATION */
97 97 uint32_t sadb_x_sa_uspi; /* Sec. Param. Index */
98 98 } sadb_x_sa_uactual;
99 99 uint64_t sadb_x_sa_alignment;
100 100 } sadb_x_sa_u;
101 101 #define sadb_sa_len sadb_x_sa_u.sadb_x_sa_uactual.sadb_x_sa_ulen
102 102 #define sadb_sa_exttype sadb_x_sa_u.sadb_x_sa_uactual.sadb_x_sa_uexttype
103 103 #define sadb_sa_spi sadb_x_sa_u.sadb_x_sa_uactual.sadb_x_sa_uspi
104 104 uint8_t sadb_sa_replay; /* Replay counter */
105 105 uint8_t sadb_sa_state; /* MATURE, DEAD, DYING, LARVAL */
106 106 uint8_t sadb_sa_auth; /* Authentication algorithm */
107 107 uint8_t sadb_sa_encrypt; /* Encryption algorithm */
108 108 uint32_t sadb_sa_flags; /* SA flags. */
109 109 } sadb_sa_t;
110 110
111 111 /*
112 112 * SA Lifetime extension. Already 64-bit aligned thanks to uint64_t fields.
113 113 */
114 114
115 115 typedef struct sadb_lifetime {
116 116 uint16_t sadb_lifetime_len;
117 117 uint16_t sadb_lifetime_exttype; /* SOFT, HARD, CURRENT */
118 118 uint32_t sadb_lifetime_allocations;
119 119 uint64_t sadb_lifetime_bytes;
120 120 uint64_t sadb_lifetime_addtime; /* These fields are assumed to hold */
121 121 uint64_t sadb_lifetime_usetime; /* >= sizeof (time_t). */
122 122 } sadb_lifetime_t;
123 123
124 124 /*
125 125 * SA address information.
126 126 */
127 127
128 128 typedef struct sadb_address {
129 129 /* Union is for guaranteeing 64-bit alignment. */
130 130 union {
131 131 struct {
132 132 uint16_t sadb_x_address_ulen;
133 133 uint16_t sadb_x_address_uexttype; /* SRC, DST, PROXY */
134 134 uint8_t sadb_x_address_uproto; /* Proto for ports... */
135 135 uint8_t sadb_x_address_uprefixlen; /* Prefix length. */
136 136 uint16_t sadb_x_address_ureserved; /* Padding */
137 137 } sadb_x_address_actual;
138 138 uint64_t sadb_x_address_alignment;
139 139 } sadb_x_address_u;
140 140 #define sadb_address_len \
141 141 sadb_x_address_u.sadb_x_address_actual.sadb_x_address_ulen
142 142 #define sadb_address_exttype \
143 143 sadb_x_address_u.sadb_x_address_actual.sadb_x_address_uexttype
144 144 #define sadb_address_proto \
145 145 sadb_x_address_u.sadb_x_address_actual.sadb_x_address_uproto
146 146 #define sadb_address_prefixlen \
147 147 sadb_x_address_u.sadb_x_address_actual.sadb_x_address_uprefixlen
148 148 #define sadb_address_reserved \
149 149 sadb_x_address_u.sadb_x_address_actual.sadb_x_address_ureserved
150 150 /* Followed by a sockaddr structure which may contain ports. */
151 151 } sadb_address_t;
152 152
153 153 /*
154 154 * SA key information.
155 155 */
156 156
157 157 typedef struct sadb_key {
158 158 /* Union is for guaranteeing 64-bit alignment. */
159 159 union {
160 160 struct {
161 161 uint16_t sadb_x_key_ulen;
162 162 uint16_t sadb_x_key_uexttype; /* AUTH, ENCRYPT */
163 163 uint16_t sadb_x_key_ubits; /* Actual len (bits) */
164 164 uint16_t sadb_x_key_ureserved;
165 165 } sadb_x_key_actual;
166 166 uint64_t sadb_x_key_alignment;
167 167 } sadb_x_key_u;
168 168 #define sadb_key_len sadb_x_key_u.sadb_x_key_actual.sadb_x_key_ulen
169 169 #define sadb_key_exttype sadb_x_key_u.sadb_x_key_actual.sadb_x_key_uexttype
170 170 #define sadb_key_bits sadb_x_key_u.sadb_x_key_actual.sadb_x_key_ubits
171 171 #define sadb_key_reserved sadb_x_key_u.sadb_x_key_actual.sadb_x_key_ureserved
172 172 /* Followed by actual key(s) in canonical (outbound proc.) order. */
173 173 } sadb_key_t;
174 174
175 175 /*
176 176 * SA Identity information. Already 64-bit aligned thanks to uint64_t fields.
177 177 */
178 178
179 179 typedef struct sadb_ident {
180 180 uint16_t sadb_ident_len;
181 181 uint16_t sadb_ident_exttype; /* SRC, DST, PROXY */
182 182 uint16_t sadb_ident_type; /* FQDN, USER_FQDN, etc. */
183 183 uint16_t sadb_ident_reserved; /* Padding */
184 184 uint64_t sadb_ident_id; /* For userid, etc. */
185 185 /* Followed by an identity null-terminate C string if present. */
186 186 } sadb_ident_t;
187 187
188 188 /*
189 189 * SA sensitivity information. This is mostly useful on MLS systems.
190 190 */
191 191
192 192 typedef struct sadb_sens {
193 193 /* Union is for guaranteeing 64-bit alignment. */
194 194 union {
195 195 struct {
196 196 uint16_t sadb_x_sens_ulen;
197 197 uint16_t sadb_x_sens_uexttype; /* SENSITIVITY */
198 198 uint32_t sadb_x_sens_udpd; /* Protection domain */
199 199 } sadb_x_sens_actual;
200 200 uint64_t sadb_x_sens_alignment;
201 201 } sadb_x_sens_u;
202 202 #define sadb_sens_len sadb_x_sens_u.sadb_x_sens_actual.sadb_x_sens_ulen
203 203 #define sadb_sens_exttype sadb_x_sens_u.sadb_x_sens_actual.sadb_x_sens_uexttype
204 204 #define sadb_sens_dpd sadb_x_sens_u.sadb_x_sens_actual.sadb_x_sens_udpd
205 205 uint8_t sadb_sens_sens_level;
206 206 uint8_t sadb_sens_sens_len; /* 64-bit words */
207 207 uint8_t sadb_sens_integ_level;
208 208 uint8_t sadb_sens_integ_len; /* 64-bit words */
209 209 uint32_t sadb_x_sens_flags;
210 210 /*
211 211 * followed by two uint64_t arrays
212 212 * uint64_t sadb_sens_bitmap[sens_bitmap_len];
213 213 * uint64_t sadb_integ_bitmap[integ_bitmap_len];
214 214 */
215 215 } sadb_sens_t;
216 216
217 217 /*
218 218 * We recycled the formerly reserved word for flags.
219 219 */
220 220
221 221 #define sadb_sens_reserved sadb_x_sens_flags
222 222
223 223 #define SADB_X_SENS_IMPLICIT 0x1 /* implicit labelling */
224 224 #define SADB_X_SENS_UNLABELED 0x2 /* peer is unlabeled */
225 225
226 226 /*
227 227 * a proposal extension. This is found in an ACQUIRE message, and it
228 228 * proposes what sort of SA the kernel would like to ACQUIRE.
229 229 */
230 230
231 231 /* First, a base structure... */
232 232
233 233 typedef struct sadb_x_propbase {
234 234 uint16_t sadb_x_propb_len;
235 235 uint16_t sadb_x_propb_exttype; /* PROPOSAL, X_EPROP */
236 236 union {
237 237 struct {
238 238 uint8_t sadb_x_propb_lenres_replay;
239 239 uint8_t sadb_x_propb_lenres_eres;
240 240 uint16_t sadb_x_propb_lenres_numecombs;
241 241 } sadb_x_propb_lenres;
242 242 struct {
243 243 uint8_t sadb_x_propb_oldres_replay;
244 244 uint8_t sadb_x_propb_oldres_reserved[3];
245 245 } sadb_x_propb_oldres;
246 246 } sadb_x_propb_u;
247 247 #define sadb_x_propb_replay \
248 248 sadb_x_propb_u.sadb_x_propb_lenres.sadb_x_propb_lenres_replay
249 249 #define sadb_x_propb_reserved \
250 250 sadb_x_propb_u.sadb_x_propb_oldres.sadb_x_propb_oldres_reserved
251 251 #define sadb_x_propb_ereserved \
252 252 sadb_x_propb_u.sadb_x_propb_lenres.sadb_x_propb_lenres_eres
253 253 #define sadb_x_propb_numecombs \
254 254 sadb_x_propb_u.sadb_x_propb_lenres.sadb_x_propb_lenres_numecombs
255 255 /* Followed by sadb_comb[] array or sadb_ecomb[] array. */
256 256 } sadb_x_propbase_t;
257 257
258 258 /* Now, the actual sadb_prop structure, which will have alignment in it! */
259 259
260 260 typedef struct sadb_prop {
261 261 /* Union is for guaranteeing 64-bit alignment. */
262 262 union {
263 263 sadb_x_propbase_t sadb_x_prop_actual;
264 264 uint64_t sadb_x_prop_alignment;
265 265 } sadb_x_prop_u;
266 266 #define sadb_prop_len sadb_x_prop_u.sadb_x_prop_actual.sadb_x_propb_len
267 267 #define sadb_prop_exttype sadb_x_prop_u.sadb_x_prop_actual.sadb_x_propb_exttype
268 268 #define sadb_prop_replay sadb_x_prop_u.sadb_x_prop_actual.sadb_x_propb_replay
269 269 #define sadb_prop_reserved \
270 270 sadb_x_prop_u.sadb_x_prop_actual.sadb_x_propb_reserved
271 271 #define sadb_x_prop_ereserved \
272 272 sadb_x_prop_u.sadb_x_prop_actual.sadb_x_propb_ereserved
273 273 #define sadb_x_prop_numecombs \
274 274 sadb_x_prop_u.sadb_x_prop_actual.sadb_x_propb_numecombs
275 275 } sadb_prop_t;
276 276
277 277 /*
278 278 * This is a proposed combination. Many of these can follow a proposal
279 279 * extension. Already 64-bit aligned thanks to uint64_t fields.
280 280 */
281 281
282 282 typedef struct sadb_comb {
283 283 uint8_t sadb_comb_auth; /* Authentication algorithm */
284 284 uint8_t sadb_comb_encrypt; /* Encryption algorithm */
285 285 uint16_t sadb_comb_flags; /* Comb. flags (e.g. PFS) */
286 286 uint16_t sadb_comb_auth_minbits; /* Bit strengths for auth */
287 287 uint16_t sadb_comb_auth_maxbits;
288 288 uint16_t sadb_comb_encrypt_minbits; /* Bit strengths for encrypt */
289 289 uint16_t sadb_comb_encrypt_maxbits;
290 290 uint32_t sadb_comb_reserved;
291 291 uint32_t sadb_comb_soft_allocations; /* Lifetime proposals for */
292 292 uint32_t sadb_comb_hard_allocations; /* this combination. */
293 293 uint64_t sadb_comb_soft_bytes;
294 294 uint64_t sadb_comb_hard_bytes;
295 295 uint64_t sadb_comb_soft_addtime;
296 296 uint64_t sadb_comb_hard_addtime;
297 297 uint64_t sadb_comb_soft_usetime;
298 298 uint64_t sadb_comb_hard_usetime;
299 299 } sadb_comb_t;
300 300
301 301 /*
302 302 * An extended combination that can comprise of many SA types.
303 303 * A single combination has algorithms and SA types locked.
304 304 * These are represented by algorithm descriptors, the second structure
305 305 * in the list. For example, if the EACQUIRE requests AH(MD5) + ESP(DES/null)
306 306 * _or_ ESP(DES/MD5), it would have two combinations:
307 307 *
308 308 * COMB: algdes(AH, AUTH, MD5), algdes(ESP, CRYPT, DES)
309 309 * COMB: algdes(ESP, AUTH, MD5), algdes(ESP, CRYPT, DES)
310 310 *
311 311 * If an SA type supports an algorithm type, and there's no descriptor,
312 312 * assume it requires NONE, just like it were explicitly stated.
313 313 * (This includes ESP NULL encryption, BTW.)
314 314 *
315 315 * Already 64-bit aligned thanks to uint64_t fields.
316 316 */
317 317
318 318 typedef struct sadb_x_ecomb {
319 319 uint8_t sadb_x_ecomb_numalgs;
320 320 uint8_t sadb_x_ecomb_reserved;
321 321 uint16_t sadb_x_ecomb_flags; /* E.g. PFS? */
322 322 uint32_t sadb_x_ecomb_reserved2;
323 323 uint32_t sadb_x_ecomb_soft_allocations;
324 324 uint32_t sadb_x_ecomb_hard_allocations;
325 325 uint64_t sadb_x_ecomb_soft_bytes;
326 326 uint64_t sadb_x_ecomb_hard_bytes;
327 327 uint64_t sadb_x_ecomb_soft_addtime;
328 328 uint64_t sadb_x_ecomb_hard_addtime;
329 329 uint64_t sadb_x_ecomb_soft_usetime;
330 330 uint64_t sadb_x_ecomb_hard_usetime;
331 331 } sadb_x_ecomb_t;
332 332
333 333 typedef struct sadb_x_algdesc {
334 334 /* Union is for guaranteeing 64-bit alignment. */
335 335 union {
336 336 struct {
337 337 uint8_t sadb_x_algdesc_usatype; /* ESP, AH, etc. */
338 338 uint8_t sadb_x_algdesc_ualgtype; /* AUTH, CRYPT, COMP */
339 339 uint8_t sadb_x_algdesc_ualg; /* 3DES, MD5, etc. */
340 340 uint8_t sadb_x_algdesc_ureserved;
341 341 uint16_t sadb_x_algdesc_uminbits; /* Bit strengths. */
342 342 uint16_t sadb_x_algdesc_umaxbits;
343 343 } sadb_x_algdesc_actual;
344 344 uint64_t sadb_x_algdesc_alignment;
345 345 } sadb_x_algdesc_u;
346 346 #define sadb_x_algdesc_satype \
347 347 sadb_x_algdesc_u.sadb_x_algdesc_actual.sadb_x_algdesc_usatype
348 348 #define sadb_x_algdesc_algtype \
349 349 sadb_x_algdesc_u.sadb_x_algdesc_actual.sadb_x_algdesc_ualgtype
350 350 #define sadb_x_algdesc_alg \
351 351 sadb_x_algdesc_u.sadb_x_algdesc_actual.sadb_x_algdesc_ualg
352 352 #define sadb_x_algdesc_reserved \
353 353 sadb_x_algdesc_u.sadb_x_algdesc_actual.sadb_x_algdesc_ureserved
354 354 #define sadb_x_algdesc_minbits \
355 355 sadb_x_algdesc_u.sadb_x_algdesc_actual.sadb_x_algdesc_uminbits
356 356 #define sadb_x_algdesc_maxbits \
357 357 sadb_x_algdesc_u.sadb_x_algdesc_actual.sadb_x_algdesc_umaxbits
358 358 } sadb_x_algdesc_t;
359 359
360 360 /*
361 361 * When key mgmt. registers with the kernel, the kernel will tell key mgmt.
362 362 * its supported algorithms.
363 363 */
364 364
365 365 typedef struct sadb_supported {
366 366 /* Union is for guaranteeing 64-bit alignment. */
367 367 union {
368 368 struct {
369 369 uint16_t sadb_x_supported_ulen;
370 370 uint16_t sadb_x_supported_uexttype;
371 371 uint32_t sadb_x_supported_ureserved;
372 372 } sadb_x_supported_actual;
373 373 uint64_t sadb_x_supported_alignment;
374 374 } sadb_x_supported_u;
375 375 #define sadb_supported_len \
376 376 sadb_x_supported_u.sadb_x_supported_actual.sadb_x_supported_ulen
377 377 #define sadb_supported_exttype \
378 378 sadb_x_supported_u.sadb_x_supported_actual.sadb_x_supported_uexttype
379 379 #define sadb_supported_reserved \
380 380 sadb_x_supported_u.sadb_x_supported_actual.sadb_x_supported_ureserved
381 381 } sadb_supported_t;
382 382
383 383 /* First, a base structure... */
384 384 typedef struct sadb_x_algb {
385 385 uint8_t sadb_x_algb_id; /* Algorithm type. */
386 386 uint8_t sadb_x_algb_ivlen; /* IV len, in bits */
387 387 uint16_t sadb_x_algb_minbits; /* Min. key len (in bits) */
388 388 uint16_t sadb_x_algb_maxbits; /* Max. key length */
389 389 union {
390 390 uint16_t sadb_x_algb_ureserved;
391 391 uint8_t sadb_x_algb_udefaults[2];
392 392 } sadb_x_algb_union;
393 393
394 394 #define sadb_x_algb_reserved sadb_x_algb_union.sadb_x_algb_ureserved
395 395 #define sadb_x_algb_increment sadb_x_algb_union.sadb_x_algb_udefaults[0]
396 396 #define sadb_x_algb_saltbits sadb_x_algb_union.sadb_x_algb_udefaults[1]
397 397 /*
398 398 * alg_increment: the number of bits from a key length to the next
399 399 */
400 400 } sadb_x_algb_t;
401 401
402 402 /* Now, the actual sadb_alg structure, which will have alignment in it. */
403 403 typedef struct sadb_alg {
404 404 /* Union is for guaranteeing 64-bit alignment. */
405 405 union {
406 406 sadb_x_algb_t sadb_x_alg_actual;
407 407 uint64_t sadb_x_alg_alignment;
408 408 } sadb_x_alg_u;
409 409 #define sadb_alg_id sadb_x_alg_u.sadb_x_alg_actual.sadb_x_algb_id
410 410 #define sadb_alg_ivlen sadb_x_alg_u.sadb_x_alg_actual.sadb_x_algb_ivlen
411 411 #define sadb_alg_minbits sadb_x_alg_u.sadb_x_alg_actual.sadb_x_algb_minbits
412 412 #define sadb_alg_maxbits sadb_x_alg_u.sadb_x_alg_actual.sadb_x_algb_maxbits
413 413 #define sadb_alg_reserved sadb_x_alg_u.sadb_x_alg_actual.sadb_x_algb_reserved
414 414 #define sadb_x_alg_increment \
415 415 sadb_x_alg_u.sadb_x_alg_actual.sadb_x_algb_increment
416 416 #define sadb_x_alg_saltbits sadb_x_alg_u.sadb_x_alg_actual.sadb_x_algb_saltbits
417 417 } sadb_alg_t;
418 418
419 419 /*
420 420 * If key mgmt. needs an SPI in a range (including 0 to 0xFFFFFFFF), it
421 421 * asks the kernel with this extension in the SADB_GETSPI message.
422 422 */
423 423
424 424 typedef struct sadb_spirange {
425 425 uint16_t sadb_spirange_len;
426 426 uint16_t sadb_spirange_exttype; /* SPI_RANGE */
427 427 uint32_t sadb_spirange_min;
428 428 /* Union is for guaranteeing 64-bit alignment. */
429 429 union {
430 430 struct {
431 431 uint32_t sadb_x_spirange_umax;
432 432 uint32_t sadb_x_spirange_ureserved;
433 433 } sadb_x_spirange_actual;
434 434 uint64_t sadb_x_spirange_alignment;
435 435 } sadb_x_spirange_u;
436 436 #define sadb_spirange_max \
437 437 sadb_x_spirange_u.sadb_x_spirange_actual.sadb_x_spirange_umax
438 438 #define sadb_spirange_reserved \
439 439 sadb_x_spirange_u.sadb_x_spirange_actual.sadb_x_spirange_ureserved
440 440 } sadb_spirange_t;
441 441
442 442 /*
443 443 * For the "extended REGISTER" which'll tell the kernel to send me
444 444 * "extended ACQUIREs".
445 445 */
446 446
447 447 typedef struct sadb_x_ereg {
448 448 /* Union is for guaranteeing 64-bit alignment. */
449 449 union {
450 450 struct {
451 451 uint16_t sadb_x_ereg_ulen;
452 452 uint16_t sadb_x_ereg_uexttype; /* X_EREG */
453 453 /* Array of SA types, 0-terminated. */
454 454 uint8_t sadb_x_ereg_usatypes[4];
455 455 } sadb_x_ereg_actual;
456 456 uint64_t sadb_x_ereg_alignment;
457 457 } sadb_x_ereg_u;
458 458 #define sadb_x_ereg_len \
459 459 sadb_x_ereg_u.sadb_x_ereg_actual.sadb_x_ereg_ulen
460 460 #define sadb_x_ereg_exttype \
461 461 sadb_x_ereg_u.sadb_x_ereg_actual.sadb_x_ereg_uexttype
462 462 #define sadb_x_ereg_satypes \
463 463 sadb_x_ereg_u.sadb_x_ereg_actual.sadb_x_ereg_usatypes
464 464 } sadb_x_ereg_t;
465 465
466 466 /*
467 467 * For conveying a Key Management Cookie with SADB_GETSPI, SADB_ADD,
468 468 * SADB_ACQUIRE, or SADB_X_INVERSE_ACQUIRE.
469 469 */
470 470
471 471 typedef struct sadb_x_kmc {
472 472 uint16_t sadb_x_kmc_len;
473 473 uint16_t sadb_x_kmc_exttype; /* X_KM_COOKIE */
474 474 uint32_t sadb_x_kmc_proto; /* KM protocol */
475 475 union {
476 476 struct {
477 477 uint32_t sadb_x_kmc_ucookie; /* KMP-specific */
478 478 uint32_t sadb_x_kmc_ureserved; /* Must be zero */
479 479 } sadb_x_kmc_actual;
480 480 uint64_t sadb_x_kmc_alignment;
481 481 } sadb_x_kmc_u;
482 482 #define sadb_x_kmc_cookie sadb_x_kmc_u.sadb_x_kmc_actual.sadb_x_kmc_ucookie
483 483 #define sadb_x_kmc_reserved sadb_x_kmc_u.sadb_x_kmc_actual.sadb_x_kmc_ureserved
484 484 } sadb_x_kmc_t;
485 485
486 486 typedef struct sadb_x_pair {
487 487 union {
488 488 /* Union is for guaranteeing 64-bit alignment. */
489 489 struct {
490 490 uint16_t sadb_x_pair_ulen;
491 491 uint16_t sadb_x_pair_uexttype;
492 492 uint32_t sadb_x_pair_uspi; /* SPI of paired SA */
493 493 } sadb_x_pair_actual;
494 494 uint64_t sadb_x_ext_alignment;
495 495 } sadb_x_pair_u;
496 496 #define sadb_x_pair_len sadb_x_pair_u.sadb_x_pair_actual.sadb_x_pair_ulen
497 497 #define sadb_x_pair_exttype \
498 498 sadb_x_pair_u.sadb_x_pair_actual.sadb_x_pair_uexttype
499 499 #define sadb_x_pair_spi sadb_x_pair_u.sadb_x_pair_actual.sadb_x_pair_uspi
500 500 } sadb_x_pair_t;
501 501
502 502 /*
503 503 * For the Sequence numbers to be used with SADB_DUMP, SADB_GET, SADB_UPDATE.
|
↓ open down ↓ |
503 lines elided |
↑ open up ↑ |
504 504 */
505 505
506 506 typedef struct sadb_x_replay_ctr {
507 507 uint16_t sadb_x_rc_len;
508 508 uint16_t sadb_x_rc_exttype;
509 509 uint32_t sadb_x_rc_replay32; /* For 240x SAs. */
510 510 uint64_t sadb_x_rc_replay64; /* For 430x SAs. */
511 511 } sadb_x_replay_ctr_t;
512 512
513 513 /*
514 - * For extended DUMP request. Dumps the SAs which were idle for
515 - * longer than the timeout specified.
516 - */
517 -
518 -typedef struct sadb_x_edump {
519 - uint16_t sadb_x_edump_len;
520 - uint16_t sadb_x_edump_exttype;
521 - uint32_t sadb_x_edump_reserved;
522 - uint64_t sadb_x_edump_timeout;
523 -} sadb_x_edump_t;
524 -
525 -/*
526 514 * Base message types.
527 515 */
528 516
529 517 #define SADB_RESERVED 0
530 518 #define SADB_GETSPI 1
531 519 #define SADB_UPDATE 2
532 520 #define SADB_ADD 3
533 521 #define SADB_DELETE 4
534 522 #define SADB_GET 5
535 523 #define SADB_ACQUIRE 6
536 524 #define SADB_REGISTER 7
537 525 #define SADB_EXPIRE 8
538 526 #define SADB_FLUSH 9
539 527 #define SADB_DUMP 10 /* not used normally */
540 528 #define SADB_X_PROMISC 11
541 529 #define SADB_X_INVERSE_ACQUIRE 12
542 530 #define SADB_X_UPDATEPAIR 13
543 531 #define SADB_X_DELPAIR 14
544 -#define SADB_X_DELPAIR_STATE 15
532 +/* #define SADB_X_DELPAIR_STATE 15 */ /* Deprecated */
545 533 #define SADB_MAX 15
546 534
547 535 /*
548 536 * SA flags
549 537 */
550 538
551 539 #define SADB_SAFLAGS_PFS 0x1 /* Perfect forward secrecy? */
552 540 #define SADB_SAFLAGS_NOREPLAY 0x2 /* Replay field NOT PRESENT. */
553 541
554 542 /* Below flags are used by this implementation. Grow from left-to-right. */
555 543 #define SADB_X_SAFLAGS_USED 0x80000000 /* SA used/not used */
556 544 #define SADB_X_SAFLAGS_UNIQUE 0x40000000 /* SA unique/reusable */
557 545 #define SADB_X_SAFLAGS_AALG1 0x20000000 /* Auth-alg specific flag 1 */
558 546 #define SADB_X_SAFLAGS_AALG2 0x10000000 /* Auth-alg specific flag 2 */
559 547 #define SADB_X_SAFLAGS_EALG1 0x8000000 /* Encr-alg specific flag 1 */
560 548 #define SADB_X_SAFLAGS_EALG2 0x4000000 /* Encr-alg specific flag 2 */
561 549 #define SADB_X_SAFLAGS_KM1 0x2000000 /* Key mgmt. specific flag 1 */
562 550 #define SADB_X_SAFLAGS_KM2 0x1000000 /* Key mgmt. specific flag 2 */
563 551 #define SADB_X_SAFLAGS_KM3 0x800000 /* Key mgmt. specific flag 3 */
564 552 #define SADB_X_SAFLAGS_KM4 0x400000 /* Key mgmt. specific flag 4 */
565 553 #define SADB_X_SAFLAGS_KRES1 0x200000 /* Reserved by the kernel */
566 554 #define SADB_X_SAFLAGS_NATT_LOC 0x100000 /* this has a natted src SA */
567 555 #define SADB_X_SAFLAGS_NATT_REM 0x80000 /* this has a natted dst SA */
568 556 #define SADB_X_SAFLAGS_KRES2 0x40000 /* Reserved by the kernel */
569 557 #define SADB_X_SAFLAGS_TUNNEL 0x20000 /* tunnel mode */
570 558 #define SADB_X_SAFLAGS_PAIRED 0x10000 /* inbound/outbound pair */
571 559 #define SADB_X_SAFLAGS_OUTBOUND 0x8000 /* SA direction bit */
572 560 #define SADB_X_SAFLAGS_INBOUND 0x4000 /* SA direction bit */
573 561 #define SADB_X_SAFLAGS_NATTED 0x1000 /* Local node is behind a NAT */
574 562
575 563 #define SADB_X_SAFLAGS_KRES \
|
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
576 564 SADB_X_SAFLAGS_KRES1 | SADB_X_SAFLAGS_KRES2
577 565
578 566 /*
579 567 * SA state.
580 568 */
581 569
582 570 #define SADB_SASTATE_LARVAL 0
583 571 #define SADB_SASTATE_MATURE 1
584 572 #define SADB_SASTATE_DYING 2
585 573 #define SADB_SASTATE_DEAD 3
586 -#define SADB_X_SASTATE_ACTIVE_ELSEWHERE 4
587 -#define SADB_X_SASTATE_IDLE 5
588 -#define SADB_X_SASTATE_ACTIVE 6
574 +/* #define SADB_X_SASTATE_ACTIVE_ELSEWHERE 4 */ /* Deprecated */
575 +/* #define SADB_X_SASTATE_IDLE 5 */ /* Deprecated */
576 +/* #define SADB_X_SASTATE_ACTIVE 6 */ /* Deprecated */
589 577
590 578 #define SADB_SASTATE_MAX 6
591 579
592 580 /*
593 581 * SA type. Gaps are present in the number space because (for the time being)
594 582 * these types correspond to the SA types in the IPsec DOI document.
595 583 */
596 584
597 585 #define SADB_SATYPE_UNSPEC 0
598 586 #define SADB_SATYPE_AH 2 /* RFC-1826 */
599 587 #define SADB_SATYPE_ESP 3 /* RFC-1827 */
600 588 #define SADB_SATYPE_RSVP 5 /* RSVP Authentication */
601 589 #define SADB_SATYPE_OSPFV2 6 /* OSPFv2 Authentication */
602 590 #define SADB_SATYPE_RIPV2 7 /* RIPv2 Authentication */
603 591 #define SADB_SATYPE_MIP 8 /* Mobile IPv4 Authentication */
604 592
605 593 #define SADB_SATYPE_MAX 8
606 594
607 595 /*
608 596 * Algorithm types. Gaps are present because (for the time being) these types
609 597 * correspond to the SA types in the IPsec DOI document.
610 598 *
611 599 * NOTE: These are numbered to play nice with the IPsec DOI. That's why
612 600 * there are gaps.
613 601 */
614 602
615 603 /* Authentication algorithms */
616 604 #define SADB_AALG_NONE 0
617 605 #define SADB_AALG_MD5HMAC 2
618 606 #define SADB_AALG_SHA1HMAC 3
619 607 #define SADB_AALG_SHA256HMAC 5
620 608 #define SADB_AALG_SHA384HMAC 6
621 609 #define SADB_AALG_SHA512HMAC 7
622 610
623 611 #define SADB_AALG_MAX 7
624 612
625 613 /* Encryption algorithms */
626 614 #define SADB_EALG_NONE 0
627 615 #define SADB_EALG_DESCBC 2
628 616 #define SADB_EALG_3DESCBC 3
629 617 #define SADB_EALG_BLOWFISH 7
630 618 #define SADB_EALG_NULL 11
631 619 #define SADB_EALG_AES 12
632 620 #define SADB_EALG_AES_CCM_8 14
633 621 #define SADB_EALG_AES_CCM_12 15
634 622 #define SADB_EALG_AES_CCM_16 16
635 623 #define SADB_EALG_AES_GCM_8 18
636 624 #define SADB_EALG_AES_GCM_12 19
637 625 #define SADB_EALG_AES_GCM_16 20
638 626 #define SADB_EALG_MAX 20
639 627
640 628 /*
641 629 * Extension header values.
642 630 */
643 631
644 632 #define SADB_EXT_RESERVED 0
645 633
646 634 #define SADB_EXT_SA 1
647 635 #define SADB_EXT_LIFETIME_CURRENT 2
648 636 #define SADB_EXT_LIFETIME_HARD 3
649 637 #define SADB_EXT_LIFETIME_SOFT 4
650 638 #define SADB_EXT_ADDRESS_SRC 5
651 639 #define SADB_EXT_ADDRESS_DST 6
652 640 /* These two are synonyms. */
653 641 #define SADB_EXT_ADDRESS_PROXY 7
654 642 #define SADB_X_EXT_ADDRESS_INNER_SRC SADB_EXT_ADDRESS_PROXY
655 643 #define SADB_EXT_KEY_AUTH 8
656 644 #define SADB_EXT_KEY_ENCRYPT 9
657 645 #define SADB_EXT_IDENTITY_SRC 10
658 646 #define SADB_EXT_IDENTITY_DST 11
659 647 #define SADB_EXT_SENSITIVITY 12
660 648 #define SADB_EXT_PROPOSAL 13
661 649 #define SADB_EXT_SUPPORTED_AUTH 14
|
↓ open down ↓ |
63 lines elided |
↑ open up ↑ |
662 650 #define SADB_EXT_SUPPORTED_ENCRYPT 15
663 651 #define SADB_EXT_SPIRANGE 16
664 652 #define SADB_X_EXT_EREG 17
665 653 #define SADB_X_EXT_EPROP 18
666 654 #define SADB_X_EXT_KM_COOKIE 19
667 655 #define SADB_X_EXT_ADDRESS_NATT_LOC 20
668 656 #define SADB_X_EXT_ADDRESS_NATT_REM 21
669 657 #define SADB_X_EXT_ADDRESS_INNER_DST 22
670 658 #define SADB_X_EXT_PAIR 23
671 659 #define SADB_X_EXT_REPLAY_VALUE 24
672 -#define SADB_X_EXT_EDUMP 25
660 +/* #define SADB_X_EXT_EDUMP 25 */ /* Deprecated */
673 661 #define SADB_X_EXT_LIFETIME_IDLE 26
674 662 #define SADB_X_EXT_OUTER_SENS 27
675 663
676 664 #define SADB_EXT_MAX 27
677 665
678 666 /*
679 667 * Identity types.
680 668 */
681 669
682 670 #define SADB_IDENTTYPE_RESERVED 0
683 671
684 672 /*
685 673 * For PREFIX and ADDR_RANGE, use the AF of the PROXY if present, or the SRC
686 674 * if not present.
687 675 */
688 676 #define SADB_IDENTTYPE_PREFIX 1
689 677 #define SADB_IDENTTYPE_FQDN 2 /* Fully qualified domain name. */
690 678 #define SADB_IDENTTYPE_USER_FQDN 3 /* e.g. root@domain.com */
691 679 #define SADB_X_IDENTTYPE_DN 4 /* ASN.1 DER Distinguished Name. */
692 680 #define SADB_X_IDENTTYPE_GN 5 /* ASN.1 DER Generic Name. */
693 681 #define SADB_X_IDENTTYPE_KEY_ID 6 /* Generic KEY ID. */
694 682 #define SADB_X_IDENTTYPE_ADDR_RANGE 7
695 683
696 684 #define SADB_IDENTTYPE_MAX 7
697 685
698 686 /*
699 687 * Protection DOI values for the SENSITIVITY extension. There are no values
700 688 * currently, so the MAX is the only non-zero value available.
701 689 */
702 690
703 691 #define SADB_DPD_NONE 0
704 692
705 693 #define SADB_DPD_MAX 1
706 694
707 695 /*
708 696 * Diagnostic codes. These supplement error messages. Be sure to
709 697 * update libipsecutil's keysock_diag() if you change any of these.
710 698 */
711 699
712 700 #define SADB_X_DIAGNOSTIC_PRESET -1 /* Internal value. */
713 701
714 702 #define SADB_X_DIAGNOSTIC_NONE 0
715 703
716 704 #define SADB_X_DIAGNOSTIC_UNKNOWN_MSG 1
717 705 #define SADB_X_DIAGNOSTIC_UNKNOWN_EXT 2
718 706 #define SADB_X_DIAGNOSTIC_BAD_EXTLEN 3
719 707 #define SADB_X_DIAGNOSTIC_UNKNOWN_SATYPE 4
720 708 #define SADB_X_DIAGNOSTIC_SATYPE_NEEDED 5
721 709 #define SADB_X_DIAGNOSTIC_NO_SADBS 6
722 710 #define SADB_X_DIAGNOSTIC_NO_EXT 7
723 711 /* Bad address family value */
724 712 #define SADB_X_DIAGNOSTIC_BAD_SRC_AF 8
725 713 /* in sockaddr->sa_family. */
726 714 #define SADB_X_DIAGNOSTIC_BAD_DST_AF 9
727 715 /* These two are synonyms. */
728 716 #define SADB_X_DIAGNOSTIC_BAD_PROXY_AF 10
729 717 #define SADB_X_DIAGNOSTIC_BAD_INNER_SRC_AF 10
730 718
731 719 #define SADB_X_DIAGNOSTIC_AF_MISMATCH 11
732 720
733 721 #define SADB_X_DIAGNOSTIC_BAD_SRC 12
734 722 #define SADB_X_DIAGNOSTIC_BAD_DST 13
735 723
736 724 #define SADB_X_DIAGNOSTIC_ALLOC_HSERR 14
737 725 #define SADB_X_DIAGNOSTIC_BYTES_HSERR 15
738 726 #define SADB_X_DIAGNOSTIC_ADDTIME_HSERR 16
739 727 #define SADB_X_DIAGNOSTIC_USETIME_HSERR 17
740 728
741 729 #define SADB_X_DIAGNOSTIC_MISSING_SRC 18
742 730 #define SADB_X_DIAGNOSTIC_MISSING_DST 19
743 731 #define SADB_X_DIAGNOSTIC_MISSING_SA 20
744 732 #define SADB_X_DIAGNOSTIC_MISSING_EKEY 21
745 733 #define SADB_X_DIAGNOSTIC_MISSING_AKEY 22
746 734 #define SADB_X_DIAGNOSTIC_MISSING_RANGE 23
747 735
748 736 #define SADB_X_DIAGNOSTIC_DUPLICATE_SRC 24
749 737 #define SADB_X_DIAGNOSTIC_DUPLICATE_DST 25
750 738 #define SADB_X_DIAGNOSTIC_DUPLICATE_SA 26
751 739 #define SADB_X_DIAGNOSTIC_DUPLICATE_EKEY 27
752 740 #define SADB_X_DIAGNOSTIC_DUPLICATE_AKEY 28
753 741 #define SADB_X_DIAGNOSTIC_DUPLICATE_RANGE 29
754 742
755 743 #define SADB_X_DIAGNOSTIC_MALFORMED_SRC 30
756 744 #define SADB_X_DIAGNOSTIC_MALFORMED_DST 31
757 745 #define SADB_X_DIAGNOSTIC_MALFORMED_SA 32
758 746 #define SADB_X_DIAGNOSTIC_MALFORMED_EKEY 33
759 747 #define SADB_X_DIAGNOSTIC_MALFORMED_AKEY 34
760 748 #define SADB_X_DIAGNOSTIC_MALFORMED_RANGE 35
761 749
762 750 #define SADB_X_DIAGNOSTIC_AKEY_PRESENT 36
763 751 #define SADB_X_DIAGNOSTIC_EKEY_PRESENT 37
764 752 #define SADB_X_DIAGNOSTIC_PROP_PRESENT 38
765 753 #define SADB_X_DIAGNOSTIC_SUPP_PRESENT 39
766 754
767 755 #define SADB_X_DIAGNOSTIC_BAD_AALG 40
768 756 #define SADB_X_DIAGNOSTIC_BAD_EALG 41
769 757 #define SADB_X_DIAGNOSTIC_BAD_SAFLAGS 42
770 758 #define SADB_X_DIAGNOSTIC_BAD_SASTATE 43
771 759
772 760 #define SADB_X_DIAGNOSTIC_BAD_AKEYBITS 44
773 761 #define SADB_X_DIAGNOSTIC_BAD_EKEYBITS 45
774 762
775 763 #define SADB_X_DIAGNOSTIC_ENCR_NOTSUPP 46
776 764
777 765 #define SADB_X_DIAGNOSTIC_WEAK_EKEY 47
778 766 #define SADB_X_DIAGNOSTIC_WEAK_AKEY 48
779 767
780 768 #define SADB_X_DIAGNOSTIC_DUPLICATE_KMP 49
781 769 #define SADB_X_DIAGNOSTIC_DUPLICATE_KMC 50
782 770
783 771 #define SADB_X_DIAGNOSTIC_MISSING_NATT_LOC 51
784 772 #define SADB_X_DIAGNOSTIC_MISSING_NATT_REM 52
785 773 #define SADB_X_DIAGNOSTIC_DUPLICATE_NATT_LOC 53
786 774 #define SADB_X_DIAGNOSTIC_DUPLICATE_NATT_REM 54
787 775 #define SADB_X_DIAGNOSTIC_MALFORMED_NATT_LOC 55
788 776 #define SADB_X_DIAGNOSTIC_MALFORMED_NATT_REM 56
789 777 #define SADB_X_DIAGNOSTIC_DUPLICATE_NATT_PORTS 57
790 778
791 779 #define SADB_X_DIAGNOSTIC_MISSING_INNER_SRC 58
792 780 #define SADB_X_DIAGNOSTIC_MISSING_INNER_DST 59
793 781 #define SADB_X_DIAGNOSTIC_DUPLICATE_INNER_SRC 60
794 782 #define SADB_X_DIAGNOSTIC_DUPLICATE_INNER_DST 61
795 783 #define SADB_X_DIAGNOSTIC_MALFORMED_INNER_SRC 62
796 784 #define SADB_X_DIAGNOSTIC_MALFORMED_INNER_DST 63
797 785
798 786 #define SADB_X_DIAGNOSTIC_PREFIX_INNER_SRC 64
799 787 #define SADB_X_DIAGNOSTIC_PREFIX_INNER_DST 65
800 788 #define SADB_X_DIAGNOSTIC_BAD_INNER_DST_AF 66
801 789 #define SADB_X_DIAGNOSTIC_INNER_AF_MISMATCH 67
802 790
803 791 #define SADB_X_DIAGNOSTIC_BAD_NATT_REM_AF 68
804 792 #define SADB_X_DIAGNOSTIC_BAD_NATT_LOC_AF 69
805 793
806 794 #define SADB_X_DIAGNOSTIC_PROTO_MISMATCH 70
807 795 #define SADB_X_DIAGNOSTIC_INNER_PROTO_MISMATCH 71
808 796
809 797 #define SADB_X_DIAGNOSTIC_DUAL_PORT_SETS 72
810 798
811 799 #define SADB_X_DIAGNOSTIC_PAIR_INAPPROPRIATE 73
812 800 #define SADB_X_DIAGNOSTIC_PAIR_ADD_MISMATCH 74
813 801 #define SADB_X_DIAGNOSTIC_PAIR_ALREADY 75
814 802 #define SADB_X_DIAGNOSTIC_PAIR_SA_NOTFOUND 76
815 803 #define SADB_X_DIAGNOSTIC_BAD_SA_DIRECTION 77
816 804
817 805 #define SADB_X_DIAGNOSTIC_SA_NOTFOUND 78
818 806 #define SADB_X_DIAGNOSTIC_SA_EXPIRED 79
819 807 #define SADB_X_DIAGNOSTIC_BAD_CTX 80
820 808 #define SADB_X_DIAGNOSTIC_INVALID_REPLAY 81
821 809 #define SADB_X_DIAGNOSTIC_MISSING_LIFETIME 82
822 810
823 811 #define SADB_X_DIAGNOSTIC_BAD_LABEL 83
824 812 #define SADB_X_DIAGNOSTIC_MAX 83
825 813
826 814 /* Algorithm type for sadb_x_algdesc above... */
827 815
828 816 #define SADB_X_ALGTYPE_NONE 0
829 817 #define SADB_X_ALGTYPE_AUTH 1
830 818 #define SADB_X_ALGTYPE_CRYPT 2
831 819 #define SADB_X_ALGTYPE_COMPRESS 3
832 820
833 821 #define SADB_X_ALGTYPE_MAX 3
834 822
835 823 /* Key management protocol for sadb_x_kmc above... */
836 824
837 825 #define SADB_X_KMP_MANUAL 0
838 826 #define SADB_X_KMP_IKE 1
839 827 #define SADB_X_KMP_KINK 2
840 828
841 829 #define SADB_X_KMP_MAX 2
842 830
843 831 /*
844 832 * Handy conversion macros. Not part of the PF_KEY spec...
845 833 */
846 834
847 835 #define SADB_64TO8(x) ((x) << 3)
848 836 #define SADB_8TO64(x) ((x) >> 3)
849 837 #define SADB_8TO1(x) ((x) << 3)
850 838 #define SADB_1TO8(x) ((x) >> 3)
851 839
852 840 #ifdef __cplusplus
853 841 }
854 842 #endif
855 843
856 844 #endif /* _NET_PFKEYV2_H */
|
↓ open down ↓ |
174 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX