]> git.ipfire.org Git - people/ms/strongswan.git/blob - linux/net/ipsec/ipsec_init.c
- import of strongswan-2.7.0
[people/ms/strongswan.git] / linux / net / ipsec / ipsec_init.c
1 /*
2 * @(#) Initialization code.
3 * Copyright (C) 1996, 1997 John Ioannidis.
4 * Copyright (C) 1998, 1999, 2000, 2001, 2002 Richard Guy Briggs <rgb@freeswan.org>
5 * 2001 Michael Richardson <mcr@freeswan.org>
6 *
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>.
11 *
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
15 * for more details.
16 *
17 * /proc system code was split out into ipsec_proc.c after rev. 1.70.
18 *
19 */
20
21 char ipsec_init_c_version[] = "RCSID $Id: ipsec_init.c,v 1.3 2004/06/13 19:57:49 as Exp $";
22
23 #include <linux/config.h>
24 #include <linux/version.h>
25 #include <linux/module.h>
26 #include <linux/kernel.h> /* printk() */
27
28 #include "freeswan/ipsec_param.h"
29
30 #ifdef MALLOC_SLAB
31 # include <linux/slab.h> /* kmalloc() */
32 #else /* MALLOC_SLAB */
33 # include <linux/malloc.h> /* kmalloc() */
34 #endif /* MALLOC_SLAB */
35 #include <linux/errno.h> /* error codes */
36 #include <linux/types.h> /* size_t */
37 #include <linux/interrupt.h> /* mark_bh */
38
39 #include <linux/netdevice.h> /* struct device, and other headers */
40 #include <linux/etherdevice.h> /* eth_type_trans */
41 #include <linux/ip.h> /* struct iphdr */
42 #include <linux/in.h> /* struct sockaddr_in */
43 #include <linux/skbuff.h>
44 #include <linux/random.h> /* get_random_bytes() */
45 #include <freeswan.h>
46
47 #ifdef SPINLOCK
48 # ifdef SPINLOCK_23
49 # include <linux/spinlock.h> /* *lock* */
50 # else /* 23_SPINLOCK */
51 # include <asm/spinlock.h> /* *lock* */
52 # endif /* 23_SPINLOCK */
53 #endif /* SPINLOCK */
54
55 #ifdef NET_21
56 # include <asm/uaccess.h>
57 # include <linux/in6.h>
58 #endif /* NET_21 */
59
60 #include <asm/checksum.h>
61 #include <net/ip.h>
62
63 #ifdef CONFIG_PROC_FS
64 # include <linux/proc_fs.h>
65 #endif /* CONFIG_PROC_FS */
66
67 #ifdef NETLINK_SOCK
68 # include <linux/netlink.h>
69 #else
70 # include <net/netlink.h>
71 #endif
72
73 #include "freeswan/radij.h"
74
75 #include "freeswan/ipsec_life.h"
76 #include "freeswan/ipsec_stats.h"
77 #include "freeswan/ipsec_sa.h"
78
79 #include "freeswan/ipsec_encap.h"
80 #include "freeswan/ipsec_radij.h"
81 #include "freeswan/ipsec_xform.h"
82 #include "freeswan/ipsec_tunnel.h"
83
84 #include "freeswan/ipsec_rcv.h"
85 #include "freeswan/ipsec_ah.h"
86 #include "freeswan/ipsec_esp.h"
87
88 #ifdef CONFIG_IPSEC_IPCOMP
89 # include "freeswan/ipcomp.h"
90 #endif /* CONFIG_IPSEC_IPCOMP */
91
92 #include "freeswan/ipsec_proto.h"
93 #include "freeswan/ipsec_alg.h"
94
95 #include <pfkeyv2.h>
96 #include <pfkey.h>
97
98 #if !defined(CONFIG_IPSEC_ESP) && !defined(CONFIG_IPSEC_AH)
99 #error "kernel configuration must include ESP or AH"
100 #endif
101
102 /*
103 * seems to be present in 2.4.10 (Linus), but also in some RH and other
104 * distro kernels of a lower number.
105 */
106 #ifdef MODULE_LICENSE
107 MODULE_LICENSE("GPL");
108 #endif
109
110 #ifdef CONFIG_IPSEC_DEBUG
111 int debug_eroute = 0;
112 int debug_spi = 0;
113 int debug_netlink = 0;
114 #endif /* CONFIG_IPSEC_DEBUG */
115
116 struct prng ipsec_prng;
117
118 extern int ipsec_device_event(struct notifier_block *dnot, unsigned long event, void *ptr);
119 /*
120 * the following structure is required so that we receive
121 * event notifications when network devices are enabled and
122 * disabled (ifconfig up and down).
123 */
124 static struct notifier_block ipsec_dev_notifier={
125 ipsec_device_event,
126 NULL,
127 0
128 };
129
130 #ifdef CONFIG_SYSCTL
131 extern int ipsec_sysctl_register(void);
132 extern void ipsec_sysctl_unregister(void);
133 #endif
134
135 static inline int
136 freeswan_inet_add_protocol(struct inet_protocol *prot, unsigned protocol)
137 {
138 #ifdef NETDEV_25
139 return inet_add_protocol(prot, protocol);
140 #else
141 inet_add_protocol(prot);
142 return 0;
143 #endif
144 }
145
146 static inline int
147 freeswan_inet_del_protocol(struct inet_protocol *prot, unsigned protocol)
148 {
149 #ifdef NETDEV_25
150 return inet_del_protocol(prot, protocol);
151 #else
152 inet_del_protocol(prot);
153 return 0;
154 #endif
155 }
156
157 /* void */
158 int
159 ipsec_init(void)
160 {
161 int error = 0;
162 unsigned char seed[256];
163 #ifdef CONFIG_IPSEC_ENC_3DES
164 extern int des_check_key;
165
166 /* turn off checking of keys */
167 des_check_key=0;
168 #endif /* CONFIG_IPSEC_ENC_3DES */
169
170 KLIPS_PRINT(1, "klips_info:ipsec_init: "
171 "KLIPS startup, FreeS/WAN IPSec version: %s\n",
172 ipsec_version_code());
173
174 error |= ipsec_proc_init();
175
176 #ifdef SPINLOCK
177 ipsec_sadb.sadb_lock = SPIN_LOCK_UNLOCKED;
178 #else /* SPINLOCK */
179 ipsec_sadb.sadb_lock = 0;
180 #endif /* SPINLOCK */
181
182 #ifndef SPINLOCK
183 tdb_lock.lock = 0;
184 eroute_lock.lock = 0;
185 #endif /* !SPINLOCK */
186
187 error |= ipsec_sadb_init();
188 error |= ipsec_radijinit();
189
190 error |= pfkey_init();
191
192 error |= register_netdevice_notifier(&ipsec_dev_notifier);
193
194 #ifdef CONFIG_IPSEC_ESP
195 freeswan_inet_add_protocol(&esp_protocol, IPPROTO_ESP);
196 #endif /* CONFIG_IPSEC_ESP */
197
198 #ifdef CONFIG_IPSEC_AH
199 freeswan_inet_add_protocol(&ah_protocol, IPPROTO_AH);
200 #endif /* CONFIG_IPSEC_AH */
201
202 /* we never actually link IPCOMP to the stack */
203 #ifdef IPCOMP_USED_ALONE
204 #ifdef CONFIG_IPSEC_IPCOMP
205 freeswan_inet_add_protocol(&comp_protocol, IPPROTO_COMP);
206 #endif /* CONFIG_IPSEC_IPCOMP */
207 #endif
208
209 error |= ipsec_tunnel_init_devices();
210
211
212 #ifdef CONFIG_SYSCTL
213 error |= ipsec_sysctl_register();
214 #endif
215
216 #ifdef CONFIG_IPSEC_ALG
217 ipsec_alg_init();
218 #endif
219
220 get_random_bytes((void *)seed, sizeof(seed));
221 prng_init(&ipsec_prng, seed, sizeof(seed));
222
223 return error;
224 }
225
226
227 /* void */
228 int
229 ipsec_cleanup(void)
230 {
231 int error = 0;
232
233 #ifdef CONFIG_SYSCTL
234 ipsec_sysctl_unregister();
235 #endif
236 KLIPS_PRINT(debug_netlink, /* debug_tunnel & DB_TN_INIT, */
237 "klips_debug:ipsec_cleanup: "
238 "calling ipsec_tunnel_cleanup_devices.\n");
239 error |= ipsec_tunnel_cleanup_devices();
240
241 KLIPS_PRINT(debug_netlink, "called ipsec_tunnel_cleanup_devices");
242
243 /* we never actually link IPCOMP to the stack */
244 #ifdef IPCOMP_USED_ALONE
245 #ifdef CONFIG_IPSEC_IPCOMP
246 if (freeswan_inet_del_protocol(&comp_protocol, IPPROTO_COMP) < 0)
247 printk(KERN_INFO "klips_debug:ipsec_cleanup: "
248 "comp close: can't remove protocol\n");
249 #endif /* CONFIG_IPSEC_IPCOMP */
250 #endif /* IPCOMP_USED_ALONE */
251
252 #ifdef CONFIG_IPSEC_AH
253 if (freeswan_inet_del_protocol(&ah_protocol, IPPROTO_AH) < 0)
254 printk(KERN_INFO "klips_debug:ipsec_cleanup: "
255 "ah close: can't remove protocol\n");
256 #endif /* CONFIG_IPSEC_AH */
257
258 #ifdef CONFIG_IPSEC_ESP
259 if (freeswan_inet_del_protocol(&esp_protocol, IPPROTO_ESP) < 0)
260 printk(KERN_INFO "klips_debug:ipsec_cleanup: "
261 "esp close: can't remove protocol\n");
262 #endif /* CONFIG_IPSEC_ESP */
263
264 error |= unregister_netdevice_notifier(&ipsec_dev_notifier);
265
266 KLIPS_PRINT(debug_netlink, /* debug_tunnel & DB_TN_INIT, */
267 "klips_debug:ipsec_cleanup: "
268 "calling ipsec_sadb_cleanup.\n");
269 error |= ipsec_sadb_cleanup(0);
270 error |= ipsec_sadb_free();
271
272 KLIPS_PRINT(debug_netlink, /* debug_tunnel & DB_TN_INIT, */
273 "klips_debug:ipsec_cleanup: "
274 "calling ipsec_radijcleanup.\n");
275 error |= ipsec_radijcleanup();
276
277 KLIPS_PRINT(debug_pfkey, /* debug_tunnel & DB_TN_INIT, */
278 "klips_debug:ipsec_cleanup: "
279 "calling pfkey_cleanup.\n");
280 error |= pfkey_cleanup();
281
282 ipsec_proc_cleanup();
283
284 prng_final(&ipsec_prng);
285
286 return error;
287 }
288
289 #ifdef MODULE
290 int
291 init_module(void)
292 {
293 int error = 0;
294
295 error |= ipsec_init();
296
297 return error;
298 }
299
300 int
301 cleanup_module(void)
302 {
303 int error = 0;
304
305 KLIPS_PRINT(debug_netlink, /* debug_tunnel & DB_TN_INIT, */
306 "klips_debug:cleanup_module: "
307 "calling ipsec_cleanup.\n");
308
309 error |= ipsec_cleanup();
310
311 KLIPS_PRINT(1, "klips_info:cleanup_module: "
312 "ipsec module unloaded.\n");
313
314 return error;
315 }
316 #endif /* MODULE */
317
318 /*
319 * $Log: ipsec_init.c,v $
320 * Revision 1.3 2004/06/13 19:57:49 as
321 * removed inclusion of ipsec_netlink.h
322 *
323 * Revision 1.2 2004/03/22 21:53:19 as
324 * merged alg-0.8.1 branch with HEAD
325 *
326 * Revision 1.1.4.1 2004/03/16 09:48:19 as
327 * alg-0.8.1rc12 patch merged
328 *
329 * Revision 1.1 2004/03/15 20:35:26 as
330 * added files from freeswan-2.04-x509-1.5.3
331 *
332 * Revision 1.89 2003/07/31 22:47:16 mcr
333 * preliminary (untested by FS-team) 2.5 patches.
334 *
335 * Revision 1.88 2003/06/22 20:05:36 mcr
336 * clarified why IPCOMP was not being registered, and put a new
337 * #ifdef in rather than #if 0.
338 *
339 * Revision 1.87 2002/09/20 15:40:51 rgb
340 * Added a lock to the global ipsec_sadb struct for future use.
341 * Split ipsec_sadb_cleanup from new funciton ipsec_sadb_free to avoid problem
342 * of freeing newly created structures when clearing the reftable upon startup
343 * to start from a known state.
344 *
345 * Revision 1.86 2002/08/15 18:39:15 rgb
346 * Move ipsec_prng outside debug code.
347 *
348 * Revision 1.85 2002/05/14 02:35:29 rgb
349 * Change reference to tdb to ipsa.
350 *
351 * Revision 1.84 2002/04/24 07:55:32 mcr
352 * #include patches and Makefiles for post-reorg compilation.
353 *
354 * Revision 1.83 2002/04/24 07:36:28 mcr
355 * Moved from ./klips/net/ipsec/ipsec_init.c,v
356 *
357 * Revision 1.82 2002/04/20 00:12:25 rgb
358 * Added esp IV CBC attack fix, disabled.
359 *
360 * Revision 1.81 2002/04/09 16:13:32 mcr
361 * switch license to straight GPL.
362 *
363 * Revision 1.80 2002/03/24 07:34:08 rgb
364 * Sanity check for at least one of AH or ESP configured.
365 *
366 * Revision 1.79 2002/02/05 22:55:15 mcr
367 * added MODULE_LICENSE declaration.
368 * This macro does not appear in all kernel versions (see comment).
369 *
370 * Revision 1.78 2002/01/29 17:17:55 mcr
371 * moved include of ipsec_param.h to after include of linux/kernel.h
372 * otherwise, it seems that some option that is set in ipsec_param.h
373 * screws up something subtle in the include path to kernel.h, and
374 * it complains on the snprintf() prototype.
375 *
376 * Revision 1.77 2002/01/29 04:00:51 mcr
377 * more excise of kversions.h header.
378 *
379 * Revision 1.76 2002/01/29 02:13:17 mcr
380 * introduction of ipsec_kversion.h means that include of
381 * ipsec_param.h must preceed any decisions about what files to
382 * include to deal with differences in kernel source.
383 *
384 * Revision 1.75 2001/11/26 09:23:48 rgb
385 * Merge MCR's ipsec_sa, eroute, proc and struct lifetime changes.
386 *
387 * Revision 1.74 2001/11/22 05:44:11 henry
388 * new version stuff
389 *
390 * Revision 1.71.2.2 2001/10/22 20:51:00 mcr
391 * explicitely set des_check_key.
392 *
393 * Revision 1.71.2.1 2001/09/25 02:19:39 mcr
394 * /proc manipulation code moved to new ipsec_proc.c
395 *
396 * Revision 1.73 2001/11/06 19:47:17 rgb
397 * Changed lifetime_packets to uint32 from uint64.
398 *
399 * Revision 1.72 2001/10/18 04:45:19 rgb
400 * 2.4.9 kernel deprecates linux/malloc.h in favour of linux/slab.h,
401 * lib/freeswan.h version macros moved to lib/kversions.h.
402 * Other compiler directive cleanups.
403 *
404 * Revision 1.71 2001/09/20 15:32:45 rgb
405 * Minor pfkey lifetime fixes.
406 *
407 * Revision 1.70 2001/07/06 19:51:21 rgb
408 * Added inbound policy checking code for IPIP SAs.
409 *
410 * Revision 1.69 2001/06/14 19:33:26 rgb
411 * Silence startup message for console, but allow it to be logged.
412 * Update copyright date.
413 *
414 * Revision 1.68 2001/05/29 05:14:36 rgb
415 * Added PMTU to /proc/net/ipsec_tncfg output. See 'man 5 ipsec_tncfg'.
416 *
417 * Revision 1.67 2001/05/04 16:34:52 rgb
418 * Rremove erroneous checking of return codes for proc_net_* in 2.4.
419 *
420 * Revision 1.66 2001/05/03 19:40:34 rgb
421 * Check error return codes in startup and shutdown.
422 *
423 * Revision 1.65 2001/02/28 05:03:27 rgb
424 * Clean up and rationalise startup messages.
425 *
426 * Revision 1.64 2001/02/27 22:24:53 rgb
427 * Re-formatting debug output (line-splitting, joining, 1arg/line).
428 * Check for satoa() return codes.
429 *
430 * Revision 1.63 2000/11/29 20:14:06 rgb
431 * Add src= to the output of /proc/net/ipsec_spi and delete dst from IPIP.
432 *
433 * Revision 1.62 2000/11/06 04:31:24 rgb
434 * Ditched spin_lock_irqsave in favour of spin_lock_bh.
435 * Fixed longlong for pre-2.4 kernels (Svenning).
436 * Add Svenning's adaptive content compression.
437 * Disabled registration of ipcomp handler.
438 *
439 * Revision 1.61 2000/10/11 13:37:54 rgb
440 * #ifdef out debug print that causes proc/net/ipsec_version to oops.
441 *
442 * Revision 1.60 2000/09/20 03:59:01 rgb
443 * Change static info functions to DEBUG_NO_STATIC to reveal function names
444 * in oopsen.
445 *
446 * Revision 1.59 2000/09/16 01:06:26 rgb
447 * Added cast of var to silence compiler warning about long fed to int
448 * format.
449 *
450 * Revision 1.58 2000/09/15 11:37:01 rgb
451 * Merge in heavily modified Svenning Soerensen's <svenning@post5.tele.dk>
452 * IPCOMP zlib deflate code.
453 *
454 * Revision 1.57 2000/09/12 03:21:50 rgb
455 * Moved radij_c_version printing to ipsec_version_get_info().
456 * Reformatted ipsec_version_get_info().
457 * Added sysctl_{,un}register() calls.
458 *
459 * Revision 1.56 2000/09/08 19:16:50 rgb
460 * Change references from DEBUG_IPSEC to CONFIG_IPSEC_DEBUG.
461 * Removed all references to CONFIG_IPSEC_PFKEYv2.
462 *
463 * Revision 1.55 2000/08/30 05:19:03 rgb
464 * Cleaned up no longer used spi_next, netlink register/unregister, other
465 * minor cleanup.
466 * Removed cruft replaced by TDB_XFORM_NAME.
467 * Removed all the rest of the references to tdb_spi, tdb_proto, tdb_dst.
468 * Moved debug version strings to printk when /proc/net/ipsec_version is
469 * called.
470 *
471 * Revision 1.54 2000/08/20 18:31:05 rgb
472 * Changed cosmetic alignment in spi_info.
473 * Changed addtime and usetime to use actual value which is relative
474 * anyways, as intended. (Momchil)
475 *
476 * Revision 1.53 2000/08/18 17:37:03 rgb
477 * Added an (int) cast to shut up the compiler...
478 *
479 * Revision 1.52 2000/08/01 14:51:50 rgb
480 * Removed _all_ remaining traces of DES.
481 *
482 * Revision 1.51 2000/07/25 20:41:22 rgb
483 * Removed duplicate parameter in spi_getinfo.
484 *
485 * Revision 1.50 2000/07/17 03:21:45 rgb
486 * Removed /proc/net/ipsec_spinew.
487 *
488 * Revision 1.49 2000/06/28 05:46:51 rgb
489 * Renamed ivlen to iv_bits for consistency.
490 * Changed output of add and use times to be relative to now.
491 *
492 * Revision 1.48 2000/05/11 18:26:10 rgb
493 * Commented out calls to netlink_attach/detach to avoid activating netlink
494 * in the kenrel config.
495 *
496 * Revision 1.47 2000/05/10 22:35:26 rgb
497 * Comment out most of the startup version information.
498 *
499 * Revision 1.46 2000/03/22 16:15:36 rgb
500 * Fixed renaming of dev_get (MB).
501 *
502 * Revision 1.45 2000/03/16 06:40:48 rgb
503 * Hardcode PF_KEYv2 support.
504 *
505 * Revision 1.44 2000/01/22 23:19:20 rgb
506 * Simplified code to use existing macro TDB_XFORM_NAME().
507 *
508 * Revision 1.43 2000/01/21 06:14:04 rgb
509 * Print individual stats only if non-zero.
510 * Removed 'bits' from each keylength for brevity.
511 * Shortened lifetimes legend for brevity.
512 * Changed wording from 'last_used' to the clearer 'idle'.
513 *
514 * Revision 1.42 1999/12/31 14:57:19 rgb
515 * MB fix for new dummy-less proc_get_info in 2.3.35.
516 *
517 * Revision 1.41 1999/11/23 23:04:03 rgb
518 * Use provided macro ADDRTOA_BUF instead of hardcoded value.
519 * Sort out pfkey and freeswan headers, putting them in a library path.
520 *
521 * Revision 1.40 1999/11/18 18:47:01 rgb
522 * Added dynamic proc registration for 2.3.25+.
523 * Changed all device registrations for static linking to
524 * dynamic to reduce the number and size of patches.
525 * Changed all protocol registrations for static linking to
526 * dynamic to reduce the number and size of patches.
527 *
528 * Revision 1.39 1999/11/18 04:12:07 rgb
529 * Replaced all kernel version macros to shorter, readable form.
530 * Added Marc Boucher's 2.3.25 proc patches.
531 * Converted all PROC_FS entries to dynamic to reduce kernel patching.
532 * Added CONFIG_PROC_FS compiler directives in case it is shut off.
533 *
534 * Revision 1.38 1999/11/17 15:53:38 rgb
535 * Changed all occurrences of #include "../../../lib/freeswan.h"
536 * to #include <freeswan.h> which works due to -Ilibfreeswan in the
537 * klips/net/ipsec/Makefile.
538 *
539 * Revision 1.37 1999/10/16 04:23:06 rgb
540 * Add stats for replaywin_errs, replaywin_max_sequence_difference,
541 * authentication errors, encryption size errors, encryption padding
542 * errors, and time since last packet.
543 *
544 * Revision 1.36 1999/10/16 00:30:47 rgb
545 * Added SA lifetime counting.
546 *
547 * Revision 1.35 1999/10/15 22:14:00 rgb
548 * Clean out cruft.
549 *
550 * Revision 1.34 1999/10/03 18:46:28 rgb
551 * Spinlock fixes for 2.0.xx and 2.3.xx.
552 *
553 * Revision 1.33 1999/10/01 17:08:10 rgb
554 * Disable spinlock init.
555 *
556 * Revision 1.32 1999/10/01 16:22:24 rgb
557 * Switch from assignment init. to functional init. of spinlocks.
558 *
559 * Revision 1.31 1999/10/01 15:44:52 rgb
560 * Move spinlock header include to 2.1> scope.
561 *
562 * Revision 1.30 1999/10/01 00:00:16 rgb
563 * Added eroute structure locking.
564 * Added tdb structure locking.
565 * Minor formatting changes.
566 * Add call to initialize tdb hash table.
567 *
568 * Revision 1.29 1999/09/23 20:22:40 rgb
569 * Enable, tidy and fix network notifier code.
570 *
571 * Revision 1.28 1999/09/18 11:39:56 rgb
572 * Start to add (disabled) netdevice notifier code.
573 *
574 * Revision 1.27 1999/08/28 08:24:47 rgb
575 * Add compiler directives to compile cleanly without debugging.
576 *
577 * Revision 1.26 1999/08/06 16:03:22 rgb
578 * Correct error messages on failure to unload /proc entries.
579 *
580 * Revision 1.25 1999/08/03 17:07:25 rgb
581 * Report device MTU, not private MTU.
582 *
583 * Revision 1.24 1999/05/25 22:24:37 rgb
584 * /PROC/NET/ipsec* init problem fix.
585 *
586 * Revision 1.23 1999/05/25 02:16:38 rgb
587 * Make modular proc_fs entries dynamic and fix for 2.2.x.
588 *
589 * Revision 1.22 1999/05/09 03:25:35 rgb
590 * Fix bug introduced by 2.2 quick-and-dirty patch.
591 *
592 * Revision 1.21 1999/05/05 22:02:30 rgb
593 * Add a quick and dirty port to 2.2 kernels by Marc Boucher <marc@mbsi.ca>.
594 *
595 * Revision 1.20 1999/04/29 15:15:50 rgb
596 * Fix undetected iv_len reporting bug.
597 * Add sanity checking for null pointer to private data space.
598 * Add return values to init and cleanup functions.
599 *
600 * Revision 1.19 1999/04/27 19:24:44 rgb
601 * Added /proc/net/ipsec_klipsdebug support for reading the current debug
602 * settings.
603 * Instrument module load/init/unload.
604 *
605 * Revision 1.18 1999/04/15 15:37:24 rgb
606 * Forward check changes from POST1_00 branch.
607 *
608 * Revision 1.15.2.3 1999/04/13 20:29:19 rgb
609 * /proc/net/ipsec_* cleanup.
610 *
611 * Revision 1.15.2.2 1999/04/02 04:28:23 rgb
612 * /proc/net/ipsec_* formatting enhancements.
613 *
614 * Revision 1.15.2.1 1999/03/30 17:08:33 rgb
615 * Add pfkey initialisation.
616 *
617 * Revision 1.17 1999/04/11 00:28:57 henry
618 * GPL boilerplate
619 *
620 * Revision 1.16 1999/04/06 04:54:25 rgb
621 * Fix/Add RCSID Id: and Log: bits to make PHMDs happy. This includes
622 * patch shell fixes.
623 *
624 * Revision 1.15 1999/02/24 20:15:07 rgb
625 * Update output format.
626 *
627 * Revision 1.14 1999/02/17 16:49:39 rgb
628 * Convert DEBUG_IPSEC to KLIPS_PRINT
629 * Ditch NET_IPIP dependancy.
630 *
631 * Revision 1.13 1999/01/26 02:06:37 rgb
632 * Remove ah/esp switching on include files.
633 * Removed CONFIG_IPSEC_ALGO_SWITCH macro.
634 * Removed dead code.
635 * Remove references to INET_GET_PROTOCOL.
636 *
637 * Revision 1.12 1999/01/22 06:19:18 rgb
638 * Cruft clean-out.
639 * 64-bit clean-up.
640 * Added algorithm switch code.
641 *
642 * Revision 1.11 1998/12/01 05:54:53 rgb
643 * Cleanup and order debug version output.
644 *
645 * Revision 1.10 1998/11/30 13:22:54 rgb
646 * Rationalised all the klips kernel file headers. They are much shorter
647 * now and won't conflict under RH5.2.
648 *
649 * Revision 1.9 1998/11/10 05:35:13 rgb
650 * Print direction in/out flag from /proc/net/ipsec_spi.
651 *
652 * Revision 1.8 1998/10/27 13:48:10 rgb
653 * Cleaned up /proc/net/ipsec_* filesystem for easy parsing by scripts.
654 * Fixed less(1) truncated output bug.
655 * Code clean-up.
656 *
657 * Revision 1.7 1998/10/22 06:43:16 rgb
658 * Convert to use satoa for printk.
659 *
660 * Revision 1.6 1998/10/19 14:24:35 rgb
661 * Added inclusion of freeswan.h.
662 *
663 * Revision 1.5 1998/10/09 04:43:35 rgb
664 * Added 'klips_debug' prefix to all klips printk debug statements.
665 *
666 * Revision 1.4 1998/07/27 21:50:22 rgb
667 * Not necessary to traverse mask tree for /proc/net/ipsec_eroute.
668 *
669 * Revision 1.3 1998/06/25 19:51:20 rgb
670 * Clean up #endif comments.
671 * Shift debugging comment control for procfs to debug_tunnel.
672 * Make proc_dir_entries visible to rest of kernel for static link.
673 * Replace hardwired fileperms with macros.
674 * Use macros for procfs inode numbers.
675 * Rearrange initialisations between ipsec_init and module_init as appropriate
676 * for static loading.
677 *
678 * Revision 1.2 1998/06/23 02:55:43 rgb
679 * Slightly quieted init-time messages.
680 * Re-introduced inet_add_protocol after it mysteriously disappeared...
681 * Check for and warn of absence of IPIP protocol on install of module.
682 * Move tdbcleanup to ipsec_xform.c.
683 *
684 * Revision 1.10 1998/06/18 21:29:04 henry
685 * move sources from klips/src to klips/net/ipsec, to keep stupid kernel
686 * build scripts happier in presence of symbolic links
687 *
688 * Revision 1.9 1998/06/14 23:49:40 rgb
689 * Clarify version reporting on module loading.
690 *
691 * Revision 1.8 1998/06/11 05:54:23 rgb
692 * Added /proc/net/ipsec_version to report freeswan and transform versions.
693 * Added /proc/net/ipsec_spinew to generate new and unique spi's..
694 * Fixed /proc/net/ipsec_tncfg bug.
695 *
696 * Revision 1.7 1998/05/25 20:23:13 rgb
697 * proc_register changed to dynamic registration to avoid arbitrary inode
698 * numbers.
699 *
700 * Implement memory recovery from tdb and eroute tables.
701 *
702 * Revision 1.6 1998/05/21 13:08:58 rgb
703 * Rewrote procinfo subroutines to avoid *bad things* when more that 3k of
704 * information is available for printout.
705 *
706 * Revision 1.5 1998/05/18 21:29:48 rgb
707 * Cleaned up /proc/net/ipsec_* output, including a title line, algorithm
708 * names instead of numbers, standard format for numerical output base,
709 * whitespace for legibility, and the names themselves for consistency.
710 *
711 * Added /proc/net/ipsec_spigrp and /proc/net/ipsec_tncfg.
712 *
713 * Revision 1.4 1998/04/30 15:42:24 rgb
714 * Silencing attach for normal operations with #ifdef IPSEC_DEBUG.
715 *
716 * Revision 1.3 1998/04/21 21:28:58 rgb
717 * Rearrange debug switches to change on the fly debug output from user
718 * space. Only kernel changes checked in at this time. radij.c was also
719 * changed to temporarily remove buggy debugging code in rj_delete causing
720 * an OOPS and hence, netlink device open errors.
721 *
722 * Revision 1.2 1998/04/12 22:03:22 rgb
723 * Updated ESP-3DES-HMAC-MD5-96,
724 * ESP-DES-HMAC-MD5-96,
725 * AH-HMAC-MD5-96,
726 * AH-HMAC-SHA1-96 since Henry started freeswan cvs repository
727 * from old standards (RFC182[5-9] to new (as of March 1998) drafts.
728 *
729 * Fixed eroute references in /proc/net/ipsec*.
730 *
731 * Started to patch module unloading memory leaks in ipsec_netlink and
732 * radij tree unloading.
733 *
734 * Revision 1.1 1998/04/09 03:06:05 henry
735 * sources moved up from linux/net/ipsec
736 *
737 * Revision 1.1.1.1 1998/04/08 05:35:02 henry
738 * RGB's ipsec-0.8pre2.tar.gz ipsec-0.8
739 *
740 * Revision 0.4 1997/01/15 01:28:15 ji
741 * No changes.
742 *
743 * Revision 0.3 1996/11/20 14:39:04 ji
744 * Fixed problem with node names of /proc/net entries.
745 * Other minor cleanups.
746 * Rationalized debugging code.
747 *
748 * Revision 0.2 1996/11/02 00:18:33 ji
749 * First limited release.
750 *
751 * Local variables:
752 * c-file-style: "linux"
753 * End:
754 *
755 */