1. 22 2月, 2019 8 次提交
    • P
      util: alloc: Introduce 'VIR_AUTOCLEAN' macros for clearing stack'd structs · c73f752e
      Peter Krempa 提交于
      The new utility macros are useful for variables we put on the stack but
      require some cleanup. The most prominent of those is virBuffer which is
      used almost exclusively in that way.
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      c73f752e
    • P
      util: buf: Remove virBufferEscapeN · e2549244
      Peter Krempa 提交于
      The function was used only in the tests, remove it.
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      e2549244
    • P
      tests: buf: Fix debug messages in 'testBufEscapeRegex' · 3d6ba96f
      Peter Krempa 提交于
      The messages reference testBufEscapeN instead of testBufEscapeRegex.
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      3d6ba96f
    • P
      util: buf: Fix memory leak in virBufferEscapeN · c97679c6
      Peter Krempa 提交于
      The conversion to VIR_AUTOFREE of 'escapeList' introduced memory leak of
      the copied item to be escaped:
      
      ==17517== 2 bytes in 1 blocks are definitely lost in loss record 1 of 32
      ==17517==    at 0x483880B: malloc (vg_replace_malloc.c:309)
      ==17517==    by 0x54D666D: strdup (in /usr/lib64/libc-2.28.so)
      ==17517==    by 0x497663E: virStrdup (virstring.c:956)
      ==17517==    by 0x497663E: virStrdup (virstring.c:945)
      ==17517==    by 0x48F8853: virBufferEscapeN (virbuffer.c:707)
      ==17517==    by 0x403C9D: testBufEscapeN (virbuftest.c:383)
      ==17517==    by 0x405FA8: virTestRun (testutils.c:174)
      ==17517==    by 0x403A70: mymain (virbuftest.c:517)
      ==17517==    by 0x406BC9: virTestMain (testutils.c:1097)
      ==17517==    by 0x5470412: (below main) (in /usr/lib64/libc-2.28.so)
      
      [...] (all other have same backtrace as it happens in a loop)
      
      Fix it by reverting all the VIR_AUTO nonsense in this function as there
      is exactly one place where it's handled.
      
      This effectively reverts commits:
      d0a92a03
      96fbf6df
      d261ed2fSigned-off-by: NPeter Krempa <pkrempa@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      c97679c6
    • P
      util: buffer: Remove misleading AUTOPTR func for 'virBuffer' · a3d0d77e
      Peter Krempa 提交于
      'virBufferFreeAndReset' does not free the top level structure itself.
      Additionally we almost exclusively use stack'd buffers rather than
      pointers.
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      a3d0d77e
    • L
      network: add netmask to dhcp range of dnsmasq conf file for IPv4 · 82fe58ff
      Laine Stump 提交于
      dnsmasq documentation says that the *IPv4* prefix/network
      address/broadcast address sent to dhcp clients will be automatically
      determined by dnsmasq by looking at the interface it's listening on,
      so the original libvirt code did not add a netmask to the dnsmasq
      commandline (or later, the dnsmasq conf file).
      
      For *IPv6* however, dnsmasq apparently cannot automatically determine
      the prefix (functionally the same as a netmask), and it must be
      explicitly provided in the conf file (as a part of the dhcp-range
      option). So many years after IPv4 DHCP support had been added, when
      IPv6 dhcp support was added the prefix was included at the end of the
      dhcp-range setting, but only for IPv6.
      
      A user had reported a bug on a host where one of the interfaces was a
      superset of the libvirt network where dhcp is needed (e.g., the host's
      ethernet is 10.0.0.20/8, and the libvirt network is 10.10.0.1/24). For
      some reason dnsmasq was supplying the netmask for the /8 network to
      clients requesting an address on the /24 interface.
      
      This seems like a bug in dnsmasq, but even if/when it gets fixed
      there, it looks like there is no harm in just always adding the
      netmask to all IPv4 dhcp-range options similar to how prefix is added
      to all IPv6 dhcp-range options.
      Signed-off-by: NLaine Stump <laine@laine.org>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      82fe58ff
    • L
      util: set missing data length in virSocketAddrPrefixToNetmask() · abb293a5
      Laine Stump 提交于
      This fixes a bug that has been present since the original version of
      the function was pushed in commit 1ab80f32 on Nov. 26 2010 (by me). The
      virSocketAddr::len was not being set.
      
      Apparently until now we were always calling
      virSocketAddrPrefixToNetmask with virSocketAddr object that was
      already (coincidentally) initialized for the proper address family,
      but the bug became apparent when trying to use it to fill in an
      otherwise uninitialized object.
      Signed-off-by: NLaine Stump <laine@laine.org>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      abb293a5
    • E
      snapshot: Saner use of uuid · c900474e
      Eric Blake 提交于
      Most of the code base is fairly consistent about using the name
      'uuidstr' when dealing with a formatted human-readable form, and
      'uuid' when dealing with the smaller raw bytes form. Fix
      snapshot_conf to comply, as well as reducing the scope of a human
      string to only the error message that needs it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c900474e
  2. 21 2月, 2019 3 次提交
  3. 20 2月, 2019 29 次提交