Hi Nithin,

Please find my comments inline.

Regards,
Ankur
________________________________________
From: dev <dev-boun...@openvswitch.org> on behalf of Nithin Raju 
<nit...@vmware.com>
Sent: Thursday, October 16, 2014 10:52 PM
To: dev@openvswitch.org
Subject: [ovs-dev] [PATCH 4/4] lib/netlink-socket.c: fixes in   
nl_sock_recv__() on Windows

In nl_sock_recv__() on Windows, we realloc a new ofpbuf to copy received
data if the caller specified buffer is small. While we do so, we need
reset some of the other stack variables to point to the new ofpbuf.

Other fixes are around using 'error' rather than 'errno'.

Acked-by: Nithin Raju <nit...@vmware.com>
---
 lib/netlink-socket.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index 7e30ab1..68e81d1 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -382,8 +382,8 @@ nl_sock_join_mcgroup(struct nl_sock *sock, unsigned int 
multicast_group)
     if (error) {
         sock->read_ioctl = OVS_IOCTL_READ;
         VLOG_WARN("could not join multicast group %u (%s)",
-                  multicast_group, ovs_strerror(errno));
-        return errno;
+                  multicast_group, ovs_strerror(error));
+        return error;
     }
 #else
     if (setsockopt(sock->fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP,
@@ -413,8 +413,8 @@ nl_sock_leave_mcgroup(struct nl_sock *sock, unsigned int 
multicast_group)
     int error = nl_sock_mcgroup(sock, multicast_group, false);
     if (error) {
         VLOG_WARN("could not leave multicast group %u (%s)",
-                   multicast_group, ovs_strerror(errno));
-        return errno;
+                   multicast_group, ovs_strerror(error));
+        return error;
     }
     sock->read_ioctl = OVS_IOCTL_READ;
 #else
@@ -548,6 +548,8 @@ nl_sock_recv__(struct nl_sock *sock, struct ofpbuf *buf, 
bool wait)
             } else {
                 if (retval >= buf->allocated) {
                     ofpbuf_reinit(buf, retval);
+                    nlmsghdr = ofpbuf_base(buf);
+                    nlmsghdr->nlmsg_len = UINT32_MAX;

[ANKUR]: Why are we assigning nlmsg_len to UINT32_MAX and not retval (aligned).

                 }
                 memcpy(ofpbuf_data(buf), tail, retval);
                 ofpbuf_set_size(buf, retval);
--
1.7.4.1

_______________________________________________
dev mailing list
dev@openvswitch.org
https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=f6EhnZ0ORGZNt5QbYmRaOxfWfx%2Bqd3KEiPf3%2FYaollU%3D%0A&m=f9MF4SPniXIonGt8lRQItVrFGQnWeNxZsT45uXpz2X4%3D%0A&s=a7066a9f8390191d61e0f73f7be911a7a0e900f0276ed908a26d56739a39a388
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to