1. 26 11月, 2019 2 次提交
  2. 25 11月, 2019 1 次提交
  3. 19 11月, 2019 2 次提交
  4. 13 11月, 2019 1 次提交
  5. 12 11月, 2019 1 次提交
  6. 08 11月, 2019 1 次提交
    • L
      util: set bridge device MAC address explicitly during virNetDevBridgeCreate · 13ec8270
      Laine Stump 提交于
      When libvirt first implemented a stable and configurable MAC address
      for the bridges created for libvirt virtual networks (commit
      5754dbd5, in libvirt v0.8.8) most distro stable releases didn't
      support explicitly setting the MAC address of a bridge; the bridge
      just always assumed the lowest numbered MAC of all attached
      interfaces. Because of this, we stabilized the bridge MAC address by
      creating a "dummy" tap interface with a MAC address guaranteed to be
      lower than any of the guest tap devices' MACs (which all started with
      0xFE, so it's not difficult to do) and attached it to the bridge -
      this was the inception of the "virbr0-nic" device that has confused so
      many people over the years.
      
      Even though the linux kernel had recently gained support for
      explicitly setting a bridge MAC, we deemed it unnecessary to set the
      MAC that way, because the other (indirect) method worked everywhere.
      
      But recently there have been reports that the bridge MAC address was
      not following the setting in the network config, and mismatched the
      MAC of the dummy tap device (which was still correct). It turns out
      that this is due to a change in systemd-242 that persists whatever MAC
      address is set for a bridge when it's initially started. According to
      the systemd NEWS file entry for version 242
      (https://github.com/systemd/systemd/blob/master/NEWS):
      
        "if a bridge interface is created without any slaves, and gains
         a slave later, then now the bridge does not inherit slave's MAC."
      
      This change was the result of:
      
        https://github.com/systemd/systemd/issues/3374
      
      (apparently if there is no MAC saved for a bridge by the name of a
      bridge being created, the random MAC generated during creation is
      saved, and then that same MAC is used to explicitly set the MAC each
      time it is created). Once a bridge has an explicitly set MAC, the "use
      the lowest numbered MAC of attached devices" rule is ignored, so our
      dummy tap device is like the goggles - it does nothing! (well, almost).
      
      We could whine about changes in default behavior, etc. etc., but
      because the change was in response to actual user problems, that seems
      likely a fruitless task. Fortunately, time has marched on, and even
      distro releases that are old enough that they are no longer supported
      by upstream libvirt (e.g. RHEL6) have support for explicitly setting a
      bridge device MAC address, either during creation or with a separate
      ioctl after creation, so we can now do that.
      
      To enable explicitly setting the mac during bridge creation, we add a
      mac arg to virNetDevBridgeCreate().  In the case of platforms where
      the bridge is created with a netlink RTM_NEWLINK message, we just add
      that mac to the message. For platforms that still use an ioctl (either
      SIOCBRADDBR or SIOCIFCREATE2), we make a separate call to
      virNetDevSetMAC() after creating the bridge.
      
      (NB: I was unable to test the calling of virNetDevSetMAC() from the
      SIOCIFCREATE2 (BSD) version of virNetDevBridgeCreate(); even though I
      managed to get a FreeBSD system setup and libvirt built there, when I
      tried to start the default network the SIOCIFCREATE2 ioctl itself
      failed, so it never even got to the virNetDevSetMAC(). That leaves the
      FreeBSD implementation untested.)
      
      This makes the dummy tap pointless for purposes of setting the MAC
      address, but it is still useful for IPv6 DAD initialization (which
      apparently requires at least one interface to be attached to the
      bridge and online), as well as for setting an initial MTU for the
      bridge, so it hasn't been removed.
      
      (NB: we can safely *always* call virNetDevBridgeCreate() with
      &def->mac from the network driver because, in spite of the existence
      of a "mac_specified" bool in the config suggesting that it may not
      always be present, in reality a mac address will always be added to
      any network that doesn't have one - this is guaranteed in all cases by
      commit a47ae7c0)
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1760851Signed-off-by: NLaine Stump <laine@redhat.com>
      Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
      13ec8270
  7. 25 10月, 2019 1 次提交
  8. 24 10月, 2019 1 次提交
    • M
      Drop needless ret variable · 3b4df5d3
      Michal Privoznik 提交于
      In few places we have the following code pattern:
      
        int ret;
        ... /* @ret is not accessed here */
        ret = f(...);
        return ret;
      
      This pattern can be written less verbose:
      
        ...
        return f(...);
      
      This patch was generated with following coccinelle spatch:
      
        @@
        type T;
        constant C;
        expression f;
        identifier ret;
        @@
        -T ret = C;
         ... when != ret
        -ret = f;
        -return ret;
        +return f;
      
      Afterwards I needed to fix a few places, e.g. comment in
      virDomainNetIPParseXML() was removed too because coccinelle
      thinks it refers to @ret while in fact it doesn't. Also in few
      places it replaced @ret declaration with a few spaces instead of
      removing the line. But nothing terribly wrong.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      3b4df5d3
  9. 21 10月, 2019 2 次提交
  10. 16 10月, 2019 3 次提交
  11. 15 10月, 2019 2 次提交
  12. 14 10月, 2019 1 次提交
  13. 08 10月, 2019 1 次提交
  14. 27 9月, 2019 2 次提交
  15. 14 9月, 2019 3 次提交
  16. 27 8月, 2019 1 次提交
  17. 21 8月, 2019 5 次提交
  18. 16 8月, 2019 2 次提交
  19. 09 8月, 2019 1 次提交
  20. 08 8月, 2019 1 次提交
  21. 18 7月, 2019 4 次提交
  22. 11 7月, 2019 1 次提交
    • D
      network: acquire a pidfile in the driver root directory · c03aef7c
      Daniel P. Berrangé 提交于
      When we allow multiple instances of the driver for the same user
      account, using a separate root directory, we need to ensure mutual
      exclusion. Use a pidfile to guarantee this.
      
      In privileged libvirtd this ends up locking
      
         /var/run/libvirt/network/driver.pid
      
      In unprivileged libvirtd this ends up locking
      
        /run/user/$UID/libvirt/network/run/driver.pid
      
      NB, the latter can vary depending on $XDG_RUNTIME_DIR
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      c03aef7c
  23. 26 6月, 2019 1 次提交
    • D
      network: avoid including sys/sysctl.h on Linux · 3338c40b
      Daniel P. Berrangé 提交于
      The sys/sysctl.h header is only needed on BSD platforms to get
      the sysctlbyname() function declaration. On Linux we talk to
      procfs instead to change sysctls.
      
      Unfortunately a legacy sys/sysctl.h header does exist on Linux
      and including it has recently started triggering a deprecation
      warning from glibc.
      
      Protect its inclusion with a HAVE_SYSCTLBYNAME check instead
      so that it only gets used on platforms where we need that
      function declaration.
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      3338c40b