fe3f453063955f4da6a641b64e19a84b3dc366e5
[strongswan.git] / src / libfreeswan / pfkey_v2_ext_bits.c
1 /*
2 * RFC2367 PF_KEYv2 Key management API message parser
3 * Copyright (C) 1999, 2000, 2001 Richard Guy Briggs.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * RCSID $Id: pfkey_v2_ext_bits.c,v 1.2 2004/03/22 21:53:18 as Exp $
16 */
17
18 /*
19 * Template from klips/net/ipsec/ipsec/ipsec_parse.c.
20 */
21
22 char pfkey_v2_ext_bits_c_version[] = "$Id: pfkey_v2_ext_bits.c,v 1.2 2004/03/22 21:53:18 as Exp $";
23
24 /*
25 * Some ugly stuff to allow consistent debugging code for use in the
26 * kernel and in user space
27 */
28
29 #ifdef __KERNEL__
30
31 # include <linux/kernel.h> /* for printk */
32
33 # include "freeswan/ipsec_kversion.h" /* for malloc switch */
34 # ifdef MALLOC_SLAB
35 # include <linux/slab.h> /* kmalloc() */
36 # else /* MALLOC_SLAB */
37 # include <linux/malloc.h> /* kmalloc() */
38 # endif /* MALLOC_SLAB */
39 # include <linux/errno.h> /* error codes */
40 # include <linux/types.h> /* size_t */
41 # include <linux/interrupt.h> /* mark_bh */
42
43 # include <linux/netdevice.h> /* struct device, and other headers */
44 # include <linux/etherdevice.h> /* eth_type_trans */
45 # include <linux/ip.h> /* struct iphdr */
46 # if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
47 # include <linux/ipv6.h>
48 # endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
49
50 #else /* __KERNEL__ */
51
52 # include <sys/types.h>
53 # include <linux/types.h>
54 # include <linux/errno.h>
55 #endif
56
57 #include <freeswan.h>
58 #include <pfkeyv2.h>
59 #include <pfkey.h>
60
61 unsigned int extensions_bitmaps[2/*in/out*/][2/*perm/req*/][SADB_MAX + 1/*ext*/] = {
62
63 /* INBOUND EXTENSIONS */
64 {
65
66 /* PERMITTED IN */
67 {
68 /* SADB_RESERVED */
69 0
70 ,
71 /* SADB_GETSPI */
72 1<<SADB_EXT_RESERVED
73 | 1<<SADB_EXT_ADDRESS_SRC
74 | 1<<SADB_EXT_ADDRESS_DST
75 | 1<<SADB_EXT_ADDRESS_PROXY
76 | 1<<SADB_EXT_SPIRANGE
77 ,
78 /* SADB_UPDATE */
79 1<<SADB_EXT_RESERVED
80 | 1<<SADB_EXT_SA
81 | 1<<SADB_EXT_LIFETIME_CURRENT
82 | 1<<SADB_EXT_LIFETIME_HARD
83 | 1<<SADB_EXT_LIFETIME_SOFT
84 | 1<<SADB_EXT_ADDRESS_SRC
85 | 1<<SADB_EXT_ADDRESS_DST
86 | 1<<SADB_EXT_ADDRESS_PROXY
87 | 1<<SADB_EXT_KEY_AUTH
88 | 1<<SADB_EXT_KEY_ENCRYPT
89 | 1<<SADB_EXT_IDENTITY_SRC
90 | 1<<SADB_EXT_IDENTITY_DST
91 | 1<<SADB_EXT_SENSITIVITY
92 #ifdef NAT_TRAVERSAL
93 | 1<<SADB_X_EXT_NAT_T_SPORT
94 | 1<<SADB_X_EXT_NAT_T_DPORT
95 #endif
96 ,
97 /* SADB_ADD */
98 1<<SADB_EXT_RESERVED
99 | 1<<SADB_EXT_SA
100 | 1<<SADB_EXT_LIFETIME_HARD
101 | 1<<SADB_EXT_LIFETIME_SOFT
102 | 1<<SADB_EXT_ADDRESS_SRC
103 | 1<<SADB_EXT_ADDRESS_DST
104 | 1<<SADB_EXT_ADDRESS_PROXY
105 | 1<<SADB_EXT_KEY_AUTH
106 | 1<<SADB_EXT_KEY_ENCRYPT
107 | 1<<SADB_EXT_IDENTITY_SRC
108 | 1<<SADB_EXT_IDENTITY_DST
109 | 1<<SADB_EXT_SENSITIVITY
110 #ifdef NAT_TRAVERSAL
111 | 1<<SADB_X_EXT_NAT_T_TYPE
112 | 1<<SADB_X_EXT_NAT_T_SPORT
113 | 1<<SADB_X_EXT_NAT_T_DPORT
114 | 1<<SADB_X_EXT_NAT_T_OA
115 #endif
116 ,
117 /* SADB_DELETE */
118 1<<SADB_EXT_RESERVED
119 | 1<<SADB_EXT_SA
120 | 1<<SADB_EXT_ADDRESS_SRC
121 | 1<<SADB_EXT_ADDRESS_DST
122 ,
123 /* SADB_GET */
124 1<<SADB_EXT_RESERVED
125 | 1<<SADB_EXT_SA
126 | 1<<SADB_EXT_ADDRESS_SRC
127 | 1<<SADB_EXT_ADDRESS_DST
128 ,
129 /* SADB_ACQUIRE */
130 1<<SADB_EXT_RESERVED
131 | 1<<SADB_EXT_ADDRESS_SRC
132 | 1<<SADB_EXT_ADDRESS_DST
133 | 1<<SADB_EXT_ADDRESS_PROXY
134 | 1<<SADB_EXT_IDENTITY_SRC
135 | 1<<SADB_EXT_IDENTITY_DST
136 | 1<<SADB_EXT_SENSITIVITY
137 | 1<<SADB_EXT_PROPOSAL
138 ,
139 /* SADB_REGISTER */
140 1<<SADB_EXT_RESERVED
141 ,
142 /* SADB_EXPIRE */
143 0
144 ,
145 /* SADB_FLUSH */
146 1<<SADB_EXT_RESERVED
147 ,
148 /* SADB_DUMP */
149 1<<SADB_EXT_RESERVED
150 ,
151 /* SADB_X_PROMISC */
152 1<<SADB_EXT_RESERVED
153 | 1<<SADB_EXT_SA
154 | 1<<SADB_EXT_LIFETIME_CURRENT
155 | 1<<SADB_EXT_LIFETIME_HARD
156 | 1<<SADB_EXT_LIFETIME_SOFT
157 | 1<<SADB_EXT_ADDRESS_SRC
158 | 1<<SADB_EXT_ADDRESS_DST
159 | 1<<SADB_EXT_ADDRESS_PROXY
160 | 1<<SADB_EXT_KEY_AUTH
161 | 1<<SADB_EXT_KEY_ENCRYPT
162 | 1<<SADB_EXT_IDENTITY_SRC
163 | 1<<SADB_EXT_IDENTITY_DST
164 | 1<<SADB_EXT_SENSITIVITY
165 | 1<<SADB_EXT_PROPOSAL
166 | 1<<SADB_EXT_SUPPORTED_AUTH
167 | 1<<SADB_EXT_SUPPORTED_ENCRYPT
168 | 1<<SADB_EXT_SPIRANGE
169 | 1<<SADB_X_EXT_KMPRIVATE
170 | 1<<SADB_X_EXT_SATYPE2
171 | 1<<SADB_X_EXT_SA2
172 | 1<<SADB_X_EXT_ADDRESS_DST2
173 ,
174 /* SADB_X_PCHANGE */
175 1<<SADB_EXT_RESERVED
176 | 1<<SADB_EXT_SA
177 | 1<<SADB_EXT_LIFETIME_CURRENT
178 | 1<<SADB_EXT_LIFETIME_HARD
179 | 1<<SADB_EXT_LIFETIME_SOFT
180 | 1<<SADB_EXT_ADDRESS_SRC
181 | 1<<SADB_EXT_ADDRESS_DST
182 | 1<<SADB_EXT_ADDRESS_PROXY
183 | 1<<SADB_EXT_KEY_AUTH
184 | 1<<SADB_EXT_KEY_ENCRYPT
185 | 1<<SADB_EXT_IDENTITY_SRC
186 | 1<<SADB_EXT_IDENTITY_DST
187 | 1<<SADB_EXT_SENSITIVITY
188 | 1<<SADB_EXT_PROPOSAL
189 | 1<<SADB_EXT_SUPPORTED_AUTH
190 | 1<<SADB_EXT_SUPPORTED_ENCRYPT
191 | 1<<SADB_EXT_SPIRANGE
192 | 1<<SADB_X_EXT_KMPRIVATE
193 | 1<<SADB_X_EXT_SATYPE2
194 | 1<<SADB_X_EXT_SA2
195 | 1<<SADB_X_EXT_ADDRESS_DST2
196 ,
197 /* SADB_X_GRPSA */
198 1<<SADB_EXT_RESERVED
199 | 1<<SADB_EXT_SA
200 | 1<<SADB_EXT_ADDRESS_DST
201 | 1<<SADB_X_EXT_SATYPE2
202 | 1<<SADB_X_EXT_SA2
203 | 1<<SADB_X_EXT_ADDRESS_DST2
204 ,
205 /* SADB_X_ADDFLOW */
206 1<<SADB_EXT_RESERVED
207 | 1<<SADB_EXT_SA
208 | 1<<SADB_EXT_ADDRESS_SRC
209 | 1<<SADB_EXT_ADDRESS_DST
210 | 1<<SADB_X_EXT_ADDRESS_SRC_FLOW
211 | 1<<SADB_X_EXT_ADDRESS_DST_FLOW
212 | 1<<SADB_X_EXT_ADDRESS_SRC_MASK
213 | 1<<SADB_X_EXT_ADDRESS_DST_MASK
214 | 1<<SADB_EXT_IDENTITY_SRC
215 | 1<<SADB_EXT_IDENTITY_DST
216 | 1<<SADB_X_EXT_PROTOCOL
217 ,
218 /* SADB_X_DELFLOW */
219 1<<SADB_EXT_RESERVED
220 | 1<<SADB_EXT_SA
221 | 1<<SADB_X_EXT_ADDRESS_SRC_FLOW
222 | 1<<SADB_X_EXT_ADDRESS_DST_FLOW
223 | 1<<SADB_X_EXT_ADDRESS_SRC_MASK
224 | 1<<SADB_X_EXT_ADDRESS_DST_MASK
225 | 1<<SADB_EXT_IDENTITY_SRC
226 | 1<<SADB_EXT_IDENTITY_DST
227 | 1<<SADB_X_EXT_PROTOCOL
228 ,
229 /* SADB_X_DEBUG */
230 1<<SADB_EXT_RESERVED
231 | 1<<SADB_X_EXT_DEBUG
232 #ifdef NAT_TRAVERSAL
233 ,
234 /* SADB_X_NAT_T_NEW_MAPPING */
235 1<<SADB_EXT_RESERVED
236 | 1<<SADB_EXT_SA
237 | 1<<SADB_EXT_ADDRESS_SRC
238 | 1<<SADB_EXT_ADDRESS_DST
239 | 1<<SADB_X_EXT_NAT_T_SPORT
240 | 1<<SADB_X_EXT_NAT_T_DPORT
241 #endif
242 },
243
244 /* REQUIRED IN */
245 {
246 /* SADB_RESERVED */
247 0
248 ,
249 /* SADB_GETSPI */
250 1<<SADB_EXT_RESERVED
251 | 1<<SADB_EXT_ADDRESS_SRC
252 | 1<<SADB_EXT_ADDRESS_DST
253 | 1<<SADB_EXT_SPIRANGE
254 ,
255 /* SADB_UPDATE */
256 1<<SADB_EXT_RESERVED
257 | 1<<SADB_EXT_SA
258 | 1<<SADB_EXT_ADDRESS_SRC
259 | 1<<SADB_EXT_ADDRESS_DST
260 /*| 1<<SADB_EXT_KEY_AUTH*/
261 /*| 1<<SADB_EXT_KEY_ENCRYPT*/
262 ,
263 /* SADB_ADD */
264 1<<SADB_EXT_RESERVED
265 | 1<<SADB_EXT_SA
266 | 1<<SADB_EXT_ADDRESS_SRC
267 | 1<<SADB_EXT_ADDRESS_DST
268 /*| 1<<SADB_EXT_KEY_AUTH*/
269 /*| 1<<SADB_EXT_KEY_ENCRYPT*/
270 ,
271 /* SADB_DELETE */
272 1<<SADB_EXT_RESERVED
273 | 1<<SADB_EXT_SA
274 | 1<<SADB_EXT_ADDRESS_SRC
275 | 1<<SADB_EXT_ADDRESS_DST
276 ,
277 /* SADB_GET */
278 1<<SADB_EXT_RESERVED
279 | 1<<SADB_EXT_SA
280 | 1<<SADB_EXT_ADDRESS_SRC
281 | 1<<SADB_EXT_ADDRESS_DST
282 ,
283 /* SADB_ACQUIRE */
284 1<<SADB_EXT_RESERVED
285 | 1<<SADB_EXT_ADDRESS_SRC
286 | 1<<SADB_EXT_ADDRESS_DST
287 | 1<<SADB_EXT_PROPOSAL
288 ,
289 /* SADB_REGISTER */
290 1<<SADB_EXT_RESERVED
291 ,
292 /* SADB_EXPIRE */
293 0
294 ,
295 /* SADB_FLUSH */
296 1<<SADB_EXT_RESERVED
297 ,
298 /* SADB_DUMP */
299 1<<SADB_EXT_RESERVED
300 ,
301 /* SADB_X_PROMISC */
302 1<<SADB_EXT_RESERVED
303 | 1<<SADB_EXT_SA
304 | 1<<SADB_EXT_LIFETIME_CURRENT
305 | 1<<SADB_EXT_LIFETIME_HARD
306 | 1<<SADB_EXT_LIFETIME_SOFT
307 | 1<<SADB_EXT_ADDRESS_SRC
308 | 1<<SADB_EXT_ADDRESS_DST
309 | 1<<SADB_EXT_ADDRESS_PROXY
310 | 1<<SADB_EXT_KEY_AUTH
311 | 1<<SADB_EXT_KEY_ENCRYPT
312 | 1<<SADB_EXT_IDENTITY_SRC
313 | 1<<SADB_EXT_IDENTITY_DST
314 | 1<<SADB_EXT_SENSITIVITY
315 | 1<<SADB_EXT_PROPOSAL
316 | 1<<SADB_EXT_SUPPORTED_AUTH
317 | 1<<SADB_EXT_SUPPORTED_ENCRYPT
318 | 1<<SADB_EXT_SPIRANGE
319 | 1<<SADB_X_EXT_KMPRIVATE
320 | 1<<SADB_X_EXT_SATYPE2
321 | 1<<SADB_X_EXT_SA2
322 | 1<<SADB_X_EXT_ADDRESS_DST2
323 ,
324 /* SADB_X_PCHANGE */
325 1<<SADB_EXT_RESERVED
326 | 1<<SADB_EXT_SA
327 | 1<<SADB_EXT_LIFETIME_CURRENT
328 | 1<<SADB_EXT_LIFETIME_HARD
329 | 1<<SADB_EXT_LIFETIME_SOFT
330 | 1<<SADB_EXT_ADDRESS_SRC
331 | 1<<SADB_EXT_ADDRESS_DST
332 | 1<<SADB_EXT_ADDRESS_PROXY
333 | 1<<SADB_EXT_KEY_AUTH
334 | 1<<SADB_EXT_KEY_ENCRYPT
335 | 1<<SADB_EXT_IDENTITY_SRC
336 | 1<<SADB_EXT_IDENTITY_DST
337 | 1<<SADB_EXT_SENSITIVITY
338 | 1<<SADB_EXT_PROPOSAL
339 | 1<<SADB_EXT_SUPPORTED_AUTH
340 | 1<<SADB_EXT_SUPPORTED_ENCRYPT
341 | 1<<SADB_EXT_SPIRANGE
342 | 1<<SADB_X_EXT_KMPRIVATE
343 | 1<<SADB_X_EXT_SATYPE2
344 | 1<<SADB_X_EXT_SA2
345 | 1<<SADB_X_EXT_ADDRESS_DST2
346 ,
347 /* SADB_X_GRPSA */
348 1<<SADB_EXT_RESERVED
349 | 1<<SADB_EXT_SA
350 | 1<<SADB_EXT_ADDRESS_DST
351 /*| 1<<SADB_X_EXT_SATYPE2*/
352 /*| 1<<SADB_X_EXT_SA2*/
353 /*| 1<<SADB_X_EXT_ADDRESS_DST2*/
354 ,
355 /* SADB_X_ADDFLOW */
356 1<<SADB_EXT_RESERVED
357 | 1<<SADB_EXT_SA
358 | 1<<SADB_EXT_ADDRESS_DST
359 | 1<<SADB_X_EXT_ADDRESS_SRC_FLOW
360 | 1<<SADB_X_EXT_ADDRESS_DST_FLOW
361 | 1<<SADB_X_EXT_ADDRESS_SRC_MASK
362 | 1<<SADB_X_EXT_ADDRESS_DST_MASK
363 ,
364 /* SADB_X_DELFLOW */
365 1<<SADB_EXT_RESERVED
366 /*| 1<<SADB_EXT_SA*/
367 #if 0 /* SADB_X_CLREROUTE doesn't need all these... */
368 | 1<<SADB_X_EXT_ADDRESS_SRC_FLOW
369 | 1<<SADB_X_EXT_ADDRESS_DST_FLOW
370 | 1<<SADB_X_EXT_ADDRESS_SRC_MASK
371 | 1<<SADB_X_EXT_ADDRESS_DST_MASK
372 #endif
373 ,
374 /* SADB_X_DEBUG */
375 1<<SADB_EXT_RESERVED
376 | 1<<SADB_X_EXT_DEBUG
377 #ifdef NAT_TRAVERSAL
378 ,
379 /* SADB_X_NAT_T_NEW_MAPPING */
380 1<<SADB_EXT_RESERVED
381 | 1<<SADB_EXT_SA
382 | 1<<SADB_EXT_ADDRESS_SRC
383 | 1<<SADB_EXT_ADDRESS_DST
384 | 1<<SADB_X_EXT_NAT_T_SPORT
385 | 1<<SADB_X_EXT_NAT_T_DPORT
386 #endif
387 }
388
389 },
390
391 /* OUTBOUND EXTENSIONS */
392 {
393
394 /* PERMITTED OUT */
395 {
396 /* SADB_RESERVED */
397 0
398 ,
399 /* SADB_GETSPI */
400 1<<SADB_EXT_RESERVED
401 | 1<<SADB_EXT_SA
402 | 1<<SADB_EXT_ADDRESS_SRC
403 | 1<<SADB_EXT_ADDRESS_DST
404 ,
405 /* SADB_UPDATE */
406 1<<SADB_EXT_RESERVED
407 | 1<<SADB_EXT_SA
408 | 1<<SADB_EXT_LIFETIME_CURRENT
409 | 1<<SADB_EXT_LIFETIME_HARD
410 | 1<<SADB_EXT_LIFETIME_SOFT
411 | 1<<SADB_EXT_ADDRESS_SRC
412 | 1<<SADB_EXT_ADDRESS_DST
413 | 1<<SADB_EXT_ADDRESS_PROXY
414 | 1<<SADB_EXT_IDENTITY_SRC
415 | 1<<SADB_EXT_IDENTITY_DST
416 | 1<<SADB_EXT_SENSITIVITY
417 ,
418 /* SADB_ADD */
419 1<<SADB_EXT_RESERVED
420 | 1<<SADB_EXT_SA
421 | 1<<SADB_EXT_LIFETIME_HARD
422 | 1<<SADB_EXT_LIFETIME_SOFT
423 | 1<<SADB_EXT_ADDRESS_SRC
424 | 1<<SADB_EXT_ADDRESS_DST
425 | 1<<SADB_EXT_IDENTITY_SRC
426 | 1<<SADB_EXT_IDENTITY_DST
427 | 1<<SADB_EXT_SENSITIVITY
428 #ifdef NAT_TRAVERSAL
429 | 1<<SADB_X_EXT_NAT_T_TYPE
430 | 1<<SADB_X_EXT_NAT_T_SPORT
431 | 1<<SADB_X_EXT_NAT_T_DPORT
432 | 1<<SADB_X_EXT_NAT_T_OA
433 #endif
434 ,
435 /* SADB_DELETE */
436 1<<SADB_EXT_RESERVED
437 | 1<<SADB_EXT_SA
438 | 1<<SADB_EXT_ADDRESS_SRC
439 | 1<<SADB_EXT_ADDRESS_DST
440 ,
441 /* SADB_GET */
442 1<<SADB_EXT_RESERVED
443 | 1<<SADB_EXT_SA
444 | 1<<SADB_EXT_LIFETIME_CURRENT
445 | 1<<SADB_EXT_LIFETIME_HARD
446 | 1<<SADB_EXT_LIFETIME_SOFT
447 | 1<<SADB_EXT_ADDRESS_SRC
448 | 1<<SADB_EXT_ADDRESS_DST
449 | 1<<SADB_EXT_ADDRESS_PROXY
450 | 1<<SADB_EXT_KEY_AUTH
451 | 1<<SADB_EXT_KEY_ENCRYPT
452 | 1<<SADB_EXT_IDENTITY_SRC
453 | 1<<SADB_EXT_IDENTITY_DST
454 | 1<<SADB_EXT_SENSITIVITY
455 ,
456 /* SADB_ACQUIRE */
457 1<<SADB_EXT_RESERVED
458 | 1<<SADB_EXT_ADDRESS_SRC
459 | 1<<SADB_EXT_ADDRESS_DST
460 | 1<<SADB_EXT_ADDRESS_PROXY
461 | 1<<SADB_EXT_IDENTITY_SRC
462 | 1<<SADB_EXT_IDENTITY_DST
463 | 1<<SADB_EXT_SENSITIVITY
464 | 1<<SADB_EXT_PROPOSAL
465 ,
466 /* SADB_REGISTER */
467 1<<SADB_EXT_RESERVED
468 | 1<<SADB_EXT_SUPPORTED_AUTH
469 | 1<<SADB_EXT_SUPPORTED_ENCRYPT
470 ,
471 /* SADB_EXPIRE */
472 1<<SADB_EXT_RESERVED
473 | 1<<SADB_EXT_SA
474 | 1<<SADB_EXT_LIFETIME_CURRENT
475 | 1<<SADB_EXT_LIFETIME_HARD
476 | 1<<SADB_EXT_LIFETIME_SOFT
477 | 1<<SADB_EXT_ADDRESS_SRC
478 | 1<<SADB_EXT_ADDRESS_DST
479 ,
480 /* SADB_FLUSH */
481 1<<SADB_EXT_RESERVED
482 ,
483 /* SADB_DUMP */
484 1<<SADB_EXT_RESERVED
485 | 1<<SADB_EXT_SA
486 | 1<<SADB_EXT_LIFETIME_CURRENT
487 | 1<<SADB_EXT_LIFETIME_HARD
488 | 1<<SADB_EXT_LIFETIME_SOFT
489 | 1<<SADB_EXT_ADDRESS_SRC
490 | 1<<SADB_EXT_ADDRESS_DST
491 | 1<<SADB_EXT_ADDRESS_PROXY
492 | 1<<SADB_EXT_KEY_AUTH
493 | 1<<SADB_EXT_KEY_ENCRYPT
494 | 1<<SADB_EXT_IDENTITY_SRC
495 | 1<<SADB_EXT_IDENTITY_DST
496 | 1<<SADB_EXT_SENSITIVITY
497 ,
498 /* SADB_X_PROMISC */
499 1<<SADB_EXT_RESERVED
500 | 1<<SADB_EXT_SA
501 | 1<<SADB_EXT_LIFETIME_CURRENT
502 | 1<<SADB_EXT_LIFETIME_HARD
503 | 1<<SADB_EXT_LIFETIME_SOFT
504 | 1<<SADB_EXT_ADDRESS_SRC
505 | 1<<SADB_EXT_ADDRESS_DST
506 | 1<<SADB_EXT_ADDRESS_PROXY
507 | 1<<SADB_EXT_KEY_AUTH
508 | 1<<SADB_EXT_KEY_ENCRYPT
509 | 1<<SADB_EXT_IDENTITY_SRC
510 | 1<<SADB_EXT_IDENTITY_DST
511 | 1<<SADB_EXT_SENSITIVITY
512 | 1<<SADB_EXT_PROPOSAL
513 | 1<<SADB_EXT_SUPPORTED_AUTH
514 | 1<<SADB_EXT_SUPPORTED_ENCRYPT
515 | 1<<SADB_EXT_SPIRANGE
516 | 1<<SADB_X_EXT_KMPRIVATE
517 | 1<<SADB_X_EXT_SATYPE2
518 | 1<<SADB_X_EXT_SA2
519 | 1<<SADB_X_EXT_ADDRESS_DST2
520 ,
521 /* SADB_X_PCHANGE */
522 1<<SADB_EXT_RESERVED
523 | 1<<SADB_EXT_SA
524 | 1<<SADB_EXT_LIFETIME_CURRENT
525 | 1<<SADB_EXT_LIFETIME_HARD
526 | 1<<SADB_EXT_LIFETIME_SOFT
527 | 1<<SADB_EXT_ADDRESS_SRC
528 | 1<<SADB_EXT_ADDRESS_DST
529 | 1<<SADB_EXT_ADDRESS_PROXY
530 | 1<<SADB_EXT_KEY_AUTH
531 | 1<<SADB_EXT_KEY_ENCRYPT
532 | 1<<SADB_EXT_IDENTITY_SRC
533 | 1<<SADB_EXT_IDENTITY_DST
534 | 1<<SADB_EXT_SENSITIVITY
535 | 1<<SADB_EXT_PROPOSAL
536 | 1<<SADB_EXT_SUPPORTED_AUTH
537 | 1<<SADB_EXT_SUPPORTED_ENCRYPT
538 | 1<<SADB_EXT_SPIRANGE
539 | 1<<SADB_X_EXT_KMPRIVATE
540 | 1<<SADB_X_EXT_SATYPE2
541 | 1<<SADB_X_EXT_SA2
542 | 1<<SADB_X_EXT_ADDRESS_DST2
543 ,
544 /* SADB_X_GRPSA */
545 1<<SADB_EXT_RESERVED
546 | 1<<SADB_EXT_SA
547 | 1<<SADB_EXT_ADDRESS_DST
548 | 1<<SADB_X_EXT_SATYPE2
549 | 1<<SADB_X_EXT_SA2
550 | 1<<SADB_X_EXT_ADDRESS_DST2
551 ,
552 /* SADB_X_ADDFLOW */
553 1<<SADB_EXT_RESERVED
554 | 1<<SADB_EXT_SA
555 | 1<<SADB_EXT_ADDRESS_SRC
556 | 1<<SADB_EXT_ADDRESS_DST
557 | 1<<SADB_X_EXT_ADDRESS_SRC_FLOW
558 | 1<<SADB_X_EXT_ADDRESS_DST_FLOW
559 | 1<<SADB_X_EXT_ADDRESS_SRC_MASK
560 | 1<<SADB_X_EXT_ADDRESS_DST_MASK
561 | 1<<SADB_X_EXT_PROTOCOL
562 ,
563 /* SADB_X_DELFLOW */
564 1<<SADB_EXT_RESERVED
565 | 1<<SADB_EXT_SA
566 | 1<<SADB_X_EXT_ADDRESS_SRC_FLOW
567 | 1<<SADB_X_EXT_ADDRESS_DST_FLOW
568 | 1<<SADB_X_EXT_ADDRESS_SRC_MASK
569 | 1<<SADB_X_EXT_ADDRESS_DST_MASK
570 | 1<<SADB_X_EXT_PROTOCOL
571 ,
572 /* SADB_X_DEBUG */
573 1<<SADB_EXT_RESERVED
574 | 1<<SADB_X_EXT_DEBUG
575 #ifdef NAT_TRAVERSAL
576 ,
577 /* SADB_X_NAT_T_NEW_MAPPING */
578 1<<SADB_EXT_RESERVED
579 | 1<<SADB_EXT_SA
580 | 1<<SADB_EXT_ADDRESS_SRC
581 | 1<<SADB_EXT_ADDRESS_DST
582 | 1<<SADB_X_EXT_NAT_T_SPORT
583 | 1<<SADB_X_EXT_NAT_T_DPORT
584 #endif
585 },
586
587 /* REQUIRED OUT */
588 {
589 /* SADB_RESERVED */
590 0
591 ,
592 /* SADB_GETSPI */
593 1<<SADB_EXT_RESERVED
594 | 1<<SADB_EXT_SA
595 | 1<<SADB_EXT_ADDRESS_SRC
596 | 1<<SADB_EXT_ADDRESS_DST
597 ,
598 /* SADB_UPDATE */
599 1<<SADB_EXT_RESERVED
600 | 1<<SADB_EXT_SA
601 | 1<<SADB_EXT_ADDRESS_SRC
602 | 1<<SADB_EXT_ADDRESS_DST
603 ,
604 /* SADB_ADD */
605 1<<SADB_EXT_RESERVED
606 | 1<<SADB_EXT_SA
607 | 1<<SADB_EXT_ADDRESS_SRC
608 | 1<<SADB_EXT_ADDRESS_DST
609 ,
610 /* SADB_DELETE */
611 1<<SADB_EXT_RESERVED
612 | 1<<SADB_EXT_SA
613 | 1<<SADB_EXT_ADDRESS_SRC
614 | 1<<SADB_EXT_ADDRESS_DST
615 ,
616 /* SADB_GET */
617 1<<SADB_EXT_RESERVED
618 | 1<<SADB_EXT_SA
619 | 1<<SADB_EXT_ADDRESS_SRC
620 | 1<<SADB_EXT_ADDRESS_DST
621 /* | 1<<SADB_EXT_KEY_AUTH */
622 /* | 1<<SADB_EXT_KEY_ENCRYPT */
623 ,
624 /* SADB_ACQUIRE */
625 1<<SADB_EXT_RESERVED
626 | 1<<SADB_EXT_ADDRESS_SRC
627 | 1<<SADB_EXT_ADDRESS_DST
628 | 1<<SADB_EXT_PROPOSAL
629 ,
630 /* SADB_REGISTER */
631 1<<SADB_EXT_RESERVED
632 /* | 1<<SADB_EXT_SUPPORTED_AUTH
633 | 1<<SADB_EXT_SUPPORTED_ENCRYPT */
634 ,
635 /* SADB_EXPIRE */
636 1<<SADB_EXT_RESERVED
637 | 1<<SADB_EXT_SA
638 | 1<<SADB_EXT_LIFETIME_CURRENT
639 /* | 1<<SADB_EXT_LIFETIME_HARD
640 | 1<<SADB_EXT_LIFETIME_SOFT */
641 | 1<<SADB_EXT_ADDRESS_SRC
642 | 1<<SADB_EXT_ADDRESS_DST
643 ,
644 /* SADB_FLUSH */
645 1<<SADB_EXT_RESERVED
646 ,
647 /* SADB_DUMP */
648 1<<SADB_EXT_RESERVED
649 | 1<<SADB_EXT_SA
650 | 1<<SADB_EXT_ADDRESS_SRC
651 | 1<<SADB_EXT_ADDRESS_DST
652 | 1<<SADB_EXT_KEY_AUTH
653 | 1<<SADB_EXT_KEY_ENCRYPT
654 ,
655 /* SADB_X_PROMISC */
656 1<<SADB_EXT_RESERVED
657 | 1<<SADB_EXT_SA
658 | 1<<SADB_EXT_LIFETIME_CURRENT
659 | 1<<SADB_EXT_LIFETIME_HARD
660 | 1<<SADB_EXT_LIFETIME_SOFT
661 | 1<<SADB_EXT_ADDRESS_SRC
662 | 1<<SADB_EXT_ADDRESS_DST
663 | 1<<SADB_EXT_ADDRESS_PROXY
664 | 1<<SADB_EXT_KEY_AUTH
665 | 1<<SADB_EXT_KEY_ENCRYPT
666 | 1<<SADB_EXT_IDENTITY_SRC
667 | 1<<SADB_EXT_IDENTITY_DST
668 | 1<<SADB_EXT_SENSITIVITY
669 | 1<<SADB_EXT_PROPOSAL
670 | 1<<SADB_EXT_SUPPORTED_AUTH
671 | 1<<SADB_EXT_SUPPORTED_ENCRYPT
672 | 1<<SADB_EXT_SPIRANGE
673 | 1<<SADB_X_EXT_KMPRIVATE
674 | 1<<SADB_X_EXT_SATYPE2
675 | 1<<SADB_X_EXT_SA2
676 | 1<<SADB_X_EXT_ADDRESS_DST2
677 ,
678 /* SADB_X_PCHANGE */
679 1<<SADB_EXT_RESERVED
680 | 1<<SADB_EXT_SA
681 | 1<<SADB_EXT_LIFETIME_CURRENT
682 | 1<<SADB_EXT_LIFETIME_HARD
683 | 1<<SADB_EXT_LIFETIME_SOFT
684 | 1<<SADB_EXT_ADDRESS_SRC
685 | 1<<SADB_EXT_ADDRESS_DST
686 | 1<<SADB_EXT_ADDRESS_PROXY
687 | 1<<SADB_EXT_KEY_AUTH
688 | 1<<SADB_EXT_KEY_ENCRYPT
689 | 1<<SADB_EXT_IDENTITY_SRC
690 | 1<<SADB_EXT_IDENTITY_DST
691 | 1<<SADB_EXT_SENSITIVITY
692 | 1<<SADB_EXT_PROPOSAL
693 | 1<<SADB_EXT_SUPPORTED_AUTH
694 | 1<<SADB_EXT_SUPPORTED_ENCRYPT
695 | 1<<SADB_EXT_SPIRANGE
696 | 1<<SADB_X_EXT_KMPRIVATE
697 | 1<<SADB_X_EXT_SATYPE2
698 | 1<<SADB_X_EXT_SA2
699 | 1<<SADB_X_EXT_ADDRESS_DST2
700 ,
701 /* SADB_X_GRPSA */
702 1<<SADB_EXT_RESERVED
703 | 1<<SADB_EXT_SA
704 | 1<<SADB_EXT_ADDRESS_DST
705 ,
706 /* SADB_X_ADDFLOW */
707 1<<SADB_EXT_RESERVED
708 | 1<<SADB_EXT_SA
709 | 1<<SADB_EXT_ADDRESS_DST
710 | 1<<SADB_X_EXT_ADDRESS_SRC_FLOW
711 | 1<<SADB_X_EXT_ADDRESS_DST_FLOW
712 | 1<<SADB_X_EXT_ADDRESS_SRC_MASK
713 | 1<<SADB_X_EXT_ADDRESS_DST_MASK
714 ,
715 /* SADB_X_DELFLOW */
716 1<<SADB_EXT_RESERVED
717 /*| 1<<SADB_EXT_SA*/
718 | 1<<SADB_X_EXT_ADDRESS_SRC_FLOW
719 | 1<<SADB_X_EXT_ADDRESS_DST_FLOW
720 | 1<<SADB_X_EXT_ADDRESS_SRC_MASK
721 | 1<<SADB_X_EXT_ADDRESS_DST_MASK
722 ,
723 /* SADB_X_DEBUG */
724 1<<SADB_EXT_RESERVED
725 | 1<<SADB_X_EXT_DEBUG
726 #ifdef NAT_TRAVERSAL
727 ,
728 /* SADB_X_NAT_T_NEW_MAPPING */
729 1<<SADB_EXT_RESERVED
730 | 1<<SADB_EXT_SA
731 | 1<<SADB_EXT_ADDRESS_SRC
732 | 1<<SADB_EXT_ADDRESS_DST
733 | 1<<SADB_X_EXT_NAT_T_SPORT
734 | 1<<SADB_X_EXT_NAT_T_DPORT
735 #endif
736 }
737 }
738 };
739
740 /*
741 * $Log: pfkey_v2_ext_bits.c,v $
742 * Revision 1.2 2004/03/22 21:53:18 as
743 * merged alg-0.8.1 branch with HEAD
744 *
745 * Revision 1.1.2.1 2004/03/15 22:30:06 as
746 * nat-0.6c patch merged
747 *
748 * Revision 1.1 2004/03/15 20:35:26 as
749 * added files from freeswan-2.04-x509-1.5.3
750 *
751 * Revision 1.15 2002/04/24 07:55:32 mcr
752 * #include patches and Makefiles for post-reorg compilation.
753 *
754 * Revision 1.14 2002/04/24 07:36:40 mcr
755 * Moved from ./lib/pfkey_v2_ext_bits.c,v
756 *
757 * Revision 1.13 2002/01/29 22:25:36 rgb
758 * Re-add ipsec_kversion.h to keep MALLOC happy.
759 *
760 * Revision 1.12 2002/01/29 01:59:10 mcr
761 * removal of kversions.h - sources that needed it now use ipsec_param.h.
762 * updating of IPv6 structures to match latest in6.h version.
763 * removed dead code from freeswan.h that also duplicated kversions.h
764 * code.
765 *
766 * Revision 1.11 2001/10/18 04:45:24 rgb
767 * 2.4.9 kernel deprecates linux/malloc.h in favour of linux/slab.h,
768 * lib/freeswan.h version macros moved to lib/kversions.h.
769 * Other compiler directive cleanups.
770 *
771 * Revision 1.10 2001/09/08 21:13:35 rgb
772 * Added pfkey ident extension support for ISAKMPd. (NetCelo)
773 *
774 * Revision 1.9 2001/06/14 19:35:16 rgb
775 * Update copyright date.
776 *
777 * Revision 1.8 2001/03/26 23:07:36 rgb
778 * Remove requirement for auth and enc key from UPDATE.
779 *
780 * Revision 1.7 2000/09/12 22:35:37 rgb
781 * Restructured to remove unused extensions from CLEARFLOW messages.
782 *
783 * Revision 1.6 2000/09/09 06:39:01 rgb
784 * Added comments for clarity.
785 *
786 * Revision 1.5 2000/06/02 22:54:14 rgb
787 * Added Gerhard Gessler's struct sockaddr_storage mods for IPv6 support.
788 *
789 * Revision 1.4 2000/01/21 06:27:56 rgb
790 * Added address cases for eroute flows.
791 * Added comments for each message type.
792 * Added klipsdebug switching capability.
793 * Fixed GRPSA bitfields.
794 *
795 * Revision 1.3 1999/12/01 22:20:27 rgb
796 * Remove requirement for a proxy address in an incoming getspi message.
797 *
798 * Revision 1.2 1999/11/27 11:57:06 rgb
799 * Consolidated the 4 1-d extension bitmap arrays into one 4-d array.
800 * Add CVS log entry to bottom of file.
801 * Cleaned out unused bits.
802 *
803 */