1. 22 9月, 2015 40 次提交
    • L
      conf: fix crash when parsing a unordered NUMA <cell/> · 328ad9e6
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1260846
      
      Introduced by 8fedbbdb, if we parse an unordered NUMA cell, will
      get a segfault. This is because of a check for overlapping @cpus
      sets we have there. However, since the array to hold guest NUMA
      cells is allocated upfront and therefore it contains all zeros,
      an out of order cell will break our assumption that cell IDs have
      increasing character. At this point we try to access yet NULL
      bitmap and therefore segfault.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      (cherry picked from commit 83ae3ee3)
      328ad9e6
    • J
      qemu: Check virGetLastError return value for migration finish failure · e5db3c4d
      John Ferlan 提交于
      Commit id '2e7cea24' added a check for an error from Finish instead
      of 'unexpected error'; however, if for some reason there wasn't an
      error, then virGetLastError could return NULL resulting in the
      NULL pointer deref to err->domain.
      
      (cherry picked from commit ea3c5f25)
      e5db3c4d
    • J
      libxl: don't overwrite error from virNetSocketNewConnectTCP() · 0206984a
      Jim Fehlig 提交于
      Remove redundant error reporting in libxlDomainMigrationPerform().
      virNetSocketNewConnectTCP() is perfectly capable of reporting
      sensible errors.
      
      (cherry picked from commit 6ce939c2)
      0206984a
    • P
      domain-conf: escape string for socket attribute · 999a873d
      Pavel Hrdina 提交于
      Commit d091518b tried to escape all strings in produced XML, but missed
      this one.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      (cherry picked from commit e92e5ba1)
      999a873d
    • M
      src: Check for symbols ordering in ADMIN_SYM_FILES · d7eb40d7
      Michal Privoznik 提交于
      Like we are checking for the correct order in SYM_FILES, we
      should do the same for ADMIN_SYM_FILES.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit a0d2ceb3)
      d7eb40d7
    • M
      src: Cleanup libvirt_admin.syms · e2b6bd50
      Michal Privoznik 提交于
      It's a generated file, so after 'distclean' it should be gone.
      But it isn't yet.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit 28fa50d2)
      e2b6bd50
    • M
      src: Check libvirt_admin.syms for exported symbols · 00cf7e08
      Michal Privoznik 提交于
      We have this check rule in src/Makefile: check-symfile that
      should check if all symbols we wanted to export are exported.
      Moreover, if we are not exporting something more. Do the same
      with libvirt_admin.syms.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit 74f11dd2)
      00cf7e08
    • L
      util: fallback to ioctl(SIOCBRDELBR) if netlink RTM_DELLINK fails · b64d62c6
      Laine Stump 提交于
      commit 09778e09 switched from using ioctl(SIOCBRDELBR) for bridge
      device deletion to using a netlink RTM_DELLINK message, which is the
      more modern way to delete a bridge (and also doesn't require the
      bridge to be ~IFF_UP to succeed). However, although older kernels
      (e.g. 2.6.32, in RHEL6/CentOS6) support deleting *some* link types
      with RTM_NEWLINK, they don't support deleting bridges, and there is no
      compile-time way to figure this out.
      
      This patch moves the body of the SIOCBRDELBR version of
      virNetDevBridgeDelete() into a static function, calls the new function
      from the original, and also calls the new function from the
      RTM_DELLINK version if the RTM_DELLINK message generates an EOPNOTSUPP
      error. Since RTM_DELLINK is done from the subordinate function
      virNetlinkDelLink, which is also called for other purposes (deleting a
      macvtap interface), a function pointer called "fallback" has been
      added to the arglist of virNetlinkDelLink() - if that arg != NULL, the
      provided function will be called when (and only when) RTM_DELLINK
      fails with EOPNOTSUPP.
      
      Resolves:  https://bugzilla.redhat.com/show_bug.cgi?id=1252780 (part 2)
      (cherry picked from commit 97d26e47)
      b64d62c6
    • L
      util: fallback to ioctl(SIOCBRADDBR) if netlink RTM_NEWLINK fails · e6c69718
      Laine Stump 提交于
      commit fc7b23db switched from using ioctl(SIOCBRADDBR) for bridge
      creation to using a netlink RTM_NEWLINK message with IFLA_INFO_KIND =
      "bridge", which is the more modern way to create a bridge. However,
      although older kernels (e.g. 2.6.32, in RHEL6/CentOS6) support
      creating *some* link types with RTM_NEWLINK, they don't support
      creating bridges, and there is no compile-time way to figure this out
      (since the "type" isn't an enum, but rather a character string).
      
      This patch moves the body of the SIOCBRADDBR version of
      virNetDevBridgeCreate() into a static function, calls the new function
      from the original, and also calls the new function from the
      RTM_NEWLINK version if the RTM_NEWLINK message generates an EOPNOTSUPP
      error.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1252780
      (cherry picked from commit 66dcb409)
      e6c69718
    • J
      libxl: acquire a job when receiving a migrating domain · 14aa9d65
      Jim Fehlig 提交于
      Commit f86ae403 moved acquiring a job from libxlDomainStart()
      to its callers. One spot missed was in libxlDoMigrateReceive().
      Acquire a job in libxlDoMigrateReceive() before calling
      libxlDomainStart().
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      (cherry picked from commit e80b84a7)
      14aa9d65
    • J
      libxl: don't attempt to resume domain when suspend fails · b4fefefc
      Jim Fehlig 提交于
      Failure of libxl_domain_suspend() does not leave the domain in
      a suspended state, so no need to call libxl_domain_resume(),
      which btw will fail with "domain not suspended".
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      (cherry picked from commit 15120b8c)
      b4fefefc
    • J
      libxl: fix ref counting of libxlMigrationDstArgs · 24d194ad
      Jim Fehlig 提交于
      This patch fixes some flawed logic around ref counting the
      libxlMigrationDstArgs object.
      
      First, when adding sockets to the event loop with
      virNetSocketAddIOCallback(), the generic virObjectFreeCallback()
      was registered as a free function, with libxlMigrationDstArgs as
      its parameter. A reference was also taken on
      libxlMigrationDstArgs for each successful call to
      virNetSocketAddIOCallback(). The rational behind this logic was
      that the libxlMigrationDstArgs object had to out-live the socket
      objects. But virNetSocketAddIOCallback() already takes a
      reference on socket objects, ensuring their life until removed
      from the event loop and unref'ed in virNetSocketEventFree(). We
      only need to ensure libxlMigrationDstArgs lives until
      libxlDoMigrateReceive() finishes, which can be done by simply
      unref'ing libxlMigrationDstArgs at the end of
      libxlDoMigrateReceive().
      
      The second flaw was unref'ing the sockets in the failure path of
      libxlMigrateReceive() and at the end of libxlDoMigrateReceive().
      As mentioned above, the sockets are already unref'ed by
      virNetSocketEventFree() when removed from the event loop.
      Attempting to unref the socket a second time resulted in a
      libvirtd crash since the socket was previously unref'ed and
      disposed.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      (cherry picked from commit 44a54eb0)
      24d194ad
    • M
      libvirt_lxc: Claim success for --help · 54032910
      Michal Privoznik 提交于
      So far, if libvirt_lxc binary (usually to be found under
      /usr/libexec/) is run with --help, due to a missing line
      and our usual functions pattern, an 'uknown' error is returned.
      Yeah, the help is printed out, but we should not claim error.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit fb0ef0d5)
      54032910
    • M
      virt-aa-helper: Improve valid_path · acf257de
      Michal Privoznik 提交于
      So, after some movement in virt-aa-helper, I've noticed the
      virt-aa-helper-test failing. I've ran gdb (it took me a while to
      realize how to do that) and this showed up immediately:
      
        Program received signal SIGSEGV, Segmentation fault.
        strlen () at ../sysdeps/x86_64/strlen.S:106
        106     ../sysdeps/x86_64/strlen.S: No such file or directory.
        (gdb) bt
        #0  strlen () at ../sysdeps/x86_64/strlen.S:106
        #1  0x0000555555561a13 in array_starts_with (str=0x5555557ce910 "/tmp/tmp.6nI2Fkv0KL/1.img", arr=0x7fffffffd160, size=-1540438016) at security/virt-aa-helper.c:525
        #2  0x0000555555561d49 in valid_path (path=0x5555557ce910 "/tmp/tmp.6nI2Fkv0KL/1.img", readonly=false) at security/virt-aa-helper.c:617
        #3  0x0000555555562506 in vah_add_path (buf=0x7fffffffd3e0, path=0x5555557cb910 "/tmp/tmp.6nI2Fkv0KL/1.img", perms=0x555555581585 "rw", recursive=false) at security/virt-aa-helper.c:823
        #4  0x0000555555562693 in vah_add_file (buf=0x7fffffffd3e0, path=0x5555557cb910 "/tmp/tmp.6nI2Fkv0KL/1.img", perms=0x555555581585 "rw") at security/virt-aa-helper.c:854
        #5  0x0000555555562918 in add_file_path (disk=0x5555557d4440, path=0x5555557cb910 "/tmp/tmp.6nI2Fkv0KL/1.img", depth=0, opaque=0x7fffffffd3e0) at security/virt-aa-helper.c:931
        #6  0x00007ffff78f18b1 in virDomainDiskDefForeachPath (disk=0x5555557d4440, ignoreOpenFailure=true, iter=0x5555555628a6 <add_file_path>, opaque=0x7fffffffd3e0) at conf/domain_conf.c:23286
        #7  0x0000555555562b5f in get_files (ctl=0x7fffffffd670) at security/virt-aa-helper.c:982
        #8  0x0000555555564100 in vahParseArgv (ctl=0x7fffffffd670, argc=5, argv=0x7fffffffd7e8) at security/virt-aa-helper.c:1277
        #9  0x00005555555643d6 in main (argc=5, argv=0x7fffffffd7e8) at security/virt-aa-helper.c:1332
      
      So I've taken look at valid_path() because it is obviously
      calling array_starts_with() with malformed @size. And here's the
      result: there are two variables to hold the size of three arrays
      and their value is recalculated before each call of
      array_starts_with(). What if we just use three variables,
      initialize them and do not touch them afterwards?
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit 52970dec)
      acf257de
    • L
      qemu: Emit correct audit message for memory hot unplug · affa75e6
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1226234#c3
      
      If the qemu monitor fails to remove the memory from the guest for
      any reason, the auditlog message will incorrectly use the current
      actual memory (via virDomainDefGetMemoryActual) instead of the
      value we were attempting to reduce to. The result is the 'new-mem'
      and 'old-mem' values for the auditlog message would be identical.
      
      This patch creates a local 'newmem' which accounts for the current
      memory size minus the memory which is being removed. NB, for the
      success case this results in the same value that would be returned
      by virDomainDefGetMemoryActual without the need to do the math. This
      follows the existing code which would subtract the size for cur_balloon.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      (cherry picked from commit 8f8031df)
      affa75e6
    • L
      qemu: Emit correct audit message for memory hot plug · fec2c786
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1226234#c3
      
      Prior to this patch, after successfully hot plugging memory
      the audit log indicated that the update failed, e.g.:
      
      type=VIRT_RESOURCE ... old-mem=1024000 new-mem=1548288 \
      exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=pts/2 res=failed
      
      This patch will adjust where virDomainAuditMemory is called to
      ensure the proper 'ret' value is used based on success or failure.
      
      Additionally, the audit message should include the size of the
      memory we were attempting to change to rather than the current
      actual size. On failure to add, the message showed the same value
      for old-mem and new-mem.
      
      In order to do this, introduce a 'newmem' local which will compute
      the new size based on the oldmem size plus the size of memory we
      are about to add. NB: This would be the same as calling the
      virDomainDefGetMemoryActual again on success, but avoids the
      overhead of recalculating. Plus cur_balloon is already adjusted
      by the same value, so this follows that.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      (cherry picked from commit cb1fbda4)
      fec2c786
    • L
      hostdev: skip ACS check when using VFIO for device assignment · 4a03dc50
      Laine Stump 提交于
      The ACS checks are meaningless when using the more modern VFIO driver
      for device assignment since VFIO has its own more complete and exact
      checks, but I didn't realize that when I added support for VFIO. This
      patch eliminates the ACS check when preparing PCI devices for
      assignment if VFIO is being used.
      
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1256486
      
      (cherry picked from commit 108d591b)
      4a03dc50
    • M
      Start daemon only after filesystems are mounted · 2c1a8f02
      Martin Kletzander 提交于
      When images are on mounted filesystems, there is no guarantee libvirtd
      will start before they are mounted.  Since we want to start after both
      local and remote filesystems are mounted, we need to add both local-fs
      and remote-fs as targets that should precede starting libvirtd service.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      (cherry picked from commit 3418e781)
      2c1a8f02
    • P
      virt-aa-helper: add NVRAM store file for read/write · d598dced
      Peter Kieser 提交于
      This is a cryptographically signed message in MIME format.
      
      Some UEFI firmwares may want to use a non-volatile memory to store some
      variables.
      If AppArmor is enabled, and NVRAM store file is set currently
      virt-aa-helper does
      not add the NVRAM store file to the template. Add this file for
      read/write when
      this functionality is defined in domain XML.
      Signed-off-by: NPeter Kieser <peter@kieser.ca>
      (cherry picked from commit 91fdcefa)
      d598dced
    • L
      qemu: Update blkio.weight value after successful set · 075f66e3
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1253107
      
      Make a call virCgroupGetBlkioWeight to re-read blkio.weight right
      after it is set in order to keep internal data up-to-date.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      (cherry picked from commit bf278821)
      075f66e3
    • V
      Eliminate incorrect and unnecessary check for changed IP address · 77fa0088
      Vasiliy Tolstov 提交于
      Commit aa2cc7 modified a previously unnecessary but innocuous check
      for interface IP address during interface update incorrectly, causing
      all attempted updates (e.g. changing link state) to interfaces of
      type='ethernet' for QEMU to fail.
      
      This patch fixes the issue by completely removing the check for IP
      address, which is pointless since QEMU doesn't support setting
      interface IP addresses from the domain interface XML anyway.
      Signed-off-by: NVasiliy Tolstov <v.tolstov@selfip.ru>
      Signed-off-by: NLaine Stump <laine@laine.org>
      (cherry picked from commit bbc705d1)
      77fa0088
    • I
      virt-aa-helper: allow access to /usr/share/ovmf/ · 4f4812f8
      intrigeri 提交于
      We forbid access to /usr/share/, but (at least on Debian-based systems)
      the Open Virtual Machine Firmware files needed for booting UEFI virtual
      machines in QEMU live in /usr/share/ovmf/. Therefore, we need to add
      that directory to the list of read only paths.
      
      A similar patch was suggested by Jamie Strandboge <jamie@canonical.com>
      on https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1483071.
      
      (cherry picked from commit 2f01cfdf)
      4f4812f8
    • G
      virt-aa-helper: Simplify restriction logic · a8eaab32
      Guido Günther 提交于
      First check overrides, then read only files then restricted access
      itself.
      
      This allows us to mark files for read only access whose parents were
      already restricted for read write.
      
      Based on a proposal by Martin Kletzander
      
      (cherry picked from commit d25a5e08)
      a8eaab32
    • G
      virt-aa-helper: document --probing and --dry-run · e50d8461
      Guido Günther 提交于
      (cherry picked from commit 26c5fa3a)
      e50d8461
    • M
      Add generated libvirt_admin.syms into .gitignore · 51521556
      Martin Kletzander 提交于
      Commit a2c5d16a switched to generating
      libvirt_admin.syms, but forgot to add the generated file into
      .gitignore, hence causing tree pollution post-build.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      (cherry picked from commit 14d84db8)
      51521556
    • G
      libvirt-admin: Generate symbols file · 83c279a7
      Guido Günther 提交于
      Since we're linking this into libvirtd we need some symbols to be public
      but not part of the public API so mark them as
      LIBVIRT_ADMIN_PRIVATE_<VERSION> as we do with libvirt.
      
      Making all other symbols local makes sure we don't accidentally leak
      unwanted ones.
      
      (cherry picked from commit a2c5d16a)
      83c279a7
    • G
      daemon: Use $(NULL) for libvird_admin's flags · f0cb1b96
      Guido Günther 提交于
      This makes it consistent with the other FLAGS in this file and reduced
      clutter in the diff when adding new entries.
      
      (cherry picked from commit 6d71d548)
      f0cb1b96
    • J
      qemu: Add check for invalid iothread_id in qemuDomainChgIOThread · 3ed4dba4
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1251886
      
      Since iothread_id == 0 is an invalid value for QEMU let's point
      that out specifically.  For the IOThreadDel code, the failure would
      have ended up being a failure to find the IOThread ID; however, for
      the IOThreadAdd code - an IOThread 0 was added and that isn't good.
      
      It seems during many reviews/edits to the code the check for
      iothread_id = 0 being invalid was lost - it could have originally
      been in the API code, but requested to be moved - I cannot remember.
      
      (cherry picked from commit 32c6b190)
      3ed4dba4
    • L
      virsh: Reset global error after successfull domain lookup · 4a3bd30e
      Luyao Huang 提交于
      When looking up a domain, we try to look up by ID, UUID and NAME
      consequently while not really caring which of those lookups succeeds.
      The problem is that if any of them fails, we dispatch the error from the
      driver and that means setting both threadlocal and global error. Let's
      say the last lookup (by NAME) succeeds and resets the threadlocal error as any
      other API does, however leaving the global error unchanged. If the underlying
      virsh command does not succeed afterwards, our cleanup routine in
      vshCommandRun ensures that no libvirt error will be forgotten and that's
      exactly where this global error comes in incorrectly.
      
       # virsh domif-setlink 123 vnet1 up
       error: interface (target: vnet1) not found
       error: Domain not found: no domain with matching id 123
      
      This patch also resets the global error which would otherwise cause some
      minor confusion in reported error messages.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1254152Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      (cherry picked from commit 70f56dd7)
      4a3bd30e
    • E
      build: fix mingw build · 9e5c5fbd
      Eric Blake 提交于
      Ever since commit e44b0269, 64-bit mingw compilation fails with:
      
      ../../src/util/virprocess.c: In function 'virProcessGetPids':
      ../../src/util/virprocess.c:628:50: error: passing argument 4 of 'virStrToLong_i' from incompatible pointer type [-Werror=incompatible-pointer-types]
               if (virStrToLong_i(ent->d_name, NULL, 10, &tmp_pid) < 0)
                                                        ^
      In file included from ../../src/util/virprocess.c:59:0:
      ../../src/util/virstring.h:53:5: note: expected 'int *' but argument is of type 'pid_t * {aka long long int *}'
       int virStrToLong_i(char const *s,
           ^
      cc1: all warnings being treated as errors
      
      Although mingw won't be using this function, it does compile the
      file, and the fix is relatively simple.
      
      * src/util/virprocess.c (virProcessGetPids): Don't assume pid_t
      fits in int.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 0a617b53)
      9e5c5fbd
    • G
      Detect location of qemu-bridge-helper · 2eef8aa8
      Guido Günther 提交于
      RedHat and Debian based distros use different locations
      
      Reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=790935
      (cherry picked from commit 0e4972fe)
      2eef8aa8
    • G
      Check if qemu-bridge-helper exists and is executable · ca208119
      Guido Günther 提交于
      Otherwise the error is just
      
          error: Failed to create domain from test1.xml
          error: failed to retrieve file descriptor for interface: Transport endpoint is not connected
      
      since we don't get a sensible error after the fork.
      
      (cherry picked from commit 151ba022)
      ca208119
    • M
      qemu: Use numad information when getting pin information · 779742f4
      Martin Kletzander 提交于
      Pinning information returned for emulatorpin and vcpupin calls is being
      returned from our data without querying cgroups for some time.  However,
      not all the data were utilized.  When automatic placement is used the
      information is not returned for the calls mentioned above.  Since the
      numad hint in private data is properly saved/restored, we can safely use
      it to return true information.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1162947Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      (cherry picked from commit 776924e3)
      779742f4
    • M
      qemu: Keep numad hint after daemon restart · a4b924b5
      Martin Kletzander 提交于
      The numad hint stored in priv->autoNodeset is information that gets lost
      during daemon restart.  And because we would like to use that
      information in the future, we also need to save it in the status XML.
      For the sake of tests, we need to initialize nnumaCell_max to some
      value, so that the restoration doesn't fail in our test suite.  There is
      no need to fill in the actual numa cell data since the recalculating
      function virCapabilitiesGetCpusForNodemask() will not fail, it will just
      skip filling the data in the bitmap which we don't use in tests anyway.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      (cherry picked from commit 8ce86722)
      a4b924b5
    • M
      conf: Pass private data to Parse function of XML options · 10283d24
      Martin Kletzander 提交于
      This needs a reorder of XML option definitions.  It might come in handy
      one day.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      (cherry picked from commit 7c8028cd)
      10283d24
    • M
      qemu: Fix segfault when parsing private domain data · edf314d7
      Martin Kletzander 提交于
      When parsing private domain data, there are two paths that are flawed.
      They are both error paths, just from different parts of the function.
      One of them can call free() on an uninitialized pointer.  Initialization
      to NULL is enough here.  The other one is a bit trickier to explain, but
      as easy as the first one to fix.  We create capabilities, parse them and
      then assign them into the private data pointer inside the domain object.
      If, however, we get to fail from now on, the error path calls unrefs the
      capabilities and then, when the domain object is being cleaned,
      qemuDomainObjPrivateFree() tries to unref them as well.  That causes a
      segfault.  Settin the pointer to NULL upon successful addition to the
      private data is enough.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      (cherry picked from commit 92ddffdb)
      edf314d7
    • C
      domain: Fix crash if trying to live update disk <serial> · 79be4dbe
      Cole Robinson 提交于
      If you pass <disk><serial> XML to UpdateDevice, and the original device
      didn't have a <serial> block, libvirtd crashes trying to read the original
      NULL serial string.
      
      Use _NULLABLE string comparisons to avoid the crash. A couple other
      properties needed the change too.
      
      (cherry picked from commit c7790408)
      79be4dbe
    • G
      virNetSocketCheckProtocols: handle EAI_NONAME as IPv6 unavailable · 85cf1ad5
      Guido Günther 提交于
      When running the test suite using "unshare -n" we might have IPv6 but no
      configured addresses. Due to AI_ADDRCONFIG getaddrinfo then fails with
      EAI_NONAME which we should then treat as IPv6 unavailable.
      
      (cherry picked from commit fbb27088)
      85cf1ad5
    • L
      util: don't overwrite stack when getting ethtool gfeatures · 58211ca5
      Laine Stump 提交于
      This fixes the crash described here:
      
       https://www.redhat.com/archives/libvir-list/2015-August/msg00162.html
      
      In short, we were calling ioctl(SIOCETHTOOL) pointing to a too-short
      object that was a local on the stack, resulting in the memory past the
      end of the object being overwritten. This was because the struct used
      by the ETHTOOL_GFEATURES command of SIOCETHTOOL ends with a 0-length
      array, but we were telling ethtool that it could use 2 elements on the
      array.
      
      The fix is to allocate the necessary memory with VIR_ALLOC_VAR(),
      including the extra length needed for a 2 element array at the end.
      
      (cherry picked from commit bfaaa2b6)
      58211ca5
    • M
      conf: Don't try formating non-existing addresses · 93fb9421
      Martin Kletzander 提交于
      Commit a6f9af82 added checking for address colisions between
      starting and ending addresses of forwarding addresses, but forgot that
      there might be no addresses set at all.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      (cherry picked from commit 1f24c149)
      93fb9421