From 5d30c626b67e1c70ba7805d468c7de39f1da2f7e Mon Sep 17 00:00:00 2001 From: Xin Long Date: Wed, 3 Feb 2021 16:54:23 +0800 Subject: rxrpc: call udp_tunnel_encap_enable in rxrpc_open_socket When doing encap_enable/increasing encap_needed_key, up->encap_enabled is not set in rxrpc_open_socket(), and it will cause encap_needed_key not being decreased in udpv6_destroy_sock(). This patch is to improve it by just calling udp_tunnel_encap_enable() where it increases both UDP and UDPv6 encap_needed_key and sets up->encap_enabled. v4->v5: - add the missing '#include ', as David Howells noticed. Acked-and-tested-by: David Howells Signed-off-by: Xin Long Signed-off-by: Jakub Kicinski --- net/rxrpc/local_object.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'net/rxrpc/local_object.c') diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c index 8c2881054266..33b49367d575 100644 --- a/net/rxrpc/local_object.c +++ b/net/rxrpc/local_object.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "ar-internal.h" @@ -135,11 +136,7 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) udp_sk(usk)->gro_receive = NULL; udp_sk(usk)->gro_complete = NULL; - udp_encap_enable(); -#if IS_ENABLED(CONFIG_AF_RXRPC_IPV6) - if (local->srx.transport.family == AF_INET6) - udpv6_encap_enable(); -#endif + udp_tunnel_encap_enable(local->socket); usk->sk_error_report = rxrpc_error_report; /* if a local address was supplied then bind it */ -- cgit v1.2.3