]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
kernel-netlink: Read protocol of acquire not from template
authorTobias Brunner <tobias@strongswan.org>
Fri, 28 May 2021 11:36:04 +0000 (13:36 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 14 Apr 2022 16:42:01 +0000 (18:42 +0200)
If a policy with IPComp template triggers an acquire, we get two, one for
an IPComp, one for ESP/AH SA.  However, the triggering template of the trap
policy (where we get the reqid from), will be the same in both acquires,
IPComp, which we ignore, so no acquire was actually forwarded.

src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c

index 339ce2a59fa1f532c9a9c661eb30aa290909ecd8..32b68534505a87354a20759540bdb1df82aa1ac6 100644 (file)
@@ -899,9 +899,10 @@ static void process_acquire(private_kernel_netlink_ipsec_t *this,
        size_t rtasize;
        traffic_selector_t *src_ts, *dst_ts;
        uint32_t reqid = 0;
-       int proto = 0;
+       uint8_t proto;
 
        acquire = NLMSG_DATA(hdr);
+       proto = acquire->id.proto;
        rta = XFRM_RTA(hdr, struct xfrm_user_acquire);
        rtasize = XFRM_PAYLOAD(hdr, struct xfrm_user_acquire);
 
@@ -916,7 +917,6 @@ static void process_acquire(private_kernel_netlink_ipsec_t *this,
                        struct xfrm_user_tmpl* tmpl;
                        tmpl = (struct xfrm_user_tmpl*)RTA_DATA(rta);
                        reqid = tmpl->reqid;
-                       proto = tmpl->id.proto;
                }
                rta = RTA_NEXT(rta, rtasize);
        }