mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
e62cb4a9b7
Commit7e62c4cd26
(first appearing in libvirt-3.9.0 as a resolution to rhbz #1343919) added a "generated" attribute to virMacAddr that was set whenever a mac address was auto-generated by libvirt. This knowledge was used in a single place - when trying to match a NetDef from the Domain to Delete with user-provided XML. Since the XML parser always auto-generates a MAC address for NetDefs when none is provided, it was previously impossible to make a search where the MAC address isn't significant, but the addition of the "generated" attribute made it possible for the search function to ignore auto-generated MACs. This implementation had a problem though - it was adding a field to a "low level" struct - virMacAddr - which is used in other places with the assumption that it contains exactly a 6 byte MAC address and nothing else. In particular, virNWFilterSnoopEthHdr uses virMacAddr as part of the definition of an ethernet packet header, whose layout must of course match an actual ethernet packet. Adding the extra bools into virNWFilterSnoopEthHdr caused the nwfilter driver's "IP discovery via DHCP packet snooping" functionality to mysteriously stop working. In order to fix that behavior, and prevent potential future similar odd behavior, this patch moves the "generated" member out of virMacAddr (so that it is again really is just a MAC address) into virDomainNetDef, and sets it only when virDomainNetGenerateMAC() is called from virDomainNetDefParseXML() (which is the only time we care about it). Resolves: https://bugzilla.redhat.com/1529338 (It should also be applied to any maintenance branch that applies commit7e62c4cd26
and friends to resolve https://bugzilla.redhat.com/1343919) Signed-off-by: Laine Stump <laine@laine.org>
28 lines
562 B
C
28 lines
562 B
C
#include <config.h>
|
|
|
|
#include "virnetdev.h"
|
|
#include "internal.h"
|
|
#include "util/viruuid.h"
|
|
|
|
#define VIR_FROM_THIS VIR_FROM_BHYVE
|
|
|
|
void
|
|
virMacAddrGenerate(const unsigned char prefix[VIR_MAC_PREFIX_BUFLEN],
|
|
virMacAddrPtr addr)
|
|
{
|
|
addr->addr[0] = prefix[0];
|
|
addr->addr[1] = prefix[1];
|
|
addr->addr[2] = prefix[2];
|
|
addr->addr[3] = 0;
|
|
addr->addr[4] = 0;
|
|
addr->addr[5] = 0;
|
|
}
|
|
|
|
int
|
|
virUUIDGenerate(unsigned char *uuid)
|
|
{
|
|
if (virUUIDParse("c7a5fdbd-edaf-9455-926a-d65c16db1809", uuid) < 0)
|
|
return -1;
|
|
return 0;
|
|
}
|