1. 03 7月, 2013 1 次提交
  2. 06 6月, 2013 1 次提交
  3. 21 5月, 2013 1 次提交
  4. 14 5月, 2013 1 次提交
    • G
      Support for static routes on a virtual bridge · ccff335f
      Gene Czarcinski 提交于
      network: static route support for <network>
      
      This patch adds the <route> subelement of <network> to define a static
      route.  the address and prefix (or netmask) attribute identify the
      destination network, and the gateway attribute specifies the next hop
      address (which must be directly reachable from the containing
      <network>) which is to receive the packets destined for
      "address/(prefix|netmask)".
      
      These attributes are translated into an "ip route add" command that is
      executed when the network is started. The command used is of the
      following form:
      
        ip route add <address>/<prefix> via <gateway> \
                     dev <virbr-bridge> proto static metric <metric>
      
      Tests are done to validate that the input data are correct.  For
      example, for a static route ip definition, the address must be a
      network address and not a host address.  Additional checks are added
      to ensure that the specified gateway is directly reachable via this
      network (i.e. that the gateway IP address is in the same subnet as one
      of the IP's defined for the network).
      
      prefix='0' is supported for both family='ipv4' address='0.0.0.0'
      netmask='0.0.0.0' or prefix='0', and for family='ipv6' address='::',
      prefix=0', although care should be taken to not override a desired
      system default route.
      
      Anytime an attempt is made to define a static route which *exactly*
      duplicates an existing static route (for example, address=::,
      prefix=0, metric=1), the following error message will be sent to
      syslog:
      
          RTNETLINK answers: File exists
      
      This can be overridden by decreasing the metric value for the route
      that should be preferred, or increasing the metric for the route that
      shouldn't be preferred (and is thus in place only in anticipation that
      the preferred route may be removed in the future).  Caution should be
      used when manipulating route metrics, especially for a default route.
      
      Note: The use of the command-line interface should be replaced by
      direct use of libnl so that error conditions can be handled better.  But,
      that is being left as an exercise for another day.
      Signed-off-by: NGene Czarcinski <gene@czarc.net>
      Signed-off-by: NLaine Stump <laine@laine.org>
      ccff335f
  5. 07 5月, 2013 1 次提交
  6. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  7. 27 4月, 2013 1 次提交
    • L
      network: support <driver name='vfio'/> in network definitions · d64e114f
      Laine Stump 提交于
      I remembered to document this bit, but somehow forgot to implement it.
      
      This adds <driver name='kvm|vfio'/> as a subelement to the <forward>
      element of a network (this puts it parallel to the match between
      mode='hostdev' attribute in a network and type='hostdev' in an
      <interface>).
      
      Since it's already documented, only the parser, formatter, backend
      driver recognition (it just translates/moves the flag into the
      <interface> at the appropriate time), and a test case were needed.
      
      (I used a separate enum for the values both because the original is
      defined in domain_conf.h, which is unavailable from network_conf.h,
      and because in the future it's possible that we may want to support
      other non-hostdev oriented driver names in the network parser; this
      makes sure that one can be expanded without the other).
      d64e114f
  8. 23 4月, 2013 2 次提交
    • G
      update input ip processing · 1e5306c7
      Gene Czarcinski 提交于
      1. Handle invalid ULong prefix specified.
      When parsing for @prefix as a ULong, a -2 can be returned
      if the specification is not a valid ULong.
      
      2.  Error out if address= is not specified.
      
      3.  Merge netmask process/tests under family tests.
      
      4. Max sure that prefix does not exceed maximum.
      .
      Signed-off-by: NGene Czarcinski <gene@czarc.net>
      1e5306c7
    • G
      create virSocketAddrGetIpPrefix utility function · bd7c7c1b
      Gene Czarcinski 提交于
      Create the utility function virSocketAddrGetIpPrefix() to
      determine the prefix for this network.  The code in this
      function was adapted from virNetworkIpDefPrefix().
      
      Update virNetworkIpDefPrefix() in src/conf/network_conf.c
      to use the new utility function.
      Signed-off-by: NGene Czarcinski <gene@czarc.net>
      bd7c7c1b
  9. 19 4月, 2013 1 次提交
    • P
      network: bridge_driver: don't lose transient networks on daemon restart · 446dd66b
      Peter Krempa 提交于
      Until now tranisent networks weren't really useful as libvirtd wasn't
      able to remember them across restarts. This patch adds support for
      loading status files of transient networks (that already were generated)
      so that the status isn't lost.
      
      This patch chops up virNetworkObjUpdateParseFile and turns it into
      virNetworkLoadState and a few friends that will help us to load status
      XMLs and refactors the functions that are loading the configs to use
      them.
      446dd66b
  10. 13 4月, 2013 1 次提交
  11. 11 4月, 2013 1 次提交
    • G
      conf: fix a memory leak when parsing nat port XML nodes · 2fff3801
      Guannan Ren 提交于
       ==5306== 8 bytes in 1 blocks are definitely lost in loss record 24 of 277
       ==5306==    at 0x4C28B2F: calloc (vg_replace_malloc.c:593)
       ==5306==    by 0x5293CAF: virAllocN (viralloc.c:152)
       ==5306==    by 0x52DFEAE: virXPathNodeSet (virxml.c:611)
       ==5306==    by 0x5313DD9: virNetworkDefParseXML (network_conf.c:1408)
       ==5306==    by 0x53170F6: virNetworkObjUpdateParseFile (network_conf.c:2031)
       ==5306==    by 0x131DA63C: networkStartup (bridge_driver.c:279)
       ==5306==    by 0x53481DF: virStateInitialize (libvirt.c:822)
       ==5306==    by 0x40DF44: daemonRunStateInit (libvirtd.c:877)
       ==5306==    by 0x52D2FF5: virThreadHelper (virthreadpthread.c:161)
       ==5306==    by 0x5D00C52: start_thread (in /usr/lib64/libpthread-2.17.so)
       ==5306==    by 0x6410ECC: clone (in /usr/lib64/libc-2.17.so)
      2fff3801
  12. 28 3月, 2013 1 次提交
    • G
      conf: fix memory leak of class_id bitmap · 7a0f5021
      Guannan Ren 提交于
      When libvirtd loads active network configs from network state directory,
      it should release the class_id memory block which was allocated
      at the time of loading xml from network config directory.
      virBitmapParse will create a new memory block of bitmap class_id which
      causes a memory leak.
      
      This happens when at least one virtual network is active before.
      
      ==12234== 8,216 (24 direct, 8,192 indirect) bytes in 1 blocks are definitely \
                    lost in loss record 702 of 709
      ==12234==    at 0x4A06B2F: calloc (vg_replace_malloc.c:593)
      ==12234==    by 0x37AB04D77D: virAlloc (in /usr/lib64/libvirt.so.0.1000.3)
      ==12234==    by 0x37AB04EF89: virBitmapNew (in /usr/lib64/libvirt.so.0.1000.3)
      ==12234==    by 0x37AB0BFB37: virNetworkAssignDef (in /usr/lib64/libvirt.so.0.1000.3)
      ==12234==    by 0x37AB0BFD31: ??? (in /usr/lib64/libvirt.so.0.1000.3)
      ==12234==    by 0x37AB0BFE92: virNetworkLoadAllConfigs (in /usr/lib64/libvirt.so.0.1000.3)
      ==12234==    by 0x10650E5A: ??? (in /usr/lib64/libvirt/connection-driver/libvirt_driver_network.so)
      ==12234==    by 0x37AB0EB72F: virStateInitialize (in /usr/lib64/libvirt.so.0.1000.3)
      ==12234==    by 0x40DE04: ??? (in /usr/sbin/libvirtd)
      ==12234==    by 0x37AB0832E8: ??? (in /usr/lib64/libvirt.so.0.1000.3)
      ==12234==    by 0x3796807D14: start_thread (in /usr/lib64/libpthread-2.16.so)
      ==12234==    by 0x37960F246C: clone (in /usr/lib64/libc-2.16.so)
      7a0f5021
  13. 27 2月, 2013 1 次提交
  14. 25 2月, 2013 1 次提交
    • G
      use client id for IPv6 DHCP host definition · 0b73a763
      Gene Czarcinski 提交于
      Originally, only a host name was used to associate a
      DHCPv6 request with a specific IPv6 address.  Further testing
      demonstrates that this is an unreliable method and, instead,
      a client-id or DUID needs to be used.  According to DHCPv6
      standards, this id can be a duid-LLT, duid-LL, or duid-UUID
      even though dnsmasq will accept almost any text string.
      
      Although validity checking of a specified string makes sure it is
      hexadecimal notation with bytes separated by colons, there is no
      rigorous check to make sure it meets the standard.
      
      Documentation and schemas have been updated.
      Signed-off-by: NGene Czarcinski <gene@czarc.net>
      Signed-off-by: NLaine Stump <laine@laine.org>
      0b73a763
  15. 23 2月, 2013 1 次提交
  16. 20 2月, 2013 3 次提交
  17. 08 2月, 2013 1 次提交
  18. 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
  19. 17 1月, 2013 1 次提交
  20. 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
  21. 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
  22. 21 12月, 2012 6 次提交
  23. 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
  24. 11 12月, 2012 7 次提交
    • 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