Pass sockets to bypass to kernel interface, allowing us to register them dynamically
This commit is contained in:
@@ -241,6 +241,15 @@ METHOD(kernel_interface_t, del_route, status_t,
|
||||
src_ip, if_name);
|
||||
}
|
||||
|
||||
METHOD(kernel_interface_t, bypass_socket, bool,
|
||||
private_kernel_interface_t *this, int fd, int family)
|
||||
{
|
||||
if (!this->ipsec)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return this->ipsec->bypass_socket(this->ipsec, fd, family);
|
||||
}
|
||||
|
||||
METHOD(kernel_interface_t, get_address_by_ts, status_t,
|
||||
private_kernel_interface_t *this, traffic_selector_t *ts, host_t **ip)
|
||||
@@ -361,6 +370,7 @@ kernel_interface_t *kernel_interface_create()
|
||||
.del_ip = _del_ip,
|
||||
.add_route = _add_route,
|
||||
.del_route = _del_route,
|
||||
.bypass_socket = _bypass_socket,
|
||||
|
||||
.get_address_by_ts = _get_address_by_ts,
|
||||
.add_ipsec_interface = _add_ipsec_interface,
|
||||
|
||||
@@ -332,6 +332,15 @@ struct kernel_interface_t {
|
||||
status_t (*del_route) (kernel_interface_t *this, chunk_t dst_net, u_int8_t prefixlen,
|
||||
host_t *gateway, host_t *src_ip, char *if_name);
|
||||
|
||||
/**
|
||||
* Set up a bypass policy for a given socket.
|
||||
*
|
||||
* @param fd socket file descriptor to setup policy for
|
||||
* @param family protocol family of the socket
|
||||
* @return TRUE of policy set up successfully
|
||||
*/
|
||||
bool (*bypass_socket)(kernel_interface_t *this, int fd, int family);
|
||||
|
||||
/**
|
||||
* manager methods
|
||||
*/
|
||||
|
||||
@@ -264,6 +264,15 @@ struct kernel_ipsec_t {
|
||||
policy_dir_t direction,
|
||||
bool unrouted);
|
||||
|
||||
/**
|
||||
* Install a bypass policy for the given socket.
|
||||
*
|
||||
* @param fd socket file descriptor to setup policy for
|
||||
* @param family protocol family of the socket
|
||||
* @return TRUE of policy set up successfully
|
||||
*/
|
||||
bool (*bypass_socket)(kernel_ipsec_t *this, int fd, int family);
|
||||
|
||||
/**
|
||||
* Destroy the implementation.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user