Revision f68b9d67 net.c
b/net.c | ||
---|---|---|
1305 | 1305 |
{ |
1306 | 1306 |
VLANState *vlan; |
1307 | 1307 |
VLANClientState *vc; |
1308 |
int seen_nics = 0; |
|
1309 |
|
|
1310 |
/* Don't warn about the default network setup that you get if |
|
1311 |
* no command line -net options are specified. There are two |
|
1312 |
* cases that we would otherwise complain about: |
|
1313 |
* (1) board doesn't support a NIC but the implicit "-net nic" |
|
1314 |
* requested one; we'd otherwise complain about more NICs being |
|
1315 |
* specified than we support, and also that the vlan set up by |
|
1316 |
* the implicit "-net user" didn't have any NICs connected to it |
|
1317 |
* (2) CONFIG_SLIRP not set: we'd otherwise complain about the |
|
1318 |
* implicit "-net nic" setting up a nic that wasn't connected to |
|
1319 |
* anything. |
|
1320 |
*/ |
|
1321 |
if (default_net) { |
|
1322 |
return; |
|
1323 |
} |
|
1308 | 1324 |
|
1309 | 1325 |
QTAILQ_FOREACH(vlan, &vlans, next) { |
1310 | 1326 |
int has_nic = 0, has_host_dev = 0; |
... | ... | |
1312 | 1328 |
QTAILQ_FOREACH(vc, &vlan->clients, next) { |
1313 | 1329 |
switch (vc->info->type) { |
1314 | 1330 |
case NET_CLIENT_TYPE_NIC: |
1331 |
seen_nics++; |
|
1315 | 1332 |
has_nic = 1; |
1316 | 1333 |
break; |
1317 | 1334 |
case NET_CLIENT_TYPE_SLIRP: |
... | ... | |
1331 | 1348 |
vlan->id); |
1332 | 1349 |
} |
1333 | 1350 |
QTAILQ_FOREACH(vc, &non_vlan_clients, next) { |
1351 |
if (vc->info->type == NET_CLIENT_TYPE_NIC) { |
|
1352 |
seen_nics++; |
|
1353 |
} |
|
1334 | 1354 |
if (!vc->peer) { |
1335 | 1355 |
fprintf(stderr, "Warning: %s %s has no peer\n", |
1336 | 1356 |
vc->info->type == NET_CLIENT_TYPE_NIC ? "nic" : "netdev", |
1337 | 1357 |
vc->name); |
1338 | 1358 |
} |
1339 | 1359 |
} |
1360 |
if (seen_nics != nb_nics) { |
|
1361 |
/* Number of NICs requested by user on command line doesn't match |
|
1362 |
* the number the model actually registered with us. |
|
1363 |
* This will generally only happen for models of embedded boards |
|
1364 |
* with no PCI bus or similar. PCI based machines can instantiate |
|
1365 |
* all requested NICs as PCI devices but usually embedded boards |
|
1366 |
* only have a single NIC. |
|
1367 |
*/ |
|
1368 |
fprintf(stderr, "Warning: more nics requested than this machine " |
|
1369 |
"supports; some have been ignored\n"); |
|
1370 |
} |
|
1340 | 1371 |
} |
1341 | 1372 |
|
1342 | 1373 |
static int net_init_client(QemuOpts *opts, void *dummy) |
Also available in: Unified diff