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