diff options
author | Tobias Brunner <tobias@strongswan.org> | 2016-06-20 15:14:40 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2017-05-23 16:51:03 +0200 |
commit | d42948fc057e25624c547649425b19ae4ebfa1e4 (patch) | |
tree | 3601bff7c27440adb98b05c25f44248426b4fb83 /src/libcharon | |
parent | 35a53d6491f6ba3e6d03a5b6681f37303bdc0bdb (diff) | |
download | strongswan-d42948fc057e25624c547649425b19ae4ebfa1e4.tar.bz2 strongswan-d42948fc057e25624c547649425b19ae4ebfa1e4.tar.xz |
kernel-netlink: Enable hardware offloading if configured for an SA
Diffstat (limited to 'src/libcharon')
-rw-r--r-- | src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c b/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c index becf6b5dc..ff3728f4f 100644 --- a/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c +++ b/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c @@ -1639,6 +1639,31 @@ METHOD(kernel_ipsec_t, add_sa, status_t, data->replay_window); sa->replay_window = data->replay_window; } + if (data->hw_offload) + { + host_t *local = data->inbound ? id->dst : id->src; + char *ifname; + + if (charon->kernel->get_interface(charon->kernel, local, &ifname)) + { + struct xfrm_user_offload *offload; + + offload = netlink_reserve(hdr, sizeof(request), + XFRMA_OFFLOAD_DEV, sizeof(*offload)); + if (!offload) + { + free(ifname); + goto failed; + } + offload->ifindex = if_nametoindex(ifname); + if (local->get_family(local) == AF_INET6) + { + offload->flags |= XFRM_OFFLOAD_IPV6; + } + offload->flags |= data->inbound ? XFRM_OFFLOAD_INBOUND : 0; + free(ifname); + } + } } if (this->socket_xfrm->send_ack(this->socket_xfrm, hdr) != SUCCESS) |