[libvirt] PATCH: Fix check for inactive network

When building up the QEMU command line args we forgot to check for a NULL when creating the TAP device arg. This can happen if the network being connected to the VM is not running. This is something I broke in the refactoring of the ARGV construction in the QEMU driver. Dan. Index: src/qemu_conf.c =================================================================== RCS file: /data/cvs/libvirt/src/qemu_conf.c,v retrieving revision 1.76 diff -u -p -r1.76 qemu_conf.c --- src/qemu_conf.c 29 May 2008 19:20:23 -0000 1.76 +++ src/qemu_conf.c 6 Jun 2008 13:29:17 -0000 @@ -2679,8 +2679,13 @@ int qemudBuildCommandLine(virConnectPtr switch (net->type) { case QEMUD_NET_NETWORK: case QEMUD_NET_BRIDGE: - ADD_ARG(qemudNetworkIfaceConnect(conn, driver, vm, net, vlan)); - break; + { + char *tap = qemudNetworkIfaceConnect(conn, driver, vm, net, vlan); + if (tap == NULL) + goto error; + ADD_ARG(tap); + break; + } case QEMUD_NET_ETHERNET: { -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Fri, Jun 06, 2008 at 02:31:10PM +0100, Daniel P. Berrange wrote:
When building up the QEMU command line args we forgot to check for a NULL when creating the TAP device arg. This can happen if the network being connected to the VM is not running. This is something I broke in the refactoring of the ARGV construction in the QEMU driver.
+1 -- I just got bitten by this bug. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top

On Fri, Jun 06, 2008 at 02:31:10PM +0100, Daniel P. Berrange wrote:
When building up the QEMU command line args we forgot to check for a NULL when creating the TAP device arg. This can happen if the network being connected to the VM is not running. This is something I broke in the refactoring of the ARGV construction in the QEMU driver.
Sure, +1, Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Richard W.M. Jones