libhydra: Use lib->ns instead of hydra->daemon
authorTobias Brunner <tobias@strongswan.org>
Wed, 22 Jan 2014 13:35:41 +0000 (14:35 +0100)
committerTobias Brunner <tobias@strongswan.org>
Wed, 12 Feb 2014 13:34:32 +0000 (14:34 +0100)
src/libcharon/plugins/kernel_libipsec/kernel_libipsec_ipsec.c
src/libhydra/attributes/mem_pool.c
src/libhydra/kernel/kernel_interface.c
src/libhydra/plugins/attr/attr_provider.c
src/libhydra/plugins/kernel_klips/kernel_klips_ipsec.c
src/libhydra/plugins/kernel_netlink/kernel_netlink_ipsec.c
src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c
src/libhydra/plugins/kernel_pfkey/kernel_pfkey_ipsec.c
src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
src/libhydra/plugins/resolve/resolve_handler.c

index d0744e3..b335807 100644 (file)
@@ -695,7 +695,7 @@ kernel_libipsec_ipsec_t *kernel_libipsec_ipsec_create()
                .policies = linked_list_create(),
                .excludes = linked_list_create(),
                .allow_peer_ts = lib->settings->get_bool(lib->settings,
-                               "%s.plugins.kernel-libipsec.allow_peer_ts", FALSE, hydra->daemon),
+                                       "%s.plugins.kernel-libipsec.allow_peer_ts", FALSE, lib->ns),
        );
 
        ipsec->events->register_listener(ipsec->events, &this->ipsec_listener);
index 77567ce..cc45e56 100644 (file)
@@ -573,7 +573,7 @@ static private_mem_pool_t *create_generic(char *name)
                                                                   (hashtable_equals_t)id_equals, 16),
                .mutex = mutex_create(MUTEX_TYPE_DEFAULT),
                .reassign_online = lib->settings->get_bool(lib->settings,
-                                                       "%s.mem-pool.reassign_online", FALSE, hydra->daemon),
+                                                               "%s.mem-pool.reassign_online", FALSE, lib->ns),
        );
 
        return this;
index cbfddd0..3e34d20 100644 (file)
@@ -796,12 +796,12 @@ kernel_interface_t *kernel_interface_create()
        );
 
        ifaces = lib->settings->get_str(lib->settings,
-                                       "%s.interfaces_use", NULL, hydra->daemon);
+                                                                       "%s.interfaces_use", NULL, lib->ns);
        if (!ifaces)
        {
                this->ifaces_exclude = TRUE;
                ifaces = lib->settings->get_str(lib->settings,
-                                       "%s.interfaces_ignore", NULL, hydra->daemon);
+                                                                       "%s.interfaces_ignore", NULL, lib->ns);
        }
        if (ifaces)
        {
index 1a2fa7f..629d2ca 100644 (file)
@@ -109,7 +109,7 @@ static void add_legacy_entry(private_attr_provider_t *this, char *key, int nr,
        host_t *host;
        char *str;
 
-       str = lib->settings->get_str(lib->settings, "%s.%s%d", NULL, hydra->daemon,
+       str = lib->settings->get_str(lib->settings, "%s.%s%d", NULL, lib->ns,
                                                                 key, nr);
        if (str)
        {
@@ -179,7 +179,7 @@ static void load_entries(private_attr_provider_t *this)
        }
 
        enumerator = lib->settings->create_key_value_enumerator(lib->settings,
-                                                                                       "%s.plugins.attr", hydra->daemon);
+                                                                                                       "%s.plugins.attr", lib->ns);
        while (enumerator->enumerate(enumerator, &key, &value))
        {
                configuration_attribute_type_t type;
index a226162..a75ccf3 100644 (file)
@@ -311,8 +311,8 @@ static status_t attach_ipsec_dev(char* name, char *phys_name)
        }
 
        mtu = lib->settings->get_int(lib->settings,
-                                               "%s.plugins.kernel-klips.ipsec_dev_mtu", 0,
-                                               hydra->daemon);
+                                                                "%s.plugins.kernel-klips.ipsec_dev_mtu", 0,
+                                                                lib->ns);
        if (mtu <= 0)
        {
                /* guess MTU as physical MTU - ESP overhead [- NAT-T overhead]
@@ -2505,8 +2505,8 @@ METHOD(kernel_ipsec_t, del_policy, status_t,
 static void init_ipsec_devices(private_kernel_klips_ipsec_t *this)
 {
        int i, count = lib->settings->get_int(lib->settings,
-                                               "%s.plugins.kernel-klips.ipsec_dev_count",
-                                               DEFAULT_IPSEC_DEV_COUNT, hydra->daemon);
+                                                                       "%s.plugins.kernel-klips.ipsec_dev_count",
+                                                                       DEFAULT_IPSEC_DEV_COUNT, lib->ns);
 
        for (i = 0; i < count; ++i)
        {
@@ -2611,7 +2611,7 @@ kernel_klips_ipsec_t *kernel_klips_ipsec_create()
                .mutex_pfkey = mutex_create(MUTEX_TYPE_DEFAULT),
                .install_routes = lib->settings->get_bool(lib->settings,
                                                                                                  "%s.install_routes", TRUE,
-                                                                                                 hydra->daemon),
+                                                                                                 lib->ns),
        );
 
        /* initialize ipsec devices */
index 24f15d9..c864a92 100644 (file)
@@ -2685,15 +2685,15 @@ kernel_netlink_ipsec_t *kernel_netlink_ipsec_create()
                .mutex = mutex_create(MUTEX_TYPE_DEFAULT),
                .policy_history = TRUE,
                .install_routes = lib->settings->get_bool(lib->settings,
-                                       "%s.install_routes", TRUE, hydra->daemon),
+                                                       "%s.install_routes", TRUE, lib->ns),
                .replay_window = lib->settings->get_int(lib->settings,
-                                       "%s.replay_window", DEFAULT_REPLAY_WINDOW, hydra->daemon),
+                                                       "%s.replay_window", DEFAULT_REPLAY_WINDOW, lib->ns),
        );
 
        this->replay_bmp = (this->replay_window + sizeof(u_int32_t) * 8 - 1) /
                                                                                                        (sizeof(u_int32_t) * 8);
 
-       if (streq(hydra->daemon, "starter"))
+       if (streq(lib->ns, "starter"))
        {       /* starter has no threads, so we do not register for kernel events */
                register_for_events = FALSE;
        }
@@ -2703,7 +2703,7 @@ kernel_netlink_ipsec_t *kernel_netlink_ipsec_create()
        {
                fprintf(f, "%u", lib->settings->get_int(lib->settings,
                                                                "%s.plugins.kernel-netlink.xfrm_acq_expires",
-                                                               DEFAULT_ACQUIRE_LIFETIME, hydra->daemon));
+                                                               DEFAULT_ACQUIRE_LIFETIME, lib->ns));
                fclose(f);
        }
 
index 0cbdef1..3cf3176 100644 (file)
@@ -2125,7 +2125,7 @@ static status_t manage_rule(private_kernel_netlink_net_t *this, int nlmsg_type,
        netlink_add_attribute(hdr, RTA_PRIORITY, chunk, sizeof(request));
 
        fwmark = lib->settings->get_str(lib->settings,
-                                       "%s.plugins.kernel-netlink.fwmark", NULL, hydra->daemon);
+                                                       "%s.plugins.kernel-netlink.fwmark", NULL, lib->ns);
        if (fwmark)
        {
 #ifdef HAVE_LINUX_FIB_RULES_H
@@ -2285,30 +2285,30 @@ kernel_netlink_net_t *kernel_netlink_net_create()
                .condvar = rwlock_condvar_create(),
                .roam_lock = spinlock_create(),
                .routing_table = lib->settings->get_int(lib->settings,
-                               "%s.routing_table", ROUTING_TABLE, hydra->daemon),
+                                               "%s.routing_table", ROUTING_TABLE, lib->ns),
                .routing_table_prio = lib->settings->get_int(lib->settings,
-                               "%s.routing_table_prio", ROUTING_TABLE_PRIO, hydra->daemon),
+                                               "%s.routing_table_prio", ROUTING_TABLE_PRIO, lib->ns),
                .process_route = lib->settings->get_bool(lib->settings,
-                               "%s.process_route", TRUE, hydra->daemon),
+                                               "%s.process_route", TRUE, lib->ns),
                .install_virtual_ip = lib->settings->get_bool(lib->settings,
-                               "%s.install_virtual_ip", TRUE, hydra->daemon),
+                                               "%s.install_virtual_ip", TRUE, lib->ns),
                .install_virtual_ip_on = lib->settings->get_str(lib->settings,
-                               "%s.install_virtual_ip_on", NULL, hydra->daemon),
+                                               "%s.install_virtual_ip_on", NULL, lib->ns),
                .roam_events = lib->settings->get_bool(lib->settings,
-                               "%s.plugins.kernel-netlink.roam_events", TRUE, hydra->daemon),
+                                               "%s.plugins.kernel-netlink.roam_events", TRUE, lib->ns),
        );
        timerclear(&this->last_route_reinstall);
        timerclear(&this->next_roam);
 
        check_kernel_features(this);
 
-       if (streq(hydra->daemon, "starter"))
+       if (streq(lib->ns, "starter"))
        {       /* starter has no threads, so we do not register for kernel events */
                register_for_events = FALSE;
        }
 
        exclude = lib->settings->get_str(lib->settings,
-                                       "%s.ignore_routing_tables", NULL, hydra->daemon);
+                                                                        "%s.ignore_routing_tables", NULL, lib->ns);
        if (exclude)
        {
                char *token;
index 98a6f81..4704d41 100644 (file)
@@ -2861,10 +2861,10 @@ kernel_pfkey_ipsec_t *kernel_pfkey_ipsec_create()
                .mutex_pfkey = mutex_create(MUTEX_TYPE_DEFAULT),
                .install_routes = lib->settings->get_bool(lib->settings,
                                                                                                  "%s.install_routes", TRUE,
-                                                                                                 hydra->daemon),
+                                                                                                 lib->ns),
        );
 
-       if (streq(hydra->daemon, "starter"))
+       if (streq(lib->ns, "starter"))
        {       /* starter has no threads, so we do not register for kernel events */
                register_for_events = FALSE;
        }
index 844d7c4..a8a57a5 100644 (file)
@@ -1785,7 +1785,7 @@ kernel_pfroute_net_t *kernel_pfroute_net_create()
                .net_changes_lock = mutex_create(MUTEX_TYPE_DEFAULT),
                .roam_lock = spinlock_create(),
                .vip_wait = lib->settings->get_int(lib->settings,
-                                       "%s.plugins.kernel-pfroute.vip_wait", 1000, hydra->daemon),
+                                               "%s.plugins.kernel-pfroute.vip_wait", 1000, lib->ns),
        );
        timerclear(&this->last_route_reinstall);
        timerclear(&this->next_roam);
@@ -1799,7 +1799,7 @@ kernel_pfroute_net_t *kernel_pfroute_net_create()
                return NULL;
        }
 
-       if (streq(hydra->daemon, "starter"))
+       if (streq(lib->ns, "starter"))
        {
                /* starter has no threads, so we do not register for kernel events */
                if (shutdown(this->socket, SHUT_RD) != 0)
index 2eee854..069466a 100644 (file)
@@ -361,7 +361,7 @@ resolve_handler_t *resolve_handler_create()
                },
                .mutex = mutex_create(MUTEX_TYPE_DEFAULT),
                .file = lib->settings->get_str(lib->settings, "%s.plugins.resolve.file",
-                                                                          RESOLV_CONF, hydra->daemon),
+                                                                          RESOLV_CONF, lib->ns),
        );
 
        if (stat(RESOLVCONF_EXEC, &st) == 0)
@@ -369,7 +369,7 @@ resolve_handler_t *resolve_handler_create()
                this->use_resolvconf = TRUE;
                this->iface_prefix = lib->settings->get_str(lib->settings,
                                                                "%s.plugins.resolve.resolvconf.iface_prefix",
-                                                               RESOLVCONF_PREFIX, hydra->daemon);
+                                                               RESOLVCONF_PREFIX, lib->ns);
        }
 
        return &this->public;