Skip to contentSkip to conversation

bareudp: Fixed bareudp receive handling

PATCH Applied Martin Varghese 2 participants 2 messages Mar 12, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 bareudp: Fixed bareudp receive handling

From: Martin Varghese <[email protected]>

Reverted commit "2baecda bareudp: remove unnecessary udp_encap_enable() in bareudp_socket_create()"

An explicit call to udp_encap_enable is needed as the setup_udp_tunnel_sock does not call udp_encap_enable if the if the socket is of type v6.

Bareudp device uses v6 socket to receive v4 & v6 traffic

CC Taehee Yoo <[email protected]>
Fixes 2baecda37f4e ("bareudp: remove unnecessary udp_encap_enable() in bareudp_socket_create()")

---
Changes in v2:
- Add Comments in the code.

 drivers/net/bareudp.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/bareudp.c +6 -0
index 71a2f48..cc0703c 100644
@@ -250,6 +250,12 @@ static int bareudp_socket_create(struct bareudp_dev *bareudp, __be16 port)
 	tunnel_cfg.encap_destroy = NULL;
 	setup_udp_tunnel_sock(bareudp->net, sock, &tunnel_cfg);
 
+	/* As the setup_udp_tunnel_sock does not call udp_encap_enable if the
+	 * socket type is v6 an explicit call to udp_encap_enable is needed.
+	 */
+	if (sock->sk->sk_family == AF_INET6)
+		udp_encap_enable();
+
 	rcu_assign_pointer(bareudp->sock, sock);
 	return 0;
 }
Signature · 1 line
1.8.3.1
maintainer Applied
#1 lore raw

From: Martin Varghese <[email protected]>
Date: Thu, 12 Mar 2020 08:33:51 +0530

Quoted 8 lines

From: Martin Varghese <[email protected]>

Reverted commit "2baecda bareudp: remove unnecessary udp_encap_enable() in bareudp_socket_create()"

An explicit call to udp_encap_enable is needed as the setup_udp_tunnel_sock does not call udp_encap_enable if the if the socket is of type v6.

Quoted 8 lines

Bareudp device uses v6 socket to receive v4 & v6 traffic

CC Taehee Yoo <[email protected]>
Fixes 2baecda37f4e ("bareudp: remove unnecessary udp_encap_enable() in bareudp_socket_create()")

---
Changes in v2:
- Add Comments in the code.

Applied, thanks Martin.