1. 26 11月, 2019 2 次提交
  2. 15 11月, 2019 1 次提交
  3. 12 11月, 2019 1 次提交
  4. 21 10月, 2019 1 次提交
  5. 16 10月, 2019 2 次提交
  6. 15 10月, 2019 1 次提交
  7. 13 8月, 2019 1 次提交
    • L
      util: allow tap-based guest interfaces to have MAC address prefix 0xFE · a60ee914
      Laine Stump 提交于
      Back in July 2010, commit 6ea90b84 (meant to resolve
      https://bugzilla.redhat.com/571991 ) added code to set the MAC address
      of any tap device to the associated guest interface's MAC, but with
      the first byte replaced with 0xFE. This was done in order to assure
      that
      
      1) the tap MAC and guest interface MAC were different (otherwise L2
         forwarding through the tap would not work, and the kernel would
         repeatedly issue a warning stating as much).
      
      2) any bridge device that had one of these taps attached would *not*
         take on the MAC of the tap (leading to network instability as
         guests started and stopped)
      
      A couple years later, https://bugzilla.redhat.com/798467 was filed,
      complaining that a user could configure a tap-based guest interface to
      have a MAC address that itself had a first byte of 0xFE, silently
      (other than the kernel warning messages) resulting in a non-working
      configuration. This was fixed by commit 5d571045, which logged an
      error and failed the guest start / interface attach if the MAC's first
      byte was 0xFE.
      
      Although this restriction only reduces the potential pool of MAC
      addresses from 2^46 (last two bits of byte 1 must be set to 10) by
      2^32 (still 4 orders of magnitude larger than the entire IPv4 address
      space), it also means that management software that autogenerates MAC
      addresses must have special code to avoid an 0xFE prefix. Now after 7
      years, someone has noticed this restriction and requested that we
      remove it.
      
      So instead of failing when 0xFE is found as the first byte, this patch
      removes the restriction by just replacing the first byte in the tap
      device MAC with 0xFA if the first byte in the guest interface is
      0xFE. 0xFA is the next-highest value that still has 10 as the lowest
      two bits, and still
      
      2) meets the requirement of "tap MAC must be different from guest
         interface MAC", and
      
      3) is high enough that there should never be an issue of the attached
         bridge device taking on the MAC of the tap.
      
      The result is that *any* MAC can be chosen by management software
      (although it would still not work correctly if a multicast MAC (lowest
      bit of first byte set to 1) was chosen), but that's a different
      issue).
      Signed-off-by: NLaine Stump <laine@redhat.com>
      Reviewed-by: Michal Privoznik <mprivozn@redhat.com
      a60ee914
  8. 16 4月, 2019 1 次提交
  9. 14 12月, 2018 1 次提交
    • D
      Remove all Author(s): lines from source file headers · 60046283
      Daniel P. Berrangé 提交于
      In many files there are header comments that contain an Author:
      statement, supposedly reflecting who originally wrote the code.
      In a large collaborative project like libvirt, any non-trivial
      file will have been modified by a large number of different
      contributors. IOW, the Author: comments are quickly out of date,
      omitting people who have made significant contribitions.
      
      In some places Author: lines have been added despite the person
      merely being responsible for creating the file by moving existing
      code out of another file. IOW, the Author: lines give an incorrect
      record of authorship.
      
      With this all in mind, the comments are useless as a means to identify
      who to talk to about code in a particular file. Contributors will always
      be better off using 'git log' and 'git blame' if they need to  find the
      author of a particular bit of code.
      
      This commit thus deletes all Author: comments from the source and adds
      a rule to prevent them reappearing.
      
      The Copyright headers are similarly misleading and inaccurate, however,
      we cannot delete these as they have legal meaning, despite being largely
      inaccurate. In addition only the copyright holder is permitted to change
      their respective copyright statement.
      Reviewed-by: NErik Skultety <eskultet@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      60046283
  10. 20 9月, 2018 2 次提交
  11. 07 8月, 2018 1 次提交
  12. 23 7月, 2018 1 次提交
    • A
      src: Make virStr*cpy*() functions return an int · 6c0d0210
      Andrea Bolognani 提交于
      Currently, the functions return a pointer to the
      destination buffer on success or NULL on failure.
      
      Not only does this kind of error handling look quite
      alien in the context of libvirt, where most functions
      return zero on success and a negative int on failure,
      but it's also somewhat pointless because unless there's
      been a failure the returned pointer will be the same
      one passed in by the user, thus offering no additional
      value.
      
      Change the functions so that they return an int
      instead.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      6c0d0210
  13. 13 7月, 2018 1 次提交
  14. 25 4月, 2018 1 次提交
    • R
      util: improve virNetDevTapGetRealDeviceName · 3b90d0dc
      Roman Bogorodskiy 提交于
      virNetDevTapGetRealDeviceName() is used on FreeBSD because interface
      names (such as one sees in output of tools like ifconfig(8)) might not
      match their /dev entity names, and for bhyve we need the latter.
      
      Current implementation is not very efficient because in order to find
      /dev name, it goes through all /dev/tap* entries and tries to issue
      TAPGIFNAME ioctl on it. Not only this is slow, but also there's a bug in
      this implementation when more than one NIC is passed to a VM: once we
      find the tap interface we're looking for, we set its state to UP because
      opening it for issuing ioctl sets it DOWN, even if it was UP before.
      When we have more than 1 NIC for a VM, we have only last one UP because
      others remain DOWN after unsuccessful attempts to match interface name.
      
      New implementation just uses sysctl(3), so it should be faster and
      won't make interfaces go down to get name.
      Signed-off-by: NRoman Bogorodskiy <bogorodskiy@gmail.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      3b90d0dc
  15. 05 10月, 2017 1 次提交
  16. 16 6月, 2017 1 次提交
  17. 21 4月, 2017 2 次提交
    • M
      Set coalesce settings for domain interfaces · fcef4472
      Martin Kletzander 提交于
      This patch makes use of the virNetDevSetCoalesce() function to make
      appropriate settings effective for devices that support them.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1414627Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      fcef4472
    • P
      util: check ifa_addr pointer before accessing its elements · 42000bf7
      Pavel Hrdina 提交于
      Reported by Rafał Wojciechowski <it@rafalwojciechowski.pl>.
      
      Thread 1 (Thread 0x7f194b99d700 (LWP 5631)):
      0  virNetDevGetifaddrsAddress (addr=0x7f194b99c7c0, ifname=0x7f193400e2b0 "ovirtmgmt") at util/virnetdevip.c:738
      1  virNetDevIPAddrGet (ifname=0x7f193400e2b0 "ovirtmgmt", addr=addr@entry=0x7f194b99c7c0) at util/virnetdevip.c:795
      2  0x00007f19467800d6 in networkGetNetworkAddress (netname=<optimized out>, netaddr=netaddr@entry=0x7f1924013f18) at network/bridge_driver.c:4780
      3  0x00007f193e43a33c in qemuProcessGraphicsSetupNetworkAddress (listenAddr=0x7f19340f7650 "127.0.0.1", glisten=0x7f1924013f10) at qemu/qemu_process.c:4062
      4  qemuProcessGraphicsSetupListen (vm=<optimized out>, graphics=0x7f1924014f10, cfg=0x7f1934119f00) at qemu/qemu_process.c:4133
      5  qemuProcessSetupGraphics (flags=17, vm=0x7f19240155d0, driver=0x7f193411f1d0) at qemu/qemu_process.c:4196
      6  qemuProcessPrepareDomain (conn=conn@entry=0x7f192c00ab50, driver=driver@entry=0x7f193411f1d0, vm=vm@entry=0x7f19240155d0, flags=flags@entry=17) at qemu/qemu_process.c:4969
      7  0x00007f193e4417c0 in qemuProcessStart (conn=conn@entry=0x7f192c00ab50, driver=driver@entry=0x7f193411f1d0, vm=0x7f19240155d0,asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_START, migrateFrom=migrateFrom@entry=0x0, migrateFd=migrateFd@entry=-1, migratePath=migratePath@entry=0x0,snapshot=snapshot@entry=0x0, vmop=vmop@entry=VIR_NETDEV_VPORT_PROFILE_OP_CREATE, flags=17, flags@entry=1) at qemu/qemu_process.c:5553
      
      Man page for getifaddrs also states that the "ifa_addr" may contain
      a null pointer which happens if there is an existing network interface
      on the host without IP address.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      42000bf7
  18. 23 3月, 2017 1 次提交
    • L
      util: new function virNetDevTapAttachBridge() · a4541349
      Laine Stump 提交于
      This patch splits out the part of virNetDevTapCreateInBridgePort()
      that would need to be re-done if an existing tap device had to be
      re-attached to a bridge, and puts it into a separate function. This
      can be used both when an existing domain interface config is updated
      to change its connection, and also to re-attach to the "same" bridge
      when a network has been stopped and restarted. So far it is used for
      nothing.
      a4541349
  19. 08 2月, 2017 1 次提交
    • 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
  20. 09 12月, 2016 1 次提交
  21. 25 6月, 2016 1 次提交
  22. 24 6月, 2016 2 次提交
    • J
      Use virDirOpen · e81de04c
      Ján Tomko 提交于
      Switch from opendir to virDirOpen everywhere we need to report an error.
      e81de04c
    • J
      Introduce VIR_DIR_CLOSE · a4e6f1eb
      Ján Tomko 提交于
      Introduce a helper that only calls closedir if DIR* is non-NULL
      and sets it to NULL afterwards.
      a4e6f1eb
  23. 18 3月, 2015 1 次提交
  24. 15 1月, 2015 1 次提交
  25. 15 11月, 2014 1 次提交
  26. 16 9月, 2014 1 次提交
    • J
      Wire up the interface backend options · b20d39a5
      Ján Tomko 提交于
      Pass the user-specified tun path down when creating tap device
      when called from the qemu driver.
      
      Also honor the vhost device path specified by user.
      b20d39a5
  27. 23 6月, 2014 1 次提交
  28. 29 4月, 2014 1 次提交
    • E
      util: use virDirRead API · ac1d42ac
      Eric Blake 提交于
      In making the conversion to the new API, I fixed a couple bugs:
      virSCSIDeviceGetSgName would leak memory if a directory
      unexpectedly contained multiple entries;
      virNetDevTapGetRealDeviceName could report a spurious error
      from a stale errno inherited before starting the readdir search.
      
      The decision on whether to store the result of virDirRead into
      a variable is based on whether the end of the loop falls through
      to cleanup code automatically.  In some cases, we have loops that
      are documented to return NULL on failure, and which raise an
      error on most failure paths but not in the case where the directory
      was unexpectedly empty; it may be worth a followup patch to
      explicitly report an error if readdir was successful but the
      directory was empty, so that a NULL return always has an error set.
      
      * src/util/vircgroup.c (virCgroupRemoveRecursively): Use new
      interface.
      (virCgroupKillRecursiveInternal, virCgroupSetOwner): Report
      readdir failures.
      * src/util/virfile.c (virFileLoopDeviceOpenSearch)
      (virFileNBDDeviceFindUnused, virFileDeleteTree): Use new
      interface.
      * src/util/virnetdevtap.c (virNetDevTapGetRealDeviceName):
      Properly check readdir errors.
      * src/util/virpci.c (virPCIDeviceIterDevices)
      (virPCIDeviceFileIterate, virPCIGetNetName): Report readdir
      failures.
      (virPCIDeviceAddressIOMMUGroupIterate): Use new interface.
      * src/util/virscsi.c (virSCSIDeviceGetSgName): Report readdir
      failures, and avoid memory leak.
      (virSCSIDeviceGetDevName): Report readdir failures.
      * src/util/virusb.c (virUSBDeviceSearch): Report readdir
      failures.
      * src/util/virutil.c (virGetFCHostNameByWWN)
      (virFindFCHostCapableVport): Report readdir failures.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ac1d42ac
  29. 27 3月, 2014 1 次提交
  30. 25 3月, 2014 1 次提交
  31. 18 3月, 2014 1 次提交
  32. 15 10月, 2013 1 次提交
    • E
      maint: avoid 'const fooPtr' in virnet files · 955af4d4
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up remaining offenders in src/util.
      
      * src/util/virnetdev.h (virNetDevSetMAC)
      (virNetDevReplaceMacAddress, virNetDevValidateConfig)
      (virNetDevReplaceNetConfig): Use intended type.
      * src/util/virnetdevbandwidth.h (virNetDevBandwidthCopy)
      (virNetDevBandwidthPlug): Likewise.
      * src/util/virnetdevmacvlan.h (virNetDevMacVLanCreate)
      (virNetDevMacVLanCreateWithVPortProfile)
      (virNetDevMacVLanDeleteWithVPortProfile)
      (virNetDevMacVLanRestartWithVPortProfile)
      (virNetDevMacVLanVPortProfileRegisterCallback): Likewise.
      * src/util/virnetdevopenvswitch.h (virNetDevOpenvswitchAddPort):
      Likewise.
      * src/util/virnetdevtap.h (virNetDevTapCreateInBridgePort):
      Likewise.
      * src/util/virnetdevvlan.h (virNetDevVlanEqual)
      (virNetDevVlanCopy): Likewise.
      * src/util/virnetdevvportprofile.h
      (virNetDevVPortProfileAssociate)
      (virNetDevVPortProfileDisassociate): Likewise.
      * src/util/virnetlink.h (virNetlinkEventRemoveCallback)
      (virNetlinkEventAddClient, virNetlinkEventRemoveClient):
      Likewise.
      * src/util/virnetdev.c (virNetDevSetMAC)
      (virNetDevReplaceMacAddress, virNetDevValidateConfig)
      (virNetDevReplaceNetConfig): Fix fallout.
      * src/util/virnetdevbandwidth.c (virNetDevBandwidthCopy)
      (virNetDevBandwidthPlug): Likewise.
      * src/util/virnetdevmacvlan.c (virNetDevMacVLanCreate)
      (virNetDevMacVLanCreateWithVPortProfile)
      (virNetDevMacVLanDeleteWithVPortProfile)
      (virNetDevMacVLanRestartWithVPortProfile)
      (virNetDevMacVLanVPortProfileRegisterCallback): Likewise.
      * src/util/virnetdevopenvswitch.c (virNetDevOpenvswitchAddPort):
      Likewise.
      * src/util/virnetdevtap.c (virNetDevTapCreateInBridgePort):
      Likewise.
      * src/util/virnetdevvlan.c (virNetDevVlanEqual)
      (virNetDevVlanCopy): Likewise.
      * src/util/virnetdevvportprofile.c
      (virNetDevVPortProfileAssociate)
      (virNetDevVPortProfileDisassociate)
      (virNetDevVPortProfileOpSetLink, virNetDevVPortProfileOpCommon)
      (virNetDevVPortProfileOp8021Qbg, virNetDevVPortProfileOp8021Qbh):
      Likewise.
      * src/util/virnetlink.c (virNetlinkEventRemoveCallback)
      (virNetlinkEventAddClient, virNetlinkEventRemoveClient):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      955af4d4
  33. 03 9月, 2013 1 次提交
    • M
      qemu: Handle huge number of queues correctly · 1dc5dea7
      Michal Privoznik 提交于
      Currently, kernel supports up to 8 queues for a multiqueue tap device.
      However, if user tries to enter a huge number (e.g. one million) the tap
      allocation fails, as expected. But what is not expected is the log full
      of warnings:
      
          warning : virFileClose:83 : Tried to close invalid fd 0
      
      The problem is, upon error we iterate over an array of FDs (handlers to
      queues) and VIR_FORCE_CLOSE() over each item. However, the array is
      pre-filled with zeros. Hence, we repeatedly close stdin. Ouch.
      But there's more. The queues allocation is done in virNetDevTapCreate()
      which cleans up the FDs in case of error. Then, its caller, the
      virNetDevTapCreateInBridgePort() iterates over the FD array and tries to
      close them too. And so does qemuNetworkIfaceConnect() and
      qemuBuildInterfaceCommandLine().
      1dc5dea7
  34. 11 7月, 2013 1 次提交
  35. 10 7月, 2013 1 次提交