Skip to content

Commit

Permalink
bareudp: Fixed bareudp receive handling
Browse files Browse the repository at this point in the history
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: 2baecda ("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>
  • Loading branch information
Martin Varghese authored and David S. Miller committed Mar 12, 2020
1 parent 86eeb97 commit 81f954a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/bareudp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 81f954a

Please sign in to comment.