]> xenbits.xensource.com Git - libvirt.git/commit
networkRunHook: Run hook only if possible
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 19 Feb 2014 13:55:23 +0000 (14:55 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 20 Feb 2014 07:56:17 +0000 (08:56 +0100)
commit83c404ff9b930e21c97ff47b8c942db17a96e94a
treee62d244441a5c8e19b8cdf054aea14e522a8f2ef
parente6dcb0e2a103f0be2b34187bc7f55e6ec961d8c9
networkRunHook: Run hook only if possible

Currently, networkRunHook() is called in networkAllocateActualDevice and
friends. These functions, however, doesn't necessarily work on networks,
For example, if domain's interface is defined in this fashion:

    <interface type='bridge'>
      <mac address='52:54:00:0b:3b:16'/>
      <source bridge='virbr1'/>
      <model type='rtl8139'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </interface>

The networkAllocateActualDevice jumps directly onto 'validate' label as
the interface is not type of 'network'. Hence, @network is left
initialized to NULL and networkRunHook(network, ...) is called. One of
the things that the hook function does is dereference @network. Soupir.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/network/bridge_driver.c