1. 25 6月, 2011 2 次提交
  2. 18 2月, 2011 1 次提交
    • L
      Give each virtual network bridge its own fixed MAC address · 5754dbd5
      Laine Stump 提交于
      This fixes https://bugzilla.redhat.com/show_bug.cgi?id=609463
      
      The problem was that, since a bridge always acquires the MAC address
      of the connected interface with the numerically lowest MAC, as guests
      are started and stopped, it was possible for the MAC address to change
      over time, and this change in the network was being detected by
      Windows 7 (it sees the MAC of the default route change), so on each
      reboot it would bring up a dialog box asking about this "new network".
      
      The solution is to create a dummy tap interface with a MAC guaranteed
      to be lower than any guest interface's MAC, and attach that tap to the
      bridge as soon as it's created. Since all guest MAC addresses start
      with 0xFE, we can just generate a MAC with the standard "0x52, 0x54,
      0" prefix, and it's guaranteed to always win (physical interfaces are
      never connected to these bridges, so we don't need to worry about
      competing numerically with them).
      
      Note that the dummy tap is never set to IFF_UP state - that's not
      necessary in order for the bridge to take its MAC, and not setting it
      to UP eliminates the clutter of having an (eg) "virbr0-nic" displayed
      in the output of the ifconfig command.
      
      I chose to not auto-generate the MAC address in the network XML
      parser, as there are likely to be consumers of that API that don't
      need or want to have a MAC address associated with the
      bridge.
      
      Instead, in bridge_driver.c when the network is being defined, if
      there is no MAC, one is generated. To account for virtual network
      configs that already exist when upgrading from an older version of
      libvirt, I've added a %post script to the specfile that searches for
      all network definitions in both the config directory
      (/etc/libvirt/qemu/networks) and the state directory
      (/var/lib/libvirt/network) that are missing a mac address, generates a
      random address, and adds it to the config (and a matching address to
      the state file, if there is one).
      
      docs/formatnetwork.html.in: document <mac address.../>
      docs/schemas/network.rng: add nac address to schema
      libvirt.spec.in: %post script to update existing networks
      src/conf/network_conf.[ch]: parse and format <mac address.../>
      src/libvirt_private.syms: export a couple private symbols we need
      src/network/bridge_driver.c:
          auto-generate mac address when needed,
          create dummy interface if mac address is present.
      tests/networkxml2xmlin/isolated-network.xml
      tests/networkxml2xmlin/routed-network.xml
      tests/networkxml2xmlout/isolated-network.xml
      tests/networkxml2xmlout/routed-network.xml: add mac address to some tests
      5754dbd5
  3. 24 12月, 2010 3 次提交
    • L
      Run radvd for virtual networks with IPv6 addresses · 8090a568
      Laine Stump 提交于
      Running an instance of the router advertisement daemon (radvd) allows
      guests using the virtual network to automatically acquire an IPv6
      address and default route. Note that acquiring an address only works
      for networks with a prefix length of exactly 64 - radvd is still run
      in other circumstances, and still advertises routes, but autoconf will
      not work because it requires exactly 64 bits of address info from the
      network prefix.
      
      This patch avoids a race condition with the pidfile by manually
      daemonizing radvd rather than allowing it to daemonize itself, then
      creating our own pidfile (in addition to radvd's own file, which is
      unnecessary, but there is no way to tell radvd to not create it). This
      is accomplished by exec'ing it with "--debug 1" in the commandline,
      and using virCommand's features to fork, create a pidfile, and detach
      from the newly forked process.
      8090a568
    • L
      Change virtual network XML parsing/formatting to support IPv6 · a950dd2a
      Laine Stump 提交于
      This commit adds support for IPv6 parsing and formatting to the
      virtual network XML parser, including moving around data definitions
      to allow for multiple <ip> elements on a single network, but only
      changes the consumers of this API to accommodate for the changes in
      API/structure, not to add any actual IPv6 functionality. That will
      come in a later patch - this patch attempts to maintain the same final
      functionality in both drivers that use the network XML parser - vbox
      and "bridge" (the Linux bridge-based driver used by the qemu
      hypervisor driver).
      
      * src/libvirt_private.syms: Add new private API functions.
      * src/conf/network_conf.[ch]: Change C data structure and
        parsing/formatting.
      * src/network/bridge_driver.c: Update to use new parser/formatter.
      * src/vbox/vbox_tmpl.c: update to use new parser/formatter
      * docs/schemas/network.rng: changes to the schema -
        * there can now be more than one <ip> element.
        * ip address is now an ip-addr (ipv4 or ipv6) rather than ipv4-addr
        * new optional "prefix" attribute that can be used in place of "netmask"
        * new optional "family" attribute - "ipv4" or "ipv6"
          (will default to ipv4)
        * define data types for the above
      * tests/networkxml2xml(in|out)/nat-network.xml: add multiple <ip> elements
        (including IPv6) to a single network definition to verify they are being
        correctly parsed and formatted.
      a950dd2a
    • L
      New virNetworkDef utility functions · 8322863f
      Laine Stump 提交于
      Later patches will add the possibility to define a network's netmask
      as a prefix (0-32, or 0-128 in the case of IPv6). To make it easier to
      deal with definition of both kinds (prefix or netmask), add two new
      functions:
      
      virNetworkDefNetmask: return a copy of the netmask into a
      virSocketAddr. If no netmask was specified in the XML, create a
      default netmask based on the network class of the virNetworkDef's IP
      address.
      
      virNetworkDefPrefix: return the netmask as numeric prefix (or the
      default prefix for the network class of the virNetworkDef's IP
      address, if no netmask was specified in the XML)
      8322863f
  4. 26 10月, 2010 1 次提交
    • D
      Fix formatting of network address in iptables helpers · eff1735e
      Daniel P. Berrange 提交于
      The network address was being set to 192.168.122.0 instead
      of 192.168.122.0/24. Fix this by removing the unneccessary
      'network' field from virNetworkDef and just pass the
      network address and netmask into the iptables APIs directly.
      
      * src/conf/network_conf.h, src/conf/network_conf.c: Remove
        the 'network' field from virNEtworkDef.
      * src/network/bridge_driver.c: Update for iptables API changes
      * src/util/iptables.c, src/util/iptables.h: Require the
        network address + netmask pair to be passed in
      eff1735e
  5. 22 10月, 2010 1 次提交
    • D
      Convert virNetwork to use virSocketAddr everywhere · 090404ac
      Daniel P. Berrange 提交于
      Instead of storing the IP address string in virNetwork related
      structs, store the parsed virSocketAddr. This will make it
      easier to add IPv6 support in the future, by letting driver
      code directly check what address family is present
      
      * src/conf/network_conf.c, src/conf/network_conf.h,
        src/network/bridge_driver.c: Convert to use virSocketAddr
        in virNetwork, instead of char *.
      * src/util/bridge.c, src/util/bridge.h,
        src/util/dnsmasq.c, src/util/dnsmasq.h,
        src/util/iptables.c, src/util/iptables.h: Convert to
        take a virSocketAddr instead of char * for any IP
        address parameters
      * src/util/network.h: Add macros to determine if an address
        is set, and what address family is set.
      090404ac
  6. 08 6月, 2010 1 次提交
    • D
      Network duplicate UUID/name checking · 3bb37439
      Daniel P. Berrange 提交于
      The network driver is not doing correct checking for
      duplicate UUID/name values. This introduces a new method
      virNetworkObjIsDuplicate, based on the previously
      written virDomainObjIsDuplicate.
      
      * src/conf/network_conf.c, src/conf/network_conf.c,
        src/libvirt_private.syms: Add virNetworkObjIsDuplicate,
      * src/network/bridge_driver.c: Call virNetworkObjIsDuplicate
        for checking uniqueness of uuid/names
      3bb37439
  7. 10 3月, 2010 1 次提交
  8. 10 2月, 2010 1 次提交
    • D
      Remove virConnectPtr from network XML APis · 0677e111
      Daniel P. Berrange 提交于
      The virConnectPtr is no longer required for error reporting since
      that is recorded in a thread local. Remove use of virConnectPtr
      from all APIs in network_conf.{h,c} and update all callers to
      match
      0677e111
  9. 21 1月, 2010 1 次提交
    • D
      Make all bitfields unsigned ints to avoid unexpected values in casts · 50b6c95d
      Daniel P. Berrange 提交于
      The 'int virInterfaceIsActive()' method was directly returning the
      value of the 'int active:1' bitfield in virIntefaceDefPtr. A bitfield
      with a signed integer, will hold the values 0 and -1, not 0 and +1
      as might be expected. This meant that virInterfaceIsActive() was
      always returning -1 when the interface was active, not +1 & thus all
      callers thought an error had occurred. To protect against this kind
      of mistake again, change all bitfields to be unsigned ints
      
      * daemon/libvirtd.h, src/conf/domain_conf.h, src/conf/interface_conf.h,
        src/conf/network_conf.h: Change bitfields to unsigned int.
      50b6c95d
  10. 07 11月, 2009 1 次提交
  11. 03 11月, 2009 1 次提交
    • D
      Rename internal APis · fc8d1991
      Daniel P. Berrange 提交于
      Rename virDomainIsActive to virDomainObjIsActive, and
      virInterfaceIsActive to virInterfaceObjIsActive and finally
      virNetworkIsActive to virNetworkObjIsActive.
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h,
        src/conf/interface_conf.h, src/conf/network_conf.c,
        src/conf/network_conf.h, src/lxc/lxc_driver.c,
        src/network/bridge_driver.c, src/opennebula/one_driver.c,
        src/openvz/openvz_driver.c, src/qemu/qemu_driver.c,
        src/test/test_driver.c, src/uml/uml_driver.c: Update for
        renamed APIs.
      fc8d1991
  12. 28 10月, 2009 1 次提交
    • P
      Add support for an external TFTP boot server · 936565c7
      Paolo Bonzini 提交于
      This patch adds an optional attribute to the <bootp> tag, that
      allows to specify a TFTP server address other than the address of
      the DHCP server itself.
      
      This can be used to forward the BOOTP settings of the host down to the
      guest.  This is something that configurations such as Xen's default
      network achieve naturally, but must be done manually for NAT.
      
      * docs/formatnetwork.html.in: Document new attribute.
      * docs/schemas/network.rng: Add it to schema.
      * src/conf/network_conf.h: Add it to struct.
      * src/conf/network_conf.c: Add it to parser and pretty printer.
      * src/network/bridge_driver.c: Put it in the dnsmasq command line.
      * tests/networkxml2xmlin/netboot-proxy-network.xml
        tests/networkxml2xmlout/netboot-proxy-network.xml
        tests/networkxml2xmltest.c: add new tests
      936565c7
  13. 23 9月, 2009 1 次提交
    • P
      network: add 'bootp' and 'tftp' config · 738ee810
      Paolo Bonzini 提交于
      Currently, libvirtd will start a dnsmasq process for the virtual
      network, but (aside from killing the dnsmasq process and replacing it),
      there's no way to define tftp boot options.
      
      This change introduces the appropriate tags to the dhcp configuration:
      
       <network>
         <name>default</name>
         <bridge name="virbr%d" />
         <forward/>
         <ip address="192.168.122.1" netmask="255.255.255.0">
           <tftp root="/var/lib/tftproot" />
           <dhcp>
             <range start="192.168.122.2" end="192.168.122.254" />
             <bootp file="pxeboot.img"/>
           </dhcp>
         </ip>
       </network>
      
      When the attributes are present, these are passed to the
      arguments to dnsmasq:
      
       dnsmasq [...] --enable-tftp --tftp-root /srv/tftp --dhcp-boot pxeboot.img
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
                            from <tftp />                     from <bootp />
      
      At present, only local tftp servers are supported (ie, dnsmasq runs as
      the tftp server), but we could improve this in future by adding a
      server= attribute.
      Signed-off-by: NJeremy Kerr <jk@ozlabs.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      
      2009-09-21  Paolo Bonzini  <pbonzini@redhat.com>
                  Jeremy Kerr  <jk@ozlabs.org>
      
      	* docs/formatnetwork.html.in: Document new tags.
      	* docs/formatnetwork.html: Regenerate.
      	* docs/schemas/network.rng: Update.
      	* src/network_conf.c (virNetworkDefFree): Free new fields.
      	(virNetworkDHCPRangeDefParseXML): Parse <bootp>.
      	(virNetworkIPParseXML): New, parsing <dhcp> and <tftp>.
      	(virNetworkDefParseXML): Use virNetworkIPParseXML instead of
      	virNetworkDHCPRangeDefParseXML.
      	(virNetworkDefFormat): Pretty print new fields.
      	* src/network_conf.h (struct _virNetworkDef): Add netboot fields.
      	* src/network_driver.c (networkBuildDnsmasqArgv): Add
      	TFTP and BOOTP arguments.
      
      	* tests/Makefile.am (EXTRA_DIST): Add networkschemadata.
      	* tests/networkschematest: Look in networkschemadata.
      	* tests/networkschemadata/netboot-network.xml: New.
      738ee810
  14. 21 9月, 2009 1 次提交
    • D
      Move all XML configuration handling to src/conf/ · e0a48c99
      Daniel P. Berrange 提交于
      * src/capabilities.c, src/capabilities.h, src/domain_conf.c,
        src/domain_conf.h, src/domain_event.c, src/domain_event.h,
        src/interface_conf.c, src/interface_conf.h,
        src/network_conf.c, src/network_conf.h, src/node_device_conf.c,
        src/node_device_conf.h, src/secret_conf.c, src/secret_conf.h,
        src/storage_conf.c, src/storage_conf.h, src/storage_encryption_conf.c,
        src/storage_encryption_conf.h: Move to src/conf/
      * src/Makefile.am: Add -Isrc/conf to the individual build targets
        which need to use XML config APIs. Remove LIBXML_CFLAGS, LIBSSH2_CFLAGS
        and SELINUX_CFLAGS from global INCLUDES and only have them in build
        targets which actually need them.  Create a libvirt_conf.la
        convenience library for all config parsers
      * src/hostusb.h: Remove bogus include of domain_conf.h
      * tests/Makefile.am: Add -Isrc/conf. Remove bogus -I$builddir/src
        since it never has any generated header files
      * daemon/Makefile.am: Add -Isrc/conf
      * proxy/Makefile.am: Add -Isrc/conf and cope with renamed files
      * src/hash.c: Remove bogus include of libxml/threads.h
      e0a48c99
  15. 16 7月, 2009 1 次提交
    • J
      remove all trailing blank lines · 07613d20
      Jim Meyering 提交于
      by running this command:
      git ls-files -z | xargs -0 perl -pi -0777 -e 's/\n\n+$/\n/'
      This is in preparation for a more strict make syntax-check
      rule that will detect trailing blank lines.
      07613d20
  16. 29 5月, 2009 1 次提交
    • C
      network driver: Fix regression defining colliding networks at daemon startup. · b121c787
      Cole Robinson 提交于
      If two virtual networks have the same hardcoded bridge device (which
      prevents them from being active simultaneously) we still want to define
      them at daemon startup, so the user has a fighting chance of correcting
      the XML error.
      
      Add an extra flag to SetBridge to avoid reporting an error if there is
      a bridge collision, and use this when loading network configs at startup.
      
      This regressed via commit 4c3f3b4d.
      b121c787
  17. 22 4月, 2009 1 次提交
  18. 03 3月, 2009 1 次提交
  19. 21 1月, 2009 1 次提交
  20. 16 1月, 2009 1 次提交
  21. 05 12月, 2008 2 次提交
  22. 05 11月, 2008 1 次提交
  23. 10 10月, 2008 1 次提交
  24. 08 9月, 2008 1 次提交
  25. 20 8月, 2008 1 次提交
  26. 11 7月, 2008 1 次提交