Revision 53e51d85 net.c
b/net.c | ||
---|---|---|
150 | 150 |
static char *assign_name(VLANClientState *vc1, const char *model) |
151 | 151 |
{ |
152 | 152 |
VLANState *vlan; |
153 |
VLANClientState *vc; |
|
153 | 154 |
char buf[256]; |
154 | 155 |
int id = 0; |
155 | 156 |
|
156 | 157 |
QTAILQ_FOREACH(vlan, &vlans, next) { |
157 |
VLANClientState *vc; |
|
158 |
|
|
159 | 158 |
QTAILQ_FOREACH(vc, &vlan->clients, next) { |
160 | 159 |
if (vc != vc1 && strcmp(vc->model, model) == 0) { |
161 | 160 |
id++; |
... | ... | |
163 | 162 |
} |
164 | 163 |
} |
165 | 164 |
|
165 |
QTAILQ_FOREACH(vc, &non_vlan_clients, next) { |
|
166 |
if (vc != vc1 && strcmp(vc->model, model) == 0) { |
|
167 |
id++; |
|
168 |
} |
|
169 |
} |
|
170 |
|
|
166 | 171 |
snprintf(buf, sizeof(buf), "%s.%d", model, id); |
167 | 172 |
|
168 | 173 |
return qemu_strdup(buf); |
Also available in: Unified diff