naccyde / rpms / iproute

Forked from rpms/iproute a year ago
Clone

Blame SOURCES/0013-xfrm-also-check-for-ipv6-state-in-xfrm_state_keep.patch

0ac2f3
From 40dda2fc9fb2597996e443117df18995c58444a9 Mon Sep 17 00:00:00 2001
0ac2f3
From: Andrea Claudi <aclaudi@redhat.com>
0ac2f3
Date: Thu, 30 Apr 2020 12:46:30 +0200
0ac2f3
Subject: [PATCH] xfrm: also check for ipv6 state in xfrm_state_keep
0ac2f3
0ac2f3
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1828033
0ac2f3
Upstream Status: iproute2.git commit d27fc6390ce32
0ac2f3
0ac2f3
commit d27fc6390ce32ecdba6324e22b1c341791c5c63f
0ac2f3
Author: Xin Long <lucien.xin@gmail.com>
0ac2f3
Date:   Mon Apr 27 15:14:24 2020 +0800
0ac2f3
0ac2f3
    xfrm: also check for ipv6 state in xfrm_state_keep
0ac2f3
0ac2f3
    As commit f9d696cf414c ("xfrm: not try to delete ipcomp states when using
0ac2f3
    deleteall") does, this patch is to fix the same issue for ip6 state where
0ac2f3
    xsinfo->id.proto == IPPROTO_IPV6.
0ac2f3
0ac2f3
      # ip xfrm state add src 2000::1 dst 2000::2 spi 0x1000 \
0ac2f3
        proto comp comp deflate mode tunnel sel src 2000::1 dst \
0ac2f3
        2000::2 proto gre
0ac2f3
      # ip xfrm sta deleteall
0ac2f3
      Failed to send delete-all request
0ac2f3
      : Operation not permitted
0ac2f3
0ac2f3
    Note that the xsinfo->proto in common states can never be IPPROTO_IPV6.
0ac2f3
0ac2f3
    Fixes: f9d696cf414c ("xfrm: not try to delete ipcomp states when using deleteall")
0ac2f3
    Reported-by: Xiumei Mu <xmu@redhat.com>
0ac2f3
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
0ac2f3
    Acked-by: Andrea Claudi <aclaudi@redhat.com>
0ac2f3
    Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
0ac2f3
---
0ac2f3
 ip/xfrm_state.c | 3 ++-
0ac2f3
 1 file changed, 2 insertions(+), 1 deletion(-)
0ac2f3
0ac2f3
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
0ac2f3
index d014444e9af4f..44f08ceed24dd 100644
0ac2f3
--- a/ip/xfrm_state.c
0ac2f3
+++ b/ip/xfrm_state.c
0ac2f3
@@ -1131,7 +1131,8 @@ static int xfrm_state_keep(struct nlmsghdr *n, void *arg)
0ac2f3
 	if (!xfrm_state_filter_match(xsinfo))
0ac2f3
 		return 0;
0ac2f3
 
0ac2f3
-	if (xsinfo->id.proto == IPPROTO_IPIP)
0ac2f3
+	if (xsinfo->id.proto == IPPROTO_IPIP ||
0ac2f3
+	    xsinfo->id.proto == IPPROTO_IPV6)
0ac2f3
 		return 0;
0ac2f3
 
0ac2f3
 	if (xb->offset > xb->size) {
0ac2f3
-- 
0ac2f3
2.25.4
0ac2f3