]>
git.ipfire.org Git - people/ms/strongswan.git/blob - src/libfreeswan/pfkey_v2_debug.c
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.2 2004/03/22 21:53:18 as 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.2 2004/03/22 21:53:18 as
138 * merged alg-0.8.1 branch with HEAD
140 * Revision 1.1.2.1 2004/03/15 22:30:06 as
141 * nat-0.6c patch merged
143 * Revision 1.1 2004/03/15 20:35:26 as
144 * added files from freeswan-2.04-x509-1.5.3
146 * Revision 1.7 2002/09/20 05:01:26 rgb
147 * Fixed limit inclusion error in both type and ext string conversion.
149 * Revision 1.6 2002/04/24 07:55:32 mcr
150 * #include patches and Makefiles for post-reorg compilation.
152 * Revision 1.5 2002/04/24 07:36:40 mcr
153 * Moved from ./lib/pfkey_v2_debug.c,v
155 * Revision 1.4 2002/01/29 22:25:36 rgb
156 * Re-add ipsec_kversion.h to keep MALLOC happy.
158 * Revision 1.3 2002/01/29 01:59:09 mcr
159 * removal of kversions.h - sources that needed it now use ipsec_param.h.
160 * updating of IPv6 structures to match latest in6.h version.
161 * removed dead code from freeswan.h that also duplicated kversions.h
164 * Revision 1.2 2002/01/20 20:34:50 mcr
165 * added pfkey_v2_sadb_type_string to decode sadb_type to string.
167 * Revision 1.1 2001/11/27 05:30:06 mcr
168 * initial set of debug strings for pfkey debugging.
169 * this will eventually only be included for debug builds.
171 * Revision 1.1 2001/09/21 04:12:03 mcr
172 * first compilable version.
176 * c-file-style: "linux"