]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
1a36a6cbd0b120c8c2594916fa000deaea7bdf80
[thirdparty/kernel/stable-queue.git] /
1 From 8c18562e3e4a54a66866e3ac13bd111616864af2 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Thu, 8 Oct 2020 16:13:24 +0800
4 Subject: xfrm: interface: fix the priorities for ipip and ipv6 tunnels
5
6 From: Xin Long <lucien.xin@gmail.com>
7
8 [ Upstream commit 7fe94612dd4cfcd35fe0ec87745fb31ad2be71f8 ]
9
10 As Nicolas noticed in his case, when xfrm_interface module is installed
11 the standard IP tunnels will break in receiving packets.
12
13 This is caused by the IP tunnel handlers with a higher priority in xfrm
14 interface processing incoming packets by xfrm_input(), which would drop
15 the packets and return 0 instead when anything wrong happens.
16
17 Rather than changing xfrm_input(), this patch is to adjust the priority
18 for the IP tunnel handlers in xfrm interface, so that the packets would
19 go to xfrmi's later than the others', as the others' would not drop the
20 packets when the handlers couldn't process them.
21
22 Note that IPCOMP also defines its own IPIP tunnel handler and it calls
23 xfrm_input() as well, so we must make its priority lower than xfrmi's,
24 which means having xfrmi loaded would still break IPCOMP. We may seek
25 another way to fix it in xfrm_input() in the future.
26
27 Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
28 Tested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
29 Fixes: da9bbf0598c9 ("xfrm: interface: support IPIP and IPIP6 tunnels processing with .cb_handler")
30 FIxes: d7b360c2869f ("xfrm: interface: support IP6IP6 and IP6IP tunnels processing with .cb_handler")
31 Signed-off-by: Xin Long <lucien.xin@gmail.com>
32 Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
33 Signed-off-by: Sasha Levin <sashal@kernel.org>
34 ---
35 net/ipv4/xfrm4_tunnel.c | 4 ++--
36 net/ipv6/xfrm6_tunnel.c | 4 ++--
37 net/xfrm/xfrm_interface.c | 8 ++++----
38 3 files changed, 8 insertions(+), 8 deletions(-)
39
40 diff --git a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c
41 index dc19aff7c2e00..fb0648e7fb32f 100644
42 --- a/net/ipv4/xfrm4_tunnel.c
43 +++ b/net/ipv4/xfrm4_tunnel.c
44 @@ -64,14 +64,14 @@ static int xfrm_tunnel_err(struct sk_buff *skb, u32 info)
45 static struct xfrm_tunnel xfrm_tunnel_handler __read_mostly = {
46 .handler = xfrm_tunnel_rcv,
47 .err_handler = xfrm_tunnel_err,
48 - .priority = 3,
49 + .priority = 4,
50 };
51
52 #if IS_ENABLED(CONFIG_IPV6)
53 static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = {
54 .handler = xfrm_tunnel_rcv,
55 .err_handler = xfrm_tunnel_err,
56 - .priority = 2,
57 + .priority = 3,
58 };
59 #endif
60
61 diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
62 index 25b7ebda2fabf..f696d46e69100 100644
63 --- a/net/ipv6/xfrm6_tunnel.c
64 +++ b/net/ipv6/xfrm6_tunnel.c
65 @@ -303,13 +303,13 @@ static const struct xfrm_type xfrm6_tunnel_type = {
66 static struct xfrm6_tunnel xfrm6_tunnel_handler __read_mostly = {
67 .handler = xfrm6_tunnel_rcv,
68 .err_handler = xfrm6_tunnel_err,
69 - .priority = 2,
70 + .priority = 3,
71 };
72
73 static struct xfrm6_tunnel xfrm46_tunnel_handler __read_mostly = {
74 .handler = xfrm6_tunnel_rcv,
75 .err_handler = xfrm6_tunnel_err,
76 - .priority = 2,
77 + .priority = 3,
78 };
79
80 static int __net_init xfrm6_tunnel_net_init(struct net *net)
81 diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
82 index a8f66112c52b4..0bb7963b9f6bc 100644
83 --- a/net/xfrm/xfrm_interface.c
84 +++ b/net/xfrm/xfrm_interface.c
85 @@ -830,14 +830,14 @@ static struct xfrm6_tunnel xfrmi_ipv6_handler __read_mostly = {
86 .handler = xfrmi6_rcv_tunnel,
87 .cb_handler = xfrmi_rcv_cb,
88 .err_handler = xfrmi6_err,
89 - .priority = -1,
90 + .priority = 2,
91 };
92
93 static struct xfrm6_tunnel xfrmi_ip6ip_handler __read_mostly = {
94 .handler = xfrmi6_rcv_tunnel,
95 .cb_handler = xfrmi_rcv_cb,
96 .err_handler = xfrmi6_err,
97 - .priority = -1,
98 + .priority = 2,
99 };
100 #endif
101
102 @@ -875,14 +875,14 @@ static struct xfrm_tunnel xfrmi_ipip_handler __read_mostly = {
103 .handler = xfrmi4_rcv_tunnel,
104 .cb_handler = xfrmi_rcv_cb,
105 .err_handler = xfrmi4_err,
106 - .priority = -1,
107 + .priority = 3,
108 };
109
110 static struct xfrm_tunnel xfrmi_ipip6_handler __read_mostly = {
111 .handler = xfrmi4_rcv_tunnel,
112 .cb_handler = xfrmi_rcv_cb,
113 .err_handler = xfrmi4_err,
114 - .priority = -1,
115 + .priority = 2,
116 };
117 #endif
118
119 --
120 2.27.0
121