[libvirt] [PATCH 2/3] network: allow disabling dnsmasq's DNS server

Michal Privoznik mprivozn at redhat.com
Sun Aug 21 10:45:45 UTC 2016


On 19.08.2016 17:26, Laine Stump wrote:

>>   Moreover, if the value has been modified, we can't be
>> entirely sure it was modified to something outside boundaries. It might
>> as well be changed from 'no' to 'yes' (or vice versa) which is not any
>> worse than the previous case IMO.
> 
> I don't follow the chain of logic there.
> 

You say that you're worried about hidden change of value of a variable
in our code. Long story short.

int enable;
enable = parseXML();
if (validate(enable) < 0) { /* valid values are 1 or 2 */
  virReportError();
  die();
}

/* For demonstrational purposes assume: */
enable = 1;

/* now the netowrk object lives its own life and something might
accidentally change enable */
enable = 3;

/* but where does this 3 come from? What if the buggy code changes that
to say 2? */
enable = 2;

formatXML(enable);

Yes, we won't crash, but we will not produce correct XML either. Valid
one, but not what user expected. Then again, I can live with that check
being there, it's just that I don't find it much helpful and consistent
with the rest of our code.

Michal




More information about the libvir-list mailing list