summaryrefslogtreecommitdiffstats
path: root/net
Commit message (Collapse)AuthorAgeFilesLines
* Add support for OpenBSD to QEMU's tap driver.Brad2010-12-211-2/+6
| | | | | Signed-off-by: Brad Smith <brad@comstyle.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix warning on mingw32Blue Swirl2010-12-171-1/+2
| | | | | | | | Avoid this warning like other uses of setsockopt: /src/qemu/net/socket.c: In function 'net_socket_mcast_create': /src/qemu/net/socket.c:210: warning: passing argument 4 of 'setsockopt' from incompatible pointer type Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* net/sock: option to specify local addressMike Ryan2010-12-091-13/+39
| | | | | | | | | | | | | Add an option to specify the host IP to send multicast packets from, when using a multicast socket for networking. The option takes an IP address and sets the IP_MULTICAST_IF socket option, which causes the packets to use that IP's interface as an egress. This is useful if the host machine has several interfaces with several virtual networks across disparate interfaces. Signed-off-by: Mike Ryan <mikeryan@ISI.EDU> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* tap: make set_offload a nop after netdev cleanupMichael S. Tsirkin2010-11-161-1/+5
| | | | | | | | | | virtio-net expects set_offload to succeed after peer cleanup. Since we don't have an open fd anymore, make it so. Fixes warning about the failure of offload setting. Reported-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* tap: clear vhost_net backend on cleanupMichael S. Tsirkin2010-11-161-0/+1
| | | | | | | | | | | Frontends calling tap_get_vhost_net get an invalid pointer after the peer backend has been deleted. Jason Wang <jasowang@redhat.com> reports this leading to a crash in ack_features when we remove the vhost-net bakend of a virtio nic. The fix is simply to clear the backend pointer. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Delete write only variablesBlue Swirl2010-10-131-3/+2
| | | | | | | | | | Compiling with GCC 4.6.0 20100925 produced warnings like: /src/qemu/net/tap-win32.c: In function 'tap_win32_open': /src/qemu/net/tap-win32.c:582:12: error: variable 'hThread' set but not used [-Werror=unused-but-set-variable] Fix by removing the unused variables. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tap: Add stub for HaikuAndreas Färber2010-10-031-0/+61
| | | | | | | Adapted from AIX code. Signed-off-by: Andreas Färber <andreas.faerber@web.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tap: Remove double include of util.hAndreas Färber2010-09-291-4/+0
| | | | | | | | | | If neither of __FreeBSD__, __FreeBSD_kernel__ and __DragonFly__ is defined, util.h is included from tap-bsd.c. Don't include it again if __OpenBSD__ is defined. Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Andreas Färber <andreas.faerber@web.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tap: add APIs for vnet header lengthMichael S. Tsirkin2010-09-078-0/+92
| | | | | | | Add APIs to control host header length. First user will be vhost-net. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* tap: generalize code for different vnet header lenMichael S. Tsirkin2010-09-072-14/+20
| | | | | | | Make host vnet header length a structure field in preparation for using this support in linux kernel. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Fix a warning on OpenSolarisBlue Swirl2010-07-311-0/+1
| | | | | | | | Add a missing #include statement to avoid a warning: /src/qemu/net/tap-solaris.c: In function 'tap_open': /src/qemu/net/tap-solaris.c:189: warning: implicit declaration of function 'error_report' Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* give some useful error messages when tap openMichael Tokarev2010-06-221-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In net/tap-linux.c, when manipulation of /dev/net/tun fails, it prints (with fprintf) something like this: warning: could not open /dev/net/tun: no virtual network emulation this has 2 issues: 1) it is not a warning really, it's a fatal error (kvm exits after that), 2) there's no indication as of what's actually wrong: printing errno there is helpful. The patch below removes the "warning" prefix, uses %m (since it's linux, %m is available as format modifier), and changes fprintf() to %qemu_error(). Now it prints something like this instead: could not configure /dev/net/tun: Device or resource busy (there are 2 messages like that in the same function) This fixes Debian bug #578154, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=578154 Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Remove dead assignments in various common files, spotted by clang analyzerBlue Swirl2010-04-251-1/+1
| | | | | | Value stored is never read. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix build on mingw32Anthony Liguori2010-04-021-0/+5
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* tap: add API to retrieve vhost net headerMichael S. Tsirkin2010-04-012-0/+10
| | | | | | | will be used by virtio-net for vhost net support Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* tap: add vhost/vhostfd optionsMichael S. Tsirkin2010-04-011-0/+29
| | | | | | | | | | | | This adds vhost binary option to tap, to enable vhost net accelerator. Default is off for now, we'll be able to make default on long term when we know it's stable. vhostfd option can be used by management, to pass in the fd. Assigning vhostfd implies vhost=on. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* tap: add interface to get device fdMichael S. Tsirkin2010-04-012-0/+9
| | | | | | | Will be used by vhost to attach/detach to backend. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix BSD and win32 buildsBlue Swirl2010-03-272-0/+2
| | | | | | | | | | | | | CC net/tap-bsd.o /src/qemu/net/tap-bsd.c: In function `tap_open': /src/qemu/net/tap-bsd.c:93: warning: implicit declaration of function `error_report' CC sparc-softmmu/../net/tap-win32.o cc1: warnings being treated as errors /src/qemu/target-sparc/../net/tap-win32.c: In function 'net_init_tap': /src/qemu/target-sparc/../net/tap-win32.c:709: warning: implicit declaration of function 'error_report' Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Revert "tap: invoke downscript when we exit abnormally"Anthony Liguori2010-03-211-16/+0
| | | | This reverts commit 8af8ce4d6116e3d46ad298ca8fe50d3b515b1aac.
* tap: invoke downscript when we exit abnormallyAnthony Liguori2010-03-191-0/+16
| | | | | | | | | | | Right now, downscript is not invoked reliably. If you execute 'quit' from the monitor, it won't be invoked. This fixes that by converting tap to use an exit_notifier to execute the downscript. In this case, allowing an exit notifier to include state is critically important for the conversion. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* error: Replace qemu_error() by error_report()Markus Armbruster2010-03-168-32/+33
| | | | | | | | | | | | | error_report() terminates the message with a newline. Strip it it from its arguments. This fixes a few error messages lacking a newline: net_handle_fd_param()'s "No file descriptor named %s found", and tap_open()'s "vnet_hdr=1 requested, but no kernel support for IFF_VNET_HDR available" (all three versions). There's one place that passes arguments without newlines intentionally: load_vmstate(). Fix it up.
* error: Move qemu_error & friends into their own headerMarkus Armbruster2010-03-164-1/+4
|
* slirp: check system() successJuan Quintela2010-03-091-1/+1
| | | | | | | we shouldn't call W*() macros until we check that fork worked. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: Fix bogus "Warning: vlan 0 with no nics" with -deviceMarkus Armbruster2010-02-195-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>
* Fix BSD buildBlue Swirl2010-01-271-0/+3
| | | | | | <sys/wait.h> must be included in order to use WIF* macros. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* net/slirp.c: fix warning with _FORTIFY_SOURCEKirill A. Shutemov2010-01-261-1/+8
| | | | | | | | | | | | CC net/slirp.o cc1: warnings being treated as errors net/slirp.c: In function 'slirp_smb_cleanup': net/slirp.c:470: error: ignoring return value of 'system', declared with attribute warn_unused_result make: *** [net/slirp.o] Error 1 Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: add API to disable/enable pollingMichael S. Tsirkin2010-01-081-0/+8
| | | | | | | | | When vhost is bound to a backend device, we need to stop polling it when vhost is started, and restart polling when vhost is stopped. Add an API for that for use by vhost, and implement in tap backend. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* tap: Compilation fix for SolarisAndreas Färber2009-12-131-0/+1
| | | | | | | | | | | | Avoid an unresolved symbol error for TFR, which is defined in sysemu.h. Based on patch by Palle Lyckegaard. Signed-off-by: Andreas Färber <afaerber@opensolaris.org> Cc: Palle Lyckegaard <palle@lyckegaard.dk> Cc: Ben Taylor <bentaylor.solx86@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* 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>
OpenPOWER on IntegriCloud