mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
Rename virXXXXMacAddr to virMacAddrXXX
Rename virFormatMacAddr, virGenerateMacAddr and virParseMacAddr to virMacAddrFormat, virMacAddrGenerate and virMacAddrParse respectively
This commit is contained in:
parent
54a38915d8
commit
4ce98dadcc
@ -848,7 +848,7 @@ extern void
|
|||||||
virCapabilitiesGenerateMac(virCapsPtr caps,
|
virCapabilitiesGenerateMac(virCapsPtr caps,
|
||||||
unsigned char *mac)
|
unsigned char *mac)
|
||||||
{
|
{
|
||||||
virGenerateMacAddr(caps->macPrefix, mac);
|
virMacAddrGenerate(caps->macPrefix, mac);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
|
@ -161,9 +161,9 @@ virDomainAuditNet(virDomainObjPtr vm,
|
|||||||
|
|
||||||
virUUIDFormat(vm->def->uuid, uuidstr);
|
virUUIDFormat(vm->def->uuid, uuidstr);
|
||||||
if (oldDef)
|
if (oldDef)
|
||||||
virFormatMacAddr(oldDef->mac, oldMacstr);
|
virMacAddrFormat(oldDef->mac, oldMacstr);
|
||||||
if (newDef)
|
if (newDef)
|
||||||
virFormatMacAddr(newDef->mac, newMacstr);
|
virMacAddrFormat(newDef->mac, newMacstr);
|
||||||
if (!(vmname = virAuditEncode("vm", vm->def->name))) {
|
if (!(vmname = virAuditEncode("vm", vm->def->name))) {
|
||||||
VIR_WARN("OOM while encoding audit message");
|
VIR_WARN("OOM while encoding audit message");
|
||||||
return;
|
return;
|
||||||
@ -207,7 +207,7 @@ virDomainAuditNetDevice(virDomainDefPtr vmDef, virDomainNetDefPtr netDef,
|
|||||||
const char *virt;
|
const char *virt;
|
||||||
|
|
||||||
virUUIDFormat(vmDef->uuid, uuidstr);
|
virUUIDFormat(vmDef->uuid, uuidstr);
|
||||||
virFormatMacAddr(netDef->mac, macstr);
|
virMacAddrFormat(netDef->mac, macstr);
|
||||||
rdev = virDomainAuditGetRdev(device);
|
rdev = virDomainAuditGetRdev(device);
|
||||||
|
|
||||||
if (!(vmname = virAuditEncode("vm", vmDef->name)) ||
|
if (!(vmname = virAuditEncode("vm", vmDef->name)) ||
|
||||||
|
@ -3810,7 +3810,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (macaddr) {
|
if (macaddr) {
|
||||||
if (virParseMacAddr((const char *)macaddr, def->mac) < 0) {
|
if (virMacAddrParse((const char *)macaddr, def->mac) < 0) {
|
||||||
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
|
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unable to parse mac address '%s'"),
|
_("unable to parse mac address '%s'"),
|
||||||
(const char *)macaddr);
|
(const char *)macaddr);
|
||||||
@ -13904,7 +13904,7 @@ virDomainNetFind(virDomainDefPtr def, const char *device)
|
|||||||
unsigned char mac[VIR_MAC_BUFLEN];
|
unsigned char mac[VIR_MAC_BUFLEN];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (virParseMacAddr(device, mac) == 0)
|
if (virMacAddrParse(device, mac) == 0)
|
||||||
isMac = true;
|
isMac = true;
|
||||||
|
|
||||||
if (isMac) {
|
if (isMac) {
|
||||||
|
@ -425,7 +425,7 @@ virNetworkDHCPRangeDefParseXML(const char *networkName,
|
|||||||
|
|
||||||
mac = virXMLPropString(cur, "mac");
|
mac = virXMLPropString(cur, "mac");
|
||||||
if ((mac != NULL) &&
|
if ((mac != NULL) &&
|
||||||
(virParseMacAddr(mac, &addr[0]) != 0)) {
|
(virMacAddrParse(mac, &addr[0]) != 0)) {
|
||||||
virNetworkReportError(VIR_ERR_INTERNAL_ERROR,
|
virNetworkReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Cannot parse MAC address '%s' in network '%s'"),
|
_("Cannot parse MAC address '%s' in network '%s'"),
|
||||||
mac, networkName);
|
mac, networkName);
|
||||||
@ -989,7 +989,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
|
|
||||||
tmp = virXPathString("string(./mac[1]/@address)", ctxt);
|
tmp = virXPathString("string(./mac[1]/@address)", ctxt);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
if (virParseMacAddr(tmp, def->mac) < 0) {
|
if (virMacAddrParse(tmp, def->mac) < 0) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virNetworkReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Invalid bridge mac address '%s' in network '%s'"),
|
_("Invalid bridge mac address '%s' in network '%s'"),
|
||||||
tmp, def->name);
|
tmp, def->name);
|
||||||
@ -1513,7 +1513,7 @@ char *virNetworkDefFormat(const virNetworkDefPtr def, unsigned int flags)
|
|||||||
|
|
||||||
if (def->mac_specified) {
|
if (def->mac_specified) {
|
||||||
char macaddr[VIR_MAC_STRING_BUFLEN];
|
char macaddr[VIR_MAC_STRING_BUFLEN];
|
||||||
virFormatMacAddr(def->mac, macaddr);
|
virMacAddrFormat(def->mac, macaddr);
|
||||||
virBufferAsprintf(&buf, " <mac address='%s'/>\n", macaddr);
|
virBufferAsprintf(&buf, " <mac address='%s'/>\n", macaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1840,7 +1840,7 @@ void virNetworkSetBridgeMacAddr(virNetworkDefPtr def)
|
|||||||
/* if the bridge doesn't have a mac address explicitly defined,
|
/* if the bridge doesn't have a mac address explicitly defined,
|
||||||
* autogenerate a random one.
|
* autogenerate a random one.
|
||||||
*/
|
*/
|
||||||
virGenerateMacAddr((unsigned char[]){ 0x52, 0x54, 0 },
|
virMacAddrGenerate((unsigned char[]){ 0x52, 0x54, 0 },
|
||||||
def->mac);
|
def->mac);
|
||||||
def->mac_specified = true;
|
def->mac_specified = true;
|
||||||
}
|
}
|
||||||
|
@ -1670,7 +1670,7 @@ static int
|
|||||||
virNWMACAddressParser(const char *input,
|
virNWMACAddressParser(const char *input,
|
||||||
nwMACAddressPtr output)
|
nwMACAddressPtr output)
|
||||||
{
|
{
|
||||||
return virParseMacAddr(input, &output->addr[0]);
|
return virMacAddrParse(input, &output->addr[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1110,8 +1110,6 @@ virFileUnlock;
|
|||||||
virFileWaitForDevices;
|
virFileWaitForDevices;
|
||||||
virFileWriteStr;
|
virFileWriteStr;
|
||||||
virFindFileInPath;
|
virFindFileInPath;
|
||||||
virFormatMacAddr;
|
|
||||||
virGenerateMacAddr;
|
|
||||||
virGetGroupID;
|
virGetGroupID;
|
||||||
virGetGroupName;
|
virGetGroupName;
|
||||||
virGetHostname;
|
virGetHostname;
|
||||||
@ -1123,7 +1121,9 @@ virIndexToDiskName;
|
|||||||
virIsDevMapperDevice;
|
virIsDevMapperDevice;
|
||||||
virKillProcess;
|
virKillProcess;
|
||||||
virMacAddrCompare;
|
virMacAddrCompare;
|
||||||
virParseMacAddr;
|
virMacAddrFormat;
|
||||||
|
virMacAddrGenerate;
|
||||||
|
virMacAddrParse;
|
||||||
virParseNumber;
|
virParseNumber;
|
||||||
virParseVersionString;
|
virParseVersionString;
|
||||||
virPipeReadUntilEOF;
|
virPipeReadUntilEOF;
|
||||||
|
@ -303,7 +303,7 @@ _printDataType(virNWFilterVarCombIterPtr vars,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virFormatMacAddr(item->u.macaddr.addr, buf);
|
virMacAddrFormat(item->u.macaddr.addr, buf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DATATYPE_IPV6MASK:
|
case DATATYPE_IPV6MASK:
|
||||||
@ -3129,7 +3129,7 @@ ebtablesApplyBasicRules(const char *ifname,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virFormatMacAddr(macaddr, macaddr_str);
|
virMacAddrFormat(macaddr, macaddr_str);
|
||||||
|
|
||||||
ebiptablesAllTeardown(ifname);
|
ebiptablesAllTeardown(ifname);
|
||||||
|
|
||||||
@ -3234,7 +3234,7 @@ ebtablesApplyDHCPOnlyRules(const char *ifname,
|
|||||||
srcIPParam = virBufferContentAndReset(&buf);
|
srcIPParam = virBufferContentAndReset(&buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
virFormatMacAddr(macaddr, macaddr_str);
|
virMacAddrFormat(macaddr, macaddr_str);
|
||||||
|
|
||||||
ebiptablesAllTeardown(ifname);
|
ebiptablesAllTeardown(ifname);
|
||||||
|
|
||||||
|
@ -831,7 +831,7 @@ __virNWFilterInstantiateFilter(const unsigned char *vmuuid,
|
|||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
virFormatMacAddr(macaddr, vmmacaddr);
|
virMacAddrFormat(macaddr, vmmacaddr);
|
||||||
str_macaddr = strdup(vmmacaddr);
|
str_macaddr = strdup(vmmacaddr);
|
||||||
if (!str_macaddr) {
|
if (!str_macaddr) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
|
@ -511,7 +511,7 @@ learnIPAddressThread(void *arg)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
virFormatMacAddr(req->macaddr, macaddr);
|
virMacAddrFormat(req->macaddr, macaddr);
|
||||||
|
|
||||||
switch (req->howDetect) {
|
switch (req->howDetect) {
|
||||||
case DETECT_DHCP:
|
case DETECT_DHCP:
|
||||||
|
@ -295,7 +295,7 @@ openvzReadNetworkConf(virDomainDefPtr def,
|
|||||||
_("MAC address %s too long for destination"), p);
|
_("MAC address %s too long for destination"), p);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (virParseMacAddr(cpy_temp, net->mac) < 0) {
|
if (virMacAddrParse(cpy_temp, net->mac) < 0) {
|
||||||
openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
|
openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Wrong MAC address"));
|
_("Wrong MAC address"));
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -763,9 +763,9 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
|
|||||||
ADD_ARG_LIT(vpsid);
|
ADD_ARG_LIT(vpsid);
|
||||||
}
|
}
|
||||||
|
|
||||||
virFormatMacAddr(net->mac, macaddr);
|
virMacAddrFormat(net->mac, macaddr);
|
||||||
virCapabilitiesGenerateMac(driver->caps, host_mac);
|
virCapabilitiesGenerateMac(driver->caps, host_mac);
|
||||||
virFormatMacAddr(host_mac, host_macaddr);
|
virMacAddrFormat(host_mac, host_macaddr);
|
||||||
|
|
||||||
if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE ||
|
if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE ||
|
||||||
(net->type == VIR_DOMAIN_NET_TYPE_ETHERNET &&
|
(net->type == VIR_DOMAIN_NET_TYPE_ETHERNET &&
|
||||||
|
@ -6479,7 +6479,7 @@ qemuParseCommandLineNet(virCapsPtr caps,
|
|||||||
for (i = 0 ; i < nkeywords ; i++) {
|
for (i = 0 ; i < nkeywords ; i++) {
|
||||||
if (STREQ(keywords[i], "macaddr")) {
|
if (STREQ(keywords[i], "macaddr")) {
|
||||||
genmac = 0;
|
genmac = 0;
|
||||||
if (virParseMacAddr(values[i], def->mac) < 0) {
|
if (virMacAddrParse(values[i], def->mac) < 0) {
|
||||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unable to parse mac address '%s'"),
|
_("unable to parse mac address '%s'"),
|
||||||
values[i]);
|
values[i]);
|
||||||
|
@ -5361,7 +5361,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
|
|||||||
net = dev->data.net;
|
net = dev->data.net;
|
||||||
if (virDomainNetIndexByMac(vmdef, net->mac) >= 0) {
|
if (virDomainNetIndexByMac(vmdef, net->mac) >= 0) {
|
||||||
char macbuf[VIR_MAC_STRING_BUFLEN];
|
char macbuf[VIR_MAC_STRING_BUFLEN];
|
||||||
virFormatMacAddr(net->mac, macbuf);
|
virMacAddrFormat(net->mac, macbuf);
|
||||||
qemuReportError(VIR_ERR_INVALID_ARG,
|
qemuReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("mac %s already exists"), macbuf);
|
_("mac %s already exists"), macbuf);
|
||||||
return -1;
|
return -1;
|
||||||
@ -5422,7 +5422,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
|
|||||||
if (virDomainNetRemoveByMac(vmdef, net->mac)) {
|
if (virDomainNetRemoveByMac(vmdef, net->mac)) {
|
||||||
char macbuf[VIR_MAC_STRING_BUFLEN];
|
char macbuf[VIR_MAC_STRING_BUFLEN];
|
||||||
|
|
||||||
virFormatMacAddr(net->mac, macbuf);
|
virMacAddrFormat(net->mac, macbuf);
|
||||||
qemuReportError(VIR_ERR_INVALID_ARG,
|
qemuReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("no nic of mac %s"), macbuf);
|
_("no nic of mac %s"), macbuf);
|
||||||
return -1;
|
return -1;
|
||||||
@ -5496,7 +5496,7 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
|
|||||||
net = dev->data.net;
|
net = dev->data.net;
|
||||||
if ((pos = virDomainNetIndexByMac(vmdef, net->mac)) < 0) {
|
if ((pos = virDomainNetIndexByMac(vmdef, net->mac)) < 0) {
|
||||||
char macbuf[VIR_MAC_STRING_BUFLEN];
|
char macbuf[VIR_MAC_STRING_BUFLEN];
|
||||||
virFormatMacAddr(net->mac, macbuf);
|
virMacAddrFormat(net->mac, macbuf);
|
||||||
qemuReportError(VIR_ERR_INVALID_ARG,
|
qemuReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("mac %s doesn't exist"), macbuf);
|
_("mac %s doesn't exist"), macbuf);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1794,7 +1794,7 @@ virMacAddrCompare (const char *p, const char *q)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virParseMacAddr:
|
* virMacAddrParse:
|
||||||
* @str: string representation of MAC address, e.g., "0:1E:FC:E:3a:CB"
|
* @str: string representation of MAC address, e.g., "0:1E:FC:E:3a:CB"
|
||||||
* @addr: 6-byte MAC address
|
* @addr: 6-byte MAC address
|
||||||
*
|
*
|
||||||
@ -1803,7 +1803,7 @@ virMacAddrCompare (const char *p, const char *q)
|
|||||||
* Return 0 upon success, or -1 in case of error.
|
* Return 0 upon success, or -1 in case of error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virParseMacAddr(const char* str, unsigned char *addr)
|
virMacAddrParse(const char* str, unsigned char *addr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1838,7 +1838,7 @@ virParseMacAddr(const char* str, unsigned char *addr)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void virFormatMacAddr(const unsigned char *addr,
|
void virMacAddrFormat(const unsigned char *addr,
|
||||||
char *str)
|
char *str)
|
||||||
{
|
{
|
||||||
snprintf(str, VIR_MAC_STRING_BUFLEN,
|
snprintf(str, VIR_MAC_STRING_BUFLEN,
|
||||||
@ -1848,7 +1848,7 @@ void virFormatMacAddr(const unsigned char *addr,
|
|||||||
str[VIR_MAC_STRING_BUFLEN-1] = '\0';
|
str[VIR_MAC_STRING_BUFLEN-1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
void virGenerateMacAddr(const unsigned char *prefix,
|
void virMacAddrGenerate(const unsigned char *prefix,
|
||||||
unsigned char *addr)
|
unsigned char *addr)
|
||||||
{
|
{
|
||||||
addr[0] = prefix[0];
|
addr[0] = prefix[0];
|
||||||
|
@ -182,11 +182,11 @@ char *virStrcpy(char *dest, const char *src, size_t destbytes)
|
|||||||
# define VIR_MAC_PREFIX_BUFLEN 3
|
# define VIR_MAC_PREFIX_BUFLEN 3
|
||||||
# define VIR_MAC_STRING_BUFLEN VIR_MAC_BUFLEN * 3
|
# define VIR_MAC_STRING_BUFLEN VIR_MAC_BUFLEN * 3
|
||||||
|
|
||||||
int virParseMacAddr(const char* str,
|
int virMacAddrParse(const char* str,
|
||||||
unsigned char *addr) ATTRIBUTE_RETURN_CHECK;
|
unsigned char *addr) ATTRIBUTE_RETURN_CHECK;
|
||||||
void virFormatMacAddr(const unsigned char *addr,
|
void virMacAddrFormat(const unsigned char *addr,
|
||||||
char *str);
|
char *str);
|
||||||
void virGenerateMacAddr(const unsigned char *prefix,
|
void virMacAddrGenerate(const unsigned char *prefix,
|
||||||
unsigned char *addr);
|
unsigned char *addr);
|
||||||
|
|
||||||
int virDiskNameToIndex(const char* str);
|
int virDiskNameToIndex(const char* str);
|
||||||
|
@ -264,7 +264,7 @@ virNetDevReplaceMacAddress(const char *linkdev,
|
|||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
virFormatMacAddr(oldmac, macstr);
|
virMacAddrFormat(oldmac, macstr);
|
||||||
if (virFileWriteStr(path, macstr, O_CREAT|O_TRUNC|O_WRONLY) < 0) {
|
if (virFileWriteStr(path, macstr, O_CREAT|O_TRUNC|O_WRONLY) < 0) {
|
||||||
virReportSystemError(errno, _("Unable to preserve mac for %s"),
|
virReportSystemError(errno, _("Unable to preserve mac for %s"),
|
||||||
linkdev);
|
linkdev);
|
||||||
@ -305,7 +305,7 @@ virNetDevRestoreMacAddress(const char *linkdev,
|
|||||||
if (virFileReadAll(path, VIR_MAC_STRING_BUFLEN, &macstr) < 0)
|
if (virFileReadAll(path, VIR_MAC_STRING_BUFLEN, &macstr) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virParseMacAddr(macstr, &oldmac[0]) != 0) {
|
if (virMacAddrParse(macstr, &oldmac[0]) != 0) {
|
||||||
virNetDevError(VIR_ERR_INTERNAL_ERROR,
|
virNetDevError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Cannot parse MAC address from '%s'"),
|
_("Cannot parse MAC address from '%s'"),
|
||||||
oldmacname);
|
oldmacname);
|
||||||
|
@ -3000,7 +3000,7 @@ sharedFoldersCleanup:
|
|||||||
MACAddress[8], MACAddress[9], MACAddress[10], MACAddress[11]);
|
MACAddress[8], MACAddress[9], MACAddress[10], MACAddress[11]);
|
||||||
|
|
||||||
/* XXX some real error handling here some day ... */
|
/* XXX some real error handling here some day ... */
|
||||||
if (virParseMacAddr(macaddr, def->nets[netAdpIncCnt]->mac) < 0)
|
if (virMacAddrParse(macaddr, def->nets[netAdpIncCnt]->mac) < 0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
netAdpIncCnt++;
|
netAdpIncCnt++;
|
||||||
@ -4349,7 +4349,7 @@ vboxAttachNetwork(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
|
|||||||
char macaddr[VIR_MAC_STRING_BUFLEN] = {0};
|
char macaddr[VIR_MAC_STRING_BUFLEN] = {0};
|
||||||
char macaddrvbox[VIR_MAC_STRING_BUFLEN - 5] = {0};
|
char macaddrvbox[VIR_MAC_STRING_BUFLEN - 5] = {0};
|
||||||
|
|
||||||
virFormatMacAddr(def->nets[i]->mac, macaddr);
|
virMacAddrFormat(def->nets[i]->mac, macaddr);
|
||||||
snprintf(macaddrvbox, VIR_MAC_STRING_BUFLEN - 5,
|
snprintf(macaddrvbox, VIR_MAC_STRING_BUFLEN - 5,
|
||||||
"%02X%02X%02X%02X%02X%02X",
|
"%02X%02X%02X%02X%02X%02X",
|
||||||
def->nets[i]->mac[0],
|
def->nets[i]->mac[0],
|
||||||
|
@ -2365,7 +2365,7 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
|
|||||||
if (addressType == NULL || STRCASEEQ(addressType, "generated") ||
|
if (addressType == NULL || STRCASEEQ(addressType, "generated") ||
|
||||||
STRCASEEQ(addressType, "vpx")) {
|
STRCASEEQ(addressType, "vpx")) {
|
||||||
if (generatedAddress != NULL) {
|
if (generatedAddress != NULL) {
|
||||||
if (virParseMacAddr(generatedAddress, (*def)->mac) < 0) {
|
if (virMacAddrParse(generatedAddress, (*def)->mac) < 0) {
|
||||||
VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Expecting VMX entry '%s' to be MAC address but "
|
_("Expecting VMX entry '%s' to be MAC address but "
|
||||||
"found '%s'"), generatedAddress_name,
|
"found '%s'"), generatedAddress_name,
|
||||||
@ -2375,7 +2375,7 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
|
|||||||
}
|
}
|
||||||
} else if (STRCASEEQ(addressType, "static")) {
|
} else if (STRCASEEQ(addressType, "static")) {
|
||||||
if (address != NULL) {
|
if (address != NULL) {
|
||||||
if (virParseMacAddr(address, (*def)->mac) < 0) {
|
if (virMacAddrParse(address, (*def)->mac) < 0) {
|
||||||
VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Expecting VMX entry '%s' to be MAC address but "
|
_("Expecting VMX entry '%s' to be MAC address but "
|
||||||
"found '%s'"), address_name, address);
|
"found '%s'"), address_name, address);
|
||||||
@ -3557,7 +3557,7 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* def:mac -> vmx:addressType, vmx:(generated)Address, vmx:checkMACAddress */
|
/* def:mac -> vmx:addressType, vmx:(generated)Address, vmx:checkMACAddress */
|
||||||
virFormatMacAddr(def->mac, mac_string);
|
virMacAddrFormat(def->mac, mac_string);
|
||||||
|
|
||||||
prefix = (def->mac[0] << 16) | (def->mac[1] << 8) | def->mac[2];
|
prefix = (def->mac[0] << 16) | (def->mac[1] << 8) | def->mac[2];
|
||||||
suffix = (def->mac[3] << 16) | (def->mac[4] << 8) | def->mac[5];
|
suffix = (def->mac[3] << 16) | (def->mac[4] << 8) | def->mac[5];
|
||||||
|
@ -2713,7 +2713,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
char macStr[VIR_MAC_STRING_BUFLEN];
|
char macStr[VIR_MAC_STRING_BUFLEN];
|
||||||
virFormatMacAddr(dev->data.net->mac, macStr);
|
virMacAddrFormat(dev->data.net->mac, macStr);
|
||||||
|
|
||||||
if (!(target = strdup(macStr))) {
|
if (!(target = strdup(macStr))) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
|
@ -1513,7 +1513,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
|||||||
}
|
}
|
||||||
xen_vif_get_record(session, &vif_rec, vif);
|
xen_vif_get_record(session, &vif_rec, vif);
|
||||||
if (vif_rec != NULL) {
|
if (vif_rec != NULL) {
|
||||||
if (virParseMacAddr((const char *)vif_rec->mac,defPtr->nets[i]->mac) < 0)
|
if (virMacAddrParse((const char *)vif_rec->mac,defPtr->nets[i]->mac) < 0)
|
||||||
xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
|
xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unable to parse given mac address"));
|
_("Unable to parse given mac address"));
|
||||||
xen_vif_record_free(vif_rec);
|
xen_vif_record_free(vif_rec);
|
||||||
|
@ -562,7 +562,7 @@ createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def,
|
|||||||
goto error_cleanup;
|
goto error_cleanup;
|
||||||
if (def->nets[i]->mac) {
|
if (def->nets[i]->mac) {
|
||||||
char macStr[VIR_MAC_STRING_BUFLEN];
|
char macStr[VIR_MAC_STRING_BUFLEN];
|
||||||
virFormatMacAddr(def->nets[i]->mac, macStr);
|
virMacAddrFormat(def->nets[i]->mac, macStr);
|
||||||
if (!(mac = strdup(macStr))) {
|
if (!(mac = strdup(macStr))) {
|
||||||
VIR_FREE(bridge);
|
VIR_FREE(bridge);
|
||||||
goto error_cleanup;
|
goto error_cleanup;
|
||||||
|
@ -580,7 +580,7 @@ xenParseSxprNets(virDomainDefPtr def,
|
|||||||
|
|
||||||
tmp = sexpr_node(node, "device/vif/mac");
|
tmp = sexpr_node(node, "device/vif/mac");
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
if (virParseMacAddr(tmp, net->mac) < 0) {
|
if (virMacAddrParse(tmp, net->mac) < 0) {
|
||||||
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR,
|
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("malformed mac address '%s'"), tmp);
|
_("malformed mac address '%s'"), tmp);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -690,7 +690,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
|
|||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
if (mac[0]) {
|
if (mac[0]) {
|
||||||
if (virParseMacAddr(mac, net->mac) < 0) {
|
if (virMacAddrParse(mac, net->mac) < 0) {
|
||||||
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR,
|
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("malformed mac address '%s'"), mac);
|
_("malformed mac address '%s'"), mac);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -1408,7 +1408,7 @@ cmdDomIfSetLink (vshControl *ctl, const vshCmd *cmd)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virParseMacAddr(iface, macaddr) == 0) {
|
if (virMacAddrParse(iface, macaddr) == 0) {
|
||||||
element = "mac";
|
element = "mac";
|
||||||
attr = "address";
|
attr = "address";
|
||||||
} else {
|
} else {
|
||||||
@ -1566,7 +1566,7 @@ cmdDomIfGetLink (vshControl *ctl, const vshCmd *cmd)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virParseMacAddr(iface, macaddr) == 0) {
|
if (virMacAddrParse(iface, macaddr) == 0) {
|
||||||
element = "mac";
|
element = "mac";
|
||||||
attr = "address";
|
attr = "address";
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user