From patchwork Wed Jun 20 09:42:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhiyong Wu X-Patchwork-Id: 165985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6F593B6FF7 for ; Wed, 20 Jun 2012 20:26:07 +1000 (EST) Received: from localhost ([::1]:36670 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShHRY-0001At-U5 for incoming@patchwork.ozlabs.org; Wed, 20 Jun 2012 05:43:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShHR3-0000ji-NN for qemu-devel@nongnu.org; Wed, 20 Jun 2012 05:42:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShHQv-0002H7-Eg for qemu-devel@nongnu.org; Wed, 20 Jun 2012 05:42:49 -0400 Received: from e3.ny.us.ibm.com ([32.97.182.143]:51698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShHQv-0002Gv-8i for qemu-devel@nongnu.org; Wed, 20 Jun 2012 05:42:41 -0400 Received: from /spool/local by e3.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 20 Jun 2012 05:42:39 -0400 Received: from d01dlp02.pok.ibm.com (9.56.224.85) by e3.ny.us.ibm.com (192.168.1.103) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 20 Jun 2012 05:42:37 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 406096E8049 for ; Wed, 20 Jun 2012 05:42:37 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5K9ga5f119668 for ; Wed, 20 Jun 2012 05:42:36 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5K9garw008940 for ; Wed, 20 Jun 2012 06:42:36 -0300 Received: from us.ibm.com (f15.cn.ibm.com [9.115.118.27]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id q5K9gWTt008447; Wed, 20 Jun 2012 06:42:33 -0300 Received: by us.ibm.com (sSMTP sendmail emulation); Wed, 20 Jun 2012 17:42:31 +0800 From: zwu.kernel@gmail.com To: qemu-devel@nongnu.org Date: Wed, 20 Jun 2012 17:42:06 +0800 Message-Id: <1340185341-30803-3-git-send-email-zwu.kernel@gmail.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1340185341-30803-1-git-send-email-zwu.kernel@gmail.com> References: <1340185341-30803-1-git-send-email-zwu.kernel@gmail.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12062009-8974-0000-0000-00000A4AF3E4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.182.143 Cc: pbonzini@redhat.com, aliguori@us.ibm.com, Zhi Yong Wu , stefanha@linux.vnet.ibm.com, jan.kiszka@siemens.com Subject: [Qemu-devel] [PATCH v6 02/17] net: Use hubs for the vlan feature X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Hajnoczi Stop using the special-case vlan code in net.c. Instead use the hub net client to implement the vlan feature. The next patch will remove vlan code from net.c completely. Signed-off-by: Stefan Hajnoczi Signed-off-by: Zhi Yong Wu --- net.c | 38 +++++++++++++++++++++----------------- net/dump.c | 19 +++++++++++++------ net/dump.h | 2 +- net/slirp.c | 8 ++++---- net/slirp.h | 2 +- net/socket.c | 48 ++++++++++++++++++++++++++---------------------- net/socket.h | 2 +- net/tap-win32.c | 8 ++++---- net/tap.c | 6 +++--- net/tap.h | 2 +- net/vde.c | 8 ++++---- net/vde.h | 2 +- 12 files changed, 80 insertions(+), 65 deletions(-) diff --git a/net.c b/net.c index 4aa416c..9a63d22 100644 --- a/net.c +++ b/net.c @@ -25,6 +25,7 @@ #include "config-host.h" +#include "net/hub.h" #include "net/tap.h" #include "net/socket.h" #include "net/dump.h" @@ -153,23 +154,25 @@ void qemu_macaddr_default_if_unset(MACAddr *macaddr) macaddr->a[5] = 0x56 + index++; } +/** + * Generate a name for net client + * + * Only net clients created with the legacy -net option need this. Naming is + * mandatory for net clients created with -netdev. + */ static char *assign_name(VLANClientState *vc1, const char *model) { - VLANState *vlan; VLANClientState *vc; char buf[256]; int id = 0; - QTAILQ_FOREACH(vlan, &vlans, next) { - QTAILQ_FOREACH(vc, &vlan->clients, next) { - if (vc != vc1 && strcmp(vc->model, model) == 0) { - id++; - } - } - } - QTAILQ_FOREACH(vc, &non_vlan_clients, next) { - if (vc != vc1 && strcmp(vc->model, model) == 0) { + if (vc == vc1) { + continue; + } + /* For compatibility only bump id for net clients on a vlan */ + if (strcmp(vc->model, model) == 0 && + net_hub_id_for_client(vc, NULL) == 0) { id++; } } @@ -745,7 +748,7 @@ int net_handle_fd_param(Monitor *mon, const char *param) return fd; } -static int net_init_nic(QemuOpts *opts, const char *name, VLANState *vlan) +static int net_init_nic(QemuOpts *opts, const char *name, VLANClientState *peer) { int idx; NICInfo *nd; @@ -768,8 +771,8 @@ static int net_init_nic(QemuOpts *opts, const char *name, VLANState *vlan) return -1; } } else { - assert(vlan); - nd->vlan = vlan; + assert(peer); + nd->netdev = peer; } if (name) { nd->name = g_strdup(name); @@ -819,7 +822,7 @@ static int net_init_nic(QemuOpts *opts, const char *name, VLANState *vlan) typedef int (*net_client_init_func)(QemuOpts *opts, const char *name, - VLANState *vlan); + VLANClientState *peer); /* magic number, but compiler will warn if too small */ #define NET_MAX_DESC 20 @@ -1133,7 +1136,7 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error **errp) if (net_client_types[i].type != NULL && !strcmp(net_client_types[i].type, type)) { Error *local_err = NULL; - VLANState *vlan = NULL; + VLANClientState *peer = NULL; int ret; qemu_opts_validate(opts, &net_client_types[i].desc[0], &local_err); @@ -1146,12 +1149,12 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error **errp) * netdev= parameter. */ if (!(is_netdev || (strcmp(type, "nic") == 0 && qemu_opt_get(opts, "netdev")))) { - vlan = qemu_find_vlan(qemu_opt_get_number(opts, "vlan", 0), 1); + peer = net_hub_add_port(qemu_opt_get_number(opts, "vlan", 0)); } ret = 0; if (net_client_types[i].init) { - ret = net_client_types[i].init(opts, name, vlan); + ret = net_client_types[i].init(opts, name, peer); if (ret < 0) { /* TODO push error reporting into init() methods */ error_set(errp, QERR_DEVICE_INIT_FAILED, type); @@ -1316,6 +1319,7 @@ void do_info_network(Monitor *mon) print_net_client(mon, peer); } } + net_hub_info(mon); } void qmp_set_link(const char *name, bool up, Error **errp) diff --git a/net/dump.c b/net/dump.c index f835c51..a59133a 100644 --- a/net/dump.c +++ b/net/dump.c @@ -27,6 +27,7 @@ #include "qemu-error.h" #include "qemu-log.h" #include "qemu-timer.h" +#include "hub.h" typedef struct DumpState { VLANClientState nc; @@ -99,7 +100,7 @@ static NetClientInfo net_dump_info = { .cleanup = dump_cleanup, }; -static int net_dump_init(VLANState *vlan, const char *device, +static int net_dump_init(VLANClientState *peer, const char *device, const char *name, const char *filename, int len) { struct pcap_file_hdr hdr; @@ -128,7 +129,7 @@ static int net_dump_init(VLANState *vlan, const char *device, return -1; } - nc = qemu_new_net_client(&net_dump_info, vlan, NULL, device, name); + nc = qemu_new_net_client(&net_dump_info, NULL, peer, device, name); snprintf(nc->info_str, sizeof(nc->info_str), "dump to %s (len=%d)", filename, len); @@ -144,21 +145,27 @@ static int net_dump_init(VLANState *vlan, const char *device, return 0; } -int net_init_dump(QemuOpts *opts, const char *name, VLANState *vlan) +int net_init_dump(QemuOpts *opts, const char *name, VLANClientState *peer) { int len; const char *file; char def_file[128]; - assert(vlan); + assert(peer); file = qemu_opt_get(opts, "file"); if (!file) { - snprintf(def_file, sizeof(def_file), "qemu-vlan%d.pcap", vlan->id); + unsigned int id; + int ret; + + ret = net_hub_id_for_client(peer, &id); + assert(ret == 0); /* peer must be on a hub */ + + snprintf(def_file, sizeof(def_file), "qemu-vlan%u.pcap", id); file = def_file; } len = qemu_opt_get_size(opts, "len", 65536); - return net_dump_init(vlan, "dump", name, file, len); + return net_dump_init(peer, "dump", name, file, len); } diff --git a/net/dump.h b/net/dump.h index 2b5d9ba..907eb03 100644 --- a/net/dump.h +++ b/net/dump.h @@ -27,6 +27,6 @@ #include "net.h" #include "qemu-common.h" -int net_init_dump(QemuOpts *opts, const char *name, VLANState *vlan); +int net_init_dump(QemuOpts *opts, const char *name, VLANClientState *peer); #endif /* QEMU_NET_DUMP_H */ diff --git a/net/slirp.c b/net/slirp.c index 37b6ccf..70e7c94 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -134,7 +134,7 @@ static NetClientInfo net_slirp_info = { .cleanup = net_slirp_cleanup, }; -static int net_slirp_init(VLANState *vlan, const char *model, +static int net_slirp_init(VLANClientState *peer, const char *model, const char *name, int restricted, const char *vnetwork, const char *vhost, const char *vhostname, const char *tftp_export, @@ -237,7 +237,7 @@ static int net_slirp_init(VLANState *vlan, const char *model, } #endif - nc = qemu_new_net_client(&net_slirp_info, vlan, NULL, model, name); + nc = qemu_new_net_client(&net_slirp_info, NULL, peer, model, name); snprintf(nc->info_str, sizeof(nc->info_str), "net=%s,restrict=%s", inet_ntoa(net), @@ -676,7 +676,7 @@ static int net_init_slirp_configs(const char *name, const char *value, void *opa return 0; } -int net_init_slirp(QemuOpts *opts, const char *name, VLANState *vlan) +int net_init_slirp(QemuOpts *opts, const char *name, VLANClientState *peer) { struct slirp_config_str *config; const char *vhost; @@ -733,7 +733,7 @@ int net_init_slirp(QemuOpts *opts, const char *name, VLANState *vlan) qemu_opt_foreach(opts, net_init_slirp_configs, NULL, 0); - ret = net_slirp_init(vlan, "user", name, restricted, vnet, vhost, + ret = net_slirp_init(peer, "user", name, restricted, vnet, vhost, vhostname, tftp_export, bootfile, vdhcp_start, vnamesrv, smb_export, vsmbsrv); diff --git a/net/slirp.h b/net/slirp.h index 53fe95d..a1ea8f2 100644 --- a/net/slirp.h +++ b/net/slirp.h @@ -30,7 +30,7 @@ #ifdef CONFIG_SLIRP -int net_init_slirp(QemuOpts *opts, const char *name, VLANState *vlan); +int net_init_slirp(QemuOpts *opts, const char *name, VLANClientState *peer); void net_slirp_hostfwd_add(Monitor *mon, const QDict *qdict); void net_slirp_hostfwd_remove(Monitor *mon, const QDict *qdict); diff --git a/net/socket.c b/net/socket.c index fcd0a3c..f231f7b 100644 --- a/net/socket.c +++ b/net/socket.c @@ -44,7 +44,7 @@ typedef struct NetSocketState { } NetSocketState; typedef struct NetSocketListenState { - VLANState *vlan; + VLANClientState *peer; char *model; char *name; int fd; @@ -245,7 +245,7 @@ static NetClientInfo net_dgram_socket_info = { .cleanup = net_socket_cleanup, }; -static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, +static NetSocketState *net_socket_fd_init_dgram(VLANClientState *peer, const char *model, const char *name, int fd, int is_connected) @@ -287,7 +287,7 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, } } - nc = qemu_new_net_client(&net_dgram_socket_info, vlan, NULL, model, name); + nc = qemu_new_net_client(&net_dgram_socket_info, NULL, peer, model, name); snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=%d (%s mcast=%s:%d)", @@ -323,7 +323,7 @@ static NetClientInfo net_socket_info = { .cleanup = net_socket_cleanup, }; -static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, +static NetSocketState *net_socket_fd_init_stream(VLANClientState *peer, const char *model, const char *name, int fd, int is_connected) @@ -331,7 +331,7 @@ static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, VLANClientState *nc; NetSocketState *s; - nc = qemu_new_net_client(&net_socket_info, vlan, NULL, model, name); + nc = qemu_new_net_client(&net_socket_info, NULL, peer, model, name); snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=%d", fd); @@ -347,7 +347,7 @@ static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, return s; } -static NetSocketState *net_socket_fd_init(VLANState *vlan, +static NetSocketState *net_socket_fd_init(VLANClientState *peer, const char *model, const char *name, int fd, int is_connected) { @@ -362,13 +362,13 @@ static NetSocketState *net_socket_fd_init(VLANState *vlan, } switch(so_type) { case SOCK_DGRAM: - return net_socket_fd_init_dgram(vlan, model, name, fd, is_connected); + return net_socket_fd_init_dgram(peer, model, name, fd, is_connected); case SOCK_STREAM: - return net_socket_fd_init_stream(vlan, model, name, fd, is_connected); + return net_socket_fd_init_stream(peer, model, name, fd, is_connected); default: /* who knows ... this could be a eg. a pty, do warn and continue as stream */ fprintf(stderr, "qemu: warning: socket type=%d for fd=%d is not SOCK_DGRAM or SOCK_STREAM\n", so_type, fd); - return net_socket_fd_init_stream(vlan, model, name, fd, is_connected); + return net_socket_fd_init_stream(peer, model, name, fd, is_connected); } return NULL; } @@ -390,15 +390,17 @@ static void net_socket_accept(void *opaque) break; } } - s1 = net_socket_fd_init(s->vlan, s->model, s->name, fd, 1); - if (s1) { + s1 = net_socket_fd_init(s->peer, s->model, s->name, fd, 1); + if (!s1) { + closesocket(fd); + } else { snprintf(s1->nc.info_str, sizeof(s1->nc.info_str), "socket: connection from %s:%d", inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port)); } } -static int net_socket_listen_init(VLANState *vlan, +static int net_socket_listen_init(VLANClientState *peer, const char *model, const char *name, const char *host_str) @@ -438,7 +440,7 @@ static int net_socket_listen_init(VLANState *vlan, closesocket(fd); return -1; } - s->vlan = vlan; + s->peer = peer; s->model = g_strdup(model); s->name = name ? g_strdup(name) : NULL; s->fd = fd; @@ -446,7 +448,7 @@ static int net_socket_listen_init(VLANState *vlan, return 0; } -static int net_socket_connect_init(VLANState *vlan, +static int net_socket_connect_init(VLANClientState *peer, const char *model, const char *name, const char *host_str) @@ -487,7 +489,7 @@ static int net_socket_connect_init(VLANState *vlan, break; } } - s = net_socket_fd_init(vlan, model, name, fd, connected); + s = net_socket_fd_init(peer, model, name, fd, connected); if (!s) return -1; snprintf(s->nc.info_str, sizeof(s->nc.info_str), @@ -496,7 +498,7 @@ static int net_socket_connect_init(VLANState *vlan, return 0; } -static int net_socket_mcast_init(VLANState *vlan, +static int net_socket_mcast_init(VLANClientState *peer, const char *model, const char *name, const char *host_str, @@ -522,7 +524,7 @@ static int net_socket_mcast_init(VLANState *vlan, if (fd < 0) return -1; - s = net_socket_fd_init(vlan, model, name, fd, 0); + s = net_socket_fd_init(peer, model, name, fd, 0); if (!s) return -1; @@ -586,7 +588,7 @@ static int net_socket_udp_init(VLANState *vlan, return 0; } -int net_init_socket(QemuOpts *opts, const char *name, VLANState *vlan) +int net_init_socket(QemuOpts *opts, const char *name, VLANClientState *peer) { if (qemu_opt_get(opts, "fd")) { int fd; @@ -604,7 +606,8 @@ int net_init_socket(QemuOpts *opts, const char *name, VLANState *vlan) return -1; } - if (!net_socket_fd_init(vlan, "socket", name, fd, 1)) { + if (!net_socket_fd_init(peer, "socket", name, fd, 1)) { + close(fd); return -1; } } else if (qemu_opt_get(opts, "listen")) { @@ -620,7 +623,7 @@ int net_init_socket(QemuOpts *opts, const char *name, VLANState *vlan) listen = qemu_opt_get(opts, "listen"); - if (net_socket_listen_init(vlan, "socket", name, listen) == -1) { + if (net_socket_listen_init(peer, "socket", name, listen) == -1) { return -1; } } else if (qemu_opt_get(opts, "connect")) { @@ -636,7 +639,7 @@ int net_init_socket(QemuOpts *opts, const char *name, VLANState *vlan) connect = qemu_opt_get(opts, "connect"); - if (net_socket_connect_init(vlan, "socket", name, connect) == -1) { + if (net_socket_connect_init(peer, "socket", name, connect) == -1) { return -1; } } else if (qemu_opt_get(opts, "mcast")) { @@ -652,7 +655,8 @@ int net_init_socket(QemuOpts *opts, const char *name, VLANState *vlan) mcast = qemu_opt_get(opts, "mcast"); localaddr = qemu_opt_get(opts, "localaddr"); - if (net_socket_mcast_init(vlan, "socket", name, mcast, localaddr) == -1) { + if (net_socket_mcast_init(peer, "socket", name, + mcast, localaddr) == -1) { return -1; } } else if (qemu_opt_get(opts, "udp")) { diff --git a/net/socket.h b/net/socket.h index e1fe959..c1ee5b3 100644 --- a/net/socket.h +++ b/net/socket.h @@ -27,6 +27,6 @@ #include "net.h" #include "qemu-common.h" -int net_init_socket(QemuOpts *opts, const char *name, VLANState *vlan); +int net_init_socket(QemuOpts *opts, const char *name, VLANClientState *vlan); #endif /* QEMU_NET_SOCKET_H */ diff --git a/net/tap-win32.c b/net/tap-win32.c index a801a55..c78db42 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -673,7 +673,7 @@ static NetClientInfo net_tap_win32_info = { .cleanup = tap_cleanup, }; -static int tap_win32_init(VLANState *vlan, const char *model, +static int tap_win32_init(VLANClientState *peer, const char *model, const char *name, const char *ifname) { VLANClientState *nc; @@ -685,7 +685,7 @@ static int tap_win32_init(VLANState *vlan, const char *model, return -1; } - nc = qemu_new_net_client(&net_tap_win32_info, vlan, NULL, model, name); + nc = qemu_new_net_client(&net_tap_win32_info, NULL, peer, model, name); s = DO_UPCAST(TAPState, nc, nc); @@ -699,7 +699,7 @@ static int tap_win32_init(VLANState *vlan, const char *model, return 0; } -int net_init_tap(QemuOpts *opts, const char *name, VLANState *vlan) +int net_init_tap(QemuOpts *opts, const char *name, VLANClientState *peer) { const char *ifname; @@ -710,7 +710,7 @@ int net_init_tap(QemuOpts *opts, const char *name, VLANState *vlan) return -1; } - if (tap_win32_init(vlan, "tap", name, ifname) == -1) { + if (tap_win32_init(peer, "tap", name, ifname) == -1) { return -1; } diff --git a/net/tap.c b/net/tap.c index 17e9135..5ddabc2 100644 --- a/net/tap.c +++ b/net/tap.c @@ -322,7 +322,7 @@ static NetClientInfo net_tap_info = { .cleanup = tap_cleanup, }; -static TAPState *net_tap_fd_init(VLANState *vlan, +static TAPState *net_tap_fd_init(VLANClientState *peer, const char *model, const char *name, int fd, @@ -331,7 +331,7 @@ static TAPState *net_tap_fd_init(VLANState *vlan, VLANClientState *nc; TAPState *s; - nc = qemu_new_net_client(&net_tap_info, vlan, NULL, model, name); + nc = qemu_new_net_client(&net_tap_info, NULL, peer, model, name); s = DO_UPCAST(TAPState, nc, nc); @@ -583,7 +583,7 @@ static int net_tap_init(QemuOpts *opts, int *vnet_hdr) return fd; } -int net_init_tap(QemuOpts *opts, const char *name, VLANState *vlan) +int net_init_tap(QemuOpts *opts, const char *name, VLANClientState *peer) { TAPState *s; int fd, vnet_hdr = 0; diff --git a/net/tap.h b/net/tap.h index b2a9450..d8bbc39 100644 --- a/net/tap.h +++ b/net/tap.h @@ -32,7 +32,7 @@ #define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup" #define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown" -int net_init_tap(QemuOpts *opts, const char *name, VLANState *vlan); +int net_init_tap(QemuOpts *opts, const char *name, VLANClientState *peer); int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required); diff --git a/net/vde.c b/net/vde.c index 6b9d452..51fb167 100644 --- a/net/vde.c +++ b/net/vde.c @@ -75,7 +75,7 @@ static NetClientInfo net_vde_info = { .cleanup = vde_cleanup, }; -static int net_vde_init(VLANState *vlan, const char *model, +static int net_vde_init(VLANClientState *peer, const char *model, const char *name, const char *sock, int port, const char *group, int mode) { @@ -96,7 +96,7 @@ static int net_vde_init(VLANState *vlan, const char *model, return -1; } - nc = qemu_new_net_client(&net_vde_info, vlan, NULL, model, name); + nc = qemu_new_net_client(&net_vde_info, NULL, peer, model, name); snprintf(nc->info_str, sizeof(nc->info_str), "sock=%s,fd=%d", sock, vde_datafd(vde)); @@ -110,7 +110,7 @@ static int net_vde_init(VLANState *vlan, const char *model, return 0; } -int net_init_vde(QemuOpts *opts, const char *name, VLANState *vlan) +int net_init_vde(QemuOpts *opts, const char *name, VLANClientState *peer) { const char *sock; const char *group; @@ -122,7 +122,7 @@ int net_init_vde(QemuOpts *opts, const char *name, VLANState *vlan) port = qemu_opt_get_number(opts, "port", 0); mode = qemu_opt_get_number(opts, "mode", 0700); - if (net_vde_init(vlan, "vde", name, sock, port, group, mode) == -1) { + if (net_vde_init(peer, "vde", name, sock, port, group, mode) == -1) { return -1; } diff --git a/net/vde.h b/net/vde.h index 732e575..5e8ae58 100644 --- a/net/vde.h +++ b/net/vde.h @@ -29,7 +29,7 @@ #ifdef CONFIG_VDE -int net_init_vde(QemuOpts *opts, const char *name, VLANState *vlan); +int net_init_vde(QemuOpts *opts, const char *name, VLANClientState *peer); #endif /* CONFIG_VDE */