1. 10 11月, 2011 5 次提交
    • D
      Expose MTU management APIs · dfb454ce
      Daniel P. Berrange 提交于
      The MTU management APIs are useful to other code inside libvirt,
      so should be exposed as non-static APIs.
      
      * src/util/bridge.c, src/util/bridge.h: Expose virNetDevSetMTU,
        virNetDevSetMTUFromDevice & virNetDevGetMTU
      dfb454ce
    • D
      Turn two int parameters into bools in bridge APIs · d8a62d95
      Daniel P. Berrange 提交于
      * src/util/bridge.c, src/util/bridge.h: s/int/bool/ in
        virNetDevSetOnline and virNetDevBridgeSetSTP
      d8a62d95
    • D
      Rename all brXXXX APIs to follow new convention · dced27c8
      Daniel P. Berrange 提交于
      The existing brXXX APIs in src/util/bridge.h are renamed to
      follow one of three different conventions
      
       - virNetDevXXX       - operations for any type of interface
       - virNetDevBridgeXXX - operations for bridge interfaces
       - virNetDevTapXXX    - operations for tap interfaces
      
      * src/util/bridge.h, src/util/bridge.c: Rename all APIs
      * src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/qemu/qemu_command.c, src/uml/uml_conf.c,
        src/uml/uml_driver.c: Update for API renaming
      dced27c8
    • D
      Make all brXXX APIs raise errors, instead of returning errnos · 4f4fd8f7
      Daniel P. Berrange 提交于
      Currently every caller of the brXXX APIs has to store the returned
      errno value and then raise an error message. This results in
      inconsistent error messages across drivers, additional burden on
      the callers and makes the error reporting inaccurate since it is
      hard to distinguish different scenarios from 1 errno value.
      
      * src/util/bridge.c: Raise errors instead of returning errnos
      * src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/qemu/qemu_command.c, src/uml/uml_conf.c,
        src/uml/uml_driver.c: Remove error reporting code
      4f4fd8f7
    • D
      Remove 'brControl' object · 6cfeb9a7
      Daniel P. Berrange 提交于
      The bridge management APIs in src/util/bridge.c require a brControl
      object to be passed around. This holds the file descriptor for the
      control socket. This extra object complicates use of the API for
      only a minor efficiency gain, which is in turn entirely offset by
      the need to fork/exec the brctl command for STP configuration.
      
      This patch removes the 'brControl' object entirely, instead opening
      the control socket & closing it again within the scope of each method.
      
      The parameter names for the APIs are also made to consistently use
      'brname' for bridge device name, and 'ifname' for an interface
      device name. Finally annotations are added for non-NULL parameters
      and return check validation
      
      * src/util/bridge.c, src/util/bridge.h: Remove brControl object
        and update API parameter names & annotations.
      * src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/uml/uml_conf.h, src/uml/uml_conf.c, src/uml/uml_driver.c,
        src/qemu/qemu_command.c, src/qemu/qemu_conf.h,
        src/qemu/qemu_driver.c: Remove reference to 'brControl' object
      6cfeb9a7
  2. 02 11月, 2011 1 次提交
    • W
      fix crash when starting network · 7ab1c25c
      Wen Congyang 提交于
      commit 27908453 introduces a regression, and it will
      cause libvirt crashed when starting network.
      
      The reason is that tapfd may be NULL, but we dereference
      it without checking whether it is NULL.
      7ab1c25c
  3. 28 10月, 2011 1 次提交
    • T
      bridge: modify for use when sVirt is enabled with qemu · 27908453
      Tyler Coumbes 提交于
      This refactors the TAP creation code out of brAddTap into a new
      function brCreateTap to allow it to be used on its own. I have also
      changed ifSetInterfaceMac to brSetInterfaceMac and exported it since
      it is will be needed by code outside of util/bridge.c in the next
      patch.
      
       AUTHORS                 |    1 +
       src/libvirt_bridge.syms |    2 +
       src/util/bridge.c       |  116 +++++++++++++++++++++++++++++++----------------
       src/util/bridge.h       |    9 ++++
       4 files changed, 89 insertions(+), 39 deletions(-)
      27908453
  4. 22 7月, 2011 1 次提交
    • E
      build: rename files.h to virfile.h · 8e22e089
      Eric Blake 提交于
      In preparation for a future patch adding new virFile APIs.
      
      * src/util/files.h, src/util/files.c: Move...
      * src/util/virfile.h, src/util/virfile.c: ...here, and rename
      functions to virFile prefix.  Macro names are intentionally
      left alone.
      * *.c: All '#include "files.h"' uses changed.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
      * src/libvirt_private.syms: Likewise.
      * docs/hacking.html.in: Likewise.
      * HACKING: Regenerate.
      8e22e089
  5. 14 7月, 2011 1 次提交
    • E
      build: don't hand-roll cloexec code · ff98359d
      Eric Blake 提交于
      No need to repeat common code.
      
      * bootstrap.conf (gnulib_modules): Import calloc-posix.
      * src/util/bridge.c (brInit): Use virSetCloseExec.
      (brSetInterfaceUp): Adjust flags name.
      * src/uml/uml_driver.c (umlSetCloseExec): Delete.
      (umlStartVMDaemon): Use util version instead.
      ff98359d
  6. 12 5月, 2011 2 次提交
    • E
      maint: omit translation for all VIR_INFO · cb84580a
      Eric Blake 提交于
      We were 31/73 on whether to translate; since less than 50% translated
      and since VIR_INFO is less than VIR_WARN which also doesn't translate,
      this makes sense.
      
      * cfg.mk (sc_prohibit_gettext_markup): Add VIR_INFO, since it
      falls between WARN and DEBUG.
      * daemon/libvirtd.c (qemudDispatchSignalEvent, remoteCheckAccess)
      (qemudDispatchServer): Adjust offenders.
      * daemon/remote.c (remoteDispatchAuthPolkit): Likewise.
      * src/network/bridge_driver.c (networkReloadIptablesRules)
      (networkStartNetworkDaemon, networkShutdownNetworkDaemon)
      (networkCreate, networkDefine, networkUndefine): Likewise.
      * src/qemu/qemu_driver.c (qemudDomainDefine)
      (qemudDomainUndefine): Likewise.
      * src/storage/storage_driver.c (storagePoolCreate)
      (storagePoolDefine, storagePoolUndefine, storagePoolStart)
      (storagePoolDestroy, storagePoolDelete, storageVolumeCreateXML)
      (storageVolumeCreateXMLFrom, storageVolumeDelete): Likewise.
      * src/util/bridge.c (brProbeVnetHdr): Likewise.
      * po/POTFILES.in: Drop src/util/bridge.c.
      cb84580a
    • L
      libvirt,logging: cleanup VIR_XXX0() · b65f37a4
      Lai Jiangshan 提交于
      These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
      
      How do these coversions works? The magic is using the gcc extension of ##.
      When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to
      avoid compile error.
      
      example: origin				after CPP
      	high_level_api("%d", a_int)	low_level_api("%d", a_int)
      	high_level_api("a  string")	low_level_api("a  string")
      
      About 400 conversions.
      
      8 special conversions:
      VIR_XXXX0("") -> VIR_XXXX("msg") (avoid empty format) 2 conversions
      VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions
      VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal)
        (for security) 6 conversions
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      b65f37a4
  7. 18 2月, 2011 1 次提交
    • L
      Allow brAddTap to create a tap device that is down · 13ae7a02
      Laine Stump 提交于
      An upcoming patch has a use for a tap device to be created that
      doesn't need to be actually put into the "up" state, and keeping it
      "down" keeps the output of ifconfig from being unnecessarily cluttered
      (ifconfig won't show down interfaces unless you add "-a").
      
      bridge.[ch]: add "up" as an arg to brAddTap()
      uml_conf.c, qemu_command.c: add "up" (set to "true") to brAddTap() call.
      13ae7a02
  8. 01 1月, 2011 1 次提交
    • L
      Set broadcast address for IPv4 addresses on virtual network bridges · 2eeeb601
      Laine Stump 提交于
      Previously we used ioctl() to set the IP address and netmask of the
      bridges used for virtual networks, and apparently the SIOCSIFNETMASK
      ioctl implicitly set the broadcast address for the interface. The new
      method of using the "ip" command requires broadcast address to be
      explicitly specified though.
      2eeeb601
  9. 24 12月, 2010 2 次提交
    • J
      bridge: Fix uninitialized variable · 0ecac8aa
      Jiri Denemark 提交于
      0ecac8aa
    • L
      Replace brSetInetAddress/brSetInetNetmask with brAddInetAddress · 20718b8b
      Laine Stump 提交于
      brSetInetAddress can only set a single IP address on the bridge, and
      uses a method (ioctl(SIOCSETIFADDR)) that only works for IPv4. Replace
      it and brSetInetNetmask with a single function that uses the external
      "ip addr add" command to add an address/prefix to the interface - this
      supports IPv6, and allows adding multiple addresses to the interface.
      
      Although it isn't currently used in the code, we also add a
      brDelInetAddress for completeness' sake.
      
      Also, while we're modifying bridge.c, we change brSetForwardDelay and
      brSetEnableSTP to use the new virCommand API rather than the
      deprecated virRun, and also log an error message in bridge_driver.c if
      either of those fail (previously the failure would be completely
      silent).
      20718b8b
  10. 10 11月, 2010 1 次提交
    • S
      bye to close(), welcome to VIR_(FORCE_)CLOSE() · 60ae1c34
      Stefan Berger 提交于
      Using automated replacement with sed and editing I have now replaced all
      occurrences of close() with VIR_(FORCE_)CLOSE() except for one, of
      course. Some replacements were straight forward, others I needed to pay
      attention. I hope I payed attention in all the right places... Please
      have a look. This should have at least solved one more double-close
      error.
      60ae1c34
  11. 22 10月, 2010 2 次提交
    • D
      Convert virNetwork to use virSocketAddr everywhere · 090404ac
      Daniel P. Berrange 提交于
      Instead of storing the IP address string in virNetwork related
      structs, store the parsed virSocketAddr. This will make it
      easier to add IPv6 support in the future, by letting driver
      code directly check what address family is present
      
      * src/conf/network_conf.c, src/conf/network_conf.h,
        src/network/bridge_driver.c: Convert to use virSocketAddr
        in virNetwork, instead of char *.
      * src/util/bridge.c, src/util/bridge.h,
        src/util/dnsmasq.c, src/util/dnsmasq.h,
        src/util/iptables.c, src/util/iptables.h: Convert to
        take a virSocketAddr instead of char * for any IP
        address parameters
      * src/util/network.h: Add macros to determine if an address
        is set, and what address family is set.
      090404ac
    • D
      Remove all use of inet_pton and inet_ntop · a8ae7d19
      Daniel P. Berrange 提交于
      The  inet_pton and inet_ntop functions are obsolete, replaced
      by getaddrinfo+getnameinfo with the AI_NUMERICHOST flag set.
      These can be accessed via the virSocket APIs.
      
      The bridge.c code had methods for fetching the IP address of
      a bridge which used inet_ntop. Aside from the use of inet_ntop
      these methods are broken, because a NIC can have multiple
      addresses and this only returns one address. Since the methods
      are never used, just remove them.
      
      * src/conf/network_conf.c, src/nwfilter/nwfilter_learnipaddr.c:
        Replace inet_pton and inet_ntop with virSocket APIs
      * src/util/bridge.c, src/util/bridge.h: Remove unused methods
        which called inet_ntop.
      a8ae7d19
  12. 15 8月, 2010 1 次提交
  13. 23 7月, 2010 1 次提交
    • D
      Set a stable & high MAC addr for guest TAP devices on host · 6ea90b84
      Daniel P. Berrange 提交于
      A Linux software bridge will assume the MAC address of the enslaved
      interface with the numerically lowest MAC addr. When the bridge
      changes MAC address there is a period of network blackout, so a
      change should be avoided. The kernel gives TAP devices a completely
      random MAC address. Occassionally the random TAP device MAC is lower
      than that of the physical interface (eth0, eth1etc) that is enslaved,
      causing the bridge to change its MAC.
      
      This change sets an explicit MAC address for all TAP devices created
      using the configured MAC from the XML, but with the high byte set
      to 0xFE. This should ensure TAP device MACs are higher than any
      physical interface MAC.
      
      * src/qemu/qemu_conf.c, src/uml/uml_conf.c: Pass in a MAC addr
        for the TAP device with high byte set to 0xFE
      * src/util/bridge.c, src/util/bridge.h: Set a MAC when creating
        the TAP device to override random MAC
      6ea90b84
  14. 10 3月, 2010 1 次提交
  15. 09 2月, 2010 1 次提交
  16. 23 9月, 2009 1 次提交
    • C
      Introduce virStrncpy. · 03d777f3
      Chris Lalancette 提交于
      Add the virStrncpy function, which takes a dst string, source string,
      the number of bytes to copy and the number of bytes available in the
      dest string.  If the source string is too large to fit into the
      destination string, including the \0 byte, then no data is copied and
      the function returns NULL.  Otherwise, this function copies n bytes
      from source into dst, including the \0, and returns a pointer to the
      dst string.  This function is intended to replace all unsafe uses
      of strncpy in the code base, since strncpy does *not* guarantee that
      the buffer terminates with a \0.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      03d777f3
  17. 21 9月, 2009 1 次提交
    • D
      Move all shared utility files to src/util/ · 1355e055
      Daniel P. Berrange 提交于
      * src/bridge.c, src/bridge.h, src/buf.c, src/buf.h, src/cgroup.c,
        src/cgroup.h, src/conf.c, src/conf.h, src/event.c, src/event.h,
        src/hash.c, src/hash.h, src/hostusb.c, src/hostusb.h,
        src/iptables.c, src/iptables.h, src/logging.c, src/logging.h,
        src/memory.c, src/memory.h, src/pci.c, src/pci.h, src/qparams.c,
        src/qparams.h, src/stats_linux.c, src/stats_linux.h,
        src/threads-pthread.c, src/threads-pthread.h, src/threads-win32.c,
        src/threads-win32.h, src/threads.c, src/threads.h, src/util.c,
        src/util.h, src/uuid.c, src/uuid.h, src/virterror.c,
        src/virterror_internal.h, src/xml.c, src/xml.h: Move all files
        into src/util/
      * daemon/Makefile.am: Add -Isrc/util/ to build flags
      * src/Makefile.am: Add -Isrc/util/ to build flags and update for
        moved files
      * src/libvirt_private.syms: Export cgroup APIs since they're now
        in util rather than linking directly to drivers
      * src/xen/xs_internal.c: Disable bogus virEventRemoveHandle call
        when built under PROXY
      * proxy/Makefile.am: Update for changed file locations. Remove
        bogus build of event.c
      * tools/Makefile.am, tests/Makefile.am: Add -Isrc/util/ to build flags
      1355e055
  18. 30 7月, 2009 3 次提交
  19. 03 6月, 2009 1 次提交
  20. 20 4月, 2009 1 次提交
  21. 03 3月, 2009 1 次提交
  22. 17 2月, 2009 1 次提交
  23. 14 2月, 2009 1 次提交
    • M
      Fix bridge.c warnings with gcc-4.4 · 9fec27be
      Mark McLoughlin 提交于
       bridge.c: In function 'brSetInetAddr':
       bridge.c:665: error: dereferencing pointer '({anonymous})' does break strict-aliasing rules
       bridge.c:665: note: initialized from here
       bridge.c:666: error: dereferencing pointer '({anonymous})' does break strict-aliasing rules
       bridge.c:666: note: initialized from here
      
      Fix qemud.c warnings with gcc-4.4
      
       qemud.c: In function ‘remoteListenTCP’:
       qemud.c:675: error: dereferencing pointer ‘sa.72’ does break strict-aliasing rules
       qemud.c:675: note: initialized from here
       qemud.c:678: error: dereferencing pointer ‘sa.73’ does break strict-aliasing rules
       qemud.c:678: note: initialized from here
      9fec27be
  24. 06 2月, 2009 1 次提交
    • J
      remove useless code · a9aa76ba
      Jim Meyering 提交于
      * src/bridge.c (brAddTap): Remove redundant errno=ENOMEM assignment
      after failed strdup.
      * src/cgroup.c (virCgroupFree): Remove redundant *group=NULL assignment
      after VIR_FREE(*group).
      * src/lxc_driver.c (lxcShutdown): Likewise.
      * src/xen_unified.c (xenUnifiedClose): Likewise.
      * src/xm_internal.c (xenXMDomainConfigFormat): Rewrite disk-
      and net-config-setting code to be clearer.
      a9aa76ba
  25. 27 1月, 2009 1 次提交
    • M
      kvm/virtio: Set IFF_VNET_HDR when setting up tap fds · b4f62abb
      Mark McLoughlin 提交于
      IFF_VNET_HDR is a tun/tap flag that allows you to send and receive
      large (i.e. GSO) packets and packets with partial checksums. Setting
      the flag means that every packet is proceeded by the same header which
      virtio uses to communicate GSO/csum metadata.
      
      By enabling this flag on the tap fds we create, we greatly increase
      the achievable throughput with virtio_net.
      
      However, we need to be careful to only set the flag when a) QEMU has
      support for this ABI and b) the value of the flag is queryable using
      the TUNGETIFF ioctl.
      
      It's nearly five months since kvm-74 - the first KVM release with this
      feature - was released. Up until now, we've not added libvirt support
      because there is no clean way to detect support for this in QEMU at
      runtime. A brief attempt to add a "info capabilities" monitor command
      to QEMU floundered. Perfect is the enemy of good enough. Probing the
      KVM version will suffice for now.
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      b4f62abb
  26. 21 1月, 2009 1 次提交
  27. 05 1月, 2009 1 次提交
    • J
      Move bridge symbols into a separate syms file · 83dfc25c
      Jim Meyering 提交于
      * configure.in: Provide a new --with-bridge option.
      * src/Makefile.am (PRIVSYMFILES) [WITH_BRIDGE]: Append libvirt_bridge.syms.
      * src/bridge.c: Test WITH_BRIDGE rather than particular drivers.
      * src/libvirt_private.syms: Move bridge-related symbols into...
      * src/libvirt_bridge.syms: ...this new file.
      Author: John Levon
      83dfc25c
  28. 04 12月, 2008 1 次提交
  29. 29 8月, 2008 1 次提交
  30. 21 8月, 2008 1 次提交
  31. 07 8月, 2008 1 次提交