1. 08 4月, 2014 1 次提交
  2. 25 3月, 2014 1 次提交
  3. 18 3月, 2014 1 次提交
  4. 13 3月, 2014 2 次提交
  5. 11 2月, 2014 1 次提交
    • L
      build: correctly check for SOICGIFVLAN GET_VLAN_VID_CMD command · 0144d729
      Laine Stump 提交于
      In order to make a client-only build successful on RHEL4 (yes, you
      read that correctly!), commit 3ed2e545 modified src/util/virnetdev.c so
      that the functional version of virNetDevGetVLanID() was only compiled
      if GET_VLAN_VID_CMD was defined. However, it is *never* defined, but
      is only an enum value, so the proper version was no longer compiled
      even on platforms that support it. This resulted in the vlan tag not
      being properly set for guest traffic on VEPA mode guest macvtap
      interfaces that were bound to a vlan interface (that's the only place
      that libvirt currently uses virNetDevGetVLanID)
      
      Since there is no way to compile conditionally based on the presence
      of an enum value, this patch modifies configure.ac to check for said
      enum value with AC_CHECK_DECLS(), which #defines
      HAVE_DECL_GET_VLAN_VID_CMD to 1 if it's successful compiling a test
      program that uses GET_VLAN_VID_CMD (and still #defines it, but to 0,
      if it's not successful).  We can then make the compilation of
      virNetDevGetVLanID() conditional on the value of
      HAVE_DECL_GET_VLAN_VID_CMD.
      0144d729
  6. 08 11月, 2013 1 次提交
  7. 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
  8. 22 8月, 2013 1 次提交
  9. 18 7月, 2013 1 次提交
    • J
      virAsprintf: correctly check return value · 23e938ee
      Ján Tomko 提交于
      When virAsprintf was changed from a function to a macro
      reporting OOM error in dc6f2dad, it was documented as returning
      0 on success. This is incorrect, it returns the number of bytes
      written as asprintf does.
      
      Some of the functions were converted to use virAsprintf's return
      value directly, changing the return value on success from 0 to >= 0.
      
      For most of these, this is not a problem, but the change in
      virPCIDriverDir breaks PCI passthrough.
      
      The return value check in virhashtest pre-dates virAsprintf OOM
      conversion.
      
      vmwareMakePath seems to be unused.
      23e938ee
  10. 11 7月, 2013 1 次提交
  11. 10 7月, 2013 1 次提交
  12. 01 7月, 2013 1 次提交
    • L
      pci: initialize virtual_functions array pointer to avoid segfault · 2c2525ab
      Laine Stump 提交于
      This fixes https://bugzilla.redhat.com/show_bug.cgi?id=971325
      
      The problem was that if virPCIGetVirtualFunctions was given the name
      of a non-existent interface, it would return to its caller without
      initializing the pointer to the array of virtual functions to NULL,
      and the caller (virNetDevGetVirtualFunctions) would try to VIR_FREE()
      the invalid pointer.
      
      The final error message before the crash would be:
      
       virPCIGetVirtualFunctions:2088 :
        Failed to open dir '/sys/class/net/eth2/device':
        No such file or directory
      
      In this patch I move the initialization in virPCIGetVirtualFunctions()
      to the begining of the function, and also do an explicit
      initialization in virNetDevGetVirtualFunctions, just in case someone
      in the future adds code into that function prior to the call to
      virPCIGetVirtualFunctions.
      2c2525ab
  13. 22 6月, 2013 1 次提交
  14. 14 6月, 2013 1 次提交
  15. 06 6月, 2013 1 次提交
  16. 14 5月, 2013 1 次提交
    • G
      Support for static routes on a virtual bridge · ccff335f
      Gene Czarcinski 提交于
      network: static route support for <network>
      
      This patch adds the <route> subelement of <network> to define a static
      route.  the address and prefix (or netmask) attribute identify the
      destination network, and the gateway attribute specifies the next hop
      address (which must be directly reachable from the containing
      <network>) which is to receive the packets destined for
      "address/(prefix|netmask)".
      
      These attributes are translated into an "ip route add" command that is
      executed when the network is started. The command used is of the
      following form:
      
        ip route add <address>/<prefix> via <gateway> \
                     dev <virbr-bridge> proto static metric <metric>
      
      Tests are done to validate that the input data are correct.  For
      example, for a static route ip definition, the address must be a
      network address and not a host address.  Additional checks are added
      to ensure that the specified gateway is directly reachable via this
      network (i.e. that the gateway IP address is in the same subnet as one
      of the IP's defined for the network).
      
      prefix='0' is supported for both family='ipv4' address='0.0.0.0'
      netmask='0.0.0.0' or prefix='0', and for family='ipv6' address='::',
      prefix=0', although care should be taken to not override a desired
      system default route.
      
      Anytime an attempt is made to define a static route which *exactly*
      duplicates an existing static route (for example, address=::,
      prefix=0, metric=1), the following error message will be sent to
      syslog:
      
          RTNETLINK answers: File exists
      
      This can be overridden by decreasing the metric value for the route
      that should be preferred, or increasing the metric for the route that
      shouldn't be preferred (and is thus in place only in anticipation that
      the preferred route may be removed in the future).  Caution should be
      used when manipulating route metrics, especially for a default route.
      
      Note: The use of the command-line interface should be replaced by
      direct use of libnl so that error conditions can be handled better.  But,
      that is being left as an exercise for another day.
      Signed-off-by: NGene Czarcinski <gene@czarc.net>
      Signed-off-by: NLaine Stump <laine@laine.org>
      ccff335f
  17. 11 5月, 2013 1 次提交
  18. 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
  19. 01 5月, 2013 1 次提交
  20. 30 4月, 2013 1 次提交
    • R
      portability: handle ifreq differences in virnetdev · 5295e35f
      Roman Bogorodskiy 提交于
      FreeBSD (and maybe other BSDs) have different member
      names in struct ifreq when compared to Linux, such as:
      
       - uses ifr_data instead of ifr_newname for setting
         interface names
       - uses ifr_index instead of ifr_ifindex for interface
         index
      
      Also, add a check for SIOCGIFHWADDR for virNetDevValidateConfig().
      
      Use AF_LOCAL if AF_PACKET is not available.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      5295e35f
  21. 08 4月, 2013 1 次提交
    • D
      Avoid casts between unsigned char * and struct nlmsghdr · e95de74d
      Daniel P. Berrange 提交于
      The virNetlinkCommand() method takes an 'unsigned char **'
      parameter to be filled with the received netlink message.
      The callers then immediately cast this to 'struct nlmsghdr',
      triggering (bogus) warnings about increasing alignment
      requirements
      
      util/virnetdev.c: In function 'virNetDevLinkDump':
      util/virnetdev.c:1300:12: warning: cast increases required alignment of target type [-Wcast-align]
           resp = (struct nlmsghdr *)*recvbuf;
                  ^
      util/virnetdev.c: In function 'virNetDevSetVfConfig':
      util/virnetdev.c:1429:12: warning: cast increases required alignment of target type [-Wcast-align]
           resp = (struct nlmsghdr *)recvbuf;
      
      Since all callers cast to 'struct nlmsghdr' we can avoid
      the warning problem entirely by simply changing the
      signature of virNetlinkCommand to return a 'struct nlmsghdr **'
      instead of 'unsigned char **'. The way we do the cast inside
      virNetlinkCommand does not have any alignment issues.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e95de74d
  22. 08 3月, 2013 1 次提交
  23. 06 2月, 2013 1 次提交
  24. 23 1月, 2013 1 次提交
  25. 22 12月, 2012 1 次提交
    • L
      util: fix botched check for new netlink request filters · 7c366506
      Laine Stump 提交于
      This is an adjustment to the fix for
      
        https://bugzilla.redhat.com/show_bug.cgi?id=889319
      
      to account for two bonehead mistakes I made.
      
      commit ac2797cf attempted to fix a
      problem with netlink in newer kernels requiring an extra attribute
      with a filter flag set in order to receive an IFLA_VFINFO_LIST from
      netlink. Unfortunately, the #ifdef that protected against compiling it
      in on systems without the new flag went a bit too far, assuring that
      the new code would *never* be compiled, and even if it had, the code
      was incorrect.
      
      The first problem was that, while some IFLA_* enum values are also
      their existence at compile time, IFLA_EXT_MASK *isn't* #defined, so
      checking to see if it's #defined is not a valid method of determining
      whether or not to add the attribute. Fortunately, the flag that is
      being set (RTEXT_FILTER_VF) *is* #defined, and it is never present if
      IFLA_EXT_MASK isn't, so it's sufficient to just check for that flag.
      
      And to top it off, due to the code not actually compiling when I
      thought it did, I didn't realize that I'd been given the wrong arglist
      to nla_put() - you can't just send a const value to nla_put, you have
      to send it a pointer to memory containing what you want to add to the
      message, along with the length of that memory.
      
      This time I've actually sent the patch over to the other machine
      that's experiencing the problem, applied it to the branch being used
      (0.10.2) and verified that it works properly, i.e. it does fix the
      problem it's supposed to fix. :-/
      7c366506
  26. 21 12月, 2012 7 次提交
    • D
      f24404a3
    • D
      Rename pci.{c,h} to virpci.{c,h} · 3ddddd98
      Daniel P. Berrange 提交于
      3ddddd98
    • D
      Rename memory.{c,h} to viralloc.{c,h} · ab9b7ec2
      Daniel P. Berrange 提交于
      ab9b7ec2
    • D
      Rename logging.{c,h} to virlog.{c,h} · 936d95d3
      Daniel P. Berrange 提交于
      936d95d3
    • D
      Rename command.{c,h} to vircommand.{c,h} · 04d9510f
      Daniel P. Berrange 提交于
      04d9510f
    • L
      util: fix functions that retrieve SRIOV VF info · ac2797cf
      Laine Stump 提交于
      This patch resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=889319
      
      When assigning an SRIOV virtual function to a guest using "intelligent
      PCI passthrough" (<interface type='hostdev'>, which sets the MAC
      address and vlan tag of the VF before passing its info to qemu),
      libvirt first learns the current MAC address and vlan tag by sending
      an NLM_F_REQUEST message for the VF's PF (physical function) to the
      kernel via a NETLINK_ROUTE socket (see virNetDevLinkDump()); the
      response message's IFLA_VFINFO_LIST section is examined to extract the
      info for the particular VF being assigned.
      
      This worked fine with kernels up until kernel commit
      115c9b81928360d769a76c632bae62d15206a94a (first appearing in upstream
      kernel 3.3) which changed the ABI to not return IFLA_VFINFO_LIST in
      the response until a newly introduced IFLA_EXT_MASK field was included
      in the request, with the (newly introduced, of course) RTEXT_FILTER_VF
      flag set.
      
      The justification for this ABI change was that new fields had been
      added to the VFINFO, causing NLM_F_REQUEST messages to fail on systems
      with large numbers of VFs if the requesting application didn't have a
      large enough buffer for all the info. The idea is that most
      applications doing an NLM_F_REQUEST don't care about VFINFO anyway, so
      eliminating it from the response would lower the requirements on
      buffer size. Apparently, the people who pushed this patch made the
      mistaken assumption that iproute2 (the "ip" command) was the only
      package that used IFLA_VFINFO_LIST, so it wouldn't break anything else
      (and they made sure that iproute2 was fixed.
      
      The logic of this "fix" is debatable at best (one could claim that the
      proper fix would be for the applications in question to be fixed so
      that they properly sized the buffer, which is what libvirt does
      (purely by virtue of using libnl), but it is what it is and we have to
      deal with it.
      
      In order for <interface type='hostdev'> to work properly on systems
      with a kernel 3.3 or later, libvirt needs to add the afore-mentioned
      IFLA_EXT_MASK field with RTEXT_FILTER_VF set.
      
      Of course we also need to continue working on systems with older
      kernels, so that one bit of code is compiled conditionally. The one
      time this could cause problems is if the libvirt binary was built on a
      system without IFLA_EXT_MASK which was subsequently updated to a
      kernel that *did* have it. That could be solved by manually providing
      the values of IFLA_EXT_MASK and RTEXT_FILTER_VF and adding it to the
      message anyway, but I'm uncertain what that might actually do on a
      system that didn't support the message, so for the time being we'll
      just fail in that case (which will very likely never happen anyway).
      ac2797cf
    • L
      util: add missing error log messages when failing to get netlink VFINFO · 846770e5
      Laine Stump 提交于
      This patch fixes the lack of error messages when libvirt fails to find
      VFINFO in a returned netlinke response message.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=827519#c10 is an example
      of the error message that was previously logged when the
      IFLA_VFINFO_LIST object was missing from the netlink response. The
      reason for this failure is detailed in
      
         https://bugzilla.redhat.com/show_bug.cgi?id=889319
      
      Even though that root problem has been fixed, the experience of
      finding the root cause shows us how important it is to properly log an
      error message in these cases. This patch *seems* to replace the entire
      function, but really most of the changes are due to moving code that
      was previously inside an if() statement out to the top level of the
      function (the original if() was reversed and made to log an error and
      return).
      846770e5
  27. 21 9月, 2012 1 次提交
  28. 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
  29. 22 8月, 2012 1 次提交
  30. 18 8月, 2012 1 次提交
  31. 16 8月, 2012 1 次提交
    • L
      util: properly save/restore original vlan tag for VFs · e979226b
      Laine Stump 提交于
      When a network device that is a VF of an SR-IOV card was assigned to a
      guest using <interface type='hostdev'>, only the MAC address was being
      saved/restored, but the VLAN tag was left untouched. Up to now we
      haven't actually used vlan tags on SR-IOV devices, so the guest would
      have used whatever was set, and left it the same at the end.
      
      The patch following this one will hook up the <vlan> element from the
      interface config, so save/restore of the device state needs to also
      include the vlan tag.
      
      MAC address is being saved as a simple ASCII string in a file named
      for the device under /var/run.  The VLAN tag is now just added at the
      end of that file, after a newline. It might be nicer if the file was
      XML (in case it ever gets more complicated) but at the moment there's
      nothing else on the horizon, and this makes backward compatibility
      easier.
      e979226b
  32. 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
  33. 19 7月, 2012 1 次提交
    • E
      build: fix compilation without struct ifreq · 68a97bd8
      Eric Blake 提交于
      Detected on Cygwin.  Broken in commit 387117ad.
      
      * src/util/virnetdev.c (virNetDevValidateConfig)
      (virNetDevReplaceNetConfig): Fix prototypes.
      * src/util/virnetlink.c (virNetlinkEventAddClient)
      (virNetlinkEventRemoveClient): Likewise.
      68a97bd8