On 01/04/2011 11:14 PM, Laine Stump wrote:
This is partially in response to
https://bugzilla.redhat.com/show_bug.cgi?id=653300
The crash in that report was coincidentally fixed when we switched
from using inet_pton() to using virSocketParseAddr(), but the absence
of an ip address in a dhcp static host definition was still silently
ignored (and that entry discarded from the saved XML). This patch
turns that into a logged failure; likewise if the entry has neither a
mac address nor a name attribute (the entry is useless without at
least one of those, plus an ip address).
/*
* You need at least one MAC address or one host name
*/
if ((mac == NULL) && (name == NULL)) {
+ virNetworkReportError(VIR_ERR_XML_ERROR,
+ _("Static host definition in network
'%s' must have mac or name attribute"),
+ networkName);
VIR_FREE(mac);
VIR_FREE(name);
These two frees are pointless, given that you can only get here if both
variables are NULL. (might have been my fault in a previous patch, but
we should clean it up now while touching it again).
ACK with that nit fixed.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org