Blame SOURCES/0011-xfrm-not-try-to-delete-ipcomp-states-when-using-dele.patch

d8fb9e
From 6c28c0a3046a162698fa19f3c2f2682342905288 Mon Sep 17 00:00:00 2001
d8fb9e
From: Andrea Claudi <aclaudi@redhat.com>
d8fb9e
Date: Tue, 21 Apr 2020 12:49:56 +0200
d8fb9e
Subject: [PATCH] xfrm: not try to delete ipcomp states when using deleteall
d8fb9e
d8fb9e
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1767328
d8fb9e
Upstream Status: iproute2.git commit f9d696cf414c2
d8fb9e
d8fb9e
commit f9d696cf414c2c475764aa3b29cf288350f1e21f
d8fb9e
Author: Xin Long <lucien.xin@gmail.com>
d8fb9e
Date:   Mon Feb 24 09:57:01 2020 -0500
d8fb9e
d8fb9e
    xfrm: not try to delete ipcomp states when using deleteall
d8fb9e
d8fb9e
    In kernel space, ipcomp(sub) states used by main states are not
d8fb9e
    allowed to be deleted by users, they would be freed only when
d8fb9e
    all main states are destroyed and no one uses them.
d8fb9e
d8fb9e
    In user space, ip xfrm sta deleteall doesn't filter these ipcomp
d8fb9e
    states out, and it causes errors:
d8fb9e
d8fb9e
      # ip xfrm state add src 192.168.0.1 dst 192.168.0.2 spi 0x1000 \
d8fb9e
          proto comp comp deflate mode tunnel sel src 192.168.0.1 dst \
d8fb9e
          192.168.0.2 proto gre
d8fb9e
      # ip xfrm sta deleteall
d8fb9e
      Failed to send delete-all request
d8fb9e
      : Operation not permitted
d8fb9e
d8fb9e
    This patch is to fix it by filtering ipcomp states with a check
d8fb9e
    xsinfo->id.proto == IPPROTO_IPIP.
d8fb9e
d8fb9e
    Fixes: c7699875bee0 ("Import patch ipxfrm-20040707_2.diff")
d8fb9e
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
d8fb9e
    Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
d8fb9e
---
d8fb9e
 ip/xfrm_state.c | 3 +++
d8fb9e
 1 file changed, 3 insertions(+)
d8fb9e
d8fb9e
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
d8fb9e
index 2222737cdd98d..8baa0eb669969 100644
d8fb9e
--- a/ip/xfrm_state.c
d8fb9e
+++ b/ip/xfrm_state.c
d8fb9e
@@ -1048,6 +1048,9 @@ static int xfrm_state_keep(const struct sockaddr_nl *who,
d8fb9e
 	if (!xfrm_state_filter_match(xsinfo))
d8fb9e
 		return 0;
d8fb9e
 
d8fb9e
+	if (xsinfo->id.proto == IPPROTO_IPIP)
d8fb9e
+		return 0;
d8fb9e
+
d8fb9e
 	if (xb->offset > xb->size) {
d8fb9e
 		fprintf(stderr, "State buffer overflow\n");
d8fb9e
 		return -1;
d8fb9e
-- 
d8fb9e
2.25.3
d8fb9e