summaryrefslogtreecommitdiff
path: root/net
Commit message (Collapse)AuthorAgeFilesLines
* net: Fix bogus "Warning: vlan 0 with no nics" with -deviceMarkus Armbruster2010-02-235-20/+0
| | | | | | | | | | | | | net_check_clients() prints this when an VLAN has host devices, but no guest devices. It uses VLANState members nb_guest_devs and nb_host_devs to keep track of these devices. However, -device does not update nb_guest_devs, only net_init_nic() does that, for -net nic. Check the VLAN clients directly, and remove the counters. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 62112d181ca33fea976100c4335dfc3e2f727e6c)
* win32: fix variable use before initializationBlue Swirl2009-12-041-2/+2
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Don't leak file descriptorsKevin Wolf2009-12-031-4/+4
| | | | | | | | We're leaking file descriptors to child processes. Set FD_CLOEXEC on file descriptors that don't need to be passed to children to stop this misbehaviour. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: fix vnet_hdr handling in solaris tap codeMark McLoughlin2009-12-031-0/+11
| | | | | | | Print an error if the user specifies vnet_hdr=1 on the cmdline. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: initialize vnet_hdr in net_init_tap()Mark McLoughlin2009-12-031-1/+1
| | | | | | | | net_tap_init() always sets vnet_hdr using qemu_opt_get_bool(), but initialize it in net_init_tap() just to reduce confusion. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: check for TUNSETOFFLOAD support before trying to enable offload featuresPierre Riteau2009-12-031-0/+5
| | | | | | | | | This avoids the "TUNSETOFFLOAD ioctl() failed: Invalid argument" message on kernels without TUNSETOFFLOAD support. Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: fix TAP networking on host kernels without IFF_VNET_HDR supportPierre Riteau2009-12-031-0/+2
| | | | | | | | | vnet_hdr is initialized at 1 by default. We need to reset it to 0 if the kernel doesn't support IFF_VNET_HDR. Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: remove VLANClientState members now in NetClientInfoMark McLoughlin2009-12-031-3/+3
| | | | | | | | Add a NetClientInfo pointer to VLANClientState and use that for the typecode and function pointers. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move parse_macaddr() to net/util.[ch]Mark McLoughlin2009-12-032-0/+92
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: convert dump to NetClientInfoMark McLoughlin2009-12-031-21/+28
| | | | | | | aliguori: fix uninitialized use of pcap_len Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: convert socket to NetClientInfoMark McLoughlin2009-12-031-29/+45
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: convert vde to NetClientInfoMark McLoughlin2009-12-031-17/+28
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: convert slirp to NetClientInfoMark McLoughlin2009-12-031-24/+37
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: convert tap-win32 to NetClientInfoMark McLoughlin2009-12-031-16/+23
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: convert tap to NetClientInfoMark McLoughlin2009-12-031-37/+45
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move dump backend code from net.c to net/dump.cMark McLoughlin2009-12-032-0/+184
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move socket backend code from net.c to net/socket.cMark McLoughlin2009-12-032-0/+594
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move vde code from net.c to net/vde.cMark McLoughlin2009-12-032-0/+160
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move slirp code from net.c to net/slirp.cMark McLoughlin2009-12-032-0/+803
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add support for GNU/kFreeBSDAurelien Jarno2009-11-291-5/+2
| | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Avoid segfault on net_tap_init() failureJuergen Lock2009-11-211-0/+3
| | | | | | | Check for fd == -1 there. Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tap-bsd: handle ifname on FreeBSD hostsJuergen Lock2009-11-211-0/+28
| | | | | | | | | Handle ifname on FreeBSD hosts; if no ifname is given, always start the search from tap0. (Simplified/cleaned up version of what has been in the FreeBSD ports for a long time.) Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix tap breakage on BSD hosts (no IFF_VNET_HDR)Juergen Lock2009-11-211-0/+11
| | | | | | | | net/tap-bsd.c was assuming IFF_VNET_HDR was always available, which I think isn't true on any BSD. Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tap: drain queue in tap_send()Mark McLoughlin2009-11-091-13/+16
| | | | | | | | | | | | | | Okay, let's try re-enabling the drain-entire-queue behaviour, with a difference - before each subsequent packet, use qemu_can_send_packet() to check that we can send it. This is similar to how we check before polling the tap fd and avoids having to drop a packet if the receiver cannot handle it. This patch should be a performance improvement since we no longer have to go through the mainloop for each packet. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net/queue: queue packets even if sender doesn't supply a callbackMark McLoughlin2009-11-091-3/+3
| | | | | | | | | | | Now that we disable any receiver whose queue is full, we do not require senders to handle a zero return by supplying a sent callback. This is a second step towards allowing can_receive() handlers to return true even if no buffer space is available. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* tap: disable draining queue in one goMark McLoughlin2009-11-091-16/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If qemu_send_packet_async() returns zero, it means the packet has been queued and the sent callback will be invoked once it has been flushed. This is only possible where the NIC's receive() handler returns zero and promises to notify the networking core that room is available in its queue again. In the case where the receive handler does not have this capability (and its queue fills up) it returns -1 and the networking core does not queue up the packet. This condition is indicated by a -1 return from qemu_send_packet_async(). Currently, tap handles this condition simply by dropping the packet. It should do its best to avoid getting into this situation by checking such NIC's have room for a packet before copying the packet from the tap interface. tap_send() used to achieve this by only reading a single packet before returning to the mainloop. That way, tap_can_send() is called before reading each packet. tap_send() was changed to completely drain the tap interface queue without taking into account the situation where the NIC returns an error and the packet is not queued. Let's start fixing this by reverting to the previous behaviour of reading one packet at a time. Reported-by: Scott Tsai <scottt.tw@gmail.com> Tested-by: Sven Rudolph <Sven_Rudolph@drewag.de> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Unbreak Linux buildAnthony Liguori2009-10-301-1/+1
| | | | | | | | | | | | commit 71f4effce79ec0485586963ea764f2c212c72f26 Author: Alexander Graf <agraf@suse.de> Date: Fri Oct 30 22:27:00 2009 +0100 Unbreak tap compilation on OS X Broke the build on Linux due to a bad #if guard Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Unbreak tap compilation on OS XAlexander Graf2009-10-303-2/+9
| | | | | | | | | | | | | | | | | | Currently compiling the tap sources breaks on Mac OS X. This is because of: 1) tap-linux.h requiring Linux includes 2) typos 3) missing #includes This patch adds what's necessary to compile tap happily on Mac OS X. I haven't tested if using tap actually works, but I don't think that's a major issue as that code was probably seriously untested before already. I didn't split the patch, because it's only a few lines of code and splitting is probably not worth the effort here. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move UFO support detection to tap-linux.cMark McLoughlin2009-10-306-6/+29
| | | | | | | Only supported on Linux Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move tap_set_offload() code into tap-linux.cMark McLoughlin2009-10-306-20/+43
| | | | | | | TUNSETOFFLOAD is only available on Linux Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move tap_probe_vnet_hdr() to tap-linux.cMark McLoughlin2009-10-306-12/+27
| | | | | | | Only Linux has support for IFF_VNET_HDR Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move tap_set_sndbuf() to tap-linux.cMark McLoughlin2009-10-306-24/+42
| | | | | | | TUNSETSNDBUF is only available on linux Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move linux code into net/tap-linux.cMark McLoughlin2009-10-302-47/+78
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move AIX code into net/tap-aix.cMark McLoughlin2009-10-302-12/+32
| | | | | | | | | Okay, this makes the tap options available on AIX even though there's no support, but if we want to do it right we should have not compile the tap code at all on AIX using e.g. CONFIG_TAP. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move solaris code to net/tap-solaris.cMark McLoughlin2009-10-303-165/+190
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: split BSD tap_open() out into net/tap-bsd.cMark McLoughlin2009-10-303-46/+68
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: split all the tap code out into net/tap.cMark McLoughlin2009-10-301-0/+759
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move tap-linux.h under net/Mark McLoughlin2009-10-301-0/+51
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move more stuff into net/tap-win32.c, add net/tap.hMark McLoughlin2009-10-302-2/+88
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move tap-win32.c under net/Mark McLoughlin2009-10-301-0/+690
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move net-checksum.c under net/Mark McLoughlin2009-10-302-0/+114
| | | | | | | Also add a new net/checksum.h header Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move net-queue.[ch] under net/Mark McLoughlin2009-10-302-0/+331
[v2: handle building in a separate dir] Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>