1. 09 12月, 2016 1 次提交
  2. 25 6月, 2016 1 次提交
  3. 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
  4. 18 3月, 2015 1 次提交
  5. 15 1月, 2015 1 次提交
  6. 15 11月, 2014 1 次提交
  7. 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
  8. 23 6月, 2014 1 次提交
  9. 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
  10. 27 3月, 2014 1 次提交
  11. 25 3月, 2014 1 次提交
  12. 18 3月, 2014 1 次提交
  13. 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
  14. 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
  15. 11 7月, 2013 1 次提交
  16. 10 7月, 2013 1 次提交
  17. 28 6月, 2013 1 次提交
  18. 14 6月, 2013 1 次提交
  19. 24 5月, 2013 1 次提交
  20. 23 5月, 2013 1 次提交
  21. 22 5月, 2013 1 次提交
    • M
      qemu: Adapt qemuBuildInterfaceCommandLine to to multiqueue net · 1f24f682
      Michal Privoznik 提交于
      In order to learn libvirt multiqueue several things must be done:
      
      1) The '/dev/net/tun' device needs to be opened multiple times with
      IFF_MULTI_QUEUE flag passed to ioctl(fd, TUNSETIFF, &ifr);
      
      2) Similarly, '/dev/vhost-net' must be opened as many times as in 1)
      in order to keep 1:1 ratio recommended by qemu and kernel folks.
      
      3) The command line construction code needs to switch from 'fd=X' to
      'fds=X:Y:...:Z' and from 'vhostfd=X' to 'vhostfds=X:Y:...:Z'.
      
      4) The monitor handling code needs to learn to pass multiple FDs.
      1f24f682
  22. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  23. 30 4月, 2013 1 次提交
    • E
      build: mark conditionally unused variables · b376dea9
      Eric Blake 提交于
      These fixes solve a compilation failure on FreeBSD:
      
      util/virnetdevtap.c: In function 'virNetDevTapGetName':
      util/virnetdevtap.c:56: warning: unused parameter 'tapfd' [-Wunused-parameter]
      util/virnetdevtap.c:56: warning: unused parameter 'ifname' [-Wunused-parameter]
      
      * src/util/virnetdevtap.c (virNetDevTapGetName): Add attributes
      when TUNGETIFF is not present.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b376dea9
  24. 27 4月, 2013 1 次提交
  25. 17 4月, 2013 1 次提交
    • O
      cleanup: Remove the duplicate header · bc95be5d
      Osier Yang 提交于
      Detected by a simple Shell script:
      
      for i in $(git ls-files -- '*.[ch]'); do
          awk 'BEGIN {
              fail=0
          }
          /# *include.*\.h/{
              match($0, /["<][^">]*[">]/)
              arr[substr($0, RSTART+1, RLENGTH-2)]++
          }
          END {
              for (key in arr) {
                  if (arr[key] > 1) {
                      fail=1
                      printf("%d %s\n", arr[key], key)
                  }
              }
              if (fail == 1)
                  exit 1
          }' $i
      
          if test $? != 0; then
              echo "Duplicate header(s) in $i"
          fi
      done;
      
      A later patch will add the syntax-check to avoid duplicate
      headers.
      bc95be5d
  26. 02 4月, 2013 1 次提交
  27. 21 12月, 2012 4 次提交
  28. 28 9月, 2012 1 次提交
    • B
      network: fix dnsmasq/radvd binding to IPv6 on recent kernels · db488c79
      Benjamin Cama 提交于
      I hit this problem recently when trying to create a bridge with an IPv6
      address on a 3.2 kernel: dnsmasq (and, further, radvd) would not bind to
      the given address, waiting 20s and then giving up with -EADDRNOTAVAIL
      (resp. exiting immediately with "error parsing or activating the config
      file", without libvirt noticing it, BTW). This can be reproduced with (I
      think) any kernel >= 2.6.39 and the following XML (to be used with
      "virsh net-create"):
      
              <network>
                <name>test-bridge</name>
                <bridge name='testbr0' />
                <ip family='ipv6' address='fd00::1' prefix='64'>
                </ip>
              </network>
      
      (it happens even when you have an IPv4, too)
      
      The problem is that since commit [1] (which, ironically, was made to
      “help IPv6 autoconfiguration”) the linux bridge code makes bridges
      behave like “real” devices regarding carrier detection. This makes the
      bridges created by libvirt, which are started without any up devices,
      stay with the NO-CARRIER flag set, and thus prevents DAD (Duplicate
      address detection) from happening, thus letting the IPv6 address flagged
      as “tentative”. Such addresses cannot be bound to (see RFC 2462), so
      dnsmasq fails binding to it (for radvd, it detects that "interface XXX
      is not RUNNING", thus that "interface XXX does not exist, ignoring the
      interface" (sic)). It seems that this behavior was enhanced somehow with
      commit [2] by avoiding setting NO-CARRIER on empty bridges, but I
      couldn't reproduce this behavior on my kernel. Anyway, with the “dummy
      tap to set MAC address” trick, this wouldn't work.
      
      To fix this, the idea is to get the bridge's attached device to be up so
      that DAD can happen (deactivating DAD altogether is not a good idea, I
      think). Currently, libvirt creates a dummy TAP device to set the MAC
      address of the bridge, keeping it down. But even if we set this device
      up, it is not RUNNING as soon as the tap file descriptor attached to it
      is closed, thus still preventing DAD. So, we must modify the API a bit,
      so that we can get the fd, keep the tap device persistent, run the
      daemons, and close it after DAD has taken place. After that, the bridge
      will be flagged NO-CARRIER again, but the daemons will be running, even
      if not happy about the device's state (but we don't really care about
      the bridge's daemons doing anything when no up interface is connected to
      it).
      
      Other solutions that I envisioned were:
            * Keeping the *-nic interface up: this would waste an fd for each
              bridge during all its life. May be acceptable, I don't really
              know.
            * Stop using the dummy tap trick, and set the MAC address directly
              on the bridge: it is possible since quite some time it seems,
              even if then there is the problem of the bridge not being
              RUNNING when empty, contrary to what [2] says, so this will need
              fixing (and this fix only happened in 3.1, so it wouldn't work
              for 2.6.39)
            * Using the --interface option of dnsmasq, but I saw somewhere
              that it's not used by libvirt for backward compatibility. I am
              not sure this would solve this problem, though, as I don't know
              how dnsmasq binds itself to it with this option.
      
      This is why this patch does what's described earlier.
      
      This patch also makes radvd start even if the interface is
      “missing” (i.e. it is not RUNNING), as it daemonizes before binding to
      it, and thus sometimes does it after the interface has been brought down
      by us (by closing the tap fd), and then originally stops. This also
      makes it stop yelling about it in the logs when the interface is down at
      a later time.
      
      [1]
      http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=1faa4356a3bd89ea11fb92752d897cff3a20ec0e
      [2]
      http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=b64b73d7d0c480f75684519c6134e79d50c1b341
      db488c79
  29. 21 9月, 2012 1 次提交
  30. 07 9月, 2012 1 次提交
    • E
      build: improved handling of <execinfo.h>, BSD <net/if.h> · ccaf0bee
      Eric Blake 提交于
      FreeBSD and OpenBSD have a <net/if.h> that is not self-contained;
      and mingw lacks the header altogether.  But gnulib has just taken
      care of that for us, so we might as well simplify our code.  In
      the process, I got a syntax-check failure if we don't also take
      the gnulib execinfo module.
      
      * .gnulib: Update to latest, for execinfo and net_if.
      * bootstrap.conf (gnulib_modules): Add execinfo and net_if modules.
      * configure.ac: Let gnulib check for headers.  Simplify check for
      'struct ifreq', while also including enough prereq headers.
      * src/internal.h (IF_NAMESIZE): Drop, now that gnulib guarantees it.
      * src/nwfilter/nwfilter_learnipaddr.h: Use correct header for
      IF_NAMESIZE.
      * src/util/virnetdev.c (includes): Assume <net/if.h> exists.
      * src/util/virnetdevbridge.c (includes): Likewise.
      * src/util/virnetdevtap.c (includes): Likewise.
      * src/util/logging.c (includes): Assume <execinfo.h> exists.
      (virLogStackTraceToFd): Handle gnulib's fallback implementation.
      ccaf0bee
  31. 17 8月, 2012 1 次提交
  32. 25 7月, 2012 1 次提交
  33. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  34. 18 7月, 2012 2 次提交
  35. 17 7月, 2012 1 次提交
    • S
      Convert 'raw MAC address' usages to use virMacAddr · 387117ad
      Stefan Berger 提交于
      Introduce new members in the virMacAddr 'class'
      - virMacAddrSet: set virMacAddr from a virMacAddr
      - virMacAddrSetRaw: setting virMacAddr from raw 6 byte MAC address buffer
      - virMacAddrGetRaw: writing virMacAddr into raw 6 byte MAC address buffer
      - virMacAddrCmp: comparing two virMacAddr
      - virMacAddrCmpRaw: comparing a virMacAddr with a raw 6 byte MAC address buffer
      
      then replace raw MAC addresses by replacing
      
      - 'unsigned char *' with virMacAddrPtr
      - 'unsigned char ... [VIR_MAC_BUFLEN]' with virMacAddr
      
      and introduce usage of above functions where necessary.
      387117ad