1 /* strongSwan netkey 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
15 #include <sys/types.h>
22 #include "../pluto/constants.h"
23 #include "../pluto/defs.h"
24 #include "../pluto/log.h"
29 starter_netkey_init(void)
33 if (stat(PROC_NETKEY
, &stb
) != 0)
35 /* af_key module makes the netkey proc interface visible */
36 if (stat(PROC_MODULES
, &stb
) == 0)
38 ignore_result(system("modprobe -qv af_key"));
42 if (stat(PROC_NETKEY
, &stb
) != 0)
45 DBG_log("kernel appears to lack the native netkey IPsec stack")
51 /* make sure that all required IPsec modules are loaded */
52 if (stat(PROC_MODULES
, &stb
) == 0)
54 ignore_result(system("modprobe -qv ah4"));
55 ignore_result(system("modprobe -qv esp4"));
56 ignore_result(system("modprobe -qv ipcomp"));
57 ignore_result(system("modprobe -qv xfrm4_tunnel"));
58 ignore_result(system("modprobe -qv xfrm_user"));
62 DBG_log("Found netkey IPsec stack")
68 starter_netkey_cleanup(void)
70 hydra
->kernel_interface
->flush_sas(hydra
->kernel_interface
);
71 hydra
->kernel_interface
->flush_policies(hydra
->kernel_interface
);