Commit Graph

87 Commits

Author SHA1 Message Date
Brad e2d8830efc Allow overriding the location of Samba's smbd.
Allow overriding the location of Samba's smbd.

Pretty much every OS I look at has some means of
changing this path (patching) so lets just make
it easier for OS developers creating packages
and/or end users to override the location.

Signed-off-by: Brad Smith <brad@comstyle.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-03 17:45:48 +00:00
Anthony Liguori 27143a445b char: rename qemu_chr_open() -> qemu_chr_new()
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-22 10:17:43 -05:00
Anthony Liguori 7267c0947d Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-20 23:01:08 -05:00
Brad 23ddf2bb1e 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 \
        -net user -tftp /usr/src/sys/arch/i386/compile/TEST -bootp pxeboot \
        -net nic,vlan=1,model=rtl8139,macaddr=52:54:00:23:03:01 \
        -net tap,vlan=1,script=no \
        -net nic,vlan=3,model=rtl8139,macaddr=52:54:00:23:03:03 \
        -net socket,vlan=3,mcast=230.0.0.1:10003
setsockopt(SOL_IP, IP_MULTICAST_LOOP): Invalid argument
qemu: -net socket,vlan=3,mcast=230.0.0.1:10003: Device 'socket' could not be initialized

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-07 11:06:43 +00:00
Manuel Bouyer 45c245bf80 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>
2011-08-07 09:48:59 +00:00
Blue Swirl 00aa0040e8 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]
/usr/local/lib/gcc/i686-mingw32msvc/4.6.0/../../../../i686-mingw32msvc/include/winsock2.h:547:32: note: expected 'char *' but argument is of type 'struct icmp *'

Remove also casts used to avoid warnings.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-07-25 14:38:56 +00:00
Jan Kiszka 6f7b3b1be2 net: Refactor net_client_types
Position entries of net_client_types according to the corresponding
values of NET_CLIENT_TYPE_*. The array size is now defined by
NET_CLIENT_TYPE_MAX. This will allow to obtain entries based on type
value in later patches.

At this chance rename NET_CLIENT_TYPE_SLIRP to NET_CLIENT_TYPE_USER for
the sake of consistency.

CC: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-07-23 10:19:50 -05:00
Jan Kiszka c54ed5bcdd 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, but
reject everything else. This avoids accidentally allowing external
connections because syntax errors were so far interpreted as
'restrict=no'.

CC: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-07-23 10:19:49 -05:00
Markus Armbruster 6daf194dde Strip trailing '\n' from error_report()'s first argument
error_report() prepends location, and appends a newline.  The message
constructed from the arguments should not contain a newline.  Fix the
obvious offenders.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-06-24 09:13:36 +01:00
Alexander Graf a9899996c8 slirp: fix guestfwd id
When using -net user,guestfwd=... Qemu immediately complains about the id
being in invalid format. This is because we pass in an id that contains a
colon, while the id restrictions don't allow colons.

This patch changes the colon into a dot, making guestfwd work again.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-06-08 09:04:29 +01:00
Alexandre Raymond 9bf0960a9a Fix compilation warning due to missing header for sigaction (followup)
This patch removes all references to signal.h when qemu-common.h is included
as they become redundant.

Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-06-08 09:04:29 +01:00
Blue Swirl d8dfad9c41 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 place
of sysemu.h.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-04-15 18:25:44 +00:00
Blue Swirl a08784dd11 Remove unused sysemu.h include directives
Remove unused sysemu.h include directives to speed up build
with the following patches.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-04-15 18:25:41 +00:00
Paolo Bonzini 7447545544 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\>' )

after checking that get_clock and new_timer never occur twice
on the same line.  There were no missed occurrences; however, even
if there had been, they would have been caught by the compiler.

There was exactly one false positive in qemu_run_timers:

     -    current_time = qemu_get_clock (clock);
     +    current_time = qemu_get_clock_ns (clock);

which is of course not in this patch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-03-21 09:23:23 +01:00
Pavel Dovgaluk c3febae62b 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 interface
in QEMU is disabled.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-25 15:14:04 +00:00
Pavel Dovgaluk c7eb1f02ed 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 as
WSAEINVAL to Winsock applications that link to either Winsock.dll or
Wsock32.dll". So check of this error code was added to allow network
connections through the sockets in Windows.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-25 15:13:02 +00:00
mst@redhat.com 5430a28fe4 vhost: force vhost off for non-MSI guests
When MSI is off, each interrupt needs to be bounced through the io
thread when it's set/cleared, so vhost-net causes more context switches and
higher CPU utilization than userspace virtio which handles networking in
the same thread.

We'll need to fix this by adding level irq support in kvm irqfd,
for now disable vhost-net in these configurations.

Added a vhostforce flag to force vhost-net back on.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-01 16:50:44 -06:00
Michael S. Tsirkin f157ed202e tap: safe sndbuf default
With current sndbuf default value, a blocked
target guest can prevent another guest from
transmitting any packets. While current
sndbuf value (1M) is reported to help some
UDP based workloads, the default should
be safe (0).

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-01 16:50:44 -06:00
Brad 5f668643dc 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>
2010-12-21 19:44:33 +00:00
Blue Swirl 4d22c6c2ee 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

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-17 21:03:00 +00:00
Mike Ryan 3a75e74c76 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 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>
2010-12-09 12:45:50 +02:00
Michael S. Tsirkin 27a6375de3 tap: make set_offload a nop after netdev cleanup
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>
2010-11-16 08:40:07 -06:00
Michael S. Tsirkin 43849424cf tap: clear vhost_net backend on cleanup
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>
2010-11-16 08:40:07 -06:00
Blue Swirl 49a2942d9b 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]

Fix by removing the unused variables.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-13 18:41:29 +00:00
Andreas Färber 3ee66dfa52 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>
2010-10-03 06:31:41 +00:00
Andreas Färber 5251d6add6 tap: Remove double include of util.h
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>
2010-09-29 16:15:37 +00:00
Michael S. Tsirkin 445d892f43 tap: add APIs for vnet header length
Add APIs to control host header length. First user
will be vhost-net.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-09-07 20:27:33 +03:00
Michael S. Tsirkin ef4252b149 tap: generalize code for different vnet header len
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>
2010-09-07 20:27:28 +03:00
Blue Swirl 3690cec8f8 Fix a warning on OpenSolaris
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>
2010-07-31 19:40:13 +00:00
Michael Tokarev 91ca60e012 give some useful error messages when tap open
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>
2010-06-22 15:15:30 -05:00
Blue Swirl 9678d9501b Remove dead assignments in various common files, spotted by clang analyzer
Value stored is never read.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-25 18:35:52 +00:00
Anthony Liguori 25da2f343c Fix build on mingw32
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-02 10:40:08 -05:00
Michael S. Tsirkin b202554cf7 tap: add API to retrieve vhost net header
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>
2010-04-01 13:56:43 -05:00
Michael S. Tsirkin 82b0d80ef6 tap: add vhost/vhostfd options
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>
2010-04-01 13:56:43 -05:00
Michael S. Tsirkin 95d528a2fe tap: add interface to get device fd
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>
2010-04-01 13:56:43 -05:00
Blue Swirl 73d96e2964 Fix BSD and win32 builds
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>
2010-03-27 18:41:08 +00:00
Anthony Liguori 31dc63dfa1 Revert "tap: invoke downscript when we exit abnormally"
This reverts commit 8af8ce4d61.
2010-03-21 14:13:34 -05:00
Anthony Liguori 8af8ce4d61 tap: invoke downscript when we exit abnormally
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>
2010-03-19 15:27:38 -05:00
Markus Armbruster 1ecda02b24 error: Replace qemu_error() by error_report()
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.
2010-03-16 16:58:32 +01:00
Markus Armbruster 2f7920166d error: Move qemu_error & friends into their own header 2010-03-16 16:55:05 +01:00
Juan Quintela 24ac07dec7 slirp: check system() success
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>
2010-03-09 11:23:00 -06:00
Markus Armbruster 62112d181c net: Fix bogus "Warning: vlan 0 with no nics" with -device
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>
2010-02-19 12:12:46 -06:00
Blue Swirl 28b150bfb0 Fix BSD build
<sys/wait.h> must be included in order to use WIF* macros.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-01-27 17:47:33 +00:00
Kirill A. Shutemov 5a01e99fab net/slirp.c: fix warning with _FORTIFY_SOURCE
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>
2010-01-26 14:59:20 -06:00
Michael S. Tsirkin ceb696159d net: add API to disable/enable polling
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>
2010-01-08 09:58:40 -06:00
Andreas Färber ee7139c33b tap: Compilation fix for Solaris
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>
2009-12-13 14:28:14 +00:00
Blue Swirl 08fd0fa9f1 win32: fix variable use before initialization
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-12-04 18:06:20 +00:00
Kevin Wolf 40ff6d7e8d Don't leak file descriptors
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>
2009-12-03 11:45:50 -06:00
Mark McLoughlin f5c5e38179 net: fix vnet_hdr handling in solaris tap code
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>
2009-12-03 09:41:35 -06:00
Mark McLoughlin df6c2a0fb2 net: initialize vnet_hdr in net_init_tap()
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>
2009-12-03 09:41:35 -06:00