From: Martin Varghese Date: Thu, 12 Mar 2020 03:03:51 +0000 (+0530) Subject: bareudp: Fixed bareudp receive handling X-Git-Tag: v5.15~4200^2~199 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=81f954a44567567c7d74a97b1db78fb43afc253d;p=platform%2Fkernel%2Flinux-starfive.git 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 Fixes: 2baecda37f4e ("bareudp: remove unnecessary udp_encap_enable() in bareudp_socket_create()") Signed-off-by: Martin Varghese Signed-off-by: David S. Miller --- diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c index 71a2f48..cc0703c 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; }