1. 25 3月, 2014 1 次提交
  2. 12 3月, 2014 3 次提交
    • S
      tap: avoid deadlocking rx · 68e5ec64
      Stefan Hajnoczi 提交于
      The net subsystem has a control flow mechanism so peer NetClientStates
      can tell each other to stop sending packets.  This is used to stop
      monitoring the tap file descriptor for incoming packets if the guest rx
      ring has no spare buffers.
      
      There is a corner case when tap_can_send() is true at the beginning of
      an event loop iteration but becomes false before the tap_send() fd
      handler is invoked.
      
      tap_send() will read the packet from the tap file descriptor and attempt
      to send it.  The net queue will hold on to the packet and return 0,
      indicating that further I/O is not possible.  tap then stops monitoring
      the file descriptor for reads.
      
      This is unlike the normal case where tap_can_send() is the same before
      and during the event loop iteration.  The event loop would simply not
      monitor the file descriptor if tap_can_send() returns true.  Upon next
      iteration it would check tap_can_send() again and begin monitoring if we
      can send.
      
      The deadlock happens because tap_send() explicitly disabled read_poll.
      This is done with the expectation that the peer will call
      qemu_net_queue_flush().  But hw/net/virtio-net.c does not monitor
      vm_running transitions and issue the flush.  Hence we're left with a
      broken tap device.
      
      Cc: qemu-stable@nongnu.org
      Reported-by: NNeil Skrypuch <neil@tembosocial.com>
      Tested-by: NNeil Skrypuch <neil@tembosocial.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      68e5ec64
    • M
      slirp smb with modern win guests when samba is also running on host · 5c1e1890
      Michael Tokarev 提交于
      After numerous reports that -smb (or -netdev user,smb=foo) not working
      with modern windows (win7 and vista are reported as non-working), I
      started digging myself.  And found that indeed it doesn't work, and
      why.
      
      The thing is that modern win tries to connect to port 445 (microsoft-ds)
      first, and if that fails, it falls back to old port 139 (netbios-ssn).
      
      slirp code in qemu only redirects port 139, it does not touch port 445.
      
      So the prob is that if samba is also running on the host, guest will try
      to communicate using port 445, and that will succed, but ofcourse guest
      will not talk with our samba but with samba running on the host.
      
      If samba is not running on the host, guest will fall back to port 139,
      and will reach the redirecting rule and qemu will spawn smbd correctly.
      
      The solution is to redirect both ports (139 and 445), and the fix is
      a one-liner, adding second call to slirp_add_exec() at the end of
      net/slirp.c:slirp_smb() function (provided below).
      
      But it looks like that is not a proper fix really, since in theory
      we should redirect both ports to the SAME, single samba instance,
      but I'm not sure this is possible with slirp.  Well, even if two
      smbd processes will be run on the same config dir, it should not
      be a problem.
      
      The one-liner (not exactly 1 since it touches previous line too) is like
      this:
      Signed-off-By: NMichael Tokarev <mjt@tls.msk.ru>
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      5c1e1890
    • M
      qemu/slirp: Fix SMB security configuration on newer samba versions · c2804ee6
      Michael Buesch 提交于
      The smb.conf automatically generated by qemu's -smb option fails on current
      samba, because smbd rejects the security=share option with the following warning:
      
      >   WARNING: Ignoring invalid value 'share' for parameter 'security'
      
      Which makes it fall back to security=user without guest login.
      This results in being unable to login to the samba server from the guest OS.
      
      This fixes it by selecting 'user' explicitly and mapping
      unknown users to guest logins.
      Signed-off-by: NMichael Buesch <m@bues.ch>
      Reviewed-by: NMichael Tokarev <mjt@tls.msk.ru>
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      c2804ee6
  3. 25 2月, 2014 7 次提交
  4. 18 2月, 2014 1 次提交
  5. 27 1月, 2014 2 次提交
  6. 23 12月, 2013 1 次提交
  7. 09 12月, 2013 2 次提交
    • V
      net: Update netdev peer on link change · 02d38fcb
      Vlad Yasevich 提交于
      When a link change occurs on a backend (like tap), we currently do
      not propage such change to the nic.  As a result, when someone turns
      off a link on a tap device, for instance, then a guest doesn't see
      that change and continues to try to send traffic or run DHCP even
      though the lower-layer is disconnected.  This is OK when the network
      is set up as a HUB since the the guest may be connected to other HUB
      ports too, but when it's set up as a netdev, it makes thinkgs worse.
      
      The patch addresses this by setting the peers link down only when the
      peer is not a HUBPORT device.  With this patch, in the following config
        -netdev tap,id=net0 -device e1000,mac=XXXXX,netdev=net0
      when net0 link is turned off, the guest e1000 shows lower-layer link
      down. This allows guests to boot much faster in such configurations.
      With windows guest, it also allows the network to recover properly
      since windows will not configure the link-local IPv4 address, and
      when the link is turned on, the proper address address is configured.
      Signed-off-by: NVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      02d38fcb
    • V
      net: Adding netmap network backend · 58952137
      Vincenzo Maffione 提交于
      This patch adds support for a network backend based on netmap.
      netmap is a framework for high speed packet I/O. You can use it
      to build extremely fast traffic generators, monitors, software
      switches or network middleboxes. Its companion software switch
      VALE lets you interconnect virtual machines.
      netmap and VALE are implemented as a non-intrusive kernel module,
      support NICs from multiple vendors, are part of standard FreeBSD
      distributions and available in source format for Linux too.
      
      To compile QEMU with netmap support, use the following configure
      options:
          ./configure [...] --enable-netmap --extra-cflags=-I/path/to/netmap/sys
      where "/path/to/netmap" contains the netmap source code, available at
          http://info.iet.unipi.it/~luigi/netmap/
      
      The same webpage contains more information about the netmap project
      (together with papers and presentations).
      Signed-off-by: NVincenzo Maffione <v.maffione@gmail.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      58952137
  8. 09 11月, 2013 2 次提交
  9. 03 10月, 2013 1 次提交
  10. 06 9月, 2013 2 次提交
  11. 23 8月, 2013 2 次提交
  12. 27 7月, 2013 1 次提交
  13. 16 7月, 2013 1 次提交
    • A
      net: add support of mac-programming over macvtap in QEMU side · b1be4280
      Amos Kong 提交于
      Currently macvtap based macvlan device is working in promiscuous
      mode, we want to implement mac-programming over macvtap through
      Libvirt for better performance.
      
      Design:
       QEMU notifies Libvirt when rx-filter config is changed in guest,
       then Libvirt query the rx-filter information by a monitor command,
       and sync the change to macvtap device. Related rx-filter config
       of the nic contains main mac, rx-mode items and vlan table.
      
      This patch adds a QMP event to notify management of rx-filter change,
      and adds a monitor command for management to query rx-filter
      information.
      
      Test:
       If we repeatedly add/remove vlan, and change macaddr of vlan
       interfaces in guest by a loop script.
      
      Result:
       The events will flood the QMP client(management), management takes
       too much resource to process the events.
      
       Event_throttle API (set rate to 1 ms) can avoid the events to flood
       QMP client, but it could cause an unexpected delay (~1ms), guests
       guests normally expect rx-filter updates immediately.
      
       So we use a flag for each nic to avoid events flooding, the event
       is emitted once until the query command is executed. The flag
       implementation could not introduce unexpected delay.
      
      There maybe exist an uncontrollable delay if we let Libvirt do the
      real change, guests normally expect rx-filter updates immediately.
      But it's another separate issue, we can investigate it when the
      work in Libvirt side is done.
      
      Michael S. Tsirkin: tweaked to enable events on start
      Michael S. Tsirkin: fixed not to crash when no id
      Michael S. Tsirkin: fold in patch:
         "additional fixes for mac-programming feature"
      Amos Kong: always notify QMP client if mactable is changed
      Amos Kong: return NULL list if no net client supports rx-filter query
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NAmos Kong <akong@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      b1be4280
  14. 19 6月, 2013 1 次提交
  15. 07 6月, 2013 1 次提交
    • J
      tap: fix NULL dereference when passing invalid parameters to tap · c87826a8
      Jason Wang 提交于
      This patch forbid the following invalid parameters to tap:
      
      1) fd and vhostfds were specified but vhostfd were not specified
      2) vhostfds were specified but fds were not specified
      3) fds and vhostfd were specified
      
      For 1 and 2, net_init_tap_one() will still pass NULL as vhostfdname to
      monitor_handle_fd_param(), which may crash the qemu.
      
      Also remove the unnecessary has_fd check.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Stefan Hajnoczi <shajnocz@redhat.com>
      Cc: Laszlo Ersek <lersek@redhat.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      c87826a8
  16. 24 5月, 2013 1 次提交
  17. 03 5月, 2013 2 次提交
    • J
      tap: properly initialize vhostfds · 7873df40
      Jason Wang 提交于
      Only tap->vhostfd were checked net_init_tap_one(), but tap->vhostfds were
      forgot, this will lead qemu to ignore all fds passed by management through
      vhostfds, and tries to create vhost_net device itself. Fix by adding this check
      also.
      Reportyed-by: NMichal Privoznik <mprivozn@redhat.com>
      Cc: Michal Privoznik <mprivozn@redhat.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      7873df40
    • A
      net: make network client name unique · c963530a
      Amos Kong 提交于
      assign_name() creates a name MODEL.NUM, where MODEL is the client's model,
      and NUM is the number of MODELs that already exist.
      
      Markus added NIC naming for non-VLAN clients in commit 53e51d85.
      commit d33d93b2 incorrectly added a judgement of net-hub. It caused
      net clients created with -netdev get same names.
      
      eg:
       # qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 \
                          -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 ..
       (qemu) info network
       virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
        \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
       virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57
        \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
      
      This patch removed the check of nic-hub, and created unique names for
      all net clients that have same model.
      
      v2: update commitlog & comments
      Signed-off-by: NAmos Kong <akong@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      c963530a
  18. 16 4月, 2013 1 次提交
  19. 09 4月, 2013 1 次提交
    • P
      hw: move headers to include/ · 0d09e41a
      Paolo Bonzini 提交于
      Many of these should be cleaned up with proper qdev-/QOM-ification.
      Right now there are many catch-all headers in include/hw/ARCH depending
      on cpu.h, and this makes it necessary to compile these files per-target.
      However, fixing this does not belong in these patches.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0d09e41a
  20. 05 4月, 2013 1 次提交
  21. 02 4月, 2013 2 次提交
  22. 25 3月, 2013 4 次提交