Commit 7fe94612 authored by Xin Long's avatar Xin Long Committed by Steffen Klassert

xfrm: interface: fix the priorities for ipip and ipv6 tunnels

As Nicolas noticed in his case, when xfrm_interface module is installed
the standard IP tunnels will break in receiving packets.

This is caused by the IP tunnel handlers with a higher priority in xfrm
interface processing incoming packets by xfrm_input(), which would drop
the packets and return 0 instead when anything wrong happens.

Rather than changing xfrm_input(), this patch is to adjust the priority
for the IP tunnel handlers in xfrm interface, so that the packets would
go to xfrmi's later than the others', as the others' would not drop the
packets when the handlers couldn't process them.

Note that IPCOMP also defines its own IPIP tunnel handler and it calls
xfrm_input() as well, so we must make its priority lower than xfrmi's,
which means having xfrmi loaded would still break IPCOMP. We may seek
another way to fix it in xfrm_input() in the future.
Reported-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Tested-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Fixes: da9bbf05 ("xfrm: interface: support IPIP and IPIP6 tunnels processing with .cb_handler")
FIxes: d7b360c2 ("xfrm: interface: support IP6IP6 and IP6IP tunnels processing with .cb_handler")
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent 3fdd47c3
...@@ -64,14 +64,14 @@ static int xfrm_tunnel_err(struct sk_buff *skb, u32 info) ...@@ -64,14 +64,14 @@ static int xfrm_tunnel_err(struct sk_buff *skb, u32 info)
static struct xfrm_tunnel xfrm_tunnel_handler __read_mostly = { static struct xfrm_tunnel xfrm_tunnel_handler __read_mostly = {
.handler = xfrm_tunnel_rcv, .handler = xfrm_tunnel_rcv,
.err_handler = xfrm_tunnel_err, .err_handler = xfrm_tunnel_err,
.priority = 3, .priority = 4,
}; };
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = { static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = {
.handler = xfrm_tunnel_rcv, .handler = xfrm_tunnel_rcv,
.err_handler = xfrm_tunnel_err, .err_handler = xfrm_tunnel_err,
.priority = 2, .priority = 3,
}; };
#endif #endif
......
...@@ -303,13 +303,13 @@ static const struct xfrm_type xfrm6_tunnel_type = { ...@@ -303,13 +303,13 @@ static const struct xfrm_type xfrm6_tunnel_type = {
static struct xfrm6_tunnel xfrm6_tunnel_handler __read_mostly = { static struct xfrm6_tunnel xfrm6_tunnel_handler __read_mostly = {
.handler = xfrm6_tunnel_rcv, .handler = xfrm6_tunnel_rcv,
.err_handler = xfrm6_tunnel_err, .err_handler = xfrm6_tunnel_err,
.priority = 2, .priority = 3,
}; };
static struct xfrm6_tunnel xfrm46_tunnel_handler __read_mostly = { static struct xfrm6_tunnel xfrm46_tunnel_handler __read_mostly = {
.handler = xfrm6_tunnel_rcv, .handler = xfrm6_tunnel_rcv,
.err_handler = xfrm6_tunnel_err, .err_handler = xfrm6_tunnel_err,
.priority = 2, .priority = 3,
}; };
static int __net_init xfrm6_tunnel_net_init(struct net *net) static int __net_init xfrm6_tunnel_net_init(struct net *net)
......
...@@ -830,14 +830,14 @@ static struct xfrm6_tunnel xfrmi_ipv6_handler __read_mostly = { ...@@ -830,14 +830,14 @@ static struct xfrm6_tunnel xfrmi_ipv6_handler __read_mostly = {
.handler = xfrmi6_rcv_tunnel, .handler = xfrmi6_rcv_tunnel,
.cb_handler = xfrmi_rcv_cb, .cb_handler = xfrmi_rcv_cb,
.err_handler = xfrmi6_err, .err_handler = xfrmi6_err,
.priority = -1, .priority = 2,
}; };
static struct xfrm6_tunnel xfrmi_ip6ip_handler __read_mostly = { static struct xfrm6_tunnel xfrmi_ip6ip_handler __read_mostly = {
.handler = xfrmi6_rcv_tunnel, .handler = xfrmi6_rcv_tunnel,
.cb_handler = xfrmi_rcv_cb, .cb_handler = xfrmi_rcv_cb,
.err_handler = xfrmi6_err, .err_handler = xfrmi6_err,
.priority = -1, .priority = 2,
}; };
#endif #endif
...@@ -875,14 +875,14 @@ static struct xfrm_tunnel xfrmi_ipip_handler __read_mostly = { ...@@ -875,14 +875,14 @@ static struct xfrm_tunnel xfrmi_ipip_handler __read_mostly = {
.handler = xfrmi4_rcv_tunnel, .handler = xfrmi4_rcv_tunnel,
.cb_handler = xfrmi_rcv_cb, .cb_handler = xfrmi_rcv_cb,
.err_handler = xfrmi4_err, .err_handler = xfrmi4_err,
.priority = -1, .priority = 3,
}; };
static struct xfrm_tunnel xfrmi_ipip6_handler __read_mostly = { static struct xfrm_tunnel xfrmi_ipip6_handler __read_mostly = {
.handler = xfrmi4_rcv_tunnel, .handler = xfrmi4_rcv_tunnel,
.cb_handler = xfrmi_rcv_cb, .cb_handler = xfrmi_rcv_cb,
.err_handler = xfrmi4_err, .err_handler = xfrmi4_err,
.priority = -1, .priority = 2,
}; };
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment