Revision 13cf8f21
b/net.c | ||
---|---|---|
3001 | 3001 |
{ /* end of list */ } |
3002 | 3002 |
}; |
3003 | 3003 |
|
3004 |
static int net_client_init_from_opts(Monitor *mon, QemuOpts *opts)
|
|
3004 |
int net_client_init_from_opts(Monitor *mon, QemuOpts *opts) |
|
3005 | 3005 |
{ |
3006 | 3006 |
const char *type; |
3007 | 3007 |
int i; |
b/net.h | ||
---|---|---|
4 | 4 |
#include "qemu-queue.h" |
5 | 5 |
#include "qemu-common.h" |
6 | 6 |
#include "qdict.h" |
7 |
#include "qemu-option.h" |
|
7 | 8 |
|
8 | 9 |
/* VLANs support */ |
9 | 10 |
|
... | ... | |
136 | 137 |
extern const char *legacy_bootp_filename; |
137 | 138 |
|
138 | 139 |
int net_client_init(Monitor *mon, const char *device, const char *p); |
140 |
int net_client_init_from_opts(Monitor *mon, QemuOpts *opts); |
|
139 | 141 |
void net_client_uninit(NICInfo *nd); |
140 | 142 |
int net_client_parse(const char *str); |
141 | 143 |
int net_slirp_smb(const char *exported_dir); |
b/vl.c | ||
---|---|---|
2595 | 2595 |
dev = usb_baum_init(); |
2596 | 2596 |
#endif |
2597 | 2597 |
} else if (strstart(devname, "net:", &p)) { |
2598 |
int nic = nb_nics; |
|
2598 |
QemuOpts *opts; |
|
2599 |
int idx; |
|
2599 | 2600 |
|
2600 |
if (net_client_init(NULL, "nic", p) < 0) |
|
2601 |
opts = qemu_opts_parse(&qemu_net_opts, p, NULL); |
|
2602 |
if (!opts) { |
|
2601 | 2603 |
return -1; |
2602 |
nd_table[nic].model = qemu_strdup("usb"); |
|
2603 |
dev = usb_net_init(&nd_table[nic]); |
|
2604 |
} |
|
2605 |
|
|
2606 |
qemu_opt_set(opts, "type", "nic"); |
|
2607 |
qemu_opt_set(opts, "model", "usb"); |
|
2608 |
|
|
2609 |
idx = net_client_init_from_opts(NULL, opts); |
|
2610 |
if (idx == -1) { |
|
2611 |
return -1; |
|
2612 |
} |
|
2613 |
|
|
2614 |
dev = usb_net_init(&nd_table[idx]); |
|
2604 | 2615 |
} else if (!strcmp(devname, "bt") || strstart(devname, "bt:", &p)) { |
2605 | 2616 |
dev = usb_bt_init(devname[2] ? hci_init(p) : |
2606 | 2617 |
bt_new_hci(qemu_find_bt_vlan(0))); |
Also available in: Unified diff