[libvirt] [PATCH v2 3/5] conf: Make virNetworkIPDefParseXML a little bit saner

Laine Stump laine at laine.org
Fri Dec 16 19:32:19 UTC 2016


On 12/16/2016 11:39 AM, Jiri Denemark wrote:
> On Wed, Dec 14, 2016 at 10:46:20 -0500, Laine Stump wrote:
>> On 12/13/2016 08:52 AM, Jiri Denemark wrote:
>>> Iterating over all child nodes when we only support one instance of each
>>> child is pretty weired. And it would even cause memory leaks if more
>>> than one <tftp> element was specified.
>> ACK, but could you also look for dhcp[2]/tftp[2] and log an error if found?
>> I know there are *lots* of places we ignore extra elements in the XML, but
>> in this case there would be a silent behavior change if someone had
>> (erroneous) multiple tftp or dhcp elements - previously we would have
>> honored the final occurence of each element, but now we honor the first. So
>> even though it's their own fault, it would be nice to
> Well, if a user provided such a wrong XML, libvirt didn't do what the
> user asked for anyway. I don't think implementing a different way of not
> doing what they asked for is something we should worry about :-)
>
> That said, adding the check there is trivial, but I'm not sure it's a
> good idea since we do not check for extra elements anywhere else.

I retract this suggestion, since doing as I suggest would cause the code 
to now *fail* to parse XML that previously passed, which is much worse 
that just failing in a different manner than it had previously failed.

I still think this should be taken care of, but in a separate patch that 
modifies the validation at network define time (so that re-parsing of 
existing networks won't fail)





More information about the libvir-list mailing list