1. 23 2月, 2017 1 次提交
    • D
      Add ATTRIBUTE_FALLTHROUGH for switch cases without break · 5d84f596
      Daniel P. Berrange 提交于
      In GCC 7 there is a new warning triggered when a switch
      case has a conditional statement (eg if ... else...) and
      some of the code paths fallthrough to the next switch
      statement. e.g.
      
      conf/domain_conf.c: In function 'virDomainChrEquals':
      conf/domain_conf.c:14926:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
               if (src->targetTypeAttr != tgt->targetTypeAttr)
                  ^
      conf/domain_conf.c:14928:5: note: here
           case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE:
           ^~~~
      conf/domain_conf.c: In function 'virDomainChrDefFormat':
      conf/domain_conf.c:22143:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
               if (def->targetTypeAttr) {
                  ^
      conf/domain_conf.c:22151:5: note: here
           default:
           ^~~~~~~
      
      GCC introduced a __attribute__((fallthrough)) to let you
      indicate that this is intentionale behaviour rather than
      a bug.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      5d84f596
  2. 08 2月, 2017 2 次提交
    • L
      c0f70686
    • L
      util: add MTU arg to virNetDevTapCreateInBridgePort() · dd8ac030
      Laine Stump 提交于
      virNetDevTapCreateInBridgePort() has always set the new tap device to
      the current MTU of the bridge it's being attached to. There is one
      case where we will want to set the new tap device to a different
      (usually larger) MTU - if that's done with the very first device added
      to the bridge, the bridge's MTU will be set to the device's MTU. This
      patch allows for that possibility by adding "int mtu" to the arg list
      for virNetDevTapCreateInBridgePort(), but all callers are sending -1,
      so it doesn't yet have any effect.
      
      Since the requested MTU isn't necessarily what is used in the end (for
      example, if there is no MTU requested, the tap device will be set to
      the current MTU of the bridge), and the hypervisor may want to know
      the actual MTU used, we also return the actual MTU to the caller (if
      actualMTU is non-NULL).
      dd8ac030
  3. 02 1月, 2017 1 次提交
  4. 19 12月, 2016 1 次提交
  5. 06 12月, 2016 2 次提交
  6. 03 11月, 2016 1 次提交
  7. 29 10月, 2016 1 次提交
  8. 20 10月, 2016 1 次提交
  9. 12 10月, 2016 1 次提交
  10. 11 10月, 2016 1 次提交
    • M
      network: add dnsmasq option 'dhcp-authoritative' · 4ac20b3a
      Martin Wilck 提交于
      The dnsmasq man page recommends that dhcp-authoritative "should be
      set when dnsmasq is definitely the only DHCP server on a network".
      This is the case for libvirt-managed virtual networks.
      
      The effect of this is that VMs that fail to renew their DHCP lease
      in time (e.g. if the VM or host is suspended) will be able to
      re-acquire the lease even if it's expired, unless the IP address has
      been taken by some other host. This avoids various annoyances caused
      by changing VM IP addresses.
      4ac20b3a
  11. 23 8月, 2016 1 次提交
  12. 20 8月, 2016 3 次提交
    • L
      network: allow limiting a <forwarder> element to certain domains · 0b6336c2
      Laine Stump 提交于
      For some unknown reason the original implementation of the <forwarder>
      element only took advantage of part of the functionality in the
      dnsmasq feature it exposes - it allowed specifying the ip address of a
      DNS server which *all* DNS requests would be forwarded to, like this:
      
         <forwarder addr='192.168.123.25'/>
      
      This is a frontend for dnsmasq's "server" option, which also allows
      you to specify a domain that must be matched in order for a request to
      be forwarded to a particular server. This patch adds support for
      specifying the domain. For example:
      
         <forwarder domain='example.com' addr='192.168.1.1'/>
         <forwarder domain='www.example.com'/>
         <forwarder domain='travesty.org' addr='10.0.0.1'/>
      
      would forward requests for bob.example.com, ftp.example.com and
      joe.corp.example.com all to the DNS server at 192.168.1.1, but would
      forward requests for travesty.org and www.travesty.org to
      10.0.0.1. And due to the second line, requests for www.example.com,
      and odd.www.example.com would be resolved by the libvirt network's own
      DNS server (i.e. thery wouldn't be immediately forwarded) even though
      they also match 'example.com' - the match is given to the entry with
      the longest matching domain. DNS requests not matching any of the
      entries would be resolved by the libvirt network's own DNS server.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1331796
      0b6336c2
    • L
      network: allow disabling dnsmasq's DNS server · 9065cfaa
      Laine Stump 提交于
      If you define a libvirt virtual network with one or more IP addresses,
      it starts up an instance of dnsmasq. It's always been possible to
      avoid dnsmasq's dhcp server (simply don't include a <dhcp> element),
      but until now it wasn't possible to avoid having the DNS server
      listening; even if the network has no <dns> element, it is started
      using default settings.
      
      This patch adds a new attribute to <dns>: enable='yes|no'. For
      backward compatibility, it defaults to 'yes', but if you don't want a
      DNS server created for the network, you can simply add:
      
         <dns enable='no'/>
      
      to the network configuration, and next time the network is started
      there will be no dns server created (if there is dhcp configuration,
      dnsmasq will be started with "port=0" which disables the DNS server;
      if there is no dhcp configuration, dnsmasq won't be started at all).
      9065cfaa
    • L
      network: new network forward mode 'open' · 25e8112d
      Laine Stump 提交于
      The new forward mode 'open' is just like mode='route', except that no
      firewall rules are added to assure that any traffic does or doesn't
      pass. It is assumed that either they aren't necessary, or they will be
      setup outside the scope of libvirt.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=846810
      25e8112d
  13. 27 7月, 2016 1 次提交
  14. 13 7月, 2016 1 次提交
    • M
      dnsmasq: disable IPv6 default gateway in RA for isolated networks · 527968d4
      Maxim Perevedentsev 提交于
      IPv6 RA always contains an implicit default route via
      the link-local address of the source of RA. This forces
      the guest to install a route via isolated network, which
      may disturb the guest's networking in case of multiple interfaces.
      More info in 013427e6.
      
      The validity of this route is controlled by "default [route] lifetime"
      field of RA. If the lifetime is set to 0 seconds, then no route
      is installed by receiver.
      
      dnsmasq 2.67+ supports "ra-param=<interface>,<RA interval>,<default
      lifetime>" option. We pass "ra-param=*,0,0"
      (here, RA_interval=0 means default) to disable default gateway in RA
      for isolated networks.
      527968d4
  15. 27 6月, 2016 3 次提交
    • L
      util: move IP route & address object-related functions to virnetdevip.c · fa18e814
      Laine Stump 提交于
      These functions all need to be called from a utility function that
      must be located in the util directory, so we move them all into
      util/virnetdevip.[ch] now that it exists.
      
      Function and struct names were appropriately changed for the new
      location, but all code is unchanged aside from motion and renaming.
      fa18e814
    • L
      util: new files virnetdevip.[ch] for IP-related netdev functions · cf0568b0
      Laine Stump 提交于
      This patch splits virnetdev.[ch] into multiple files, with the new
      virnetdevip.[ch] containing all the functions related to setting and
      retrieving IP-related info for a device (both addresses and routes).
      cf0568b0
    • 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
  16. 24 6月, 2016 3 次提交
  17. 01 6月, 2016 1 次提交
    • L
      network: restart dnsmasq after adding/removing txt and srv records · 93b59fcf
      Laine Stump 提交于
      Although dns host records are stored in a separate configuration file
      that is reread by dnsmasq when it receives a SIGHUP, the txt and srv
      records are directly in the dnsmasq .conf file which can't be reread
      after initial dnsmasq startup. This means that if an srv or txt record
      is modified in a network config, libvirt needs to restart the dnsmasq
      process rather than just sending a SIGHUP.
      
      This was pointed out in a question in
      https://bugzilla.redhat.com/show_bug.cgi?id=988718 , but no separate
      BZ was filed.
      93b59fcf
  18. 13 5月, 2016 1 次提交
  19. 11 5月, 2016 1 次提交
    • L
      util: set vlan tag for macvtap passthrough mode on SRIOV VFs · 75db9997
      Laine Stump 提交于
      SRIOV VFs used in macvtap passthrough mode can take advantage of the
      SRIOV card's transparent vlan tagging. All the code was there to set
      the vlan tag, and it has been used for SRIOV VFs used for hostdev
      interfaces for several years, but for some reason, the vlan tag for
      macvtap passthrough devices was stubbed out with a -1.
      
      This patch moves a bit of common validation down to a lower level
      (virNetDevReplaceNetConfig()) so it is shared by hostdev and macvtap
      modes, and updates the macvtap caller to actually send the vlan config
      instead of -1.
      75db9997
  20. 10 5月, 2016 1 次提交
  21. 02 5月, 2016 2 次提交
    • C
      network: Fix segfault on daemon reload · 26af7e4e
      Cole Robinson 提交于
      We will segfault of a daemon reload picks up a new network config
      that needs to be autostarted. We shouldn't be passing NULL for
      network_driver here. This seems like it was missed in the larger
      rework in commit 1009a61e
      26af7e4e
    • 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
  22. 22 4月, 2016 1 次提交
    • L
      network: fix DHCPv6 on networks with prefix != 64 · bf3d9f30
      Laine Stump 提交于
      According to the dnsmasq manpage, the netmask for IPv4 address ranges
      will be auto-deteremined from the interface dnsmasq is listening on,
      but it can't do this for IPv6 for some reason - it instead assumes a
      network prefix of 64 for all IPv6 address ranges. If this is
      incorrect, dnsmasq will refuse to give out an address to clients,
      instead logging this message:
      
       dnsmasq-dhcp[2380]: no address range available for DHCPv6 request via virbr0
      
      The solution is for libvirt to add ",$prefix" to all IPv6 dhcp-range
      arguments when building the dnsmasq.conf file.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1033739
      bf3d9f30
  23. 08 4月, 2016 1 次提交
  24. 04 4月, 2016 1 次提交
    • L
      network: new function networkGetActualType · 3992ff14
      Laine Stump 提交于
      There are times when it's necessary to learn the actual type of a
      network connection before any resources have been allocated
      (e.g. during qemuProcessPrepareDomain()), but in the past it was
      necessary to call networkAllocateActualDevice() in order to have the
      actual type filled in.
      
      This new function returns the type of network that *will be* setup
      once it actually happens, but without making any changes on the host.
      3992ff14
  25. 26 3月, 2016 2 次提交
    • L
      network: call proper start/stop functions for macvtap bridge-mode networks · b41261f0
      Laine Stump 提交于
      networkStartNetwork() and networkShutdownNetwork() were calling the
      wrong type-specific function in the case of networks that were
      configured for macvtap ("direct") bridge mode - they were instead
      calling the functions for a tap+bridge network. Currently none of
      these functions does anything (they just return 0) so it hasn't
      created any problems, but that could change in the future.
      b41261f0
    • L
      network: differentiate macvtap/bridge from host-bridge based networks · 2a537fe1
      Laine Stump 提交于
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1316465
      
      An attempt to simplify the code for the VIR_NETWORK_FORWARD_BRIDGE
      case of networkUpdateState in commit b61db335 (first in release
      1.2.14) resulted in networks based on macvtap bridge mode being
      erroneously marked as inactive any time libvirtd was restarted.
      
      The problem is that the original code had differentiated between a
      network using tap devices to connect to an existing host-bridge device
      (forward mode of VIR_NETWORK_FORWARD_BRIDGE and a non-NULL
      def->bridge), and one using macvtap bridge mode to connect to any
      ethernet device (still forward mode VIR_NETWORK_FORWARD_BRIDGE, but
      null def->bridge), but the changed code assumed that all networks with
      VIR_NETWORK_FORWARD_BRIDGE were tap + host-bridge networks, so a null
      def->bridge was interpreted as "inactive".
      
      This patch restores the original code in networkUpdateState
      2a537fe1
  26. 18 3月, 2016 1 次提交
    • M
      Drop paths.h include · 865764de
      Michal Privoznik 提交于
      We include the file in plenty of places. This is mostly due to
      historical reasons. The only place that needs something from the
      header file is storage_backend_fs which opens _PATH_MOUNTED. But
      it gets the file included indirectly via mntent.h. At no other
      place in our code we need _PATH_.*. Drop the include and
      configure check then.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      865764de
  27. 07 3月, 2016 1 次提交
  28. 15 2月, 2016 2 次提交
    • L
      network: consolidated info log for all network allocate/free operations · eb72bd63
      Laine Stump 提交于
      There are three functions that deal with allocating and freeing
      devices from a networks netdev/pci device pool:
      network(Allocate|Notify|Release)ActualDevice(). These functions also
      maintain a counter of the number of domains currently using a network
      (regardless of whether or not that network uses a device pool). Each
      of these functions had multiple log messages (output using VIR_DEBUG)
      that were in slightly different formats and gave varying amounts of
      information.
      
      This patch creates a single function to log the pertinent information
      in a consistent manner for all three of these functions. Along with
      assuring that all the functions produce a consistent form of output
      (and making it simpler to change), it adds the MAC address of the
      domain interface involved in the operation, making it possible to
      verify which interface of which domain the operation is being done for
      (assuming that all MAC addresses are unique, of course).
      
      All of these messages are raised from DEBUG to INFO, since they don't
      happen that often (once per interface per domain/libvirtd start or
      domain stop), and can be very informative and helpful - eliminating
      the need to log debug level messages makes it much easier to sort
      these out.
      eb72bd63
    • L
      network: consolidate connection count updates for device pool · 3ea8b8b8
      Laine Stump 提交于
      networkReleaseActualDevice() and networkNotifyActualDevice() both were
      updating the individual devices' connections count in two separate
      places (unlike networkAllocateActualDevice() which does it in a single
      unified place after success:). The code is correct, but prone to
      confusion / later breakage. All of these updates are anyway located at
      the end of if/else clauses that are (with the exception of a single
      VIR_DEBUG() in each case) immediately followed by the success: label
      anyway, so this patch replaces the duplicated ++/-- instructions with
      a single ++/-- inside a qualifying "if (dev)" down below success:.
      (NB: if dev != NULL, by definition we are using a device (either pci
      or netdev, doesn't matter for these purposes) from the network's pool)
      
      The VIR_DEBUG args (which will be replaced in a followup patch anyway)
      were all adjusted to account for the connection count being out of
      date at the time.
      3ea8b8b8
  29. 04 2月, 2016 1 次提交