softmmu: move include files to include/sysemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
misc: move include files to include/qemu/
monitor: move include files to include/monitor/
qapi: move include files to include/qobject/
net: reorganize headers
Move public headers to include/net, and leave private headers in net/.Put the virtio headers in include/net/tap.h, removing the multiple copiesthat existed. Leave include/net/tap.h as the interface for NICs, andnet/tap_int.h as the interface for OS-specific parts of the tap backend....
janitor: do not include qemu-char everywhere
Touching char/char.h basically causes the whole of QEMU tobe rebuilt. Avoid this, it is usually unnecessary.
net: move net.c to net/
tap: reset vnet header size on open
For tap, we currently assume the vnet header size is 10(the default value) but that might not be the caseif tap is persistent and has been used by qemu previously.To fix, set vnet header size correctly on open.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Fix spelling (prefered -> preferred)
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
For tap, we currently assume the vnet header size is 10(the default value) but that might not be the caseif tap is persistent and has been used by qemu previously.To fix, set host header size in tap device on open....
slirp: Add domain-search option to slirp's DHCP server
This patch will allow the user to include the domain-search option inreplies from the built-in DHCP server. The domain suffixes can bespecified by adding dnssearch= entries to the "-net user" parameter....
net: use "socket" model name for UDP sockets
Fix the problem that can not delete the udp socket.It's caused by passing "udp" model to net_socket_udp_init,but we do not have "udp" model in our model list.Pass the right model "socket" to init function....
tap-win32: stubs to fix win32 build
Add missing stubs to win32 to fix link failure.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Reported-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
net/tap-win32: Fix compiler warning caused by missing include statement
The include file for net_init_tap was missing:
net/tap-win32.c:703: warning: no previous prototype for ‘net_init_tap’
net: consolidate NetClientState header files into one
This patch doesn't seem much useful alone, I must admit. However,it makes sense as part of the upcoming directory reorganization,where I want to have include/net/tap.h as the net<->hw interfacefor tap. Then having both net/tap.h and include/net/tap.h does...
net/socket: Fix compiler warning (regression for MinGW)
Commit 213fd5087e2e4e2da10ad266df0ba950cf7618bf removed a type castwhich is needed for MinGW:
net/socket.c:136: warning: pointer targets in passing argument 2 of ‘sendto’ differ in signedness/usr/lib/gcc/amd64-mingw32msvc/4.4.4/../../../../amd64-mingw32msvc/include/winsock2.h:1313: note:...
net: broadcast hub packets if at least one port can receive
In commit 60c07d933c66c4b30a83b7ccbc8a0cb3df1b2d0e ("net: fixqemu_can_send_packet logic") the "VLAN" broadcast behavior was changedto queue packets if any net client cannot receive. It turns out that...
net: asynchronous send/receive infrastructure for net/socket.c
The net/socket.c net client is not truly asynchronous. This patchborrows the qemu_set_fd_handler2() code from net/tap.c as the basis forproper asynchronous send/receive.
Only read packets from the socket when the peer is able to receive....
net: EAGAIN handling for net/socket.c UDP
Implement asynchronous send for UDP (or other SOCK_DGRAM) sockets. Ifsend fails with EAGAIN we wait for the socket to become writable again.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
net: EAGAIN handling for net/socket.c TCP
Replace spinning send_all() with a proper non-blocking send. When thesocket write buffer limit is reached, we should stop trying to send andwait for the socket to become writable again.
Non-blocking TCP sockets can return in two different ways when the write...
net: do not report queued packets as sent
Net send functions have a return value where 0 means the packet has notbeen sent and will be queued. A non-zero value means the packet wassent or an error caused the packet to be dropped.
This patch fixes two instances where packets are queued but we return...
net: notify iothread after flushing queue
virtio-net has code to flush the queue and notify the iothreadwhenever new receive buffers are added by the guest. That isfine, and indeed we need to do the same in all other drivers.However, notifying the iothread should be work for the network...
monitor: Rename+move net_handle_fd_param -> monitor_handle_fd_param
This patch renames+moves the net_handle_fd_param() caller used toobtain a file descriptor from either qemu_parse_fd() (the normal case)or from monitor_get_fd() (migration case) into a generically prefixed...
qapi: avoid reserved keywords
Clang compiler complained about use of reserved word 'restrict' in SLIRPand QAPI.
Prefix C keywords with "q_", adjust SLIRP accordingly.
Reviewed-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
net: Make "info network" output more readable info
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Reviewed-by: Laszlo Ersek <lersek@redhat.com>
net: cleanup deliver/deliver_iov func pointers
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Reviewed-by: Laszlo Ersek <lersek@redhat.com>
net: determine if packets can be sent before net queue deliver packets
hub: add the support for hub own flow control
Only when all other hub port's peer .can_receive() all return 1,the source hub port .can_receive() return 1.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>...
net: fix the coding style
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Reviewed-by: Laszlo Ersek <lersek@redhat.com>
net: add the support for -netdev socket, listen
The -net socket,listen option does not work with the newer -netdevsyntax: http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg01508.html
This patch makes it work now.
For the case where one vlan has multiple listenning sockets,...
net: Rename VLANClientState to NetClientState
The vlan feature is no longer part of net core. Rename VLANClientStateto NetClientState because net clients are not explicitly associated witha vlan at all, instead they have a peer net client to which they are...
net: Rename vc local variables to nc
Now that VLANClientState has been renamed to NetClientState all 'vc'local variables should be 'nc'. Much of the code already used 'nc' butthere are places where 'vc' needs to be renamed.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>...
net: Rename qemu_del_vlan_client() to qemu_del_net_client()
Another step in moving the vlan feature out of net core. Users onlydeal with NetClientState and therefore qemu_del_vlan_client() should benamed qemu_del_net_client().
net: Add a hub net client
The vlan feature can be implemented in terms of hubs. By introducing ahub net client it becomes possible to remove the special case vlan codefrom net.c and push the vlan feature out of generic networking code.
net: Use hubs for the vlan feature
Stop using the special-case vlan code in net.c. Instead use the hub netclient to implement the vlan feature. The next patch will remove vlancode from net.c completely.
net: Look up 'vlan' net clients using hubs
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>Reviewed-by: Laszlo Ersek <lersek@redhat.com>
hub: Check that hubs are configured correctly
Checks can be performed to make sure that hubs have at least one NIC andone host device, warning the user if this is not the case.Configurations which do not meet this rule tend to be broken but justemit a warning. This patch preserves compatibility with the checks...
net: Drop vlan argument to qemu_new_net_client()
Since hubs are now used to implement the 'vlan' feature and the vlanargument is always NULL, remove the argument entirely and update all netclients that use qemu_new_net_client().
net: Convert qdev_prop_vlan to peer with hub
Instead of using VLANState use net/hub.h to support the vlan qdevproperty. The vlan qdev property becomes an alias for the peer qdevproperty but is represented as a VLAN ID number. When a VLAN ID isselected the device will really peer with a hub port....
hw, net: "net_client_type" -> "NetClientOptionsKind" (qapi-generated)
NET_CLIENT_TYPE_ -> NET_CLIENT_OPTIONS_KIND_
Signed-off-by: Laszlo Ersek <lersek@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
convert net_client_init() to OptsVisitor
The net_client_init() prototype is kept intact.
Based on "is_netdev", the QemuOpts-rooted QemuOpt-list is parsed as aNetdev or a NetLegacy. The original meat of net_client_init() is moved toand simplified in net_client_init1():...
convert net_init_dump() to NetClientOptions
v1->v2:- NetdevDumpOptions::len is of type 'size', whose C type was changed to uint64_t. Adapt the printf() format specifier macro.
convert net_init_slirp() to NetClientOptions
convert net_init_socket() to NetClientOptions
I "reverse engineered" the following permissions between the -socketsub-options:
fd listen connect mcast udp | localaddr fd x . . . . | . listen . x . . . | ....
convert net_init_vde() to NetClientOptions
v1->v2:- NetdevVdeOptions::port and ::mode are of type uint16. Remove superfluous range checks.
convert net_init_tap() to NetClientOptions
convert net_init_bridge() to NetClientOptions
remove unused QemuOpts parameter from net init functions
v1->v2:- unchanged
v2->v3:- keep "qemu-option.h" included in "net/slirp.h"
slirp: Improve error reporting of inaccessible smb directories
Instead of guessing, print the error code returned by access.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
slirp: Enforce host-side user of smb share
Windows 7 (and possibly other versions) cannot connect to the sambashare if the exported host directory is not world-readable. This can beresolved by forcing the username used for access checks to the oneunder which QEMU and smbd are running....
slirp: add 'cmd:' target for guestfwd
When using guestfwd=, Qemu only connects the virtual server's TCP portto a single chardev. This is useless in most cases, as we usually wantto have more than a single connection from the guest to the outside world....
slirp: Ensure smbd and shared directory exist when enable smb
Users may pass the following parameters to qemu: $ qemu-kvm -net nic -net user,smb= ... $ qemu-kvm -net nic -net user,smb ... $ qemu-kvm -net nic -net user,smb=bad_directory ...
In these cases, qemu started successfully while samba server...
qmp: include monitor.h when needed
This is needed to get file descriptors from SCM_RIGHTS.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
do not include <libutil.h> needlessly or if it doesn't exist
<libutil.h> and <util.h> on *BSD (some have one, some another)were #included just for openpty() declaration. The only filewhere this function is actually used is qemu-char.c.
In vl.c and net/tap-bsd.c, none of functions declared in libutil.h...
build: move net/ objects to nested Makefile.objs
net: purge the monitor object from all init functions
The only backend that really uses it is the socket one, which callsmonitor_get_fd(). But it can use 'cur_mon' instead.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Reviewed-By: Laszlo Ersek <lersek@redhat.com>
slirp: don't use "smb ports = 0" option
The "smb ports = 0" option causes recent samba versions to crash. It wasintroduced in commit 157777ef3e with log message "Samba 3 support".However, a value of 0 has never been officially supported by smb and isalso not necessary: if stdin is a socket, smb does not try to listen on...
Declare state directory in smb.conf
The smb.conf generated by the userspace networking does not include a state directorydirective. Samba therefore falls back to the default value. Since the user generallydoes not have write access to this path, smbd immediately crashes....
net: remove extra spaces in help messages
Signed-off-by: Benjamin MARSILI <mlspirat42@gmail.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Change license from GPLv2 to GPLv2+
This file only contains code from Red Hat, so it can use GPLv2+.Tested with `git blame -M -C net/checksum.c`.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Add support for net bridge
The most common use of -net tap is to connect a tap device to a bridge. Thisrequires the use of a script and running qemu as root in order to allocate atap device to pass to the script.
This model is great for portability and flexibility but it's incredibly...
prepare for future GPLv2+ relicensing
All files under GPLv2 will get GPLv2+ changes starting tomorrow.event_notifier.c and exec-obsolete.h were only ever touched by Red Hatemployees and can be relicensed now.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
Support for UDP unicast network backend
Signed-off-by: Benjamin MARSILI <mlspirat42@gmail.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net/socket.c: Fix fd leak in net_socket_listen_init() error paths
Fix a leak of a file descriptor due to missing closesocket() callsin error paths in net_socket_listen_init().
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
net: store guest timestamp in dump file instead of time since guest startup
Stored dates are no more 1970-01-01 (+ run time), but have a real meaning.If someone wants to have comparable timestamps accross boots, it ispossible to start qemu with -rtc to give the startup date....
net: truncate output file when using dump backend
This prevents data of a previous run to be seen in the new dump file.
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
slirp: Fix typo in net_slirp_hostfwd_remove
Report an error when err is nonzero, not when it is zero.
Signed-off-by: Geoffrey Thomas <geofft@ldpreload.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
network scripts: don't block SIGCHLD before forking
This patch fixes a bug where child processes of launch_script() canmisbehave due to SIGCHLD being blocked. In the case of `sudo`, thiscauses a permanent hang.
Previously a SIGCHLD handler was added to reap fork_exec()'d zombie...
Merge remote-tracking branch 'stefanha/trivial-patches-next' into staging
net: expand tabs in net/socket.c
In order to make later patches sane, expand the tab characters andconform to QEMU coding style now.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: take ownership of fd in socket init functions
Today net/socket.c has no consistent policy for closing the socket filedescriptor when initialization fails. This means we leak the filedescriptor in some cases or we could also try to close it twice....
net/socket.c : fix memory leak
Signed-off-by: Li Zhi Hui <zhihuili@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
fix typo: delete redundant semicolon
Double semicolons should be single.
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
slirp: Clean up net_slirp_hostfwd_remove()'s use of get_str_sep()
get_str_sep() can fail, but net_slirp_hostfwd_remove() doesn't check.Works, because it initializes buf[] to "", which get_str_sep() doesn'ttouch when it fails. Coverity doesn't like it, and neither do I....
net: tap-linux: Fix unhelpful error message
I'm getting:
could not configure /dev/net/tun (tap%d): Operation not permitted
When the ioctl() fails, ifr.ifr_name will most likely not be overwritten.So we better only use it when ifname contains a string....
Allow overriding the location of Samba's smbd.
Pretty much every OS I look at has some means ofchanging this path (patching) so lets just makeit easier for OS developers creating packagesand/or end users to override the location....
char: rename qemu_chr_open() -> qemu_chr_new()
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Fix forcing multicast msgs to loopback on OpenBSD.
Fix forcing multicast msgs to loopback on OpenBSD.e.g.$ sudo qemu -m 128 -no-fd-bootchk \ -hda virtual.img -boot n -nographic \ -net nic,vlan=0,model=rtl8139,macaddr=52:54:00:12:34:03 \...
Fix network interface tap backend
Fix network interface tap backend work on NetBSD.It uses an ioctl to get the tap name.
Signed-off-by: Christoph Egger<Christoph.Egger@amd.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Wrap recv to avoid warnings
Avoid warnings like these by wrapping recv(): CC slirp/ip_icmp.o/src/qemu/slirp/ip_icmp.c: In function 'icmp_receive':/src/qemu/slirp/ip_icmp.c:418:5: error: passing argument 2 of 'recv' from incompatible pointer type [-Werror]...
net: Refactor net_client_types
Position entries of net_client_types according to the correspondingvalues of NET_CLIENT_TYPE_*. The array size is now defined byNET_CLIENT_TYPE_MAX. This will allow to obtain entries based on typevalue in later patches....
slirp: Canonicalize restrict syntax
All other boolean arguments accept on|off - except for slirp's restrict.Fix that while still accepting the formerly allowed yes|y|no|n, butreject everything else. This avoids accidentally allowing externalconnections because syntax errors were so far interpreted as...
Strip trailing '\n' from error_report()'s first argument
error_report() prepends location, and appends a newline. The messageconstructed from the arguments should not contain a newline. Fix theobvious offenders.
Signed-off-by: Markus Armbruster <armbru@redhat.com>...
Fix compilation warning due to missing header for sigaction (followup)
This patch removes all references to signal.h when qemu-common.h is includedas they become redundant.
Signed-off-by: Alexandre Raymond <cerbere@gmail.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
slirp: fix guestfwd id
When using -net user,guestfwd=... Qemu immediately complains about the idbeing in invalid format. This is because we pass in an id that contains acolon, while the id restrictions don't allow colons.
This patch changes the colon into a dot, making guestfwd work again....
Use qemu-common.h or qemu-timer.h in place of sysemu.h
In some cases qemu-common.h or qemu-timer.h can be used in placeof sysemu.h.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Remove unused sysemu.h include directives
Remove unused sysemu.h include directives to speed up buildwith the following patches.
change all other clock references to use nanosecond resolution accessors
This was done with:
sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \ $(git grep -l 'qemu_get_clock\>' ) sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \ $(git grep -l 'qemu_new_timer\>' )...
Fixing tap adapter for win32
This fix allows connection of internal VLAN to the external TAP interface.If tap_win32_write function always returns 0, the TAP network interfacein QEMU is disabled.
Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@gmail.com>...
Fixing network over sockets implementation for win32
MSDN includes the following in WSAEALREADY error description for connect()function: "To preserve backward compatibility, this error is reported asWSAEINVAL to Winsock applications that link to either Winsock.dll or...
tap: safe sndbuf default
With current sndbuf default value, a blockedtarget guest can prevent another guest fromtransmitting any packets. While currentsndbuf value (1M) is reported to help someUDP based workloads, the default shouldbe safe (0).
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>...
vhost: force vhost off for non-MSI guests
When MSI is off, each interrupt needs to be bounced through the iothread when it's set/cleared, so vhost-net causes more context switches andhigher CPU utilization than userspace virtio which handles networking in...
Add support for OpenBSD to QEMU's tap driver.
Signed-off-by: Brad Smith <brad@comstyle.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Fix warning on mingw32
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
net/sock: option to specify local address
Add an option to specify the host IP to send multicast packets from,when using a multicast socket for networking. The option takes an IPaddress and sets the IP_MULTICAST_IF socket option, which causes thepackets to use that IP's interface as an egress....
tap: clear vhost_net backend on cleanup
Frontends calling tap_get_vhost_net get an invalid pointer after thepeer backend has been deleted. Jason Wang <jasowang@redhat.com> reportsthis leading to a crash in ack_features when we remove the vhost-netbakend of a virtio nic....
tap: make set_offload a nop after netdev cleanup
virtio-net expects set_offload to succeed afterpeer 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>...
Delete write only variables
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]...
tap: Add stub for Haiku
Adapted from AIX code.
Signed-off-by: Andreas Färber <andreas.faerber@web.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>