Skip to content

Commit 7fe9461

Browse files
lxinklassert
authored andcommitted
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: Nicolas Dichtel <nicolas.dichtel@6wind.com> Tested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Fixes: da9bbf0 ("xfrm: interface: support IPIP and IPIP6 tunnels processing with .cb_handler") FIxes: d7b360c ("xfrm: interface: support IP6IP6 and IP6IP tunnels processing with .cb_handler") Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
1 parent 3fdd47c commit 7fe9461

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎net/ipv4/xfrm4_tunnel.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ static int xfrm_tunnel_err(struct sk_buff *skb, u32 info)
6464
static struct xfrm_tunnel xfrm_tunnel_handler __read_mostly = {
6565
.handler = xfrm_tunnel_rcv,
6666
.err_handler = xfrm_tunnel_err,
67-
.priority = 3,
67+
.priority = 4,
6868
};
6969

7070
#if IS_ENABLED(CONFIG_IPV6)
7171
static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = {
7272
.handler = xfrm_tunnel_rcv,
7373
.err_handler = xfrm_tunnel_err,
74-
.priority = 2,
74+
.priority = 3,
7575
};
7676
#endif
7777

‎net/ipv6/xfrm6_tunnel.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,13 @@ static const struct xfrm_type xfrm6_tunnel_type = {
303303
static struct xfrm6_tunnel xfrm6_tunnel_handler __read_mostly = {
304304
.handler = xfrm6_tunnel_rcv,
305305
.err_handler = xfrm6_tunnel_err,
306-
.priority = 2,
306+
.priority = 3,
307307
};
308308

309309
static struct xfrm6_tunnel xfrm46_tunnel_handler __read_mostly = {
310310
.handler = xfrm6_tunnel_rcv,
311311
.err_handler = xfrm6_tunnel_err,
312-
.priority = 2,
312+
.priority = 3,
313313
};
314314

315315
static int __net_init xfrm6_tunnel_net_init(struct net *net)

‎net/xfrm/xfrm_interface.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -830,14 +830,14 @@ static struct xfrm6_tunnel xfrmi_ipv6_handler __read_mostly = {
830830
.handler = xfrmi6_rcv_tunnel,
831831
.cb_handler = xfrmi_rcv_cb,
832832
.err_handler = xfrmi6_err,
833-
.priority = -1,
833+
.priority = 2,
834834
};
835835

836836
static struct xfrm6_tunnel xfrmi_ip6ip_handler __read_mostly = {
837837
.handler = xfrmi6_rcv_tunnel,
838838
.cb_handler = xfrmi_rcv_cb,
839839
.err_handler = xfrmi6_err,
840-
.priority = -1,
840+
.priority = 2,
841841
};
842842
#endif
843843

@@ -875,14 +875,14 @@ static struct xfrm_tunnel xfrmi_ipip_handler __read_mostly = {
875875
.handler = xfrmi4_rcv_tunnel,
876876
.cb_handler = xfrmi_rcv_cb,
877877
.err_handler = xfrmi4_err,
878-
.priority = -1,
878+
.priority = 3,
879879
};
880880

881881
static struct xfrm_tunnel xfrmi_ipip6_handler __read_mostly = {
882882
.handler = xfrmi4_rcv_tunnel,
883883
.cb_handler = xfrmi_rcv_cb,
884884
.err_handler = xfrmi4_err,
885-
.priority = -1,
885+
.priority = 2,
886886
};
887887
#endif
888888

0 commit comments

Comments
 (0)