use XFRM_MSG_UPDPOLICY for existing policies only
[strongswan.git] / src / charon / kernel / kernel_interface.c
index 44b79cc..7808110 100644 (file)
@@ -2669,7 +2669,7 @@ static status_t add_policy(private_kernel_interface_t *this,
        memset(&request, 0, sizeof(request));
        hdr = (struct nlmsghdr*)request;
        hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
-       hdr->nlmsg_type = XFRM_MSG_UPDPOLICY;
+       hdr->nlmsg_type = found ? XFRM_MSG_UPDPOLICY : XFRM_MSG_NEWPOLICY;
        hdr->nlmsg_len = NLMSG_LENGTH(sizeof(struct xfrm_userpolicy_info));
 
        policy_info = (struct xfrm_userpolicy_info*)NLMSG_DATA(hdr);