1. 27 6月, 2016 1 次提交
    • L
      global: consistently use IP rather than Ip in identifiers · 22a6873a
      Laine Stump 提交于
      I'm tired of mistyping this all the time, so let's do it the same all
      the time (similar to how we changed all "Pci" to "PCI" awhile back).
      
      (NB: I've left alone some things in the esx and vbox drivers because
      I'm unable to compile them and they weren't obviously *not* a part of
      some API. I also didn't change a couple of variables named,
      e.g. "somethingIptables", because they were derived from the name of
      the "iptables" command)
      22a6873a
  2. 24 6月, 2016 3 次提交
  3. 20 6月, 2016 1 次提交
  4. 02 5月, 2016 2 次提交
    • C
      conf: network: reject name containing '/' · 454f739f
      Cole Robinson 提交于
      Trying to define a network name containing an embedded '/'
      will immediately fail when trying to write the XML to disk.
      This patch explicitly rejects names containing a '/'
      
      Besides the network bridge driver, the only other network
      implementation is a very thin one for virtualbox, which seems to
      use the network name as a host interface name, which won't
      accept '/' anyways, so I think this is fine to do unconitionally.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=787604
      454f739f
    • M
      Change virDevicePCIAddress to virPCIDeviceAddress · c36b1f7b
      Martin Kletzander 提交于
      We had both and the only difference was that the latter also included
      information about multifunction setting.  The problem with that was that
      we couldn't use functions made for only one of the structs (e.g.
      parsing).  To consolidate those two structs, use the one in virpci.h,
      include that in domain_conf.h and add the multifunction member in it.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      c36b1f7b
  5. 20 4月, 2016 2 次提交
  6. 03 3月, 2016 1 次提交
    • M
      Drop inline keyword from some functions. · be8b536a
      Michal Privoznik 提交于
      While trying to build with -Os I've encountered some build
      failures.
      
      util/vircommand.c: In function 'virCommandAddEnvFormat':
      util/vircommand.c:1257:1: error: inlining failed in call to 'virCommandAddEnv': call is unlikely and code size would grow [-Werror=inline]
       virCommandAddEnv(virCommandPtr cmd, char *env)
       ^
      util/vircommand.c:1308:5: error: called from here [-Werror=inline]
           virCommandAddEnv(cmd, env);
           ^
      This function is big enough for the compiler to be not inlined.
      This is the error message I'm seeing:
      
      Then virDomainNumatuneNodeSpecified is exported and called from
      other places. It shouldn't be inlined then.
      
      In file included from network/bridge_driver_platform.h:30:0,
                       from network/bridge_driver_platform.c:26:
      network/bridge_driver_linux.c: In function 'networkRemoveRoutingFirewallRules':
      ./conf/network_conf.h:350:1: error: inlining failed in call to 'virNetworkDefForwardIf.constprop': call is unlikely and code size would grow [-Werror=inline]
       virNetworkDefForwardIf(const virNetworkDef *def, size_t n)
       ^
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      be8b536a
  7. 17 2月, 2016 1 次提交
    • E
      util: Add a return value to void hash iterators · cc48d3a1
      Erik Skultety 提交于
      Our existing virHashForEach method iterates through all items disregarding the
      fact, that some of the iterators might have actually failed. Errors are usually
      dispatched through an error element in opaque data which then causes the
      original caller of virHashForEach to return -1. In that case, virHashForEach
      could return as soon as one of the iterators fail. This patch changes the
      iterator return type and adjusts all of its instances accordingly, so the
      actual refactor of virHashForEach method can be dealt with later.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      cc48d3a1
  8. 21 10月, 2015 1 次提交
  9. 11 8月, 2015 2 次提交
    • M
      conf: Don't try formating non-existing addresses · 1f24c149
      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>
      1f24c149
    • L
      network: validate network NAT range · a6f9af82
      Laine Stump 提交于
      This patch modifies virSocketAddrGetRange() to function properly when
      the containing network/prefix of the address range isn't known, for
      example in the case of the NAT range of a virtual network (since it is
      a range of addresses on the *host*, not within the network itself). We
      then take advantage of this new functionality to validate the NAT
      range of a virtual network.
      
      Extra test cases are also added to verify that virSocketAddrGetRange()
      works properly in both positive and negative cases when the network
      pointer is NULL.
      
      This is the *real* fix for:
      
      https://bugzilla.redhat.com/show_bug.cgi?id=985653
      
      Commits 1e334a and 48e8b9 had earlier been pushed as fixes for that
      bug, but I had neglected to read the report carefully, so instead of
      fixing validation for the NAT range, I had fixed validation for the
      DHCP range. sigh.
      a6f9af82
  10. 10 8月, 2015 1 次提交
    • L
      network: verify proper address family in updates to <host> and <range> · 6a21bc11
      Laine Stump 提交于
      By specifying parentIndex in a call to virNetworkUpdate(), it was
      possible to direct libvirt to add a dhcp range or static host of a
      non-matching address family to the <dhcp> element of an <ip>. For
      example, given:
      
       <ip address='192.168.122.1' netmask='255.255.255.0'/>
       <ip family='ipv6' address='2001:db6:ca3:45::1' prefix='64'/>
      
      you could provide a static host entry with an IPv4 address, and
      specify that it be added to the 2nd <ip> element (index 1):
      
        virsh net-update default add ip-dhcp-host --parent-index 1 \
        '<host mac="52:54:00:00:00:01" ip="192.168.122.45"/>'
      
      This would be happily added with no error (and no concern of any
      possible future consequences).
      
      This patch checks that any dhcp range or host element being added to a
      network ip's <dhcp> subelement has addresses of the same family as the
      ip element they are being added to.
      
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1184736
      6a21bc11
  11. 24 7月, 2015 1 次提交
    • L
      conf: reorganize virNetworkDHCPDefParseXML · 03b6bdca
      Laine Stump 提交于
      This makes the range and static host array management in
      virNetworkDHCPDefParseXML() more similar to what is done in
      virNetworkDefUpdateIPDHCPRange() and virNetworkDefUpdateIPDHCPHost() -
      they use VIR_APPEND_ELEMENT rather than a combination of
      VIR_REALLOC_N() and separate incrementing of the array size.
      
      The one functional change here is that a memory leak of the contents
      of the last (unsuccessful) virNetworkDHCPHostDef was previously leaked
      in certain failure conditions, but it is now properly cleaned up.
      03b6bdca
  12. 14 7月, 2015 1 次提交
  13. 03 6月, 2015 2 次提交
    • L
      util: report all address range errors in virSocketAddrGetRange() · 55ace7c4
      Laine Stump 提交于
      There are now many more reasons that virSocketAddrGetRange() could
      fail, so it is much more informative to report the error there instead
      of in the caller. (one of the two callers was previously assuming
      success, which is almost surely safe based on the parsing that has
      already happened to the config by that time, but it still is nicer to
      account for an error "just in case")
      
      Part of fix for: https://bugzilla.redhat.com/show_bug.cgi?id=985653
      55ace7c4
    • L
      network: validate DHCP ranges are completely within defined network · 1e334a0a
      Laine Stump 提交于
      virSocketAddrGetRange() has been updated to take the network address
      and prefix, and now checks that both the start and end of the range
      are within that network, thus validating that the entire range of
      addresses is in the network. For IPv4, it also checks that ranges to
      not start with the "network address" of the subnet, nor end with the
      broadcast address of the subnet (this check doesn't apply to IPv6,
      since IPv6 doesn't have a broadcast or network address)
      
      Negative tests have been added to the network update and socket tests
      to verify that bad ranges properly generate an error.
      
      This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=985653
      1e334a0a
  14. 12 5月, 2015 1 次提交
  15. 28 4月, 2015 2 次提交
    • L
      network: check newDef for used bridge names in addition to def · 06313277
      Laine Stump 提交于
      If someone has updated a network to change its bridge name, but the
      network is still active (so that bridge name hasn't taken effect yet),
      we still want to disallow another network from taking that new name.
      06313277
    • L
      network: move auto-assign of bridge name from XML parser to net driver · a28d3e48
      Laine Stump 提交于
      We already check that any auto-assigned bridge device name for a
      virtual network (e.g. "virbr1") doesn't conflict with the bridge name
      for any existing libvirt network (via virNetworkSetBridgeName() in
      conf/network_conf.c).
      
      We also want to check that the name doesn't conflict with any bridge
      device created on the host system outside the control of libvirt
      (history: possibly due to the ploriferation of references to libvirt's
      bridge devices in HOWTO documents all around the web, it is not
      uncommon for an admin to manually create a bridge in their host's
      system network config and name it "virbrX"). To add such a check to
      virNetworkBridgeInUse() (which is called by virNetworkSetBridgeName())
      we would have to call virNetDevExists() (from util/virnetdev.c); this
      function calls ioctl(SIOCGIFFLAGS), which everyone on the mailing list
      agreed should not be done from an XML parsing function in the conf
      directory.
      
      To remedy that problem, this patch removes virNetworkSetBridgeName()
      from conf/network_conf.c and puts an identically functioning
      networkBridgeNameValidate() in network/bridge_driver.c (because it's
      reasonable for the bridge driver to call virNetDevExists(), although
      we don't do that yet because I wanted this patch to have as close to 0
      effect on function as possible).
      
      There are a couple of inevitable changes though:
      
      1) We no longer check the bridge name during
         virNetworkLoadConfig(). Close examination of the code shows that
         this wasn't necessary anyway - the only *correct* way to get XML
         into the config files is via networkDefine(), and networkDefine()
         will always call networkValidate(), which previously called
         virNetworkSetBridgeName() (and now calls
         networkBridgeNameValidate()). This means that the only way the
         bridge name can be unset during virNetworkLoadConfig() is if
         someone edited the config file on disk by hand (which we explicitly
         prohibit).
      
      2) Just on the off chance that somebody *has* edited the file by hand,
         rather than crashing when they try to start their malformed
         network, a check for non-NULL bridge name has been added to
         networkStartNetworkVirtual().
      
         (For those wondering why I don't instead call
         networkValidateBridgeName() there to set a bridge name if one
         wasn't present - the problem is that during
         networkStartNetworkVirtual(), the lock for the network being
         started has already been acquired, but the lock for the network
         list itself *has not* (because we aren't adding/removing a
         network). But virNetworkBridgeInuse() iterates through *all*
         networks (including this one) and locks each network as it is
         checked for a duplicate entry; it is necessary to lock each network
         even before checking if it is the designated "skip" network because
         otherwise some other thread might acquire the list lock and delete
         the very entry we're examining. In the end, permitting a setting of
         the bridge name during network start would require that we lock the
         entire network list during any networkStartNetwork(), which
         eliminates a *lot* of parallelism that we've worked so hard to
         achieve (it can make a huge difference during libvirtd startup). So
         rather than try to adjust for someone playing against the rules, I
         choose to instead give them the error they deserve.)
      
      3) virNetworkAllocateBridge() (now removed) would leak any "template"
         string set as the bridge name. Its replacement
         networkFindUnusedBridgeName() doesn't leak the template string - it
         is properly freed.
      a28d3e48
  16. 02 4月, 2015 1 次提交
    • J
      Remove unused macros · a0482396
      Ján Tomko 提交于
      In the order of appearance:
      
      * MAX_LISTEN - never used
        added by 23ad665c (qemud) and addec57 (lock daemon)
      
      * NEXT_FREE_CLASS_ID - never used, added by 07d1b6b5
      
      * virLockError - never used, added by eb8268a4
      
      * OPENVZ_MAX_ARG, CMDBUF_LEN, CMDOP_LEN
        unused since the removal of ADD_ARG_LIT in d8b31306
      
      * QEMU_NB_PER_CPU_STAT_PARAM - unused since 897808e7
      
      * QEMU_CMD_PROMPT, QEMU_PASSWD_PROMPT - unused since 1dc10a7b
      
      * TEST_MODEL_WORDSIZE - unused since c25c18f7
      
      * TEMPDIR - never used, added by 714bef5b
      
      * NSIG - workaround around old headers
        added by commit 60ed1d2a
        unused since virExec was moved by commit 02e86910
      
      * DO_TEST_PARSE - never used, added by 9afa0060
      
      * DIFF_MSEC, GETTIMEOFDAY - unused since eee6eb66
      a0482396
  17. 23 3月, 2015 1 次提交
    • M
      network_conf: Drop virNetworkObjIsDuplicate · d9706aea
      Michal Privoznik 提交于
      This function does not make any sense now, that network driver is
      (almost) dropped. I mean, previously, when threads were
      serialized, this function was there to check, if no other network
      with the same name or UUID exists. However, nowadays that threads
      can run more in parallel, this function is useless, in fact it
      gives misleading return values. Consider the following scenario.
      Two threads, both trying to define networks with same name but
      different UUID (e.g. because it was generated during XML parsing
      phase, whatever). Lets assume that both threads are about to call
      networkValidate() which immediately calls
      virNetworkObjIsDuplicate().
      
      T1: calls virNetworkObjIsDuplicate() and since no network with
      given name or UUID exist, success is returned.
      T2: calls virNetworkObjIsDuplicate() and since no network with
      given name or UUID exist, success is returned.
      
      T1: calls virNetworkAssignDef() and successfully places its
      network into the virNetworkObjList.
      T2: calls virNetworkAssignDef() and since network with the same
      name exists, the network definition is replaced.
      
      Okay, this is mainly because virNetworkAssignDef() does not check
      whether name and UUID matches. Well, lets make it so! And drop
      useless function too.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      d9706aea
  18. 11 3月, 2015 8 次提交
  19. 09 3月, 2015 6 次提交
  20. 04 3月, 2015 2 次提交