]> git.ipfire.org Git - thirdparty/libvirt.git/commit
network: don't even call networkRunHook if there is no network
authorLaine Stump <laine@laine.org>
Tue, 25 Feb 2014 14:35:59 +0000 (16:35 +0200)
committerLaine Stump <laine@laine.org>
Wed, 26 Feb 2014 11:03:49 +0000 (13:03 +0200)
commit0700a3dac4d20a7984f46d4f1862890a922512fd
treeed459379edaca5e23b4a314f52b60ae94af8f769
parent969493f91d107767d827feaa55908cd4c1bf5a2f
network: don't even call networkRunHook if there is no network

networkAllocateActualDevice() is called for *all* interfaces, not just
those with type='network'. In that case, it will jump down to its
validate: label immediately, without allocating anything. After
validation is done, two counters are potentially updated (one for the
network, and one for any particular physical device that is chosen),
and then networkRunHook() is called.

This patch refactors that code a slight bit so that networkRunHook()
doesn't get called if netdef is NULL (i.e. type != network) and to
place the conditional increment of dev->connections inside the "if
(netdef)" as well - dev can never be non-null if netdef is null
(because "dev" is the pointer to a device in a network's pool of
devices), so this doesn't have any functional effect, it just makes
the code clearer.
src/network/bridge_driver.c