1. 06 11月, 2015 3 次提交
    • J
      virnetdev: Fix function comments for virNetDevGetFeatures · 9efab5da
      John Ferlan 提交于
      In commit id 'c9027d8f' when updating the posted patch to generate
      a bitmap instead of an array of named feature bits, adjustment of
      the args was missed
      9efab5da
    • J
      virnetdev: Document reasons for ignoring some SIOCETHTOOL errno values · 301bd801
      John Ferlan 提交于
      Recently reverted commit id '6f2a0198' showed a need to add extra
      comments when dealing with filtering of potential "non-issues".
      
      Scanning through upstream patch postings indicates early on the
      reasons for the filtering of specific ioctl failures were provided;
      however, when converted from causing an error to VIR_DEBUG's the
      reasons were missing. A future read/change of the code incorrectly
      assumed they could or should be removed.
      301bd801
    • D
      Revert "utils: Remove the logging of errors from virNetDevSendEthtoolIoctl" · a3f63b85
      Daniel P. Berrange 提交于
      This reverts commit 6f2a0198.
      
      This commit removed error reporting from virNetDevSendEthtoolIoctl
      pushing responsibility onto the callers. This is wrong, however,
      since virNetDevSendEthtoolIoctl calls virNetDevSetupControl
      which can still report errors. So as a result virNetDevSendEthtoolIoctl
      may or may not report errors depending on which bit of it fails, and as
      a result callers now overwrite some errors.
      
      It also introduced a regression causing unprivileged libvirtd to
      spew error messages to the console due to inability to query the
      NIC features, an error which was previously ignored.
      
      virNetDevSetupControlFull:148 : Cannot open network interface control socket: Operation not permitted
      virNetDevFeatureAvailable:3062 : Cannot get device wlp3s0 flags: Operation not permitted
      virNetDevSetupControlFull:148 : Cannot open network interface control socket: Operation not permitted
      virNetDevFeatureAvailable:3062 : Cannot get device wlp3s0 flags: Operation not permitted
      virNetDevSetupControlFull:148 : Cannot open network interface control socket: Operation not permitted
      virNetDevFeatureAvailable:3062 : Cannot get device wlp3s0 flags: Operation not permitted
      virNetDevSetupControlFull:148 : Cannot open network interface control socket: Operation not permitted
      virNetDevFeatureAvailable:3062 : Cannot get device wlp3s0 flags: Operation not permitted
      
      Looking back at the original posting I see no explanation of why
      thsi refactoring was needed, so reverting the clearly broken
      error reporting logic looks like the best option.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a3f63b85
  2. 05 11月, 2015 1 次提交
  3. 30 10月, 2015 2 次提交
    • L
      util: set max wait for IPv6 DAD to 20 seconds · ac339206
      Laine Stump 提交于
      This was originally set to 5 seconds, but times of 5.5 to 7 seconds
      were experienced. Since it's an arbitrary number intended to prevent
      an infinite hang, having it a bit too high won't hurt anything, and 20
      seconds looks to be adequate (i.e. I think/hope we don't need to make
      it tunable in libvirtd.conf)
      ac339206
    • L
      util: set error if DAD is not finished · d41a64a1
      Luyao Huang 提交于
      If DAD not finished in 5 seconds, user will get an
      unknown error like this:
      
       # virsh net-start ipv6
       error: Failed to start network ipv6
       error: An error occurred, but the cause is unknown
      
      Call virReportError to set an error.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      d41a64a1
  4. 29 10月, 2015 2 次提交
    • R
      Fix virNetDevWaitDadFinish stub · 2589ca30
      Roman Bogorodskiy 提交于
      Build on non-Linux fails because the virNetDevWaitDadFinish() stub
      has unused parameters. Fix by adding appropriate ATTRIBUTE_UNUSED
      for these parameters.
      
      Pushing under build-breaker rule.
      2589ca30
    • M
      network: wait for DAD to finish for bridge IPv6 addresses · 0f7436ca
      Maxim Perevedentsev 提交于
      commit db488c79 assumed that dnsmasq would complete IPv6 DAD before
      daemonizing, but in reality it doesn't wait, which creates problems
      when libvirt's bridge driver sets the matching "dummy tap device" to
      IFF_DOWN prior to DAD completing.
      
      This patch waits for DAD completion by periodically polling the kernel
      using netlink to check whether there are any IPv6 addresses assigned
      to bridge which have a 'tentative' state (if there are any in this
      state, then DAD hasn't yet finished). After DAD is finished, execution
      continues. To avoid an endless hang in case something was wrong with
      the kernel's DAD, we wait a maximum of 5 seconds.
      0f7436ca
  5. 03 9月, 2015 1 次提交
  6. 27 8月, 2015 1 次提交
  7. 12 8月, 2015 1 次提交
    • L
      util: don't overwrite stack when getting ethtool gfeatures · bfaaa2b6
      Laine Stump 提交于
      This fixes the crash described here:
      
       https://www.redhat.com/archives/libvir-list/2015-August/msg00162.html
      
      In short, we were calling ioctl(SIOCETHTOOL) pointing to a too-short
      object that was a local on the stack, resulting in the memory past the
      end of the object being overwritten. This was because the struct used
      by the ETHTOOL_GFEATURES command of SIOCETHTOOL ends with a 0-length
      array, but we were telling ethtool that it could use 2 elements on the
      array.
      
      The fix is to allocate the necessary memory with VIR_ALLOC_VAR(),
      including the extra length needed for a 2 element array at the end.
      bfaaa2b6
  8. 11 8月, 2015 1 次提交
  9. 24 7月, 2015 1 次提交
    • J
      nodeinfo: Check for SYSFS_INFINIBAND_DIR before open · 136f17ef
      John Ferlan 提交于
      Commit id 'ac3ed208' causes 'virsh nodedev-list --cap net' to fail
      on any system without SYSFS_INFINIBAND_DIR (/sys/class/infiniband).
      
      Rather than assume it's there and fail on the attempt to open the
      non-existent directory, check if it's there - if not, return
      success and move on. Also fix caller to check < 0 upon return.
      
      As reported by Suren Hajyan <shajyan@redhat.com> from run of unit tests
      136f17ef
  10. 22 7月, 2015 1 次提交
    • R
      netdev: fix build on FreeBSD · 830344d6
      Roman Bogorodskiy 提交于
      Commit ac3ed208 breaks build on FreeBSD with:
      
        CC       util/libvirt_util_la-virnetdev.lo
      util/virnetdev.c:2967:1: error: unused function 'virNetDevRDMAFeature' [-Werror,-Wunused-function]
      virNetDevRDMAFeature(const char *ifname,
      ^
      
      So hide virNetDevRDMAFeature function under the #ifdef 'SIOCETHTOOL'
      and 'HAVE_STRUCT_IFREQ' section.
      
      Pushed under the build breaker rule.
      830344d6
  11. 21 7月, 2015 1 次提交
    • M
      nodedev: add RDMA and tx-udp_tnl-segmentation NIC capabilities · ac3ed208
      Moshe Levi 提交于
      Adding functionality to libvirt that will allow
      it query the interface for the availability of RDMA and
      tx-udp_tnl-segmentation Offloading NIC capabilities
      
      Here is an example of the feature XML definition:
      
      <device>
      <name>net_eth4_90_e2_ba_5e_a5_45</name>
        <path>/sys/devices/pci0000:00/0000:00:03.0/0000:08:00.1/net/eth4</path>
        <parent>pci_0000_08_00_1</parent>
        <capability type='net'>
          <interface>eth4</interface>
          <address>90:e2:ba:5e:a5:45</address>
          <link speed='10000' state='up'/>
          <feature name='rx'/>
          <feature name='tx'/>
          <feature name='sg'/>
          <feature name='tso'/>
          <feature name='gso'/>
          <feature name='gro'/>
          <feature name='rxvlan'/>
          <feature name='txvlan'/>
          <feature name='rxhash'/>
          <feature name='rdma'/>
          <feature name='txudptnl'/>
          <capability type='80203'/>
        </capability>
      </device>
      ac3ed208
  12. 04 6月, 2015 1 次提交
    • L
      virnetdev: fix moving of 802.11 phys · 81b19ce4
      Lubomir Rintel 提交于
      There was a couple of problems with the style fixes applied to the original
      patch:
      
      1.) virFileReadAllQuiet comparison was incorrectly parenthesized when moved
      into a condition, causing the len to be set to the result of comparison. This,
      together with the removed underflow check would underflow the phy buffer.
      
      2.) The logic was broken. Failure to call "ip" would abort the function, thus
      the "iw" branch would never be reached.
      
      This aims to fix the issues and work around possible style complains :)
      Signed-off-by: NLubomir Rintel <lkundrak@v3.sk>
      81b19ce4
  13. 22 5月, 2015 1 次提交
    • L
      netdev: fail when setting up an SRIOV VF if PF is offline · 474523fa
      Laine Stump 提交于
      If an SRIOV PF is offline, the kernel won't complain if you set the
      mac address and vlan tag for a VF via this PF, and it will even let
      you assign the VF to a guest using PCI device assignment or macvtap
      passthrough. But in this case (the PF isn't online), the device won't
      be usable in the guest.
      
      Silently setting the PF online would solve the connectivity problem,
      but as pointed out by Dan Berrange, when an interface is set online
      with no associated config, the kernel will by default turn on IPv6
      autoconf, which could create unexpected security problems for the
      host. For this reason, this patch instead logs an error and fails the
      operation.
      
      This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=893738
      
      Originally filed against RHEL6, but present in every version of
      libvirt until today.
      474523fa
  14. 22 4月, 2015 2 次提交
    • R
      util: fix build on non-Linux · 584db105
      Roman Bogorodskiy 提交于
      Build fails on non-Linux systems with this error:
      
        CC       util/libvirt_util_la-virnetdev.lo
      util/virnetdev.c:364:1: error: unused function 'virNetDevReplaceMacAddress' [-Werror,-Wunused-function]
      virNetDevReplaceMacAddress(const char *linkdev,
      ^
      util/virnetdev.c:406:1: error: unused function 'virNetDevRestoreMacAddress' [-Werror,-Wunused-function]
      virNetDevRestoreMacAddress(const char *linkdev,
      ^
      2 errors generated.
      
      The virNetDev{Restore,Replace}MacAddress() functions are only used
      by VF-related routines that are available on Linux only. So move these
      functions under the same #ifdef.
      584db105
    • L
      util: set MAC address for VF via netlink message to PF+VF# when possible · cb3fe38c
      Laine Stump 提交于
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1113474
      
      When we set the MAC address of a network device as a part of setting
      up macvtap "passthrough" mode (where the domain has an emulated netdev
      connected to a host macvtap device that has exclusive use of the
      physical device, and sets the device MAC address to match its own,
      i.e. "<interface type='direct'> <source mode='passthrough' .../>"), we
      use ioctl(SIOCSIFHWADDR) giving it the name of that device. This is
      true even if it is an SRIOV Virtual Function (VF).
      
      But, when we are setting the MAC address / vlan ID of a VF in
      preparation for "hostdev network" passthrough (this is where we set
      the MAC address and vlan id of the VF after detaching the host net
      driver and before assigning the device to the domain with PCI
      passthrough, i.e. "<interface type='hostdev'>", we do the setting via
      a netlink RTM_SETLINK message for that VF's Physical Function (PF),
      telling it the VF# we want to change. This sets an "administratively
      changed MAC" flag for that VF in the PF's driver, and from that point
      on (until the PF driver is reloaded, *not* merely the VF driver) that
      VF's MAC address can't be changed using ioctl(SIOCSIFHWADDR) - the
      only way to change it is via the PF with RTM_SETLINK.
      
      This means that if a VF is used for hostdev passthrough, it will have
      the admin flag set, and future attempts to use that VF for macvtap
      passthrough will fail.
      
      The solution to this problem is to check if the device being used for
      macvtap passthrough is actually a VF; if so, we use the netlink
      RTM_SETLINK message to the PF to set the VF's mac address instead of
      ioctl(SIOCSIFHWADDR) directly to the VF; if not, behavior does not
      change from previously.
      
      There are three pieces to making this work:
      
      1) virNetDevMacVLan(Create|Delete)WithVPortProfile() now call
         virNetDev(Replace|Restore)NetConfig() rather than
         virNetDev(Replace|Restore)MacAddress() (simply passing -1 for VF#
         and vlanid).
      
      2) virNetDev(Replace|Restore)NetConfig() check to see if the device is
         a VF. If so, they find the PF's name and VF#, allowing them to call
         virNetDev(Replace|Restore)VfConfig().
      
      3) To prevent mixups when detaching a macvtap passthrough device that
         had been attached while running an older version of libvirt,
         virNetDevRestoreVfConfig() is potentially given the preserved name
         of the VF, and if the proper statefile for a VF can't be found in
         the stateDir (${stateDir}/${pfname}_vf${vfid}),
         virNetDevRestoreMacAddress() is called instead (which will look in
         the file named ${stateDir}/${vfname}).
      
      This problem has existed in every version of libvirt that has both
      macvtap passthrough and interface type='hostdev'. Fortunately people
      seem to use one or the other though, so it hasn't caused any real
      world problem reports.
      cb3fe38c
  15. 17 4月, 2015 1 次提交
  16. 15 4月, 2015 3 次提交
  17. 14 4月, 2015 1 次提交
  18. 10 4月, 2015 2 次提交
  19. 15 3月, 2015 1 次提交
    • E
      netdev: silence valgrind warning about ioctl use · a9abc08d
      Eric Blake 提交于
      Valgrind complained:
      
      ==3770== Syscall param ioctl(SIOCETHTOOL) points to uninitialised byte(s)
      ==3770==    at 0x919D407: ioctl (syscall-template.S:81)
      ==3770==    by 0x530FE7E: rpl_ioctl (ioctl.c:42)
      ==3770==    by 0x50CB433: virNetDevFeatureAvailable (virnetdev.c:2764)
      ==3770==    by 0x50CB6A7: virNetDevGetFeatures (virnetdev.c:2830)
      ==3770==    by 0x1F0E5347: udevProcessNetworkInterface (node_device_udev.c:722)
      ==3770==    by 0x1F0E689F: udevGetDeviceDetails (node_device_udev.c:1300)
      ==3770==    by 0x1F0E6E06: udevAddOneDevice (node_device_udev.c:1422)
      ==3770==    by 0x1F0E6FB8: udevProcessDeviceListEntry (node_device_udev.c:1464)
      ==3770==    by 0x1F0E70CF: udevEnumerateDevices (node_device_udev.c:1494)
      ==3770==    by 0x1F0E7BB4: nodeStateInitialize (node_device_udev.c:1806)
      ==3770==    by 0x51B4303: virStateInitialize (libvirt.c:777)
      ==3770==    by 0x11DEE7: daemonRunStateInit (libvirtd.c:906)
      ==3770==  Address 0x228e38d4 is on thread 12's stack
      ==3770==  in frame #2, created by virNetDevFeatureAvailable (virnetdev.c:2750)
      
      * src/util/virnetdev.c (virNetDevFeatureAvailable): Initialize all
      bytes of ifr.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a9abc08d
  20. 13 3月, 2015 1 次提交
    • P
      virnetdev: fix build with old kernel · 48461b16
      Pavel Hrdina 提交于
      Commit c9027d8f added a detection of NIC HW features, but some of them
      are not available in old kernel.  Very old kernels lack enum
      ethtool_flags and even if this enum is present, not all values are
      available for all kernels.  To be sure that we have everything in kernel
      that we need, we must check for existence of most of that flags, because
      only few of them were defined at first.
      
      Also to successfully build libvirt with older kernel we need to include
      <linux/types.h> before <linux/ethtool.h> to have __u32 and friends
      defined.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      48461b16
  21. 05 3月, 2015 2 次提交
    • J
      Fix build on mingw · 41c5baea
      Ján Tomko 提交于
      Last commit unconditionally included a linux-specific header.
      
      Do not do that.
      41c5baea
    • J
      SRIOV NIC offload feature discovery · c9027d8f
      James Chapman 提交于
      Adding functionality to libvirt that will allow it
      query the ethtool interface for the availability
      of certain NIC HW offload features
      
      Here is an example of the feature XML definition:
      
      <device>
      <name>net_eth4_90_e2_ba_5e_a5_45</name>
        <path>/sys/devices/pci0000:00/0000:00:03.0/0000:08:00.1/net/eth4</path>
        <parent>pci_0000_08_00_1</parent>
        <capability type='net'>
          <interface>eth4</interface>
          <address>90:e2:ba:5e:a5:45</address>
          <link speed='10000' state='up'/>
          <feature name='rx'/>
          <feature name='tx'/>
          <feature name='sg'/>
          <feature name='tso'/>
          <feature name='gso'/>
          <feature name='gro'/>
          <feature name='rxvlan'/>
          <feature name='txvlan'/>
          <feature name='rxhash'/>
          <capability type='80203'/>
        </capability>
      </device>
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      c9027d8f
  22. 03 2月, 2015 2 次提交
    • P
      virnetdev: fix some issues found by coverity and mingw builds · 8bda9035
      Pavel Hrdina 提交于
      Commit e562a61a introduced new function to get/set interface state but
      there was misuse of ATTRIBUTE_NONNULL on non-pointer attributes and also
      we need to wrap that functions by #ifdef to not break mingw build.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      8bda9035
    • L
      util: make virNetDev(Get|Set)IFFlags() static · df2cc650
      Laine Stump 提交于
      e562a61a added these two new helper functions and only used them
      within virnetdev.c, but declared them in the .h file. If some
      currently unsupported interface flags need to be accessed in the
      future, it will make more sense to write the appropriate higher level
      function rather than require us to artificially define IFF_* on some
      mythical platform that doesn't have SIOC[SG]IFFLAGS (and therefore
      doesn't have IFF_*) just so we can call virNetDevSetIFFFlags() to
      return an error.
      
      To help someone in not going down the wrong road, this patch makes the
      two helper functions static, hopefully making it less likely that
      someone will want to use them outside of virnetdev.c.
      df2cc650
  23. 30 1月, 2015 1 次提交
  24. 06 1月, 2015 6 次提交
  25. 15 11月, 2014 1 次提交