summaryrefslogtreecommitdiff
path: root/drivers/net/bareudp.c
diff options
context:
space:
mode:
authorMartin Varghese <martin.varghese@nokia.com>2020-03-12 08:33:51 +0530
committerDavid S. Miller <davem@davemloft.net>2020-03-11 22:54:27 -0700
commit81f954a44567567c7d74a97b1db78fb43afc253d (patch)
treecdf4f84063651aac1d36f872f8fbd9488b8b2dab /drivers/net/bareudp.c
parent86eeb97de71018695e9dc9e1f96df7b33cb0e7d6 (diff)
downloadlwn-81f954a44567567c7d74a97b1db78fb43afc253d.tar.gz
lwn-81f954a44567567c7d74a97b1db78fb43afc253d.zip
bareudp: Fixed bareudp receive handling
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 <ap420073@gmail.com> Fixes: 2baecda37f4e ("bareudp: remove unnecessary udp_encap_enable() in bareudp_socket_create()") Signed-off-by: Martin Varghese <martin.varghese@nokia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bareudp.c')
-rw-r--r--drivers/net/bareudp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c
index 71a2f480f70e..cc0703c3d57f 100644
--- a/drivers/net/bareudp.c
+++ b/drivers/net/bareudp.c
@@ -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;
}