aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2016-10-12 12:11:24 +0200
committerTobias Brunner <tobias@strongswan.org>2017-02-08 10:38:28 +0100
commit46c21e3cc3ee3422463362495e1ab59cd292298e (patch)
treedfc375f163520dd51419cb5d1bdef58d11d1d1c5
parentf8a362bfbc5715f30d8be90a285313b966436ef6 (diff)
downloadstrongswan-46c21e3cc3ee3422463362495e1ab59cd292298e.tar.bz2
strongswan-46c21e3cc3ee3422463362495e1ab59cd292298e.tar.xz
kernel-interface: Add interface name to local subnet enumerator
-rw-r--r--src/libcharon/kernel/kernel_interface.h4
-rw-r--r--src/libcharon/kernel/kernel_net.h4
-rw-r--r--src/libcharon/plugins/bypass_lan/bypass_lan_listener.c3
-rw-r--r--src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c3
4 files changed, 10 insertions, 4 deletions
diff --git a/src/libcharon/kernel/kernel_interface.h b/src/libcharon/kernel/kernel_interface.h
index dca4babad..96c9ffa62 100644
--- a/src/libcharon/kernel/kernel_interface.h
+++ b/src/libcharon/kernel/kernel_interface.h
@@ -320,7 +320,9 @@ struct kernel_interface_t {
*
* Local subnets are subnets the host is directly connected to.
*
- * @return enumerator over host_t*, uint8_t
+ * The enumerator returns the network, subnet mask and interface.
+ *
+ * @return enumerator over host_t*, uint8_t, char*
*/
enumerator_t *(*create_local_subnet_enumerator)(kernel_interface_t *this);
diff --git a/src/libcharon/kernel/kernel_net.h b/src/libcharon/kernel/kernel_net.h
index a1ced362c..12475b123 100644
--- a/src/libcharon/kernel/kernel_net.h
+++ b/src/libcharon/kernel/kernel_net.h
@@ -123,7 +123,9 @@ struct kernel_net_t {
*
* Local subnets are subnets the host is directly connected to.
*
- * @return enumerator over host_t*, uint8_t
+ * The enumerator returns the network, subnet mask and interface.
+ *
+ * @return enumerator over host_t*, uint8_t, char*
*/
enumerator_t *(*create_local_subnet_enumerator)(kernel_net_t *this);
diff --git a/src/libcharon/plugins/bypass_lan/bypass_lan_listener.c b/src/libcharon/plugins/bypass_lan/bypass_lan_listener.c
index 7963677bf..3e744b96d 100644
--- a/src/libcharon/plugins/bypass_lan/bypass_lan_listener.c
+++ b/src/libcharon/plugins/bypass_lan/bypass_lan_listener.c
@@ -102,6 +102,7 @@ static job_requeue_t update_bypass(private_bypass_lan_listener_t *this)
bypass_policy_t *found, *lookup;
host_t *net;
uint8_t mask;
+ char *iface;
seen = hashtable_create((hashtable_hash_t)policy_hash,
(hashtable_equals_t)policy_equals, 4);
@@ -109,7 +110,7 @@ static job_requeue_t update_bypass(private_bypass_lan_listener_t *this)
this->mutex->lock(this->mutex);
enumerator = charon->kernel->create_local_subnet_enumerator(charon->kernel);
- while (enumerator->enumerate(enumerator, &net, &mask))
+ while (enumerator->enumerate(enumerator, &net, &mask, &iface))
{
INIT(lookup,
.net = net->clone(net),
diff --git a/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c b/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c
index a31f312b9..61e029254 100644
--- a/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c
+++ b/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c
@@ -2148,7 +2148,7 @@ METHOD(enumerator_t, destroy_subnet_enumerator, void,
}
METHOD(enumerator_t, enumerate_subnets, bool,
- subnet_enumerator_t *this, host_t **net, uint8_t *mask)
+ subnet_enumerator_t *this, host_t **net, uint8_t *mask, char **ifname)
{
if (!this->current)
{
@@ -2204,6 +2204,7 @@ METHOD(enumerator_t, enumerate_subnets, bool,
this->net = host_create_from_chunk(msg->rtm_family, dst, 0);
*net = this->net;
*mask = msg->rtm_dst_len;
+ *ifname = NULL;
return TRUE;
}
break;