diff options
author | Xin Long <lucien.xin@gmail.com> | 2020-02-24 09:57:01 -0500 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2020-02-28 13:50:58 -0800 |
commit | f9d696cf414c2c475764aa3b29cf288350f1e21f (patch) | |
tree | bbbc6525a3defaea92fd711de86534cba558d1d9 | |
parent | 229bb886a3c4444521eca16c7ab74a539aaf9cb4 (diff) | |
download | iproute2-f9d696cf414c2c475764aa3b29cf288350f1e21f.tar.gz |
xfrm: not try to delete ipcomp states when using deleteall
In kernel space, ipcomp(sub) states used by main states are not
allowed to be deleted by users, they would be freed only when
all main states are destroyed and no one uses them.
In user space, ip xfrm sta deleteall doesn't filter these ipcomp
states out, and it causes errors:
# ip xfrm state add src 192.168.0.1 dst 192.168.0.2 spi 0x1000 \
proto comp comp deflate mode tunnel sel src 192.168.0.1 dst \
192.168.0.2 proto gre
# ip xfrm sta deleteall
Failed to send delete-all request
: Operation not permitted
This patch is to fix it by filtering ipcomp states with a check
xsinfo->id.proto == IPPROTO_IPIP.
Fixes: c7699875bee0 ("Import patch ipxfrm-20040707_2.diff")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r-- | ip/xfrm_state.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c index 16ff1931b..d68f600ae 100644 --- a/ip/xfrm_state.c +++ b/ip/xfrm_state.c @@ -1131,6 +1131,9 @@ static int xfrm_state_keep(struct nlmsghdr *n, void *arg) if (!xfrm_state_filter_match(xsinfo)) return 0; + if (xsinfo->id.proto == IPPROTO_IPIP) + return 0; + if (xb->offset > xb->size) { fprintf(stderr, "State buffer overflow\n"); return -1; |