1. 18 10月, 2017 1 次提交
  2. 05 10月, 2017 1 次提交
  3. 17 8月, 2017 13 次提交
  4. 15 7月, 2017 1 次提交
  5. 25 6月, 2017 1 次提交
    • J
      events: Avoid double free possibility on remote call failure · 2065499b
      John Ferlan 提交于
      If a remote call fails during event registration (more than likely from
      a network failure or remote libvirtd restart timed just right), then when
      calling the virObjectEventStateDeregisterID we don't want to call the
      registered @freecb function because that breaks our contract that we
      would only call it after succesfully returning.  If the @freecb routine
      were called, it could result in a double free from properly coded
      applications that free their opaque data on failure to register, as seen
      in the following details:
      
          Program terminated with signal 6, Aborted.
          #0  0x00007fc45cba15d7 in raise
          #1  0x00007fc45cba2cc8 in abort
          #2  0x00007fc45cbe12f7 in __libc_message
          #3  0x00007fc45cbe86d3 in _int_free
          #4  0x00007fc45d8d292c in PyDict_Fini
          #5  0x00007fc45d94f46a in Py_Finalize
          #6  0x00007fc45d960735 in Py_Main
          #7  0x00007fc45cb8daf5 in __libc_start_main
          #8  0x0000000000400721 in _start
      
      The double dereference of 'pyobj_cbData' is triggered in the following way:
      
          (1) libvirt_virConnectDomainEventRegisterAny is invoked.
          (2) the event is successfully added to the event callback list
              (virDomainEventStateRegisterClient in
              remoteConnectDomainEventRegisterAny returns 1 which means ok).
          (3) when function remoteConnectDomainEventRegisterAny is hit,
              network connection disconnected coincidently (or libvirtd is
              restarted) in the context of function 'call' then the connection
              is lost and the function 'call' failed, the branch
              virObjectEventStateDeregisterID is therefore taken.
          (4) 'pyobj_conn' is dereferenced the 1st time in
              libvirt_virConnectDomainEventFreeFunc.
          (5) 'pyobj_cbData' (refered to pyobj_conn) is dereferenced the
               2nd time in libvirt_virConnectDomainEventRegisterAny.
          (6) the double free error is triggered.
      
      Resolve this by adding a @doFreeCb boolean in order to avoid calling the
      freeCb in virObjectEventStateDeregisterID for any remote call failure in
      a remoteConnect*EventRegister* API. For remoteConnect*EventDeregister* calls,
      the passed value would be true indicating they should run the freecb if it
      exists; whereas, it's false for the remote call failure path.
      
      Patch based on the investigation and initial patch posted by
      fangying <fangying1@huawei.com>.
      2065499b
  6. 28 4月, 2017 2 次提交
    • L
      network: better log message when network is inactive during reconnect · 7949de96
      Laine Stump 提交于
      If the network isn't active during networkNotifyActualDevice(), we
      would log an error message stating that the bridge device didn't
      exist. This patch adds a check to see if the network is active, making
      the logs more useful in the case that it isn't.
      
      Partially resolves: https://bugzilla.redhat.com/1442700
      7949de96
    • L
      qemu: don't kill qemu process on restart if networkNotify fails · cb182eb1
      Laine Stump 提交于
      Nothing that could happen during networkNotifyActualDevice() could
      justify unceremoniously killing the qemu process, but that's what we
      were doing.
      
      In particular, new code added in commit 85bcc022 (first appearred in
      libvirt-3.2.0) attempts to reattach tap devices to their assigned
      bridge devices when libvirtd restarts (to make it easier to recover
      from a restart of a libvirt network). But if the network has been
      stopped and *not* restarted, the bridge device won't exist and
      networkNotifyActualDevice() will fail.
      
      This patch changes networkNotifyActualDevice() and
      qemuProcessNotifyNets() to return void, so that qemuProcessReconnect()
      will soldier on regardless of what happens (any errors will still be
      logged though).
      
      Partially resolves: https://bugzilla.redhat.com/1442700
      cb182eb1
  7. 21 4月, 2017 1 次提交
  8. 19 4月, 2017 3 次提交
  9. 03 4月, 2017 1 次提交
    • M
      networkUpdateState: Create virMacMap module more frequently · 3054dacf
      Michal Privoznik 提交于
      The virMacMap module is there for dumping [domain, <list of is
      MACs>] pairs into a file so that libvirt_guest NSS module can use
      it. Whenever a interface is allocated from network (e.g. on
      domain<F2> startup or NIC hotplug), network is notified and so is
      virMacMap module subsequently. The module update functions
      networkMacMgrAdd() and networkMacMgrDel() gracefully handle the
      case when there's no module. The problem is, the module is
      created if and only if network is freshly started, or if the
      daemon restarts and network previously had the module.
      
      This is not very user friendly - if users want to use the NSS
      module they need to destroy their network and bring it up again
      (and subsequently all the domains using it).
      
      One disadvantage of this approach implemented here is that one
      may get just partial results: any already running network does
      not record mac maps, thus only newly plugged domains will be
      stored in the module. The network restart scenario is not touched
      by this of course. But one can argue that older libvirts had
      never recorded the mac maps anyway.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      3054dacf
  10. 29 3月, 2017 1 次提交
    • M
      network: Don't crash on domain destroy · 2fe93123
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1434882
      
      Imagine the following scenario:
      
      1) virsh net-start default
      2) virsh start myFavouriteDomain
      3) virsh net-destroy default
      4) virsh destroy myFavouriteDomain
      
      (assuming myFavouriteDomain has an interface from default
      network)
      
      Regardless of how unlikely this scenario looks like, we should
      not crash. The problem is, on net-destroy in
      networkShutdownNetworkVirtual() the virMacMap module is unrefed,
      but the stale pointer is kept around. Thus when the domain
      destroy procedure comes in, networkReleaseActualDevice() and
      subsequently networkMacMgrDel() is called. This function sees the
      stale pointer and starts calling the virMacMap module APIs which
      work over freed memory.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      2fe93123
  11. 28 3月, 2017 1 次提交
  12. 24 3月, 2017 1 次提交
    • L
      network: only check for IPv6 RA routes when the network has an IPv6 address · a1f46c71
      Laine Stump 提交于
      commit 00d28a78 added a check to see if there were any IPv6 routes
      added by RA (Router Advertisement) via an interface that had accept_ra
      set to something other than "2". The check was being done
      unconditionally, but it's only relevant if IPv6 forwarding is going to
      be turned on, and that will only happen if the network has an IPv6
      address.
      a1f46c71
  13. 23 3月, 2017 2 次提交
    • J
      network: Remove null newBandwidth check from networkBandwidthUpdate · 802579b5
      John Ferlan 提交于
      The prototype requires a NONNULL argument and the only caller passes in
      a non-null parameter. Besides the "else if" condition would deref it anyway.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      802579b5
    • L
      network: reconnect tap devices during networkNotifyActualDevice · 85bcc022
      Laine Stump 提交于
      If a network is destroyed and restarted, or its bridge is changed, any
      tap devices that had previously been connected to the bridge will no
      longer be connected. As a first step in automating a reconnection of
      all tap devices when this happens, this patch modifies
      networkNotifyActualDevice() (which is called once for every
      <interface> of every active domain whenever libvirtd is restarted) to
      reconnect any tap devices that it finds disconnected.
      
      With this patch in place, you will need to restart libvirtd to
      reconnect all the taps to their proper bridges. A future patch will
      add a callback that hypervisor drivers can register with the network
      driver to that the network driver can trigger this behavior
      automatically whenever a network is started.
      85bcc022
  14. 22 3月, 2017 2 次提交
  15. 21 3月, 2017 1 次提交
    • L
      network: don't add "no-resolv" if we still need DNS servers from resolv.conf · 15b5902d
      Laine Stump 提交于
      It was pointed out here:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1331796#c4
      
      that we shouldn't be adding a "no-resolv" to the dnsmasq.conf file for
      a network if there isn't any <forwarder> element that specifies an IP
      address but no qualifying domain. If there is such an element, it will
      handle all DNS requests that weren't otherwise handled by one of the
      forwarder entries with a matching domain attribute. If not, then DNS
      requests that don't match the domain of any <forwarder> would not be
      resolved if we added no-resolv.
      
      So, only add "no-resolv" when there is at least one <forwarder>
      element that specifies an IP address but no qualifying domain.
      15b5902d
  16. 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
  17. 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
  18. 02 1月, 2017 1 次提交
  19. 19 12月, 2016 1 次提交
  20. 06 12月, 2016 2 次提交
  21. 03 11月, 2016 1 次提交