2
* @(#) pfkey version 2 debugging messages
4
* Copyright (C) 2001 Richard Guy Briggs <rgb@freeswan.org>
5
* and Michael Richardson <mcr@freeswan.org>
7
* This program is free software; you can redistribute it and/or modify it
8
* under the terms of the GNU General Public License as published by the
9
* Free Software Foundation; either version 2 of the License, or (at your
10
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12
* This program is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17
* RCSID $Id: pfkey_v2_debug.c,v 1.8.4.2 2004/04/16 12:32:56 mcr Exp $
23
# include <linux/kernel.h> /* for printk */
25
# include "freeswan/ipsec_kversion.h" /* for malloc switch */
27
# include <linux/slab.h> /* kmalloc() */
28
# else /* MALLOC_SLAB */
29
# include <linux/malloc.h> /* kmalloc() */
30
# endif /* MALLOC_SLAB */
31
# include <linux/errno.h> /* error codes */
32
# include <linux/types.h> /* size_t */
33
# include <linux/interrupt.h> /* mark_bh */
35
# include <linux/netdevice.h> /* struct device, and other headers */
36
# include <linux/etherdevice.h> /* eth_type_trans */
37
extern int debug_pfkey;
39
#else /* __KERNEL__ */
41
# include <sys/types.h>
42
# include <linux/types.h>
43
# include <linux/errno.h>
45
#endif /* __KERNEL__ */
52
* This file provides ASCII translations of PF_KEY magic numbers.
56
static char *pfkey_sadb_ext_strings[]={
57
"reserved", /* SADB_EXT_RESERVED 0 */
58
"security-association", /* SADB_EXT_SA 1 */
59
"lifetime-current", /* SADB_EXT_LIFETIME_CURRENT 2 */
60
"lifetime-hard", /* SADB_EXT_LIFETIME_HARD 3 */
61
"lifetime-soft", /* SADB_EXT_LIFETIME_SOFT 4 */
62
"source-address", /* SADB_EXT_ADDRESS_SRC 5 */
63
"destination-address", /* SADB_EXT_ADDRESS_DST 6 */
64
"proxy-address", /* SADB_EXT_ADDRESS_PROXY 7 */
65
"authentication-key", /* SADB_EXT_KEY_AUTH 8 */
66
"cipher-key", /* SADB_EXT_KEY_ENCRYPT 9 */
67
"source-identity", /* SADB_EXT_IDENTITY_SRC 10 */
68
"destination-identity", /* SADB_EXT_IDENTITY_DST 11 */
69
"sensitivity-label", /* SADB_EXT_SENSITIVITY 12 */
70
"proposal", /* SADB_EXT_PROPOSAL 13 */
71
"supported-auth", /* SADB_EXT_SUPPORTED_AUTH 14 */
72
"supported-cipher", /* SADB_EXT_SUPPORTED_ENCRYPT 15 */
73
"spi-range", /* SADB_EXT_SPIRANGE 16 */
74
"X-kmpprivate", /* SADB_X_EXT_KMPRIVATE 17 */
75
"X-satype2", /* SADB_X_EXT_SATYPE2 18 */
76
"X-security-association", /* SADB_X_EXT_SA2 19 */
77
"X-destination-address2", /* SADB_X_EXT_ADDRESS_DST2 20 */
78
"X-source-flow-address", /* SADB_X_EXT_ADDRESS_SRC_FLOW 21 */
79
"X-dest-flow-address", /* SADB_X_EXT_ADDRESS_DST_FLOW 22 */
80
"X-source-mask", /* SADB_X_EXT_ADDRESS_SRC_MASK 23 */
81
"X-dest-mask", /* SADB_X_EXT_ADDRESS_DST_MASK 24 */
82
"X-set-debug", /* SADB_X_EXT_DEBUG 25 */
84
"X-NAT-T-type", /* SADB_X_EXT_NAT_T_TYPE 26 */
85
"X-NAT-T-sport", /* SADB_X_EXT_NAT_T_SPORT 27 */
86
"X-NAT-T-dport", /* SADB_X_EXT_NAT_T_DPORT 28 */
87
"X-NAT-T-OA", /* SADB_X_EXT_NAT_T_OA 29 */
92
pfkey_v2_sadb_ext_string(int ext)
94
if(ext <= SADB_EXT_MAX) {
95
return pfkey_sadb_ext_strings[ext];
102
static char *pfkey_sadb_type_strings[]={
103
"reserved", /* SADB_RESERVED */
104
"getspi", /* SADB_GETSPI */
105
"update", /* SADB_UPDATE */
106
"add", /* SADB_ADD */
107
"delete", /* SADB_DELETE */
108
"get", /* SADB_GET */
109
"acquire", /* SADB_ACQUIRE */
110
"register", /* SADB_REGISTER */
111
"expire", /* SADB_EXPIRE */
112
"flush", /* SADB_FLUSH */
113
"dump", /* SADB_DUMP */
114
"x-promisc", /* SADB_X_PROMISC */
115
"x-pchange", /* SADB_X_PCHANGE */
116
"x-groupsa", /* SADB_X_GRPSA */
117
"x-addflow(eroute)", /* SADB_X_ADDFLOW */
118
"x-delflow(eroute)", /* SADB_X_DELFLOW */
119
"x-debug", /* SADB_X_DEBUG */
123
pfkey_v2_sadb_type_string(int sadb_type)
125
if(sadb_type <= SADB_MAX) {
126
return pfkey_sadb_type_strings[sadb_type];
128
return "unknown-sadb-type";
136
* $Log: pfkey_v2_debug.c,v $
137
* Revision 1.8.4.2 2004/04/16 12:32:56 mcr
138
* erroneously pullup some freeswan->openswan changes that
139
* are really for 2.2.
141
* Revision 1.8.4.1 2004/03/21 05:23:31 mcr
142
* pullup of freeswan->openswan and CR/CERT patches from HEAD
144
* Revision 1.9 2004/03/08 01:59:08 ken
145
* freeswan.h -> openswan.h
147
* Revision 1.8 2003/12/10 01:20:19 mcr
148
* NAT-traversal patches to KLIPS.
150
* Revision 1.7 2002/09/20 05:01:26 rgb
151
* Fixed limit inclusion error in both type and ext string conversion.
153
* Revision 1.6 2002/04/24 07:55:32 mcr
154
* #include patches and Makefiles for post-reorg compilation.
156
* Revision 1.5 2002/04/24 07:36:40 mcr
157
* Moved from ./lib/pfkey_v2_debug.c,v
159
* Revision 1.4 2002/01/29 22:25:36 rgb
160
* Re-add ipsec_kversion.h to keep MALLOC happy.
162
* Revision 1.3 2002/01/29 01:59:09 mcr
163
* removal of kversions.h - sources that needed it now use ipsec_param.h.
164
* updating of IPv6 structures to match latest in6.h version.
165
* removed dead code from openswan.h that also duplicated kversions.h
168
* Revision 1.2 2002/01/20 20:34:50 mcr
169
* added pfkey_v2_sadb_type_string to decode sadb_type to string.
171
* Revision 1.1 2001/11/27 05:30:06 mcr
172
* initial set of debug strings for pfkey debugging.
173
* this will eventually only be included for debug builds.
175
* Revision 1.1 2001/09/21 04:12:03 mcr
176
* first compilable version.
180
* c-file-style: "linux"