libhydra: Use lib->ns instead of hydra->daemon
This commit is contained in:
@@ -695,7 +695,7 @@ kernel_libipsec_ipsec_t *kernel_libipsec_ipsec_create()
|
|||||||
.policies = linked_list_create(),
|
.policies = linked_list_create(),
|
||||||
.excludes = linked_list_create(),
|
.excludes = linked_list_create(),
|
||||||
.allow_peer_ts = lib->settings->get_bool(lib->settings,
|
.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);
|
ipsec->events->register_listener(ipsec->events, &this->ipsec_listener);
|
||||||
|
|||||||
@@ -573,7 +573,7 @@ static private_mem_pool_t *create_generic(char *name)
|
|||||||
(hashtable_equals_t)id_equals, 16),
|
(hashtable_equals_t)id_equals, 16),
|
||||||
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
||||||
.reassign_online = lib->settings->get_bool(lib->settings,
|
.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;
|
return this;
|
||||||
|
|||||||
@@ -796,12 +796,12 @@ kernel_interface_t *kernel_interface_create()
|
|||||||
);
|
);
|
||||||
|
|
||||||
ifaces = lib->settings->get_str(lib->settings,
|
ifaces = lib->settings->get_str(lib->settings,
|
||||||
"%s.interfaces_use", NULL, hydra->daemon);
|
"%s.interfaces_use", NULL, lib->ns);
|
||||||
if (!ifaces)
|
if (!ifaces)
|
||||||
{
|
{
|
||||||
this->ifaces_exclude = TRUE;
|
this->ifaces_exclude = TRUE;
|
||||||
ifaces = lib->settings->get_str(lib->settings,
|
ifaces = lib->settings->get_str(lib->settings,
|
||||||
"%s.interfaces_ignore", NULL, hydra->daemon);
|
"%s.interfaces_ignore", NULL, lib->ns);
|
||||||
}
|
}
|
||||||
if (ifaces)
|
if (ifaces)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ static void add_legacy_entry(private_attr_provider_t *this, char *key, int nr,
|
|||||||
host_t *host;
|
host_t *host;
|
||||||
char *str;
|
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);
|
key, nr);
|
||||||
if (str)
|
if (str)
|
||||||
{
|
{
|
||||||
@@ -179,7 +179,7 @@ static void load_entries(private_attr_provider_t *this)
|
|||||||
}
|
}
|
||||||
|
|
||||||
enumerator = lib->settings->create_key_value_enumerator(lib->settings,
|
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))
|
while (enumerator->enumerate(enumerator, &key, &value))
|
||||||
{
|
{
|
||||||
configuration_attribute_type_t type;
|
configuration_attribute_type_t type;
|
||||||
|
|||||||
@@ -311,8 +311,8 @@ static status_t attach_ipsec_dev(char* name, char *phys_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mtu = lib->settings->get_int(lib->settings,
|
mtu = lib->settings->get_int(lib->settings,
|
||||||
"%s.plugins.kernel-klips.ipsec_dev_mtu", 0,
|
"%s.plugins.kernel-klips.ipsec_dev_mtu", 0,
|
||||||
hydra->daemon);
|
lib->ns);
|
||||||
if (mtu <= 0)
|
if (mtu <= 0)
|
||||||
{
|
{
|
||||||
/* guess MTU as physical MTU - ESP overhead [- NAT-T overhead]
|
/* 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)
|
static void init_ipsec_devices(private_kernel_klips_ipsec_t *this)
|
||||||
{
|
{
|
||||||
int i, count = lib->settings->get_int(lib->settings,
|
int i, count = lib->settings->get_int(lib->settings,
|
||||||
"%s.plugins.kernel-klips.ipsec_dev_count",
|
"%s.plugins.kernel-klips.ipsec_dev_count",
|
||||||
DEFAULT_IPSEC_DEV_COUNT, hydra->daemon);
|
DEFAULT_IPSEC_DEV_COUNT, lib->ns);
|
||||||
|
|
||||||
for (i = 0; i < count; ++i)
|
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),
|
.mutex_pfkey = mutex_create(MUTEX_TYPE_DEFAULT),
|
||||||
.install_routes = lib->settings->get_bool(lib->settings,
|
.install_routes = lib->settings->get_bool(lib->settings,
|
||||||
"%s.install_routes", TRUE,
|
"%s.install_routes", TRUE,
|
||||||
hydra->daemon),
|
lib->ns),
|
||||||
);
|
);
|
||||||
|
|
||||||
/* initialize ipsec devices */
|
/* initialize ipsec devices */
|
||||||
|
|||||||
@@ -2685,15 +2685,15 @@ kernel_netlink_ipsec_t *kernel_netlink_ipsec_create()
|
|||||||
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
||||||
.policy_history = TRUE,
|
.policy_history = TRUE,
|
||||||
.install_routes = lib->settings->get_bool(lib->settings,
|
.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,
|
.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) /
|
this->replay_bmp = (this->replay_window + sizeof(u_int32_t) * 8 - 1) /
|
||||||
(sizeof(u_int32_t) * 8);
|
(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 */
|
{ /* starter has no threads, so we do not register for kernel events */
|
||||||
register_for_events = FALSE;
|
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,
|
fprintf(f, "%u", lib->settings->get_int(lib->settings,
|
||||||
"%s.plugins.kernel-netlink.xfrm_acq_expires",
|
"%s.plugins.kernel-netlink.xfrm_acq_expires",
|
||||||
DEFAULT_ACQUIRE_LIFETIME, hydra->daemon));
|
DEFAULT_ACQUIRE_LIFETIME, lib->ns));
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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));
|
netlink_add_attribute(hdr, RTA_PRIORITY, chunk, sizeof(request));
|
||||||
|
|
||||||
fwmark = lib->settings->get_str(lib->settings,
|
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)
|
if (fwmark)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LINUX_FIB_RULES_H
|
#ifdef HAVE_LINUX_FIB_RULES_H
|
||||||
@@ -2285,30 +2285,30 @@ kernel_netlink_net_t *kernel_netlink_net_create()
|
|||||||
.condvar = rwlock_condvar_create(),
|
.condvar = rwlock_condvar_create(),
|
||||||
.roam_lock = spinlock_create(),
|
.roam_lock = spinlock_create(),
|
||||||
.routing_table = lib->settings->get_int(lib->settings,
|
.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,
|
.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,
|
.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,
|
.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,
|
.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,
|
.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->last_route_reinstall);
|
||||||
timerclear(&this->next_roam);
|
timerclear(&this->next_roam);
|
||||||
|
|
||||||
check_kernel_features(this);
|
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 */
|
{ /* starter has no threads, so we do not register for kernel events */
|
||||||
register_for_events = FALSE;
|
register_for_events = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
exclude = lib->settings->get_str(lib->settings,
|
exclude = lib->settings->get_str(lib->settings,
|
||||||
"%s.ignore_routing_tables", NULL, hydra->daemon);
|
"%s.ignore_routing_tables", NULL, lib->ns);
|
||||||
if (exclude)
|
if (exclude)
|
||||||
{
|
{
|
||||||
char *token;
|
char *token;
|
||||||
|
|||||||
@@ -2861,10 +2861,10 @@ kernel_pfkey_ipsec_t *kernel_pfkey_ipsec_create()
|
|||||||
.mutex_pfkey = mutex_create(MUTEX_TYPE_DEFAULT),
|
.mutex_pfkey = mutex_create(MUTEX_TYPE_DEFAULT),
|
||||||
.install_routes = lib->settings->get_bool(lib->settings,
|
.install_routes = lib->settings->get_bool(lib->settings,
|
||||||
"%s.install_routes", TRUE,
|
"%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 */
|
{ /* starter has no threads, so we do not register for kernel events */
|
||||||
register_for_events = FALSE;
|
register_for_events = FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1785,7 +1785,7 @@ kernel_pfroute_net_t *kernel_pfroute_net_create()
|
|||||||
.net_changes_lock = mutex_create(MUTEX_TYPE_DEFAULT),
|
.net_changes_lock = mutex_create(MUTEX_TYPE_DEFAULT),
|
||||||
.roam_lock = spinlock_create(),
|
.roam_lock = spinlock_create(),
|
||||||
.vip_wait = lib->settings->get_int(lib->settings,
|
.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->last_route_reinstall);
|
||||||
timerclear(&this->next_roam);
|
timerclear(&this->next_roam);
|
||||||
@@ -1799,7 +1799,7 @@ kernel_pfroute_net_t *kernel_pfroute_net_create()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (streq(hydra->daemon, "starter"))
|
if (streq(lib->ns, "starter"))
|
||||||
{
|
{
|
||||||
/* starter has no threads, so we do not register for kernel events */
|
/* starter has no threads, so we do not register for kernel events */
|
||||||
if (shutdown(this->socket, SHUT_RD) != 0)
|
if (shutdown(this->socket, SHUT_RD) != 0)
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ resolve_handler_t *resolve_handler_create()
|
|||||||
},
|
},
|
||||||
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
||||||
.file = lib->settings->get_str(lib->settings, "%s.plugins.resolve.file",
|
.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)
|
if (stat(RESOLVCONF_EXEC, &st) == 0)
|
||||||
@@ -369,7 +369,7 @@ resolve_handler_t *resolve_handler_create()
|
|||||||
this->use_resolvconf = TRUE;
|
this->use_resolvconf = TRUE;
|
||||||
this->iface_prefix = lib->settings->get_str(lib->settings,
|
this->iface_prefix = lib->settings->get_str(lib->settings,
|
||||||
"%s.plugins.resolve.resolvconf.iface_prefix",
|
"%s.plugins.resolve.resolvconf.iface_prefix",
|
||||||
RESOLVCONF_PREFIX, hydra->daemon);
|
RESOLVCONF_PREFIX, lib->ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
|
|||||||
Reference in New Issue
Block a user