Skip to content

Commit

Permalink
rxrpc: call udp_tunnel_encap_enable in rxrpc_open_socket
Browse files Browse the repository at this point in the history
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 <net/udp_tunnel.h>', as David Howells
    noticed.

Acked-and-tested-by: David Howells <dhowells@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Xin Long authored and Jakub Kicinski committed Feb 5, 2021
1 parent a4a600d commit 5d30c62
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions net/rxrpc/local_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/hashtable.h>
#include <net/sock.h>
#include <net/udp.h>
#include <net/udp_tunnel.h>
#include <net/af_rxrpc.h>
#include "ar-internal.h"

Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 5d30c62

Please sign in to comment.