aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/kernel_iph/kernel_iph_net.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2013-12-24 10:40:09 +0100
committerMartin Willi <martin@revosec.ch>2014-06-04 16:32:11 +0200
commit5e6e214ab41000b3eb89ab08b1bc09364ea39408 (patch)
treecc87b16ebdbc00d6d7ee6e61d6fb637f3c4ceb94 /src/libcharon/plugins/kernel_iph/kernel_iph_net.c
parentc7d30c2ad16d4855ade151dc96a9404a56a70c4e (diff)
downloadstrongswan-5e6e214ab41000b3eb89ab08b1bc09364ea39408.tar.bz2
strongswan-5e6e214ab41000b3eb89ab08b1bc09364ea39408.tar.xz
kernel-iph: Implicitly enable IP forwarding when installing routes
Diffstat (limited to 'src/libcharon/plugins/kernel_iph/kernel_iph_net.c')
-rw-r--r--src/libcharon/plugins/kernel_iph/kernel_iph_net.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libcharon/plugins/kernel_iph/kernel_iph_net.c b/src/libcharon/plugins/kernel_iph/kernel_iph_net.c
index 71c595ba7..68b753792 100644
--- a/src/libcharon/plugins/kernel_iph/kernel_iph_net.c
+++ b/src/libcharon/plugins/kernel_iph/kernel_iph_net.c
@@ -51,6 +51,11 @@ struct private_kernel_iph_net_t {
HANDLE changes;
/**
+ * EnableRouter() OVERLAPPED
+ */
+ OVERLAPPED router;
+
+ /**
* Mutex to access interface list
*/
mutex_t *mutex;
@@ -677,6 +682,23 @@ static status_t manage_route(private_kernel_iph_net_t *this, bool add,
DBG1(DBG_KNL, "%sing route failed: 0x%08lx", add ? "add" : "remov", ret);
return FAILED;
}
+
+ if (add)
+ {
+ ret = EnableRouter(NULL, &this->router);
+ if (ret != ERROR_IO_PENDING)
+ {
+ DBG1(DBG_KNL, "EnableRouter router failed: 0x%08lx", ret);
+ }
+ }
+ else
+ {
+ ret = UnenableRouter(&this->router, NULL);
+ if (ret != NO_ERROR)
+ {
+ DBG1(DBG_KNL, "UnenableRouter router failed: 0x%08lx", ret);
+ }
+ }
return SUCCESS;
}
@@ -701,6 +723,7 @@ METHOD(kernel_net_t, destroy, void,
{
CancelMibChangeNotify2(this->changes);
}
+ CloseHandle(this->router.hEvent);
this->mutex->destroy(this->mutex);
this->ifaces->destroy_function(this->ifaces, (void*)iface_destroy);
free(this);
@@ -728,6 +751,9 @@ kernel_iph_net_t *kernel_iph_net_create()
.destroy = _destroy,
},
},
+ .router = {
+ .hEvent = CreateEvent(NULL, FALSE, FALSE, NULL),
+ },
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
.ifaces = linked_list_create(),
);