kernel-interface: Add interface name to local subnet enumerator

This commit is contained in:
Tobias Brunner
2017-02-08 10:38:28 +01:00
parent f8a362bfbc
commit 46c21e3cc3
4 changed files with 10 additions and 4 deletions
+3 -1
View File
@@ -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);
+3 -1
View File
@@ -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);
@@ -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),
@@ -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;