Moved kernel interface to libhydra.

This commit is contained in:
Tobias Brunner
2010-09-02 19:01:25 +02:00
parent 9f166d9ac2
commit 6f449d2efd
16 changed files with 61 additions and 60 deletions
-4
View File
@@ -41,10 +41,6 @@ encoding/payloads/ts_payload.c encoding/payloads/ts_payload.h \
encoding/payloads/unknown_payload.c encoding/payloads/unknown_payload.h \ encoding/payloads/unknown_payload.c encoding/payloads/unknown_payload.h \
encoding/payloads/vendor_id_payload.c encoding/payloads/vendor_id_payload.h \ encoding/payloads/vendor_id_payload.c encoding/payloads/vendor_id_payload.h \
kernel/kernel_handler.c kernel/kernel_handler.h \ kernel/kernel_handler.c kernel/kernel_handler.h \
kernel/kernel_interface.c kernel/kernel_interface.h \
kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
kernel/kernel_net.h \
kernel/kernel_listener.h \
network/packet.c network/packet.h \ network/packet.c network/packet.h \
network/receiver.c network/receiver.h \ network/receiver.c network/receiver.h \
network/sender.c network/sender.h \ network/sender.c network/sender.h \
-4
View File
@@ -39,10 +39,6 @@ encoding/payloads/ts_payload.c encoding/payloads/ts_payload.h \
encoding/payloads/unknown_payload.c encoding/payloads/unknown_payload.h \ encoding/payloads/unknown_payload.c encoding/payloads/unknown_payload.h \
encoding/payloads/vendor_id_payload.c encoding/payloads/vendor_id_payload.h \ encoding/payloads/vendor_id_payload.c encoding/payloads/vendor_id_payload.h \
kernel/kernel_handler.c kernel/kernel_handler.h \ kernel/kernel_handler.c kernel/kernel_handler.h \
kernel/kernel_interface.c kernel/kernel_interface.h \
kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
kernel/kernel_net.h \
kernel/kernel_listener.h \
network/packet.c network/packet.h \ network/packet.c network/packet.h \
network/receiver.c network/receiver.h \ network/receiver.c network/receiver.h \
network/sender.c network/sender.h \ network/sender.c network/sender.h \
+3 -31
View File
@@ -25,8 +25,6 @@
typedef enum action_t action_t; typedef enum action_t action_t;
typedef enum ipcomp_transform_t ipcomp_transform_t; typedef enum ipcomp_transform_t ipcomp_transform_t;
typedef struct lifetime_cfg_t lifetime_cfg_t;
typedef struct mark_t mark_t;
typedef struct child_cfg_t child_cfg_t; typedef struct child_cfg_t child_cfg_t;
#include <library.h> #include <library.h>
@@ -67,32 +65,6 @@ enum ipcomp_transform_t {
*/ */
extern enum_name_t *ipcomp_transform_names; extern enum_name_t *ipcomp_transform_names;
/**
* A lifetime_cfg_t defines the lifetime limits of a CHILD_SA.
*
* Set any of these values to 0 to ignore.
*/
struct lifetime_cfg_t {
struct {
/** Limit before the CHILD_SA gets invalid. */
u_int64_t life;
/** Limit before the CHILD_SA gets rekeyed. */
u_int64_t rekey;
/** The range of a random value subtracted from rekey. */
u_int64_t jitter;
} time, bytes, packets;
};
/**
* A mark_t defines an optional mark in a CHILD_SA.
*/
struct mark_t {
/** Mark value */
u_int32_t value;
/** Mark mask */
u_int32_t mask;
};
/** /**
* A child_cfg_t defines the config template for a CHILD_SA. * A child_cfg_t defines the config template for a CHILD_SA.
* *
@@ -238,7 +210,7 @@ struct child_cfg_t {
* Check whether IPComp should be used, if the other peer supports it. * Check whether IPComp should be used, if the other peer supports it.
* *
* @return TRUE, if IPComp should be used * @return TRUE, if IPComp should be used
* FALSE, otherwise * FALSE, otherwise
*/ */
bool (*use_ipcomp)(child_cfg_t *this); bool (*use_ipcomp)(child_cfg_t *this);
@@ -277,7 +249,7 @@ struct child_cfg_t {
* Check whether IPsec transport SA should be set up in proxy mode * Check whether IPsec transport SA should be set up in proxy mode
* *
* @return TRUE, if proxy mode should be used * @return TRUE, if proxy mode should be used
* FALSE, otherwise * FALSE, otherwise
*/ */
bool (*use_proxy_mode)(child_cfg_t *this); bool (*use_proxy_mode)(child_cfg_t *this);
@@ -285,7 +257,7 @@ struct child_cfg_t {
* Check whether IPsec policies should be installed in the kernel * Check whether IPsec policies should be installed in the kernel
* *
* @return TRUE, if IPsec kernel policies should be installed * @return TRUE, if IPsec kernel policies should be installed
* FALSE, otherwise * FALSE, otherwise
*/ */
bool (*install_policy)(child_cfg_t *this); bool (*install_policy)(child_cfg_t *this);
+2 -4
View File
@@ -115,10 +115,9 @@ static void destroy(private_daemon_t *this)
#ifdef CAPABILITIES_LIBCAP #ifdef CAPABILITIES_LIBCAP
cap_free(this->caps); cap_free(this->caps);
#endif /* CAPABILITIES_LIBCAP */ #endif /* CAPABILITIES_LIBCAP */
DESTROY_IF(this->kernel_handler);
DESTROY_IF(this->public.traps); DESTROY_IF(this->public.traps);
DESTROY_IF(this->public.ike_sa_manager); DESTROY_IF(this->public.ike_sa_manager);
DESTROY_IF(this->kernel_handler);
DESTROY_IF(this->public.kernel_interface);
DESTROY_IF(this->public.controller); DESTROY_IF(this->public.controller);
DESTROY_IF(this->public.eap); DESTROY_IF(this->public.eap);
DESTROY_IF(this->public.sim); DESTROY_IF(this->public.sim);
@@ -368,10 +367,9 @@ METHOD(daemon_t, initialize, bool,
this->public.eap = eap_manager_create(); this->public.eap = eap_manager_create();
this->public.sim = sim_manager_create(); this->public.sim = sim_manager_create();
this->public.backends = backend_manager_create(); this->public.backends = backend_manager_create();
this->public.kernel_interface = kernel_interface_create();
this->kernel_handler = kernel_handler_create();
this->public.socket = socket_manager_create(); this->public.socket = socket_manager_create();
this->public.traps = trap_manager_create(); this->public.traps = trap_manager_create();
this->kernel_handler = kernel_handler_create();
/* load plugins, further infrastructure may need it */ /* load plugins, further infrastructure may need it */
if (!lib->plugins->load(lib->plugins, NULL, if (!lib->plugins->load(lib->plugins, NULL,
+1 -7
View File
@@ -37,7 +37,7 @@
* @defgroup payloads payloads * @defgroup payloads payloads
* @ingroup encoding * @ingroup encoding
* *
* @defgroup kernel kernel * @defgroup ckernel kernel
* @ingroup libcharon * @ingroup libcharon
* *
* @defgroup network network * @defgroup network network
@@ -140,7 +140,6 @@ typedef struct daemon_t daemon_t;
#include <network/sender.h> #include <network/sender.h>
#include <network/receiver.h> #include <network/receiver.h>
#include <network/socket_manager.h> #include <network/socket_manager.h>
#include <kernel/kernel_interface.h>
#include <control/controller.h> #include <control/controller.h>
#include <bus/bus.h> #include <bus/bus.h>
#include <bus/listeners/file_logger.h> #include <bus/listeners/file_logger.h>
@@ -221,11 +220,6 @@ struct daemon_t {
*/ */
linked_list_t *sys_loggers; linked_list_t *sys_loggers;
/**
* Kernel Interface to communicate with kernel
*/
kernel_interface_t *kernel_interface;
/** /**
* Controller to control the daemon * Controller to control the daemon
*/ */
+1 -1
View File
@@ -15,7 +15,7 @@
/** /**
* @defgroup kernel_handler kernel_handler * @defgroup kernel_handler kernel_handler
* @{ @ingroup kernel * @{ @ingroup ckernel
*/ */
#ifndef KERNEL_HANDLER_H_ #ifndef KERNEL_HANDLER_H_
+4
View File
@@ -8,6 +8,10 @@ attributes/attributes.c attributes/attributes.h \
attributes/attribute_provider.h attributes/attribute_handler.h \ attributes/attribute_provider.h attributes/attribute_handler.h \
attributes/attribute_manager.c attributes/attribute_manager.h \ attributes/attribute_manager.c attributes/attribute_manager.h \
attributes/mem_pool.c attributes/mem_pool.h \ attributes/mem_pool.c attributes/mem_pool.h \
kernel/kernel_interface.c kernel/kernel_interface.h \
kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
kernel/kernel_net.h \
kernel/kernel_listener.h \
processing/jobs/job.h \ processing/jobs/job.h \
processing/jobs/callback_job.c processing/jobs/callback_job.h \ processing/jobs/callback_job.c processing/jobs/callback_job.h \
processing/processor.c processing/processor.h \ processing/processor.c processing/processor.h \
+4
View File
@@ -6,6 +6,10 @@ attributes/attributes.c attributes/attributes.h \
attributes/attribute_provider.h attributes/attribute_handler.h \ attributes/attribute_provider.h attributes/attribute_handler.h \
attributes/attribute_manager.c attributes/attribute_manager.h \ attributes/attribute_manager.c attributes/attribute_manager.h \
attributes/mem_pool.c attributes/mem_pool.h \ attributes/mem_pool.c attributes/mem_pool.h \
kernel/kernel_interface.c kernel/kernel_interface.h \
kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
kernel/kernel_net.h \
kernel/kernel_listener.h \
processing/jobs/job.h \ processing/jobs/job.h \
processing/jobs/callback_job.c processing/jobs/callback_job.h \ processing/jobs/callback_job.c processing/jobs/callback_job.h \
processing/processor.c processing/processor.h \ processing/processor.c processing/processor.h \
+2
View File
@@ -42,6 +42,7 @@ void libhydra_deinit()
{ {
private_hydra_t *this = (private_hydra_t*)hydra; private_hydra_t *this = (private_hydra_t*)hydra;
this->public.attributes->destroy(this->public.attributes); this->public.attributes->destroy(this->public.attributes);
this->public.kernel_interface->destroy(this->public.kernel_interface);
this->public.scheduler->destroy(this->public.scheduler); this->public.scheduler->destroy(this->public.scheduler);
this->public.processor->destroy(this->public.processor); this->public.processor->destroy(this->public.processor);
free((void*)this->public.daemon); free((void*)this->public.daemon);
@@ -59,6 +60,7 @@ bool libhydra_init(const char *daemon)
INIT(this, INIT(this,
.public = { .public = {
.attributes = attribute_manager_create(), .attributes = attribute_manager_create(),
.kernel_interface = kernel_interface_create(),
.processor = processor_create(), .processor = processor_create(),
.daemon = strdup(daemon ?: "libhydra"), .daemon = strdup(daemon ?: "libhydra"),
}, },
+9
View File
@@ -19,6 +19,9 @@
* @defgroup attributes attributes * @defgroup attributes attributes
* @ingroup libhydra * @ingroup libhydra
* *
* @defgroup hkernel kernel
* @ingroup libhydra
*
* @defgroup hplugins plugins * @defgroup hplugins plugins
* @ingroup libhydra * @ingroup libhydra
* *
@@ -38,6 +41,7 @@
typedef struct hydra_t hydra_t; typedef struct hydra_t hydra_t;
#include <attributes/attribute_manager.h> #include <attributes/attribute_manager.h>
#include <kernel/kernel_interface.h>
#include <processing/processor.h> #include <processing/processor.h>
#include <processing/scheduler.h> #include <processing/scheduler.h>
@@ -53,6 +57,11 @@ struct hydra_t {
*/ */
attribute_manager_t *attributes; attribute_manager_t *attributes;
/**
* kernel interface to communicate with kernel
*/
kernel_interface_t *kernel_interface;
/** /**
* process jobs using a thread pool * process jobs using a thread pool
*/ */
@@ -17,7 +17,7 @@
#include "kernel_interface.h" #include "kernel_interface.h"
#include <daemon.h> #include <debug.h>
#include <threading/mutex.h> #include <threading/mutex.h>
#include <utils/linked_list.h> #include <utils/linked_list.h>
@@ -18,7 +18,7 @@
/** /**
* @defgroup kernel_interface kernel_interface * @defgroup kernel_interface kernel_interface
* @{ @ingroup kernel * @{ @ingroup hkernel
*/ */
#ifndef KERNEL_INTERFACE_H_ #ifndef KERNEL_INTERFACE_H_
@@ -28,7 +28,6 @@ typedef struct kernel_interface_t kernel_interface_t;
#include <utils/host.h> #include <utils/host.h>
#include <crypto/prf_plus.h> #include <crypto/prf_plus.h>
#include <encoding/payloads/proposal_substructure.h>
#include <kernel/kernel_listener.h> #include <kernel/kernel_listener.h>
#include <kernel/kernel_ipsec.h> #include <kernel/kernel_ipsec.h>
@@ -18,7 +18,7 @@
/** /**
* @defgroup kernel_ipsec kernel_ipsec * @defgroup kernel_ipsec kernel_ipsec
* @{ @ingroup kernel * @{ @ingroup hkernel
*/ */
#ifndef KERNEL_IPSEC_H_ #ifndef KERNEL_IPSEC_H_
@@ -27,11 +27,12 @@
typedef enum ipsec_mode_t ipsec_mode_t; typedef enum ipsec_mode_t ipsec_mode_t;
typedef enum policy_dir_t policy_dir_t; typedef enum policy_dir_t policy_dir_t;
typedef struct kernel_ipsec_t kernel_ipsec_t; typedef struct kernel_ipsec_t kernel_ipsec_t;
typedef struct lifetime_cfg_t lifetime_cfg_t;
typedef struct mark_t mark_t;
#include <utils/host.h> #include <utils/host.h>
#include <crypto/prf_plus.h> #include <crypto/prf_plus.h>
#include <config/proposal.h> #include <selectors/traffic_selector.h>
#include <config/child_cfg.h>
/** /**
* Mode of a CHILD_SA. * Mode of a CHILD_SA.
@@ -69,6 +70,32 @@ enum policy_dir_t {
*/ */
extern enum_name_t *policy_dir_names; extern enum_name_t *policy_dir_names;
/**
* A lifetime_cfg_t defines the lifetime limits of an SA.
*
* Set any of these values to 0 to ignore.
*/
struct lifetime_cfg_t {
struct {
/** Limit before the SA gets invalid. */
u_int64_t life;
/** Limit before the SA gets rekeyed. */
u_int64_t rekey;
/** The range of a random value subtracted from rekey. */
u_int64_t jitter;
} time, bytes, packets;
};
/**
* A mark_t defines an optional mark in an IPsec SA.
*/
struct mark_t {
/** Mark value */
u_int32_t value;
/** Mark mask */
u_int32_t mask;
};
/** /**
* Interface to the ipsec subsystem of the kernel. * Interface to the ipsec subsystem of the kernel.
* *
@@ -15,7 +15,7 @@
/** /**
* @defgroup kernel_listener kernel_listener * @defgroup kernel_listener kernel_listener
* @{ @ingroup kernel * @{ @ingroup hkernel
*/ */
#ifndef KERNEL_LISTENER_H_ #ifndef KERNEL_LISTENER_H_
@@ -16,7 +16,7 @@
/** /**
* @defgroup kernel_net kernel_net * @defgroup kernel_net kernel_net
* @{ @ingroup kernel * @{ @ingroup hkernel
*/ */
#ifndef KERNEL_NET_H_ #ifndef KERNEL_NET_H_