+Tue Feb 14 14:50:22 EST 2007 Mark McLoughlin <markmc@redhat.com
+
+ * qemud/conf.c: handle an unspecified MAC address,
+ fix the argv freeing code in qemudBuildCommandLine()
+ and fix copy and paste error in qemudGenerateXML()
+
Tue Feb 14 14:42:38 EST 2007 Mark McLoughlin <markmc@redhat.com
* src/internal.h: add virConnect->qemud_fd so that
} else {
while (net) {
char nic[3+1+7+1+17+1];
- sprintf(nic, "nic,macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
- net->mac[0], net->mac[1],
- net->mac[2], net->mac[3],
- net->mac[4], net->mac[5]);
+
+ if (!net->mac[0] && !net->mac[1] && !net->mac[2] &&
+ !net->mac[3] && !net->mac[4] && !net->mac[5]) {
+ strncpy(nic, "nic", 4);
+ } else {
+ sprintf(nic, "nic,macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
+ net->mac[0], net->mac[1],
+ net->mac[2], net->mac[3],
+ net->mac[4], net->mac[5]);
+ }
if (!((*argv)[++n] = strdup("-net")))
goto no_memory;
no_memory:
if (argv) {
for (i = 0 ; i < n ; i++)
- free(argv[i]);
- free(argv);
+ free((*argv)[i]);
+ free(*argv);
}
qemudReportError(server, VIR_ERR_NO_MEMORY, "argv");
return -1;
}
net = vm->def.nets;
- disk = vm->def.disks;
- while (disk) {
+ while (net) {
const char *types[] = {
"user",
"tap",
types[net->type]) < 0)
goto no_memory;
- if (qemudBufferPrintf(&buf, " <mac address='%02x:%02x:%02x:%02x:%02x:%02x'/>\n",
+ if (net->mac[0] && net->mac[1] && net->mac[2] &&
+ net->mac[3] && net->mac[4] && net->mac[5] &&
+ qemudBufferPrintf(&buf, " <mac address='%02x:%02x:%02x:%02x:%02x:%02x'/>\n",
net->mac[0], net->mac[1], net->mac[2],
net->mac[3], net->mac[4], net->mac[5]) < 0)
goto no_memory;
if (qemudBufferPrintf(&buf, " </interface>\n") < 0)
goto no_memory;
- disk = disk->next;
+ net = net->next;
}
if (vm->def.graphicsType == QEMUD_GRAPHICS_VNC) {