Refer to kernel interface via hydra and not charon.
authorTobias Brunner <tobias@strongswan.org>
Mon, 12 Jul 2010 09:14:54 +0000 (11:14 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 2 Sep 2010 17:01:25 +0000 (19:01 +0200)
24 files changed:
src/libcharon/kernel/kernel_handler.c
src/libcharon/plugins/dhcp/dhcp_socket.c
src/libcharon/plugins/kernel_klips/kernel_klips_ipsec.c
src/libcharon/plugins/kernel_klips/kernel_klips_plugin.c
src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c
src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c
src/libcharon/plugins/kernel_netlink/kernel_netlink_plugin.c
src/libcharon/plugins/kernel_pfkey/kernel_pfkey_ipsec.c
src/libcharon/plugins/kernel_pfkey/kernel_pfkey_plugin.c
src/libcharon/plugins/kernel_pfroute/kernel_pfroute_net.c
src/libcharon/plugins/kernel_pfroute/kernel_pfroute_plugin.c
src/libcharon/plugins/load_tester/load_tester_plugin.c
src/libcharon/plugins/socket_default/socket_default_socket.c
src/libcharon/plugins/socket_dynamic/socket_dynamic_socket.c
src/libcharon/plugins/socket_raw/socket_raw_socket.c
src/libcharon/plugins/stroke/stroke_config.c
src/libcharon/plugins/stroke/stroke_list.c
src/libcharon/plugins/updown/updown_listener.c
src/libcharon/sa/child_sa.c
src/libcharon/sa/ike_sa.c
src/libcharon/sa/tasks/ike_me.c
src/libcharon/sa/tasks/ike_mobike.c
src/libcharon/sa/tasks/ike_natd.c
src/libcharon/sa/trap_manager.c

index d863ca5..ef70043 100644 (file)
@@ -133,8 +133,8 @@ METHOD(kernel_listener_t, roam, bool,
 METHOD(kernel_handler_t, destroy, void,
           private_kernel_handler_t *this)
 {
-       charon->kernel_interface->remove_listener(charon->kernel_interface,
-                                                                                         &this->public.listener);
+       hydra->kernel_interface->remove_listener(hydra->kernel_interface,
+                                                                                        &this->public.listener);
        free(this);
 }
 
@@ -155,8 +155,8 @@ kernel_handler_t *kernel_handler_create()
                },
        );
 
-       charon->kernel_interface->add_listener(charon->kernel_interface,
-                                                                                  &this->public.listener);
+       hydra->kernel_interface->add_listener(hydra->kernel_interface,
+                                                                                 &this->public.listener);
 
        return &this->public;
 }
index 4a6b451..5bca514 100644 (file)
@@ -206,8 +206,8 @@ static int prepare_dhcp(private_dhcp_socket_t *this,
        else
        {
                /* act as relay agent */
-               src = charon->kernel_interface->get_source_addr(
-                                                                       charon->kernel_interface, this->dst, NULL);
+               src = hydra->kernel_interface->get_source_addr(hydra->kernel_interface,
+                                                                                                          this->dst, NULL);
                if (src)
                {
                        memcpy(&dhcp->gateway_address, src->get_address(src).ptr,
index 7fa307f..68cab17 100644 (file)
@@ -1293,8 +1293,8 @@ static void process_acquire(private_kernel_klips_ipsec_t *this, struct sadb_msg*
 
        this->mutex->unlock(this->mutex);
 
-       charon->kernel_interface->acquire(charon->kernel_interface, reqid, NULL,
-                                                                         NULL);
+       hydra->kernel_interface->acquire(hydra->kernel_interface, reqid, NULL,
+                                                                        NULL);
 }
 
 /**
@@ -1353,8 +1353,8 @@ static void process_mapping(private_kernel_klips_ipsec_t *this, struct sadb_msg*
                new_src = host_create_from_sockaddr(addr);
                if (new_src)
                {
-                       charon->kernel_interface->mapping(charon->kernel_interface, reqid,
-                                                                                         spi, new_src);
+                       hydra->kernel_interface->mapping(hydra->kernel_interface, reqid,
+                                                                                        spi, new_src);
                }
        }
 }
@@ -1491,8 +1491,8 @@ static job_requeue_t sa_expires(sa_expire_t *expire)
        DBG2(DBG_KNL, "%N CHILD_SA with SPI %.8x and reqid {%d} expired",
                        protocol_id_names, protocol, ntohl(spi), reqid);
 
-       charon->kernel_interface->expire(charon->kernel_interface, reqid, protocol,
-                                                                        spi, hard);
+       hydra->kernel_interface->expire(hydra->kernel_interface, reqid, protocol,
+                                                                       spi, hard);
        return JOB_REQUEUE_NONE;
 }
 
@@ -2105,8 +2105,8 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
                if (mode != MODE_TRANSPORT && src->get_family(src) != AF_INET6 &&
                        this->install_routes)
                {
-                       charon->kernel_interface->get_address_by_ts(charon->kernel_interface,
-                                               src_ts, &route->src_ip);
+                       hydra->kernel_interface->get_address_by_ts(hydra->kernel_interface,
+                                                                                                          src_ts, &route->src_ip);
                }
 
                if (!route->src_ip)
@@ -2115,8 +2115,8 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
                }
 
                /* find the virtual interface */
-               iface = charon->kernel_interface->get_interface(charon->kernel_interface,
-                                                                                                               src);
+               iface = hydra->kernel_interface->get_interface(hydra->kernel_interface,
+                                                                                                          src);
                if (find_ipsec_dev(this, iface, &dev) == SUCCESS)
                {
                        /* above, we got either the name of a virtual or a physical
@@ -2162,12 +2162,12 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
                route->if_name = strdup(dev->name);
 
                /* get the nexthop to dst */
-               route->gateway = charon->kernel_interface->get_nexthop(
-                                                                               charon->kernel_interface, dst);
+               route->gateway = hydra->kernel_interface->get_nexthop(
+                                                                                               hydra->kernel_interface, dst);
                route->dst_net = chunk_clone(policy->dst.net->get_address(policy->dst.net));
                route->prefixlen = policy->dst.mask;
 
-               switch (charon->kernel_interface->add_route(charon->kernel_interface,
+               switch (hydra->kernel_interface->add_route(hydra->kernel_interface,
                                route->dst_net, route->prefixlen, route->gateway,
                                route->src_ip, route->if_name))
                {
@@ -2449,7 +2449,7 @@ METHOD(kernel_ipsec_t, del_policy, status_t,
        {
                ipsec_dev_t *dev;
 
-               if (charon->kernel_interface->del_route(charon->kernel_interface,
+               if (hydra->kernel_interface->del_route(hydra->kernel_interface,
                                route->dst_net, route->prefixlen, route->gateway,
                                route->src_ip, route->if_name) != SUCCESS)
                {
index fa5e9eb..1a22835 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "kernel_klips_ipsec.h"
 
-#include <daemon.h>
+#include <hydra.h>
 
 typedef struct private_kernel_klips_plugin_t private_kernel_klips_plugin_t;
 
@@ -37,7 +37,8 @@ struct private_kernel_klips_plugin_t {
  */
 static void destroy(private_kernel_klips_plugin_t *this)
 {
-       charon->kernel_interface->remove_ipsec_interface(charon->kernel_interface, (kernel_ipsec_constructor_t)kernel_klips_ipsec_create);
+       hydra->kernel_interface->remove_ipsec_interface(hydra->kernel_interface,
+                                               (kernel_ipsec_constructor_t)kernel_klips_ipsec_create);
        free(this);
 }
 
@@ -50,7 +51,8 @@ plugin_t *kernel_klips_plugin_create()
 
        this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
 
-       charon->kernel_interface->add_ipsec_interface(charon->kernel_interface, (kernel_ipsec_constructor_t)kernel_klips_ipsec_create);
+       hydra->kernel_interface->add_ipsec_interface(hydra->kernel_interface,
+                                               (kernel_ipsec_constructor_t)kernel_klips_ipsec_create);
 
        return &this->public.plugin;
 }
index c366efd..7de60b0 100644 (file)
@@ -554,8 +554,8 @@ static void process_acquire(private_kernel_netlink_ipsec_t *this, struct nlmsghd
        src_ts = selector2ts(&acquire->sel, TRUE);
        dst_ts = selector2ts(&acquire->sel, FALSE);
 
-       charon->kernel_interface->acquire(charon->kernel_interface, reqid, src_ts,
-                                                                         dst_ts);
+       hydra->kernel_interface->acquire(hydra->kernel_interface, reqid, src_ts,
+                                                                        dst_ts);
 }
 
 /**
@@ -581,8 +581,8 @@ static void process_expire(private_kernel_netlink_ipsec_t *this, struct nlmsghdr
                return;
        }
 
-       charon->kernel_interface->expire(charon->kernel_interface, reqid, protocol,
-                                                                        spi, expire->hard != 0);
+       hydra->kernel_interface->expire(hydra->kernel_interface, reqid, protocol,
+                                                                       spi, expire->hard != 0);
 }
 
 /**
@@ -646,8 +646,8 @@ static void process_migrate(private_kernel_netlink_ipsec_t *this, struct nlmsghd
 
        if (src_ts && dst_ts && local && remote)
        {
-               charon->kernel_interface->migrate(charon->kernel_interface, reqid,
-                                                                                 src_ts, dst_ts, dir, local, remote);
+               hydra->kernel_interface->migrate(hydra->kernel_interface, reqid,
+                                                                                src_ts, dst_ts, dir, local, remote);
        }
        else
        {
@@ -680,8 +680,8 @@ static void process_mapping(private_kernel_netlink_ipsec_t *this,
                                                 mapping->new_sport);
                if (host)
                {
-                       charon->kernel_interface->mapping(charon->kernel_interface, reqid,
-                                                                                         spi, host);
+                       hydra->kernel_interface->mapping(hydra->kernel_interface, reqid,
+                                                                                        spi, host);
                }
        }
 }
@@ -1791,23 +1791,23 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
        {
                route_entry_t *route = malloc_thing(route_entry_t);
 
-               if (charon->kernel_interface->get_address_by_ts(charon->kernel_interface,
+               if (hydra->kernel_interface->get_address_by_ts(hydra->kernel_interface,
                                dst_ts, &route->src_ip) == SUCCESS)
                {
                        /* get the nexthop to src (src as we are in POLICY_FWD).*/
-                       route->gateway = charon->kernel_interface->get_nexthop(
-                                                                                               charon->kernel_interface, src);
+                       route->gateway = hydra->kernel_interface->get_nexthop(
+                                                                                               hydra->kernel_interface, src);
                        /* install route via outgoing interface */
-                       route->if_name = charon->kernel_interface->get_interface(
-                                                                                               charon->kernel_interface, dst);
+                       route->if_name = hydra->kernel_interface->get_interface(
+                                                                                               hydra->kernel_interface, dst);
                        route->dst_net = chunk_alloc(policy->sel.family == AF_INET ? 4 : 16);
                        memcpy(route->dst_net.ptr, &policy->sel.saddr, route->dst_net.len);
                        route->prefixlen = policy->sel.prefixlen_s;
 
                        if (route->if_name)
                        {
-                               switch (charon->kernel_interface->add_route(
-                                                                       charon->kernel_interface, route->dst_net,
+                               switch (hydra->kernel_interface->add_route(
+                                                                       hydra->kernel_interface, route->dst_net,
                                                                        route->prefixlen, route->gateway,
                                                                        route->src_ip, route->if_name))
                                {
@@ -2053,7 +2053,7 @@ METHOD(kernel_ipsec_t, del_policy, status_t,
 
        if (route)
        {
-               if (charon->kernel_interface->del_route(charon->kernel_interface,
+               if (hydra->kernel_interface->del_route(hydra->kernel_interface,
                                route->dst_net, route->prefixlen, route->gateway,
                                route->src_ip, route->if_name) != SUCCESS)
                {
index e55329e..0beb32d 100644 (file)
@@ -227,7 +227,7 @@ static int get_vip_refcount(private_kernel_netlink_net_t *this, host_t* ip)
  */
 static job_requeue_t roam_event(uintptr_t address)
 {
-       charon->kernel_interface->roam(charon->kernel_interface, address != 0);
+       hydra->kernel_interface->roam(hydra->kernel_interface, address != 0);
        return JOB_REQUEUE_NONE;
 }
 
index 4c61265..212675d 100644 (file)
@@ -19,7 +19,7 @@
 #include "kernel_netlink_ipsec.h"
 #include "kernel_netlink_net.h"
 
-#include <daemon.h>
+#include <hydra.h>
 
 typedef struct private_kernel_netlink_plugin_t private_kernel_netlink_plugin_t;
 
@@ -38,8 +38,10 @@ struct private_kernel_netlink_plugin_t {
  */
 static void destroy(private_kernel_netlink_plugin_t *this)
 {
-       charon->kernel_interface->remove_ipsec_interface(charon->kernel_interface, (kernel_ipsec_constructor_t)kernel_netlink_ipsec_create);
-       charon->kernel_interface->remove_net_interface(charon->kernel_interface, (kernel_net_constructor_t)kernel_netlink_net_create);
+       hydra->kernel_interface->remove_ipsec_interface(hydra->kernel_interface,
+                                       (kernel_ipsec_constructor_t)kernel_netlink_ipsec_create);
+       hydra->kernel_interface->remove_net_interface(hydra->kernel_interface,
+                                       (kernel_net_constructor_t)kernel_netlink_net_create);
        free(this);
 }
 
@@ -52,8 +54,10 @@ plugin_t *kernel_netlink_plugin_create()
 
        this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
 
-       charon->kernel_interface->add_ipsec_interface(charon->kernel_interface, (kernel_ipsec_constructor_t)kernel_netlink_ipsec_create);
-       charon->kernel_interface->add_net_interface(charon->kernel_interface, (kernel_net_constructor_t)kernel_netlink_net_create);
+       hydra->kernel_interface->add_ipsec_interface(hydra->kernel_interface,
+                                       (kernel_ipsec_constructor_t)kernel_netlink_ipsec_create);
+       hydra->kernel_interface->add_net_interface(hydra->kernel_interface,
+                                       (kernel_net_constructor_t)kernel_netlink_net_create);
 
        return &this->public.plugin;
 }
index 4cb175b..7359783 100644 (file)
@@ -916,8 +916,8 @@ static void process_acquire(private_kernel_pfkey_ipsec_t *this, struct sadb_msg*
        dst_ts = sadb_address2ts(response.dst);
        this->mutex->unlock(this->mutex);
 
-       charon->kernel_interface->acquire(charon->kernel_interface, reqid, src_ts,
-                                                                         dst_ts);
+       hydra->kernel_interface->acquire(hydra->kernel_interface, reqid, src_ts,
+                                                                        dst_ts);
 }
 
 /**
@@ -950,8 +950,8 @@ static void process_expire(private_kernel_pfkey_ipsec_t *this, struct sadb_msg*
                return;
        }
 
-       charon->kernel_interface->expire(charon->kernel_interface, reqid, protocol,
-                                                                        spi, hard);
+       hydra->kernel_interface->expire(hydra->kernel_interface, reqid, protocol,
+                                                                       spi, hard);
 }
 
 #ifdef SADB_X_MIGRATE
@@ -996,8 +996,8 @@ static void process_migrate(private_kernel_pfkey_ipsec_t *this, struct sadb_msg*
 
        if (src_ts && dst_ts && local && remote)
        {
-               charon->kernel_interface->migrate(charon->kernel_interface, reqid,
-                                                                                 src_ts, dst_ts, dir, local, remote);
+               hydra->kernel_interface->migrate(hydra->kernel_interface, reqid,
+                                                                                src_ts, dst_ts, dir, local, remote);
        }
        else
        {
@@ -1058,8 +1058,8 @@ static void process_mapping(private_kernel_pfkey_ipsec_t *this, struct sadb_msg*
                host = host_create_from_sockaddr(sa);
                if (host)
                {
-                       charon->kernel_interface->mapping(charon->kernel_interface, reqid,
-                                                                                         spi, host);
+                       hydra->kernel_interface->mapping(hydra->kernel_interface, reqid,
+                                                                                        spi, host);
                }
        }
 }
@@ -1745,21 +1745,21 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
        {
                route_entry_t *route = malloc_thing(route_entry_t);
 
-               if (charon->kernel_interface->get_address_by_ts(charon->kernel_interface,
+               if (hydra->kernel_interface->get_address_by_ts(hydra->kernel_interface,
                                dst_ts, &route->src_ip) == SUCCESS)
                {
                        /* get the nexthop to src (src as we are in POLICY_FWD).*/
-                       route->gateway = charon->kernel_interface->get_nexthop(
-                                                                       charon->kernel_interface, src);
-                       route->if_name = charon->kernel_interface->get_interface(
-                                                                       charon->kernel_interface, dst);
+                       route->gateway = hydra->kernel_interface->get_nexthop(
+                                                                       hydra->kernel_interface, src);
+                       route->if_name = hydra->kernel_interface->get_interface(
+                                                                       hydra->kernel_interface, dst);
                        route->dst_net = chunk_clone(policy->src.net->get_address(policy->src.net));
                        route->prefixlen = policy->src.mask;
 
                        if (route->if_name)
                        {
-                               switch (charon->kernel_interface->add_route(
-                                                                       charon->kernel_interface, route->dst_net,
+                               switch (hydra->kernel_interface->add_route(
+                                                                       hydra->kernel_interface, route->dst_net,
                                                                        route->prefixlen, route->gateway,
                                                                        route->src_ip, route->if_name))
                                {
@@ -1991,7 +1991,7 @@ METHOD(kernel_ipsec_t, del_policy, status_t,
 
        if (route)
        {
-               if (charon->kernel_interface->del_route(charon->kernel_interface,
+               if (hydra->kernel_interface->del_route(hydra->kernel_interface,
                                route->dst_net, route->prefixlen, route->gateway,
                                route->src_ip, route->if_name) != SUCCESS)
                {
index b84ccf1..781ba50 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "kernel_pfkey_ipsec.h"
 
-#include <daemon.h>
+#include <hydra.h>
 
 typedef struct private_kernel_pfkey_plugin_t private_kernel_pfkey_plugin_t;
 
@@ -37,7 +37,8 @@ struct private_kernel_pfkey_plugin_t {
  */
 static void destroy(private_kernel_pfkey_plugin_t *this)
 {
-       charon->kernel_interface->remove_ipsec_interface(charon->kernel_interface, (kernel_ipsec_constructor_t)kernel_pfkey_ipsec_create);
+       hydra->kernel_interface->remove_ipsec_interface(hydra->kernel_interface,
+                                               (kernel_ipsec_constructor_t)kernel_pfkey_ipsec_create);
        free(this);
 }
 
@@ -50,7 +51,8 @@ plugin_t *kernel_pfkey_plugin_create()
 
        this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
 
-       charon->kernel_interface->add_ipsec_interface(charon->kernel_interface, (kernel_ipsec_constructor_t)kernel_pfkey_ipsec_create);
+       hydra->kernel_interface->add_ipsec_interface(hydra->kernel_interface,
+                                               (kernel_ipsec_constructor_t)kernel_pfkey_ipsec_create);
 
        return &this->public.plugin;
 }
index 9f40dae..b471a10 100644 (file)
@@ -155,7 +155,7 @@ struct private_kernel_pfroute_net_t
  */
 static job_requeue_t roam_event(uintptr_t address)
 {
-       charon->kernel_interface->roam(charon->kernel_interface, address != 0);
+       hydra->kernel_interface->roam(hydra->kernel_interface, address != 0);
        return JOB_REQUEUE_NONE;
 }
 
index 97139fb..5f351bd 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "kernel_pfroute_net.h"
 
-#include <daemon.h>
+#include <hydra.h>
 
 typedef struct private_kernel_pfroute_plugin_t private_kernel_pfroute_plugin_t;
 
@@ -37,7 +37,7 @@ struct private_kernel_pfroute_plugin_t {
  */
 static void destroy(private_kernel_pfroute_plugin_t *this)
 {
-       charon->kernel_interface->remove_net_interface(charon->kernel_interface,
+       hydra->kernel_interface->remove_net_interface(hydra->kernel_interface,
                                                (kernel_net_constructor_t)kernel_pfroute_net_create);
        free(this);
 }
@@ -51,7 +51,7 @@ plugin_t *kernel_pfroute_plugin_create()
 
        this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
 
-       charon->kernel_interface->add_net_interface(charon->kernel_interface,
+       hydra->kernel_interface->add_net_interface(hydra->kernel_interface,
                                                (kernel_net_constructor_t)kernel_pfroute_net_create);
 
        return &this->public.plugin;
index c9384d5..a1956d1 100644 (file)
@@ -156,7 +156,7 @@ static void destroy(private_load_tester_plugin_t *this)
                this->condvar->wait(this->condvar, this->mutex);
        }
        this->mutex->unlock(this->mutex);
-       charon->kernel_interface->remove_ipsec_interface(charon->kernel_interface,
+       hydra->kernel_interface->remove_ipsec_interface(hydra->kernel_interface,
                                                (kernel_ipsec_constructor_t)load_tester_ipsec_create);
        charon->backends->remove_backend(charon->backends, &this->config->backend);
        lib->credmgr->remove_set(lib->credmgr, &this->creds->credential_set);
@@ -216,7 +216,7 @@ plugin_t *load_tester_plugin_create()
        if (lib->settings->get_bool(lib->settings,
                                        "charon.plugins.load-tester.fake_kernel", FALSE))
        {
-               charon->kernel_interface->add_ipsec_interface(charon->kernel_interface,
+               hydra->kernel_interface->add_ipsec_interface(hydra->kernel_interface,
                                                (kernel_ipsec_constructor_t)load_tester_ipsec_create);
        }
        this->running = 0;
index 04d4f21..9834818 100644 (file)
@@ -42,6 +42,7 @@
 #include <sys/sysctl.h>
 #endif
 
+#include <hydra.h>
 #include <daemon.h>
 #include <threading/thread.h>
 
@@ -525,8 +526,8 @@ static int open_socket(private_socket_default_socket_t *this,
                }
        }
 
-       if (!charon->kernel_interface->bypass_socket(charon->kernel_interface,
-                                                                                                skt, family))
+       if (!hydra->kernel_interface->bypass_socket(hydra->kernel_interface,
+                                                                                               skt, family))
        {
                DBG1(DBG_NET, "installing IKE bypass policy failed");
        }
index fa2f2f0..861ebfd 100644 (file)
@@ -36,6 +36,7 @@
 #include <netinet/udp.h>
 #include <net/if.h>
 
+#include <hydra.h>
 #include <daemon.h>
 #include <threading/thread.h>
 #include <threading/rwlock.h>
@@ -422,8 +423,8 @@ static int open_socket(private_socket_dynamic_socket_t *this,
                return 0;
        }
 
-       if (!charon->kernel_interface->bypass_socket(charon->kernel_interface,
-                                                                                                fd, family))
+       if (!hydra->kernel_interface->bypass_socket(hydra->kernel_interface,
+                                                                                               fd, family))
        {
                DBG1(DBG_NET, "installing IKE bypass policy failed");
        }
index 6cc2375..66bc785 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/filter.h>
 #include <net/if.h>
 
+#include <hydra.h>
 #include <daemon.h>
 #include <threading/thread.h>
 
@@ -496,8 +497,8 @@ static int open_send_socket(private_socket_raw_socket_t *this,
                }
        }
 
-       if (!charon->kernel_interface->bypass_socket(charon->kernel_interface,
-                                                                                                skt, family))
+       if (!hydra->kernel_interface->bypass_socket(hydra->kernel_interface,
+                                                                                               skt, family))
        {
                DBG1(DBG_NET, "installing bypass policy on send socket failed");
        }
@@ -602,8 +603,8 @@ static int open_recv_socket(private_socket_raw_socket_t *this, int family)
                return 0;
        }
 
-       if (!charon->kernel_interface->bypass_socket(charon->kernel_interface,
-                                                                                                skt, family))
+       if (!hydra->kernel_interface->bypass_socket(hydra->kernel_interface,
+                                                                                               skt, family))
        {
                DBG1(DBG_NET, "installing bypass policy on receive socket failed");
        }
index 86b958b..165212a 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "stroke_config.h"
 
+#include <hydra.h>
 #include <daemon.h>
 #include <threading/mutex.h>
 #include <utils/lexparser.h>
@@ -199,8 +200,8 @@ static ike_cfg_t *build_ike_cfg(private_stroke_config_t *this, stroke_msg_t *msg
        host = host_create_from_dns(msg->add_conn.other.address, 0, 0);
        if (host)
        {
-               interface = charon->kernel_interface->get_interface(
-                                                                                               charon->kernel_interface, host);
+               interface = hydra->kernel_interface->get_interface(
+                                                                                               hydra->kernel_interface, host);
                host->destroy(host);
                if (interface)
                {
@@ -215,8 +216,8 @@ static ike_cfg_t *build_ike_cfg(private_stroke_config_t *this, stroke_msg_t *msg
                        host = host_create_from_dns(msg->add_conn.me.address, 0, 0);
                        if (host)
                        {
-                               interface = charon->kernel_interface->get_interface(
-                                                                                               charon->kernel_interface, host);
+                               interface = hydra->kernel_interface->get_interface(
+                                                                                               hydra->kernel_interface, host);
                                host->destroy(host);
                                if (!interface)
                                {
index d21e1f0..ee7927f 100644 (file)
@@ -455,8 +455,8 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo
                }
                enumerator->destroy(enumerator);
 
-               enumerator = charon->kernel_interface->create_address_enumerator(
-                                                               charon->kernel_interface, FALSE, FALSE);
+               enumerator = hydra->kernel_interface->create_address_enumerator(
+                                                                       hydra->kernel_interface, FALSE, FALSE);
                fprintf(out, "Listening IP addresses:\n");
                while (enumerator->enumerate(enumerator, (void**)&host))
                {
index ea4a792..8e58b1a 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "updown_listener.h"
 
+#include <hydra.h>
 #include <daemon.h>
 #include <config/child_cfg.h>
 
@@ -218,8 +219,8 @@ METHOD(listener_t, child_updown, bool,
 
                if (up)
                {
-                       iface = charon->kernel_interface->get_interface(
-                                                                                               charon->kernel_interface, me);
+                       iface = hydra->kernel_interface->get_interface(
+                                                                                               hydra->kernel_interface, me);
                        if (iface)
                        {
                                cache_iface(this, child_sa->get_reqid(child_sa), iface);
index 2f5d948..b5c2feb 100644 (file)
@@ -23,6 +23,7 @@
 #include <string.h>
 #include <time.h>
 
+#include <hydra.h>
 #include <daemon.h>
 
 ENUM(child_sa_state_names, CHILD_CREATED, CHILD_DESTROYING,
@@ -413,7 +414,7 @@ static status_t update_usebytes(private_child_sa_t *this, bool inbound)
        {
                if (this->my_spi)
                {
-                       status = charon->kernel_interface->query_sa(charon->kernel_interface,
+                       status = hydra->kernel_interface->query_sa(hydra->kernel_interface,
                                                        this->other_addr, this->my_addr, this->my_spi,
                                                        proto_ike2ip(this->protocol), this->mark_in,
                                                        &bytes);
@@ -432,7 +433,7 @@ static status_t update_usebytes(private_child_sa_t *this, bool inbound)
        {
                if (this->other_spi)
                {
-                       status = charon->kernel_interface->query_sa(charon->kernel_interface,
+                       status = hydra->kernel_interface->query_sa(hydra->kernel_interface,
                                                        this->my_addr, this->other_addr, this->other_spi,
                                                        proto_ike2ip(this->protocol), this->mark_out,
                                                        &bytes);
@@ -466,14 +467,14 @@ static void update_usetime(private_child_sa_t *this, bool inbound)
 
                if (inbound)
                {
-                       if (charon->kernel_interface->query_policy(charon->kernel_interface,
+                       if (hydra->kernel_interface->query_policy(hydra->kernel_interface,
                                                other_ts, my_ts, POLICY_IN, this->mark_in, &in) == SUCCESS)
                        {
                                last_use = max(last_use, in);
                        }
                        if (this->mode != MODE_TRANSPORT)
                        {
-                               if (charon->kernel_interface->query_policy(charon->kernel_interface,
+                               if (hydra->kernel_interface->query_policy(hydra->kernel_interface,
                                                other_ts, my_ts, POLICY_FWD, this->mark_in, &fwd) == SUCCESS)
                                {
                                        last_use = max(last_use, fwd);
@@ -482,7 +483,7 @@ static void update_usetime(private_child_sa_t *this, bool inbound)
                }
                else
                {
-                       if (charon->kernel_interface->query_policy(charon->kernel_interface,
+                       if (hydra->kernel_interface->query_policy(hydra->kernel_interface,
                                                my_ts, other_ts, POLICY_OUT, this->mark_out, &out) == SUCCESS)
                        {
                                last_use = max(last_use, out);
@@ -534,10 +535,10 @@ METHOD(child_sa_t, get_lifetime, time_t,
 METHOD(child_sa_t, alloc_spi, u_int32_t,
           private_child_sa_t *this, protocol_id_t protocol)
 {
-       if (charon->kernel_interface->get_spi(charon->kernel_interface,
-                                                                       this->other_addr, this->my_addr,
-                                                                       proto_ike2ip(protocol), this->reqid,
-                                                                       &this->my_spi) == SUCCESS)
+       if (hydra->kernel_interface->get_spi(hydra->kernel_interface,
+                                                                                this->other_addr, this->my_addr,
+                                                                                proto_ike2ip(protocol), this->reqid,
+                                                                                &this->my_spi) == SUCCESS)
        {
                return this->my_spi;
        }
@@ -547,9 +548,9 @@ METHOD(child_sa_t, alloc_spi, u_int32_t,
 METHOD(child_sa_t, alloc_cpi, u_int16_t,
           private_child_sa_t *this)
 {
-       if (charon->kernel_interface->get_cpi(charon->kernel_interface,
-                                                                       this->other_addr, this->my_addr,
-                                                                       this->reqid, &this->my_cpi) == SUCCESS)
+       if (hydra->kernel_interface->get_cpi(hydra->kernel_interface,
+                                                                                this->other_addr, this->my_addr,
+                                                                                this->reqid, &this->my_cpi) == SUCCESS)
        {
                return this->my_cpi;
        }
@@ -636,7 +637,7 @@ METHOD(child_sa_t, install, status_t,
                }
        }
 
-       status = charon->kernel_interface->add_sa(charon->kernel_interface,
+       status = hydra->kernel_interface->add_sa(hydra->kernel_interface,
                                src, dst, spi, proto_ike2ip(this->protocol), this->reqid,
                                inbound ? this->mark_in : this->mark_out,
                                lifetime, enc_alg, encr, int_alg, integ, this->mode,
@@ -677,14 +678,14 @@ METHOD(child_sa_t, add_policies, status_t,
                while (enumerator->enumerate(enumerator, &my_ts, &other_ts))
                {
                        /* install 3 policies: out, in and forward */
-                       status |= charon->kernel_interface->add_policy(charon->kernel_interface,
+                       status |= hydra->kernel_interface->add_policy(hydra->kernel_interface,
                                                        this->my_addr, this->other_addr, my_ts, other_ts,
                                                        POLICY_OUT, this->other_spi,
                                                        proto_ike2ip(this->protocol), this->reqid,
                                                        this->mark_out, this->mode, this->ipcomp,
                                                        this->other_cpi, routed);
 
-                       status |= charon->kernel_interface->add_policy(charon->kernel_interface,
+                       status |= hydra->kernel_interface->add_policy(hydra->kernel_interface,
                                                        this->other_addr, this->my_addr, other_ts, my_ts,
                                                        POLICY_IN, this->my_spi,
                                                        proto_ike2ip(this->protocol), this->reqid,
@@ -692,7 +693,7 @@ METHOD(child_sa_t, add_policies, status_t,
                                                        this->my_cpi, routed);
                        if (this->mode != MODE_TRANSPORT)
                        {
-                               status |= charon->kernel_interface->add_policy(charon->kernel_interface,
+                               status |= hydra->kernel_interface->add_policy(hydra->kernel_interface,
                                                        this->other_addr, this->my_addr, other_ts, my_ts,
                                                        POLICY_FWD, this->my_spi,
                                                        proto_ike2ip(this->protocol), this->reqid,
@@ -739,7 +740,7 @@ METHOD(child_sa_t, update, status_t,
                /* update our (initator) SA */
                if (this->my_spi)
                {
-                       if (charon->kernel_interface->update_sa(charon->kernel_interface,
+                       if (hydra->kernel_interface->update_sa(hydra->kernel_interface,
                                                        this->my_spi, proto_ike2ip(this->protocol),
                                                        this->ipcomp != IPCOMP_NONE ? this->my_cpi : 0,
                                                        this->other_addr, this->my_addr, other, me,
@@ -752,7 +753,7 @@ METHOD(child_sa_t, update, status_t,
                /* update his (responder) SA */
                if (this->other_spi)
                {
-                       if (charon->kernel_interface->update_sa(charon->kernel_interface,
+                       if (hydra->kernel_interface->update_sa(hydra->kernel_interface,
                                                        this->other_spi, proto_ike2ip(this->protocol),
                                                        this->ipcomp != IPCOMP_NONE ? this->other_cpi : 0,
                                                        this->my_addr, this->other_addr, me, other,
@@ -777,13 +778,13 @@ METHOD(child_sa_t, update, status_t,
                        while (enumerator->enumerate(enumerator, &my_ts, &other_ts))
                        {
                                /* remove old policies first */
-                               charon->kernel_interface->del_policy(charon->kernel_interface,
+                               hydra->kernel_interface->del_policy(hydra->kernel_interface,
                                                        my_ts, other_ts, POLICY_OUT, this->mark_out, FALSE);
-                               charon->kernel_interface->del_policy(charon->kernel_interface,
+                               hydra->kernel_interface->del_policy(hydra->kernel_interface,
                                                        other_ts, my_ts,  POLICY_IN, this->mark_in, FALSE);
                                if (this->mode != MODE_TRANSPORT)
                                {
-                                       charon->kernel_interface->del_policy(charon->kernel_interface,
+                                       hydra->kernel_interface->del_policy(hydra->kernel_interface,
                                                        other_ts, my_ts, POLICY_FWD, this->mark_in, FALSE);
                                }
 
@@ -803,24 +804,24 @@ METHOD(child_sa_t, update, status_t,
                                 * correctly */
                                if (vip)
                                {
-                                       charon->kernel_interface->del_ip(charon->kernel_interface, vip);
-                                       charon->kernel_interface->add_ip(charon->kernel_interface, vip, me);
+                                       hydra->kernel_interface->del_ip(hydra->kernel_interface, vip);
+                                       hydra->kernel_interface->add_ip(hydra->kernel_interface, vip, me);
                                }
 
                                /* reinstall updated policies */
-                               charon->kernel_interface->add_policy(charon->kernel_interface,
+                               hydra->kernel_interface->add_policy(hydra->kernel_interface,
                                                        me, other, my_ts, other_ts, POLICY_OUT,
                                                        this->other_spi, proto_ike2ip(this->protocol),
                                                        this->reqid, this->mark_out, this->mode,
                                                        this->ipcomp, this->other_cpi, FALSE);
-                               charon->kernel_interface->add_policy(charon->kernel_interface,
+                               hydra->kernel_interface->add_policy(hydra->kernel_interface,
                                                        other, me, other_ts, my_ts, POLICY_IN,
                                                        this->my_spi, proto_ike2ip(this->protocol),
                                                        this->reqid, this->mark_in, this->mode,
                                                        this->ipcomp, this->my_cpi, FALSE);
                                if (this->mode != MODE_TRANSPORT)
                                {
-                                       charon->kernel_interface->add_policy(charon->kernel_interface,
+                                       hydra->kernel_interface->add_policy(hydra->kernel_interface,
                                                        other, me, other_ts, my_ts, POLICY_FWD,
                                                        this->my_spi, proto_ike2ip(this->protocol),
                                                        this->reqid, this->mark_in, this->mode,
@@ -870,14 +871,14 @@ METHOD(child_sa_t, destroy, void,
                {
                        this->protocol = PROTO_ESP;
                }
-               charon->kernel_interface->del_sa(charon->kernel_interface,
+               hydra->kernel_interface->del_sa(hydra->kernel_interface,
                                        this->other_addr, this->my_addr, this->my_spi,
                                        proto_ike2ip(this->protocol), this->my_cpi,
                                        this->mark_in);
        }
        if (this->other_spi)
        {
-               charon->kernel_interface->del_sa(charon->kernel_interface,
+               hydra->kernel_interface->del_sa(hydra->kernel_interface,
                                        this->my_addr, this->other_addr, this->other_spi,
                                        proto_ike2ip(this->protocol), this->other_cpi,
                                        this->mark_out);
@@ -889,13 +890,13 @@ METHOD(child_sa_t, destroy, void,
                enumerator = create_policy_enumerator(this);
                while (enumerator->enumerate(enumerator, &my_ts, &other_ts))
                {
-                       charon->kernel_interface->del_policy(charon->kernel_interface,
+                       hydra->kernel_interface->del_policy(hydra->kernel_interface,
                                                my_ts, other_ts, POLICY_OUT, this->mark_out, unrouted);
-                       charon->kernel_interface->del_policy(charon->kernel_interface,
+                       hydra->kernel_interface->del_policy(hydra->kernel_interface,
                                                other_ts, my_ts, POLICY_IN, this->mark_in, unrouted);
                        if (this->mode != MODE_TRANSPORT)
                        {
-                               charon->kernel_interface->del_policy(charon->kernel_interface,
+                               hydra->kernel_interface->del_policy(hydra->kernel_interface,
                                                other_ts, my_ts, POLICY_FWD, this->mark_in, unrouted);
                        }
                }
index 6656317..e82b4e0 100644 (file)
@@ -730,14 +730,14 @@ METHOD(ike_sa_t, set_virtual_ip, void,
        if (local)
        {
                DBG1(DBG_IKE, "installing new virtual IP %H", ip);
-               if (charon->kernel_interface->add_ip(charon->kernel_interface, ip,
-                                                                                        this->my_host) == SUCCESS)
+               if (hydra->kernel_interface->add_ip(hydra->kernel_interface, ip,
+                                                                                       this->my_host) == SUCCESS)
                {
                        if (this->my_virtual_ip)
                        {
                                DBG1(DBG_IKE, "removing old virtual IP %H", this->my_virtual_ip);
-                               charon->kernel_interface->del_ip(charon->kernel_interface,
-                                                                                                this->my_virtual_ip);
+                               hydra->kernel_interface->del_ip(hydra->kernel_interface,
+                                                                                               this->my_virtual_ip);
                        }
                        DESTROY_IF(this->my_virtual_ip);
                        this->my_virtual_ip = ip->clone(ip);
@@ -1062,8 +1062,8 @@ static void resolve_hosts(private_ike_sa_t *this)
                        !this->other_host->is_anyaddr(this->other_host))
                {
                        host->destroy(host);
-                       host = charon->kernel_interface->get_source_addr(
-                                                       charon->kernel_interface, this->other_host, NULL);
+                       host = hydra->kernel_interface->get_source_addr(
+                                                       hydra->kernel_interface, this->other_host, NULL);
                        if (host)
                        {
                                host->set_port(host, this->ike_cfg->get_my_port(this->ike_cfg));
@@ -1760,7 +1760,7 @@ METHOD(ike_sa_t, roam, status_t,
        }
 
        /* keep existing path if possible */
-       src = charon->kernel_interface->get_source_addr(charon->kernel_interface,
+       src = hydra->kernel_interface->get_source_addr(hydra->kernel_interface,
                                                                                        this->other_host, this->my_host);
        if (src)
        {
@@ -1781,8 +1781,8 @@ METHOD(ike_sa_t, roam, status_t,
                enumerator_t *enumerator;
                host_t *addr;
 
-               src = charon->kernel_interface->get_source_addr(charon->kernel_interface,
-                                                                                                               this->other_host, NULL);
+               src = hydra->kernel_interface->get_source_addr(hydra->kernel_interface,
+                                                                                                          this->other_host, NULL);
                if (!src)
                {
                        enumerator = this->additional_addresses->create_enumerator(
@@ -1790,8 +1790,8 @@ METHOD(ike_sa_t, roam, status_t,
                        while (enumerator->enumerate(enumerator, &addr))
                        {
                                DBG1(DBG_IKE, "looking for a route to %H ...", addr);
-                               src = charon->kernel_interface->get_source_addr(
-                                                                               charon->kernel_interface, addr, NULL);
+                               src = hydra->kernel_interface->get_source_addr(
+                                                                               hydra->kernel_interface, addr, NULL);
                                if (src)
                                {
                                        break;
@@ -1958,8 +1958,8 @@ METHOD(ike_sa_t, destroy, void,
 
        if (this->my_virtual_ip)
        {
-               charon->kernel_interface->del_ip(charon->kernel_interface,
-                                                                                this->my_virtual_ip);
+               hydra->kernel_interface->del_ip(hydra->kernel_interface,
+                                                                               this->my_virtual_ip);
                this->my_virtual_ip->destroy(this->my_virtual_ip);
        }
        if (this->other_virtual_ip)
index 1b37716..3ccefd4 100644 (file)
@@ -135,8 +135,8 @@ static void gather_and_add_endpoints(private_ike_me_t *this, message_t *message)
        host = this->ike_sa->get_my_host(this->ike_sa);
        port = host->get_port(host);
 
-       enumerator = charon->kernel_interface->create_address_enumerator(
-                                                                               charon->kernel_interface, FALSE, FALSE);
+       enumerator = hydra->kernel_interface->create_address_enumerator(
+                                                                               hydra->kernel_interface, FALSE, FALSE);
        while (enumerator->enumerate(enumerator, (void**)&addr))
        {
                host = addr->clone(addr);
index a62886f..8d963a2 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <string.h>
 
+#include <hydra.h>
 #include <daemon.h>
 #include <sa/tasks/ike_natd.h>
 #include <encoding/payloads/notify_payload.h>
@@ -193,8 +194,8 @@ static void build_address_list(private_ike_mobike_t *this, message_t *message)
        int added = 0;
 
        me = this->ike_sa->get_my_host(this->ike_sa);
-       enumerator = charon->kernel_interface->create_address_enumerator(
-                                                                               charon->kernel_interface, FALSE, FALSE);
+       enumerator = hydra->kernel_interface->create_address_enumerator(
+                                                                               hydra->kernel_interface, FALSE, FALSE);
        while (enumerator->enumerate(enumerator, (void**)&host))
        {
                if (me->ip_equals(me, host))
@@ -310,8 +311,8 @@ static void transmit(private_ike_mobike_t *this, packet_t *packet)
        other_old = this->ike_sa->get_other_host(this->ike_sa);
        ike_cfg = this->ike_sa->get_ike_cfg(this->ike_sa);
 
-       me = charon->kernel_interface->get_source_addr(
-                                                                       charon->kernel_interface, other_old, NULL);
+       me = hydra->kernel_interface->get_source_addr(
+                                                                       hydra->kernel_interface, other_old, NULL);
        if (me)
        {
                apply_port(this, me, me_old, ike_cfg->get_my_port(ike_cfg));
@@ -324,8 +325,8 @@ static void transmit(private_ike_mobike_t *this, packet_t *packet)
        iterator = this->ike_sa->create_additional_address_iterator(this->ike_sa);
        while (iterator->iterate(iterator, (void**)&other))
        {
-               me = charon->kernel_interface->get_source_addr(
-                                                                               charon->kernel_interface, other, NULL);
+               me = hydra->kernel_interface->get_source_addr(
+                                                                               hydra->kernel_interface, other, NULL);
                if (me)
                {
                        if (me->get_family(me) != other->get_family(other))
@@ -363,7 +364,7 @@ static status_t build_i(private_ike_mobike_t *this, message_t *message)
 
                /* we check if the existing address is still valid */
                old = message->get_source(message);
-               new = charon->kernel_interface->get_source_addr(charon->kernel_interface,
+               new = hydra->kernel_interface->get_source_addr(hydra->kernel_interface,
                                                                                message->get_destination(message), old);
                if (new)
                {
index aa0d3ec..7839b52 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <string.h>
 
+#include <hydra.h>
 #include <daemon.h>
 #include <config/peer_cfg.h>
 #include <crypto/hashers/hasher.h>
@@ -316,7 +317,7 @@ static status_t build_i(private_ike_natd_t *this, message_t *message)
        }
        else
        {
-               host = charon->kernel_interface->get_source_addr(charon->kernel_interface,
+               host = hydra->kernel_interface->get_source_addr(hydra->kernel_interface,
                                                        this->ike_sa->get_other_host(this->ike_sa), NULL);
                if (host)
                {       /* 2. */
@@ -327,8 +328,8 @@ static status_t build_i(private_ike_natd_t *this, message_t *message)
                }
                else
                {       /* 3. */
-                       enumerator = charon->kernel_interface->create_address_enumerator(
-                                                                               charon->kernel_interface, FALSE, FALSE);
+                       enumerator = hydra->kernel_interface->create_address_enumerator(
+                                                                               hydra->kernel_interface, FALSE, FALSE);
                        while (enumerator->enumerate(enumerator, (void**)&host))
                        {
                                /* apply port 500 to host, but work on a copy */
index 80bf647..f91eff0 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "trap_manager.h"
 
+#include <hydra.h>
 #include <daemon.h>
 #include <threading/rwlock.h>
 #include <utils/linked_list.h>
@@ -138,8 +139,8 @@ static u_int32_t install(private_trap_manager_t *this, peer_cfg_t *peer,
        if (!me || me->is_anyaddr(me))
        {
                DESTROY_IF(me);
-               me = charon->kernel_interface->get_source_addr(
-                                                                       charon->kernel_interface, other, NULL);
+               me = hydra->kernel_interface->get_source_addr(
+                                                                       hydra->kernel_interface, other, NULL);
                if (!me)
                {
                        DBG1(DBG_CFG, "installing trap failed, local address unknown");