kernel-netlink: Add manager for XFRM interfaces
The manager will allow charon-nm to create XFRM interfaces if supported by the kernel instead of creating an unused dummy TUN interface. The xfrmi tool is mostly obsolete nowadays as iproute2 supports creating XFRM interfaces since 5.1.0 (2019-05). Older Debians don't ship that and early versions didn't list the interface IDs. So there might still be some uses for this tool.
This commit is contained in:
@@ -63,6 +63,7 @@
|
||||
|
||||
#include "kernel_netlink_ipsec.h"
|
||||
#include "kernel_netlink_shared.h"
|
||||
#include "kernel_netlink_xfrmi.h"
|
||||
|
||||
#include <daemon.h>
|
||||
#include <utils/debug.h>
|
||||
@@ -337,6 +338,11 @@ struct private_kernel_netlink_ipsec_t {
|
||||
*/
|
||||
netlink_socket_t *socket_xfrm;
|
||||
|
||||
/**
|
||||
* XFRM interface manager
|
||||
*/
|
||||
kernel_netlink_xfrmi_t *xfrmi;
|
||||
|
||||
/**
|
||||
* Netlink xfrm socket to receive acquire and expire events
|
||||
*/
|
||||
@@ -3949,6 +3955,11 @@ METHOD(kernel_ipsec_t, destroy, void,
|
||||
DESTROY_IF(this->socket_link_events);
|
||||
DESTROY_IF(this->socket_xfrm_events);
|
||||
array_destroy_function(this->bypass, remove_port_bypass, this);
|
||||
if (this->xfrmi)
|
||||
{
|
||||
lib->set(lib, KERNEL_NETLINK_XFRMI_MANAGER, NULL);
|
||||
kernel_netlink_xfrmi_destroy(this->xfrmi);
|
||||
}
|
||||
DESTROY_IF(this->socket_xfrm);
|
||||
enumerator = this->policies->create_enumerator(this->policies);
|
||||
while (enumerator->enumerate(enumerator, NULL, &policy))
|
||||
@@ -4188,5 +4199,11 @@ kernel_netlink_ipsec_t *kernel_netlink_ipsec_create()
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
this->xfrmi = kernel_netlink_xfrmi_create(TRUE);
|
||||
if (this->xfrmi)
|
||||
{
|
||||
lib->set(lib, KERNEL_NETLINK_XFRMI_MANAGER, this->xfrmi);
|
||||
}
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user