1. 20 2月, 2013 2 次提交
  2. 08 2月, 2013 1 次提交
  3. 23 1月, 2013 1 次提交
    • P
      conf: Fix usage of virBitmapParse · bf62e995
      Peter Krempa 提交于
      virNetworkObjUpdateParseFile used ',' as the termination character for
      virBitmapParse. This would break if an non-contiguous range would be
      parsed.
      bf62e995
  4. 17 1月, 2013 1 次提交
  5. 08 1月, 2013 1 次提交
    • E
      build: avoid compiler warning · 0a5eaf0d
      Eric Blake 提交于
      gcc 4.1.2 on RHEL 5 warned:
      conf/network_conf.c:3136: warning: 'foundIdx' may be used uninitialized in this function
      
      The warning is spurious, but initializing the variable doesn't hurt.
      
      * src/conf/network_conf.c (virNetworkDefUpdateDNSHost): Silence
      unused variable warning.
      0a5eaf0d
  6. 05 1月, 2013 1 次提交
    • E
      network: fix check for ambiguous lookup · f5b654e3
      Eric Blake 提交于
      gcc -O2 complained:
      ../../src/conf/network_conf.c: In function 'virNetworkDefUpdateDNSSrv':
      ../../src/conf/network_conf.c:3232: error: 'foundIdx' may be used uninitialized in this function [-Wuninitialized]
      
      It turned out to be a spurious warning (we didn't use foundIdx
      unless foundCt was non-zero).  But in investigating that, I noticed
      a worse problem: we were using 'if (foundCt > 1)', but since foundCt
      was bool, it could never be > 1.
      
      * src/conf/network_conf.c (virNetworkDefUpdateDNSHost): Use
      correct type.
      (virNetworkDefUpdateDNSSrv): Likewise, and silence compiler
      warning.
      f5b654e3
  7. 21 12月, 2012 6 次提交
  8. 12 12月, 2012 3 次提交
    • M
      network: Create real network status files · ae757743
      Michal Privoznik 提交于
      Currently, we are only keeping a inactive XML configuration
      in status dir. This is no longer enough as we need to keep
      this class_id attribute so we don't overwrite old entries
      when the daemon restarts. However, since there has already
      been release which has just <network/> as root element,
      and we want to keep things compatible, detect that loaded
      status file is older one, and don't scream about it.
      ae757743
    • M
      bandwidth: Create network bandwidth (un)plug functions · 07d1b6b5
      Michal Privoznik 提交于
      Network should be notified if we plug in or unplug an
      interface, so it can perform some action, e.g. set/unset
      network part of QoS. However, we are doing this in very
      early stage, so iface->ifname isn't filled in yet. So
      whenever we want to report an error, we must use a different
      identifier, e.g. the MAC address.
      07d1b6b5
    • M
      bandwidth: add new 'floor' attribute · ec6474b2
      Michal Privoznik 提交于
      This is however supported only on domain interfaces with
      type='network'. Moreover, target network needs to have at least
      inbound QoS set. This is required by hierarchical traffic shaping.
      
      From now on, the required attribute for <inbound/> is either 'average'
      (old) or 'floor' (new). This new attribute can be used just for
      interfaces type of network (<interface type='network'/>) currently.
      ec6474b2
  9. 11 12月, 2012 9 次提交
    • G
      network: add support for DHCPv6 · 2d5cd1d7
      Gene Czarcinski 提交于
      The DHCPv6 support includes IPV6 dhcp-range and dhcp-host for one
      IPv6 subnetwork on one interface.  This support will only work
      if dnsmasq version >= 2.64; otherwise an error occurs if
      dhcp-range or dhcp-host is specified for an IPv6 address.
      
      Essentially, this change provides the same DHCP support for IPv6
      that has been available for IPv4.
      
      With dnsmasq >= 2.64, support for the RA service is also now provided
      by dnsmasq (radvd is no longer used/started). (Although at least one
      version of dnsmasq prior to 2.64 "supported" IPv6 Router
      Advertisement, there were bugs (fixed in 2.64) that rendered it
      unusable.)
      
      Documentation and the network schema has been updated
      to reflect the new support.
      2d5cd1d7
    • L
      conf: split <forward> parser/clear into separate functions · 71e30eff
      Laine Stump 提交于
      virNetworkDefUpdateForward requires separate functions to parse and
      clear a virNetworkForwardDef by itself, but they were previously just
      inlined in the virNetworkDef parse and free functions. This patch
      makes them into separate functions.
      71e30eff
    • L
      conf: put data for network <forward> element into its own struct · 47c94b65
      Laine Stump 提交于
      The attributes of a <network> element's <forward> element were
      previously stored directly in the virNetworkDef object, but
      virNetworkUpdateForward() needs to operate on a <forward> in
      isolation, so this patchs pulls out all those attributes into a
      separate virNetworkForwardDef struct (and shortens their names
      appropriately). This new object is contained in the virNetworkDef, not
      pointed to by it, so there is no extra memory management.
      
      This patch makes no functional changes, it only changes, e.g.,
      "nForwardIfs" to "forward.nifs".
      47c94b65
    • L
      conf: make virNetworkIpDefClear consistent with other functions · 31d21197
      Laine Stump 提交于
      The other clear functions in network_conf.c that clear out arrays of
      sub-objects do so by using the n[itemname]s value as a counter going
      down to 0. Make this one consistent. There's no functional value, just
      makes the style more consistent with the rest of the file.
      31d21197
    • L
      conf: rename some labels and functions in network_conf · dc9d8d68
      Laine Stump 提交于
      This makes some function names and arg lists for consistent with other
      parse functions in network_conf.c. While modifying
      virNetworkIPParseXML(), also change its "error" label to "cleanup",
      since the code at that label is executed on success as well as
      failure.
      dc9d8d68
    • L
      network: backend functions for updating network dns host/srv/txt · fc19a005
      Laine Stump 提交于
      These three functions are very similar - none allow a MODIFY
      operation; you can only add or delete.
      
      The biggest difference between them (other than the data itself) is in
      the criteria for determining a match, and whether or not multiple
      matches are possible:
      
      1) for HOST records, it's considered a match if the IP address or any
      of the hostnames of an existing record matches.
      
      2) for SRV records, it's a match if all of
      domain+service+protocol+target *which have been specified* are
      matched.
      
      3) for TXT records, there is only a single field to match - name
      (value can be the same for multiple records, and isn't considered a
      search term), so by definition there can be no ambiguous matches.
      
      In all three cases, if any matches are found, ADD will fail; if
      multiple matches are found, it means the search term was ambiguous,
      and a DELETE will fail.
      
      The upper level code in bridge_driver.c is already implemented for
      these functions - appropriate conf files will be re-written, and
      dnsmasq will be SIGHUPed or restarted as appropriate.
      fc19a005
    • L
      conf: clear and parse functions for dns host/srv/txt records · ab297bec
      Laine Stump 提交于
      Since there is only a single virNetworkDNSDef for any virNetworkDef,
      and it's trivial to determine whether or not it contains any real
      data, it's much simpler (and fits more uniformly with the parse
      function calling sequence of the parsers for many other objects that
      are subordinates of virNetworkDef) if virNetworkDef *contains* an
      virNetworkDNSDef rather than pointing to one.
      
      Since it is now just a part of another object rather than its own
      object, it no longer makes sense to have a *Free() function, so that
      is changed to a *Clear() function.
      
      More importantly though, ParseXML and Clear functions are needed for
      the individual items contained in a virNetworkDNSDef (srv, txt, and
      host records), but none of them have a *Clear(), and only two of the
      three had *ParseXML() functions (both of which used a non-uniform
      arglist). Those problems are cleared up by this patch - it splits the
      higher-level Clear function into separate functions for each of the
      three, creates a parse for txt records, and cleans up the srv and host
      parsers, so we now have all the utility functions necessary to
      implement virNetworkDefUpdateDNS(Host|Srv|Txt).
      ab297bec
    • L
      conf: rename network dns host/srv/txt arrays · 8b7d1874
      Laine Stump 提交于
      This shortens the name of the structs for srv and txt, and their
      instances in virNetworkDNSDef, to be more compact and uniform with the
      naming of the dns host array. It also changes the type of ntxts, etc
      from unsigned int to size_t, so that they can be used directly as args
      to VIR_*_ELEMENT.
      8b7d1874
    • L
      conf: use VIR_(INSERT|DELETE)_ELEMENT in virNetworkUpdate backend · 2dc5839a
      Laine Stump 提交于
      The already-written backend functions for virNetworkUpdate that add
      and delete items into lists within the a network were already debugged
      to work properly, but future such functions will use
      VIR_(INSERT|DELETE)_ELEMENT instead, so these are changed for
      uniformity.
      2dc5839a
  10. 06 12月, 2012 2 次提交
    • L
      network: prevent a few invalid configuration combinations · fd54f1de
      Laine Stump 提交于
      This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=767057
      
      It was possible to define a network with <forward mode='bridge'> that
      had both a bridge device and a forward device defined. These two are
      mutually exclusive by definition (if you are using a bridge device,
      then this is a host bridge, and if you have a forward dev defined,
      this is using macvtap). It was also possible to put <ip>, <dns>, and
      <domain> elements in this definition, although those aren't supported
      by the current driver (although it's conceivable that some other
      driver might support that).
      
      The items that are invalid by definition, are now checked in the XML
      parser (since they will definitely *always* be wrong), and the others
      are checked in networkValidate() in the network driver (since, as
      mentioned, it's possible that some other network driver, or even this
      one, could some day support setting those).
      fd54f1de
    • G
      network: allow guest to guest IPv6 without gateway definition · 705e67d4
      Gene Czarcinski 提交于
      This patch adds the capability for virtual guests to do IPv6
      communication via a virtual network interface with no IPv6 (gateway)
      addresses specified.  This capability has always been enabled by
      default for IPv4, but disabled for IPv6 for security concerns, and
      because it requires the ip6tables command to be operational (which
      isn't the case on a system with the ipv6 module completely disabled).
      
      This patch adds a new attribute "ipv6" at the toplevel of a <network>
      object.  If ipv6='yes', the extra ip6tables rules required to permite
      inter-guest communications are added when the network is started. If
      it is 'no', or not present, those rules will not be added; thus the
      default behavior doesn't change, so there should be no compatibility
      issues with any existing installations.
      
      Note that virtual guests cannot communication with the virtualization
      host via this interface, because the following kernel tunable has
      been set:
      
         net.ipv6.conf.<bridge_interface_name>.disable_ipv6 = 1
      
      This assures that the bridge interface will not have an IPv6
      link-local (fe80::) address.
      
      To control this behavior so that it is not enabled by default, the parameter
      ipv6='yes' on the <network> statement has been added.
      
      Documentation related to this patch has been updated.
      The network schema has also been updated.
      705e67d4
  11. 29 11月, 2012 1 次提交
    • L
      network: fix crash when portgroup has no name · 012d69df
      Laine Stump 提交于
      This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=879473
      
      The name attribute is required for portgroup elements (yes, the RNG
      specifies that), and there is code in libvirt that assumes it is
      non-null.  Unfortunately, the portgroup parsing function wasn't
      checking for lack of portgroup. One adverse result of this was that
      attempts to update a network by adding a portgroup with no name would
      cause libvirtd to segfault. For example:
      
         virsh net-update default add portgroup "<portgroup default='yes'/>"
      
      This patch causes virNetworkPortGroupParseXML to fail if no name is
      specified, thus avoiding any later problems.
      012d69df
  12. 02 11月, 2012 4 次提交
  13. 29 10月, 2012 1 次提交
    • J
      xml: print uuids in the warning · 0b121614
      Ján Tomko 提交于
      In the XML warning, we print a virsh command line that can be used to
      edit that XML. This patch prints UUIDs if the entity name contains
      special characters (like shell metacharacters, or "--" that would break
      parsing of the XML comment). If the entity doesn't have a UUID, just
      print the virsh command that can be used to edit it.
      0b121614
  14. 21 10月, 2012 1 次提交
    • L
      network: don't allow multiple default portgroups · 6f8a8b30
      Laine Stump 提交于
      This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=868483
      
      virNetworkUpdate, virNetworkDefine, and virNetworkCreate all three
      allow network definitions to contain multiple <portgroup> elements
      with default='yes'. Only a single default portgroup should be allowed
      for each network.
      
      This patch updates networkValidate() (called by both
      virNetworkCreate() and virNetworkDefine()) and
      virNetworkDefUpdatePortGroup (called by virNetworkUpdate() to not
      allow multiple default portgroups.
      6f8a8b30
  15. 20 10月, 2012 1 次提交
    • L
      network: free/null newDef if network fails to start · 78fab277
      Laine Stump 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=866364
      
      pointed out a crash due to virNetworkObjAssignDef free'ing
      network->newDef without NULLing it afterward. A fix for this is in
      upstream commit b7e92024. While the
      NULLing of newDef was a legitimate fix, newDef should have already
      been empty (NULL) anyway (as indicated in the comment that was deleted
      by that commit).
      
      The reason that newDef had a non-NULL value (i.e. the root cause) was
      that networkStartNetwork() had failed after populating
      network->newDef, but then neglected to free/NULL newDef in the
      cleanup.
      
      (A bit of background here: network->newDef should contain the
      persistent config of a network when a network is active (and of course
      only when it is persisten), and NULL at all other times. There is also
      a network->def which should contain the persistent definition of the
      network when it is inactive, and the current live state at all other
      times. The idea is that you can make changes to network->newDef which
      will take effect the next time the network is restarted, but won't
      mess with the current state of the network (virDomainObj has a similar
      pair of virDomainDefs that behave in the same fashion). Personally I
      think there should be a network->live and network->config, and the
      location of the persistent config should *always* be in
      network->config, but that's for a later cleanup).
      
      Since I love things to be symmetric, I created a new function called
      virNetworkObjUnsetDefTransient(), which reverses the effects of
      virNetworkObjSetDefTransient(). I don't really like the name of the
      new function, but then I also didn't really like the name of the old
      one either (it's just named that way to match a similar function in
      the domain conf code).
      78fab277
  16. 18 10月, 2012 1 次提交
    • M
      network: Set to NULL after virNetworkDefFree() · b7e92024
      Michal Privoznik 提交于
      which frees all allocated memory but doesn't set the passed pointer to
      NULL.  Therefore, we must do it ourselves. This is causing actual
      libvirtd crash: Basically, when doing 'virsh net-edit' the newDef should
      be dropped.  And the memory is freed, indeed. However, the pointer is
      not set to NULL but kept instead. And the next duo of calls 'virsh
      net-start' and 'virsh net-destroy' starts the disaster. The latter one
      does the same as 'virsh destroy'; it sees that newDef is nonNULL so it
      replaces def with newDef (which has been freed already as said a few
      lines above). Therefore any subsequent call accessing def will hit the ground.
      b7e92024
  17. 27 9月, 2012 1 次提交
    • L
      network: backend for virNetworkUpdate of interface list · 024879e5
      Laine Stump 提交于
      <interface> elements are location inside the <forward> element of a
      network. There is only one <forward> element in any network, but it
      might have many <interface> elements. This element only contains a
      single attribute, "dev", which is the name of a network device
      (e.g. "eth0").
      
      Since there is only a single attribute, the modify operation isn't
      supported for this "section", only add-first, add-last, and
      delete. Also, note that it's not permitted to delete an interface from
      the list while any guest is using it. We may later decide this is safe
      (because removing it from the list really only excludes it from
      consideration in future guest allocations of interfaces, but doesn't
      affect any guests currently connected), but for now this limitation
      seems prudent (of course when changing the persistent config, this
      limitation doesn't apply, because the persistent config doesn't
      support the concept of "in used").
      
      Another limitation - it is also possible for the interfraces in this
      list to be described by PCI address rather than netdev name. However,
      I noticed while writing this function that we currently don't support
      defining interfaces that way in config - the only method of getting
      interfaces specified as <adress type='pci' ..../> instead of
      <interface dev='xx'/> is to provide a <pf dev='yy'/> element under
      forward, and let the entries in the interface list be automatically
      populated with the virtual functions (VF) of the physical function
      device given in <pg>.
      
      As with the other virNetworkUpdate section backends, support for this
      section is completely contained within a single static function, no
      other changes were required, and only functions already called from
      elsewhere within the same file are used in the new content for this
      existing function (i.e., adding this code should not cause a new build
      problem on any platform).
      024879e5
  18. 22 9月, 2012 2 次提交
    • L
      network: log error for unknown virNetworkUpdate command codes · 5cdcb75d
      Laine Stump 提交于
      Every level of the code for virNetworkUpdate was assuming that some
      other level was checking for validity of the "command" arg, but none
      actually were. The result was that an invalid command code would do
      nothing, but also report success.
      
      Since the command code isn't used until the very lowest level backend
      functions, that's where I put the check. I made a separate one-line
      function to log the error. The compiler would have combined the
      identical strings used by multiple calls if I'd just called
      virReportError directly in each location, but sending them all to the
      same string in the source guards against inadvertant divergence (which
      would lead to extra work for translators.)
      5cdcb75d
    • L
      network: make virNetworkObjUpdate error detection/recovery better · f59e25e0
      Laine Stump 提交于
      1) virNetworkObjUpdate should be an all or none operation, but in the
      case that we want to update both the live state and persistent config
      versions of the network, it was committing the update to the live
      state before starting to update the persistent config. If update of
      the persistent config failed, we would leave with things in an
      inconsistent state - the live state would be updated (even though an
      error was returned), but persistent config unchanged.
      
      This patch changed virNetworkObjUpdate to use a separate pointer for
      each copy of the virNetworkDef, and not commit either of them in the
      virNetworkObj until both live and config parts of the update have
      successfully completed.
      
      2) The parsers for various pieces of the virNetworkDef have all sorts
      of subtle limitations on them that may not be known by the
      Update[section] function, making it possible for one of these
      functions to make a modification directly to the object that may not
      pass the scrutiny of a subsequent parse. But normally another parse
      wouldn't be done on the data until the *next* time the object was
      updated (which could leave the network definition in an unusable
      state).
      
      Rather than fighting the losing battle of trying to duplicate all the
      checks from the parsers into the update functions as well, the more
      foolproof solution to this is to simply do an extra
      virNetworkDefCopy() operation on the updated networkdef -
      virNetworkDefCopy() does a virNetworkFormat() followed by a
      virNetworkParseString(), so it will do all the checks we need. If this
      fails, then we don't commit the changed def.
      f59e25e0
  19. 21 9月, 2012 1 次提交
    • L
      network: backend for virNetworkUpdate of portgroups · 8b6f831c
      Laine Stump 提交于
      portgroup elements are located in the toplevel of <network>
      objects. There can be multiple <portgroup> elements, and they each
      have a unique name attribute.
      
      Add, delete, and modify are all supported for portgroup. When deleting
      a portgroup, only the name must be specified in the provided xml - all
      other attributes and subelements are ignored for the purposes of
      matching and existing portgroup.
      
      The bridge driver and virsh already know about the portgroup element,
      so providing this backend should cause the entire stack to work. Note
      that in the case of portgroup, there is no external daemon based on
      the portgroup config, so nothing must be restarted.
      
      It is important to note that guests make a copy of the appropriate
      network's portgroup data when they are started, so although an updated
      portgroup's configuration will have an affect on new guests started
      after the cahange, existing guests won't magically have their
      bandwidth changed, for example. If something like that is desired, it
      will take a lot of redesign work in the way network devices are setup
      (there is currently no link from the network back to the individual
      interfaces using it, much less from a portgroup within a network back
      to the individual interfaces).
      8b6f831c