Acked-by: Alin Gabriel Serdean <aserd...@cloudbasesolutions.com>



-----Mesaj original-----
De la: dev [mailto:dev-boun...@openvswitch.org] În numele Nithin Raju
Trimis: Saturday, October 18, 2014 9:40 PM
Către: dev@openvswitch.org
Subiect: [ovs-dev] [PATCH 4/4 v2] 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'.

Signed-off-by: Nithin Raju <nit...@vmware.com>
Acked-by: Ankur Sharma <ankursha...@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;
                 }
                 memcpy(ofpbuf_data(buf), tail, retval);
                 ofpbuf_set_size(buf, retval);
--
1.7.4.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to