diff options
author | Mark McLoughlin <markmc@redhat.com> | 2009-04-29 09:36:43 +0100 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2009-06-09 11:38:49 +0100 |
commit | 2e1e06411095ed122d44bf0e3f5e18e8a6304b16 (patch) | |
tree | 62680249befe04378e2ddb7a110ac371281a6ee8 /net.c | |
parent | 5b01e886d9eb4d5e94384a79634dcb43848e7bbf (diff) | |
download | qemu-2e1e06411095ed122d44bf0e3f5e18e8a6304b16.tar.gz qemu-2e1e06411095ed122d44bf0e3f5e18e8a6304b16.tar.bz2 qemu-2e1e06411095ed122d44bf0e3f5e18e8a6304b16.zip |
net: vlan clients with no fd_can_read() can always receive
If a vlan client has no fd_can_read(), that means it can
always receive packets. The current code assumes it can *never*
receive packets.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Diffstat (limited to 'net.c')
-rw-r--r-- | net.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -389,15 +389,19 @@ VLANClientState *qemu_find_vlan_client(VLANState *vlan, void *opaque) return NULL; } -int qemu_can_send_packet(VLANClientState *vc1) +int qemu_can_send_packet(VLANClientState *sender) { - VLANState *vlan = vc1->vlan; + VLANState *vlan = sender->vlan; VLANClientState *vc; - for(vc = vlan->first_client; vc != NULL; vc = vc->next) { - if (vc != vc1) { - if (vc->fd_can_read && vc->fd_can_read(vc->opaque)) - return 1; + for (vc = vlan->first_client; vc != NULL; vc = vc->next) { + if (vc == sender) { + continue; + } + + /* no fd_can_read() handler, they can always receive */ + if (!vc->fd_can_read || vc->fd_can_read(vc->opaque)) { + return 1; } } return 0; |