2014-08-22 12:38:44 +02:00
|
|
|
From c20addda112a82af598960724a0968904c1735fb Mon Sep 17 00:00:00 2001
|
2012-12-13 11:49:19 +01:00
|
|
|
From: Alexander Graf <agraf@suse.de>
|
|
|
|
Date: Wed, 12 Dec 2012 19:11:31 +0100
|
|
|
|
Subject: [PATCH] Legacy Patch kvm-qemu-preXX-report-default-mac-used.patch
|
|
|
|
|
|
|
|
---
|
2014-01-17 23:04:30 +01:00
|
|
|
net/net.c | 22 ++++++++++++++++++++++
|
|
|
|
1 file changed, 22 insertions(+)
|
2012-12-13 11:49:19 +01:00
|
|
|
|
2013-02-10 19:32:29 +01:00
|
|
|
diff --git a/net/net.c b/net/net.c
|
2014-07-11 18:51:43 +02:00
|
|
|
index 6d930ea..9656f3e 100644
|
2013-02-10 19:32:29 +01:00
|
|
|
--- a/net/net.c
|
|
|
|
+++ b/net/net.c
|
2014-07-11 18:51:43 +02:00
|
|
|
@@ -158,6 +158,27 @@ void qemu_format_nic_info_str(NetClientState *nc, uint8_t macaddr[6])
|
2012-12-13 11:49:19 +01:00
|
|
|
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;
|
2014-07-11 18:51:43 +02:00
|
|
|
@@ -1276,6 +1297,7 @@ int net_init_clients(void)
|
2012-12-13 11:49:19 +01:00
|
|
|
if (qemu_opts_foreach(net, net_init_client, NULL, 1) == -1) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
+ default_mac_check();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|