]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
kernel-netlink: Enable UDP GRO
authorTobias Brunner <tobias@strongswan.org>
Tue, 25 Mar 2025 12:44:44 +0000 (13:44 +0100)
committerTobias Brunner <tobias@strongswan.org>
Mon, 14 Apr 2025 09:39:44 +0000 (11:39 +0200)
This enables GRO offload for inbound ESP-in-UDP packets if the
esp4|6_offload modules are loaded.  Note that inbound ESP or ESP-in-UDP
packets won't be visible on layer 3 in Netfilter or tcpdump.

src/include/linux/udp.h
src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c

index b68a166f2e46f455a92ca809dfe43e30dd6e38fd..c0920eaa2d40ae5e00af629e557c100225df0653 100644 (file)
@@ -29,6 +29,7 @@ struct udphdr {
 /* UDP socket options */
 #define UDP_CORK       1       /* Never send partially complete segments */
 #define UDP_ENCAP      100     /* Set the socket to accept encapsulated packets */
+#define UDP_GRO                104     /* This socket can receive UDP GRO packets */
 
 /* UDP encapsulation types */
 #define UDP_ENCAP_ESPINUDP_NON_IKE     1 /* draft-ietf-ipsec-nat-t-ike-00/01 */
index c6e50cc05dbb975a4024a30ed1083ba4c2aa9bd3..df2822885312a5b172460baab13faba884badf31 100644 (file)
@@ -3884,6 +3884,12 @@ METHOD(kernel_ipsec_t, enable_udp_decap, bool,
                DBG1(DBG_KNL, "unable to set UDP_ENCAP: %s", strerror(errno));
                return FALSE;
        }
+       type = 1;
+       if (setsockopt(fd, SOL_UDP, UDP_GRO, &type, sizeof(type)) < 0)
+       {
+               DBG1(DBG_KNL, "unable to set UDP_GRO: %s", strerror(errno));
+               return FALSE;
+       }
        return TRUE;
 }