diff mbox

[ovs-dev] netlink-socket: return correct error code when connect fails

Message ID 1455556410-17753-1-git-send-email-cascardo@redhat.com
State Accepted
Headers show

Commit Message

Thadeu Lima de Souza Cascardo Feb. 15, 2016, 5:13 p.m. UTC
When connect and other calls fail after get_socket_rcvbuf, the return code would
be the rcvbuf size, not errno from the last call.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
---
 lib/netlink-socket.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Simon Horman Feb. 16, 2016, 2:32 a.m. UTC | #1
Hi,

On Mon, Feb 15, 2016 at 03:13:30PM -0200, Thadeu Lima de Souza Cascardo wrote:
> When connect and other calls fail after get_socket_rcvbuf, the return code would
> be the rcvbuf size, not errno from the last call.
> 
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>

This seems correct to me and I have pushed it to the master branch.

Please let me know if you think it is appropriate for backporting
to branch-2.4 or branch-2.5.

Thanks

> ---
>  lib/netlink-socket.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
> index 5ef4b15..0cedb41 100644
> --- a/lib/netlink-socket.c
> +++ b/lib/netlink-socket.c
> @@ -195,6 +195,7 @@ nl_sock_create(int protocol, struct nl_sock **sockp)
>          goto error;
>      }
>      sock->rcvbuf = retval;
> +    retval = 0;
>  
>      /* Connect to kernel (pid 0) as remote address. */
>      memset(&remote, 0, sizeof remote);
> -- 
> 2.5.0
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
Thadeu Lima de Souza Cascardo Feb. 16, 2016, 11:38 a.m. UTC | #2
On Tue, Feb 16, 2016 at 11:32:19AM +0900, Simon Horman wrote:
> Hi,
> 
> On Mon, Feb 15, 2016 at 03:13:30PM -0200, Thadeu Lima de Souza Cascardo wrote:
> > When connect and other calls fail after get_socket_rcvbuf, the return code would
> > be the rcvbuf size, not errno from the last call.
> > 
> > Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
> 
> This seems correct to me and I have pushed it to the master branch.
> 
> Please let me know if you think it is appropriate for backporting
> to branch-2.4 or branch-2.5.

Thanks, Simon.

I noticed the problem on branch-2.5. So, it applies there. I just checked that
it should also affect 2.4 and 2.3.

Regards.
Cascardo.

> 
> Thanks
> 
> > ---
> >  lib/netlink-socket.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
> > index 5ef4b15..0cedb41 100644
> > --- a/lib/netlink-socket.c
> > +++ b/lib/netlink-socket.c
> > @@ -195,6 +195,7 @@ nl_sock_create(int protocol, struct nl_sock **sockp)
> >          goto error;
> >      }
> >      sock->rcvbuf = retval;
> > +    retval = 0;
> >  
> >      /* Connect to kernel (pid 0) as remote address. */
> >      memset(&remote, 0, sizeof remote);
> > -- 
> > 2.5.0
> > 
> > _______________________________________________
> > dev mailing list
> > dev@openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev
Ben Pfaff Feb. 16, 2016, 5:15 p.m. UTC | #3
On Tue, Feb 16, 2016 at 11:32:19AM +0900, Simon Horman wrote:
> Hi,
> 
> On Mon, Feb 15, 2016 at 03:13:30PM -0200, Thadeu Lima de Souza Cascardo wrote:
> > When connect and other calls fail after get_socket_rcvbuf, the return code would
> > be the rcvbuf size, not errno from the last call.
> > 
> > Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
> 
> This seems correct to me and I have pushed it to the master branch.
> 
> Please let me know if you think it is appropriate for backporting
> to branch-2.4 or branch-2.5.

It seemed worthwhile to me, so I backported it as far as branch-2.3.
diff mbox

Patch

diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index 5ef4b15..0cedb41 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -195,6 +195,7 @@  nl_sock_create(int protocol, struct nl_sock **sockp)
         goto error;
     }
     sock->rcvbuf = retval;
+    retval = 0;
 
     /* Connect to kernel (pid 0) as remote address. */
     memset(&remote, 0, sizeof remote);