libvirt/tests/bhyveargv2xmlmock.c
Michal Privoznik 7e62c4cd26 virmacaddr: Track if MAC address is autogenerated
It will come handy to know if the MAC address was generated (e.g.
during XML parse) or if it was parsed since provided by user in
the XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2017-10-04 17:10:12 +02:00

29 lines
590 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;
addr->generated = true;
}
int
virUUIDGenerate(unsigned char *uuid)
{
if (virUUIDParse("c7a5fdbd-edaf-9455-926a-d65c16db1809", uuid) < 0)
return -1;
return 0;
}