</choice>
</attribute>
</optional>
+ <optional>
+ <attribute name="check">
+ <ref name="virYesNo"/>
+ </attribute>
+ </optional>
<empty/>
</element>
</optional>
int rv, val;
g_autofree char *macaddr = NULL;
g_autofree char *macaddr_type = NULL;
+ g_autofree char *macaddr_check = NULL;
g_autofree char *type = NULL;
g_autofree char *network = NULL;
g_autofree char *portgroup = NULL;
if (!macaddr && virXMLNodeNameEqual(cur, "mac")) {
macaddr = virXMLPropString(cur, "address");
macaddr_type = virXMLPropString(cur, "type");
+ macaddr_check = virXMLPropString(cur, "check");
} else if (!network &&
def->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
virXMLNodeNameEqual(cur, "source")) {
}
def->mac_type = tmp;
}
+ if (macaddr_check) {
+ int tmpCheck;
+ if ((tmpCheck = virTristateBoolTypeFromString(macaddr_check)) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("invalid mac address check value: '%s'"),
+ macaddr_check);
+ goto error;
+ }
+ def->mac_check = tmpCheck;
+ }
if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info,
flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT
virMacAddrFormat(&def->mac, macstr));
if (def->mac_type)
virBufferAsprintf(buf, " type='%s'", virDomainNetMacTypeTypeToString(def->mac_type));
+ if (def->mac_check != VIR_TRISTATE_BOOL_ABSENT)
+ virBufferAsprintf(buf, " check='%s'", virTristateBoolTypeToString(def->mac_check));
virBufferAddLit(buf, "/>\n");
if (publicActual) {
virMacAddr mac;
bool mac_generated; /* true if mac was *just now* auto-generated by libvirt */
virDomainNetMacType mac_type;
+ virTristateBool mac_check;
int model; /* virDomainNetModelType */
char *modelstr;
union {
goto cleanup;
}
+ if (checkMACAddress) {
+ if (STREQ(checkMACAddress, "true")) {
+ (*def)->mac_check = VIR_TRISTATE_BOOL_YES;
+ } else {
+ (*def)->mac_check = VIR_TRISTATE_BOOL_NO;
+ }
+ }
+
/* vmx:virtualDev, vmx:features -> def:model */
if (virVMXGetConfigString(conf, virtualDev_name, &virtualDev, true) < 0 ||
virVMXGetConfigLong(conf, features_name, &features, 0, true) < 0) {
mac_check = VIR_TRISTATE_BOOL_ABSENT;
}
+ if (def->mac_check != VIR_TRISTATE_BOOL_ABSENT)
+ mac_check = def->mac_check;
+
if (mac_type == VIR_DOMAIN_NET_MAC_TYPE_GENERATED) {
virBufferAsprintf(buffer, "ethernet%d.addressType = \"%s\"\n",
controller, mac_vpx ? "vpx" : "generated");
--- /dev/null
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <interface type='bridge'>
+ <mac address='aa:bb:cc:dd:ee:ff'/>
+ <source bridge='br0'/>
+ </interface>
+ <interface type='bridge'>
+ <mac address='aa:bb:cc:dd:ee:fe' type='static' check='yes'/>
+ <source bridge='br1'/>
+ </interface>
+ <interface type='bridge'>
+ <mac address='aa:bb:cc:dd:ee:fd' type='generated' check='no'/>
+ <source bridge='br2'/>
+ </interface>
+ </devices>
+</domain>
DO_TEST("cpu-cache-passthrough");
DO_TEST("cpu-cache-disable");
+ DO_TEST("network-interface-mac-check");
+
DO_TEST_DIFFERENT("chardev-tcp");
DO_TEST_FULL("chardev-tcp-missing-host", 0, false,
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE);
<on_crash>destroy</on_crash>
<devices>
<interface type='bridge'>
- <mac address='00:12:34:56:78:90' type='static'/>
+ <mac address='00:12:34:56:78:90' type='static' check='no'/>
<source bridge='VM Network'/>
</interface>
<video>
ethernet1.connectionType = "bridged"
ethernet1.addressType = "static"
ethernet1.address = "00:0c:29:dd:ee:fe"
+ethernet1.checkMACAddress = "true"
ethernet2.present = "true"
ethernet2.networkName = "br2"
ethernet2.connectionType = "bridged"
ethernet2.addressType = "generated"
ethernet2.generatedAddress = "aa:bb:cc:dd:ee:fd"
ethernet2.generatedAddressOffset = "0"
+ethernet2.checkMACAddress = "false"
<source bridge='br0'/>
</interface>
<interface type='bridge'>
- <mac address='00:0c:29:dd:ee:fe' type='static'/>
+ <mac address='00:0c:29:dd:ee:fe' type='static' check='yes'/>
<source bridge='br1'/>
</interface>
<interface type='bridge'>
- <mac address='aa:bb:cc:dd:ee:fd' type='generated'/>
+ <mac address='aa:bb:cc:dd:ee:fd' type='generated' check='no'/>
<source bridge='br2'/>
</interface>
</devices>