1 /* strongSwan KLIPS starter
2 * Copyright (C) 2001-2002 Mathieu Lafon - Arkoon Network Security
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 #include <sys/types.h>
23 #include "../pluto/constants.h"
24 #include "../pluto/defs.h"
25 #include "../pluto/log.h"
30 starter_klips_init(void)
34 if (stat(PROC_KLIPS
, &stb
) != 0)
36 /* ipsec module makes the pf_key proc interface visible */
37 if (stat(PROC_MODULES
, &stb
) == 0)
39 ignore_result(system("modprobe -qv ipsec"));
43 if (stat(PROC_KLIPS
, &stb
) != 0)
46 DBG_log("kernel appears to lack the KLIPS IPsec stack")
52 /* load crypto algorithm modules */
53 ignore_result(system("modprobe -qv ipsec_aes"));
54 ignore_result(system("modprobe -qv ipsec_blowfish"));
55 ignore_result(system("modprobe -qv ipsec_sha2"));
58 DBG_log("Found KLIPS IPsec stack")
65 starter_klips_cleanup(void)
67 if (system("type eroute > /dev/null 2>&1") == 0)
69 ignore_result(system("spi --clear"));
70 ignore_result(system("eroute --clear"));
72 else if (system("type setkey > /dev/null 2>&1") == 0)
74 ignore_result(system("setkey -F"));
75 ignore_result(system("setkey -FP"));
79 plog("WARNING: cannot flush IPsec state/policy database");