X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=net%2Fhub.c;h=df32074de0142480dec4841bd8a4ed100a00b52e;hb=9e1c2ec8fd8d9a9ee299ea86c5f6c986fe25e838;hp=650a8b4a40188cf60b994f06e8de2980a9b6c3f3;hpb=509e9c462d03c4b7edc4a0d277311a7f45c9c046;p=qemu.git diff --git a/net/hub.c b/net/hub.c index 650a8b4a4..df32074de 100644 --- a/net/hub.c +++ b/net/hub.c @@ -12,10 +12,11 @@ * */ -#include "monitor.h" -#include "net.h" +#include "monitor/monitor.h" +#include "net/net.h" +#include "clients.h" #include "hub.h" -#include "iov.h" +#include "qemu/iov.h" /* * A hub broadcasts incoming packets to all its ports except the source port. @@ -255,7 +256,7 @@ void net_hub_info(Monitor *mon) /** * Get the hub id that a client is connected to * - * @id Pointer for hub id output, may be NULL + * @id: Pointer for hub id output, may be NULL */ int net_hub_id_for_client(NetClientState *nc, int *id) { @@ -337,3 +338,17 @@ void net_hub_check_clients(void) } } } + +bool net_hub_flush(NetClientState *nc) +{ + NetHubPort *port; + NetHubPort *source_port = DO_UPCAST(NetHubPort, nc, nc); + int ret = 0; + + QLIST_FOREACH(port, &source_port->hub->ports, next) { + if (port != source_port) { + ret += qemu_net_queue_flush(port->nc.send_queue); + } + } + return ret ? true : false; +}