2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

netlink-socket: Fix 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 <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Nithin Raju
2014-10-18 11:39:38 -07:00
committed by Ben Pfaff
parent befa5b43fa
commit 15fd90524b

View File

@@ -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);