diff mbox series

[net-next] bareudp: Fixed bareudp receive handling

Message ID 1583859760-18364-1-git-send-email-martinvarghesenokia@gmail.com
State Changes Requested
Delegated to: David Miller
Headers show
Series [net-next] bareudp: Fixed bareudp receive handling | expand

Commit Message

Martin Varghese March 10, 2020, 5:02 p.m. UTC
From: Martin Varghese <martin.varghese@nokia.com>

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

Signed-off-by: Martin Varghese <martin.varghese@nokia.com>
Fixes: 2baecda37f4e ("bareudp: remove unnecessary udp_encap_enable() in bareudp_socket_create()")
---
 drivers/net/bareudp.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Eric Dumazet March 10, 2020, 5:28 p.m. UTC | #1
On 3/10/20 10:02 AM, Martin Varghese wrote:
> From: Martin Varghese <martin.varghese@nokia.com>
> 
> 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
> 
> Signed-off-by: Martin Varghese <martin.varghese@nokia.com>
> Fixes: 2baecda37f4e ("bareudp: remove unnecessary udp_encap_enable() in bareudp_socket_create()")

Please CC the author of recent patches, do not hide,
and to be clear, it is not about blaming, just information.

> ---
>  drivers/net/bareudp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c
> index 71a2f48..c9d0d68 100644
> --- a/drivers/net/bareudp.c
> +++ b/drivers/net/bareudp.c
> @@ -250,6 +250,9 @@ 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);
>  

This might need a comment. 

Can this condition be false ?

According to your changelog, it seems not.

Give to reviewers more chance to avoid future mistakes.

Thanks.

> +	if (sock->sk->sk_family == AF_INET6)
> +		udp_encap_enable();
> +
>  	rcu_assign_pointer(bareudp->sock, sock);
>  	return 0;
>  }
>
Martin Varghese March 11, 2020, 12:56 a.m. UTC | #2
On Tue, Mar 10, 2020 at 10:28:40AM -0700, Eric Dumazet wrote:
> 
> 
> On 3/10/20 10:02 AM, Martin Varghese wrote:
> > From: Martin Varghese <martin.varghese@nokia.com>
> > 
> > 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
> > 
> > Signed-off-by: Martin Varghese <martin.varghese@nokia.com>
> > Fixes: 2baecda37f4e ("bareudp: remove unnecessary udp_encap_enable() in bareudp_socket_create()")
> 
> Please CC the author of recent patches, do not hide,
> and to be clear, it is not about blaming, just information.
> 

You mean the author of 2baecda37f4e ("bareudp: remove unnecessary udp_encap_enable() in bareudp_socket_create()") ?
yes i will do.

> > ---
> >  drivers/net/bareudp.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c
> > index 71a2f48..c9d0d68 100644
> > --- a/drivers/net/bareudp.c
> > +++ b/drivers/net/bareudp.c
> > @@ -250,6 +250,9 @@ 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);
> >  
> 
> This might need a comment. 
> 
> Can this condition be false ?
> 
If the IPv6 is disabled the socket type will be v4 and there is no need of explicit  call to
udp_encap_enable


> According to your changelog, it seems not.
> 
> Give to reviewers more chance to avoid future mistakes.
> 
You mean add a comment?
> Thanks.
> 
> > +	if (sock->sk->sk_family == AF_INET6)
> > +		udp_encap_enable();
> > +
> >  	rcu_assign_pointer(bareudp->sock, sock);
> >  	return 0;
> >  }
> >
diff mbox series

Patch

diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c
index 71a2f48..c9d0d68 100644
--- a/drivers/net/bareudp.c
+++ b/drivers/net/bareudp.c
@@ -250,6 +250,9 @@  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);
 
+	if (sock->sk->sk_family == AF_INET6)
+		udp_encap_enable();
+
 	rcu_assign_pointer(bareudp->sock, sock);
 	return 0;
 }