diff mbox series

[PATCHv5,net-next,2/2] rxrpc: call udp_tunnel_encap_enable in rxrpc_open_socket

Message ID 2da45aee43c74c05a586a7d3c7b1f9fc48bb72f2.1612342376.git.lucien.xin@gmail.com (mailing list archive)
State Accepted
Commit 5d30c626b67e1c70ba7805d468c7de39f1da2f7e
Delegated to: Netdev Maintainers
Headers show
Series net: enable udp v6 sockets receiving v4 packets with UDP | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 1 maintainers not CCed: linux-afs@lists.infradead.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 19 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Xin Long Feb. 3, 2021, 8:54 a.m. UTC
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>
---
 net/rxrpc/local_object.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

David Howells Feb. 3, 2021, 9:50 a.m. UTC | #1
Xin Long <lucien.xin@gmail.com> wrote:

> 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>

Looks good.

David
diff mbox series

Patch

diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c
index 8c28810..33b4936 100644
--- a/net/rxrpc/local_object.c
+++ b/net/rxrpc/local_object.c
@@ -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"
 
@@ -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 */