diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2011-08-04 17:15:22 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-08-04 17:15:22 -0500 |
commit | 81e34a2401f7ffd519bb7f093e833cb48734169f (patch) | |
tree | 146a7b6eebbee1367453fde501d4462ac6d9f8b4 /net.c | |
parent | e06516f565dca3636a4cbef770b191a5fcdf63ab (diff) | |
parent | cb4b4fde82b064472c13fb9d983ca36a70e560aa (diff) | |
download | qemu-81e34a2401f7ffd519bb7f093e833cb48734169f.tar.gz qemu-81e34a2401f7ffd519bb7f093e833cb48734169f.tar.bz2 qemu-81e34a2401f7ffd519bb7f093e833cb48734169f.zip |
Merge remote-tracking branch 'mst/for_anthony' into staging
Diffstat (limited to 'net.c')
-rw-r--r-- | net.c | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -150,12 +150,11 @@ void qemu_macaddr_default_if_unset(MACAddr *macaddr) static char *assign_name(VLANClientState *vc1, const char *model) { VLANState *vlan; + VLANClientState *vc; char buf[256]; int id = 0; QTAILQ_FOREACH(vlan, &vlans, next) { - VLANClientState *vc; - QTAILQ_FOREACH(vc, &vlan->clients, next) { if (vc != vc1 && strcmp(vc->model, model) == 0) { id++; @@ -163,6 +162,12 @@ static char *assign_name(VLANClientState *vc1, const char *model) } } + QTAILQ_FOREACH(vc, &non_vlan_clients, next) { + if (vc != vc1 && strcmp(vc->model, model) == 0) { + id++; + } + } + snprintf(buf, sizeof(buf), "%s.%d", model, id); return qemu_strdup(buf); @@ -653,6 +658,8 @@ VLANClientState *qemu_find_netdev(const char *id) VLANClientState *vc; QTAILQ_FOREACH(vc, &non_vlan_clients, next) { + if (vc->info->type == NET_CLIENT_TYPE_NIC) + continue; if (!strcmp(vc->name, id)) { return vc; } @@ -1212,7 +1219,7 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data) VLANClientState *vc; vc = qemu_find_netdev(id); - if (!vc || vc->info->type == NET_CLIENT_TYPE_NIC) { + if (!vc) { qerror_report(QERR_DEVICE_NOT_FOUND, id); return -1; } @@ -1270,7 +1277,11 @@ int do_set_link(Monitor *mon, const QDict *qdict, QObject **ret_data) } } } - vc = qemu_find_netdev(name); + QTAILQ_FOREACH(vc, &non_vlan_clients, next) { + if (!strcmp(vc->name, name)) { + goto done; + } + } done: if (!vc) { |