convert net_init_bridge() to NetClientOptions

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
This commit is contained in:
Laszlo Ersek 2012-07-17 16:17:20 +02:00 committed by Stefan Hajnoczi
parent 08c573a8d1
commit f79b51b081
1 changed files with 12 additions and 11 deletions

View File

@ -513,21 +513,22 @@ static int net_bridge_run_helper(const char *helper, const char *bridge)
return -1; return -1;
} }
int net_init_bridge(QemuOpts *opts, const NetClientOptions *new_opts, int net_init_bridge(QemuOpts *old_opts, const NetClientOptions *opts,
const char *name, VLANState *vlan) const char *name, VLANState *vlan)
{ {
const NetdevBridgeOptions *bridge;
const char *helper, *br;
TAPState *s; TAPState *s;
int fd, vnet_hdr; int fd, vnet_hdr;
if (!qemu_opt_get(opts, "br")) { assert(opts->kind == NET_CLIENT_OPTIONS_KIND_BRIDGE);
qemu_opt_set(opts, "br", DEFAULT_BRIDGE_INTERFACE); bridge = opts->bridge;
}
if (!qemu_opt_get(opts, "helper")) {
qemu_opt_set(opts, "helper", DEFAULT_BRIDGE_HELPER);
}
fd = net_bridge_run_helper(qemu_opt_get(opts, "helper"), helper = bridge->has_helper ? bridge->helper : DEFAULT_BRIDGE_HELPER;
qemu_opt_get(opts, "br")); br = bridge->has_br ? bridge->br : DEFAULT_BRIDGE_INTERFACE;
fd = net_bridge_run_helper(helper, br);
if (fd == -1) { if (fd == -1) {
return -1; return -1;
} }
@ -542,8 +543,8 @@ int net_init_bridge(QemuOpts *opts, const NetClientOptions *new_opts,
return -1; return -1;
} }
snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s", snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s", helper,
qemu_opt_get(opts, "helper"), qemu_opt_get(opts, "br")); br);
return 0; return 0;
} }