kernel-iph: Implicitly enable IP forwarding when installing routes
This commit is contained in:
@@ -50,6 +50,11 @@ struct private_kernel_iph_net_t {
|
|||||||
*/
|
*/
|
||||||
HANDLE changes;
|
HANDLE changes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EnableRouter() OVERLAPPED
|
||||||
|
*/
|
||||||
|
OVERLAPPED router;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mutex to access interface list
|
* Mutex to access interface list
|
||||||
*/
|
*/
|
||||||
@@ -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);
|
DBG1(DBG_KNL, "%sing route failed: 0x%08lx", add ? "add" : "remov", ret);
|
||||||
return FAILED;
|
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;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -701,6 +723,7 @@ METHOD(kernel_net_t, destroy, void,
|
|||||||
{
|
{
|
||||||
CancelMibChangeNotify2(this->changes);
|
CancelMibChangeNotify2(this->changes);
|
||||||
}
|
}
|
||||||
|
CloseHandle(this->router.hEvent);
|
||||||
this->mutex->destroy(this->mutex);
|
this->mutex->destroy(this->mutex);
|
||||||
this->ifaces->destroy_function(this->ifaces, (void*)iface_destroy);
|
this->ifaces->destroy_function(this->ifaces, (void*)iface_destroy);
|
||||||
free(this);
|
free(this);
|
||||||
@@ -728,6 +751,9 @@ kernel_iph_net_t *kernel_iph_net_create()
|
|||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
.router = {
|
||||||
|
.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL),
|
||||||
|
},
|
||||||
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
||||||
.ifaces = linked_list_create(),
|
.ifaces = linked_list_create(),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user