[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 43/67] net: fix sending of data with -net socket, li
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 43/67] net: fix sending of data with -net socket, listen backend |
Date: |
Wed, 14 Dec 2016 18:44:37 -0600 |
From: "Daniel P. Berrange" <address@hidden>
The use of -net socket,listen was broken in the following
commit
commit 16a3df403b10c4ac347159e39005fd520b2648bb
Author: Zhang Chen <address@hidden>
Date: Fri May 13 15:35:19 2016 +0800
net/net: Add SocketReadState for reuse codes
This function is from net/socket.c, move it to net.c and net.h.
Add SocketReadState to make others reuse net_fill_rstate().
suggestion from jason.
This refactored the state out of NetSocketState into a
separate SocketReadState. This refactoring requires
that a callback is provided to be triggered upon
completion of a packet receive from the guest.
The patch only registered this callback in the codepaths
hit by -net socket,connect, not -net socket,listen. So
as a result packets sent by the guest in the latter case
get dropped on the floor.
This bug is hidden because net_fill_rstate() silently
does nothing if the callback is not set.
This patch adds in the middle callback registration
and also adds an assert so that QEMU aborts if there
are any other codepaths hit which are missing the
callback.
Signed-off-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Zhang Chen <address@hidden>
Signed-off-by: Jason Wang <address@hidden>
(cherry picked from commit e79cd4068063ea2859199002a049010a11202939)
Signed-off-by: Michael Roth <address@hidden>
---
net/net.c | 5 ++---
net/socket.c | 1 +
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/net.c b/net/net.c
index d51cb29..19b4d9e 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1648,9 +1648,8 @@ int net_fill_rstate(SocketReadState *rs, const uint8_t
*buf, int size)
if (rs->index >= rs->packet_len) {
rs->index = 0;
rs->state = 0;
- if (rs->finalize) {
- rs->finalize(rs);
- }
+ assert(rs->finalize);
+ rs->finalize(rs);
}
break;
}
diff --git a/net/socket.c b/net/socket.c
index 3f98eef..dcae1ae 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -522,6 +522,7 @@ static int net_socket_listen_init(NetClientState *peer,
s->fd = -1;
s->listen_fd = fd;
s->nc.link_down = true;
+ net_socket_rs_init(&s->rs, net_socket_rs_finalize);
qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s);
return 0;
--
1.9.1
- [Qemu-devel] [PATCH 36/67] ppc/kvm: Mark 64kB page size support as disabled if not available, (continued)
- [Qemu-devel] [PATCH 36/67] ppc/kvm: Mark 64kB page size support as disabled if not available, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 39/67] net: rtl8139: limit processing of ring descriptors, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 32/67] qmp: fix object-add assert() without props, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 35/67] rbd: shift byte count as a 64-bit value, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 34/67] tests/test-qmp-input-strict: Cover missing struct members, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 37/67] throttle: Correct access to wrong BlockBackendPublic structures, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 44/67] target-ppc: Fix CPU migration from qemu-2.6 <-> later versions, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 38/67] qemu-iotests: Test I/O in a single drive from a throttling group, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 03/67] hw/ppc/spapr: Fix the selection of the processor features, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 46/67] virtio-net: mark VIRTIO_NET_F_GSO as legacy, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 43/67] net: fix sending of data with -net socket, listen backend,
Michael Roth <=
- [Qemu-devel] [PATCH 40/67] memory: Replace skip_dump flag with "ram_device", Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 41/67] memory: Don't use memcpy for ram_device regions, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 42/67] acpi/ipmi: Initialize the fwinfo before fetching it, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 45/67] virtio: allow per-device-class legacy features, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 47/67] block: Don't mark node clean after failed flush, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 50/67] qcow2: Inform block layer about discard boundaries, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 51/67] block: Let write zeroes fallback work even with small max_transfer, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 53/67] block: Pass unaligned discard requests to drivers, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 48/67] vhost: adapt vhost_verify_ring_mappings() to virtio 1 ring layout, Michael Roth, 2016/12/14
- [Qemu-devel] [PATCH 55/67] block/curl: Fix return value from curl_read_cb, Michael Roth, 2016/12/14