summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-12-12 19:11:31 +0100
committerYury Usishchev <y.usishchev@samsung.com>2014-12-10 14:51:41 +0300
commit3a9d1e902ac1b93e5836ebd93f48450766751442 (patch)
treea0c35f2fdd77f02eb0c790f058dc2af02df4fb22 /net
parent95a92f0f810dc800b2ff1e2ab8d986415a5d1e3e (diff)
downloadqemu-3a9d1e902ac1b93e5836ebd93f48450766751442.tar.gz
qemu-3a9d1e902ac1b93e5836ebd93f48450766751442.tar.bz2
qemu-3a9d1e902ac1b93e5836ebd93f48450766751442.zip
Legacy Patch kvm-qemu-preXX-report-default-mac-used.patch
Diffstat (limited to 'net')
-rw-r--r--net/net.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/net/net.c b/net/net.c
index 7acc162b4..1c7ff128a 100644
--- a/net/net.c
+++ b/net/net.c
@@ -160,6 +160,27 @@ void qemu_format_nic_info_str(NetClientState *nc, uint8_t macaddr[6])
macaddr[3], macaddr[4], macaddr[5]);
}
+static void default_mac_check(void)
+{
+ static const MACAddr def_mac = { .a = { 0x52,0x54,0x00,0x12,0x34,0x56 } };
+ static int warned = 0;
+ int i;
+
+ for (i = 0; i < MAX_NICS; i++)
+ {
+ if (!nd_table[i].used)
+ continue;
+ if (memcmp(nd_table[i].macaddr.a, def_mac.a, 5))
+ continue;
+ if (nd_table[i].macaddr.a[5] >= 0x56 &&
+ nd_table[i].macaddr.a[5] < 0x56 + MAX_NICS && !warned) {
+ warned = 1;
+ fprintf(stderr, "Warning: default mac address being used, creating "
+ "potential for address conflict\n");
+ }
+ }
+}
+
void qemu_macaddr_default_if_unset(MACAddr *macaddr)
{
static int index = 0;
@@ -1314,6 +1335,7 @@ int net_init_clients(void)
if (qemu_opts_foreach(net, net_init_client, NULL, 1) == -1) {
return -1;
}
+ default_mac_check();
return 0;
}