Statistics
| Branch: | Revision:

root / net / socket.c @ feature-archipelago

History | View | Annotate | Download (21.2 kB)

# Date Author Comment
bcbe92fb 10/02/2013 08:20 pm Sebastian Ottlik

net: call socket_set_fast_reuse instead of setting SO_REUSEADDR

SO_REUSEADDR should be avoided on Windows but is desired on other operating
systems. So instead of setting it we call socket_set_fast_reuse that will result
in the appropriate behaviour on all operating systems....

6a1751b7 08/22/2013 08:10 pm Alex Bligh

aio / timers: Untangle include files

include/qemu/timer.h has no need to include main-loop.h and
doing so causes an issue for the next patch. Unfortunately
various files assume including timers.h will pull in main-loop.h.
Untangle this mess.

Signed-off-by: Alex Bligh <>...

f9e8cacc 04/02/2013 06:47 pm Stefan Hajnoczi

oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()

The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets.
Rename to qemu_set_nonblock() just like qemu_set_cloexec().

Signed-off-by: Stefan Hajnoczi <>
Reviewed-by: Eric Blake <>...

fc13fa00 04/02/2013 06:47 pm Stefan Hajnoczi

net: ensure "socket" backend uses non-blocking fds

There are several code paths in net_init_socket() depending on how the
socket is created: file descriptor passing, UDP multicast, TCP, or UDP.
Some of these support both listen and connect.

Not all code paths set the socket to non-blocking. This patch addresses...

d32fcad3 03/25/2013 12:14 pm Scott Feldman

net: increase buffer size to accommodate Jumbo frame pkts

Socket buffer sizes were hard-coded to 4K for VDE and socket netdevs. Bump this
up to 68K (ala tap netdev) to handle maximum GSO packet size (64k) plus plenty
of room for the ethernet and virtio_net headers....

20048d0a 03/25/2013 12:13 pm Stefan Hajnoczi

net: use socket_set_nodelay() for -netdev socket

Reduce -netdev socket latency by disabling the Nagle algorithm on
SOCK_STREAM sockets in net/socket.c. Since we are tunelling Ethernet
over TCP we shouldn't artificially delay outgoing packets, let the guest...

9957fc7f 03/22/2013 02:14 pm Stefan Weil

MinGW: Replace setsockopt by qemu_setsocketopt

Instead of adding missing type casts which are needed by MinGW for the
4th argument, the patch uses qemu_setsockopt which was invented for this
purpose.

Signed-off-by: Stefan Weil <>
Signed-off-by: Stefan Hajnoczi <>

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

83c9089e 12/19/2012 09:31 am Paolo Bonzini

monitor: move include files to include/monitor/

Signed-off-by: Paolo Bonzini <>

1422e32d 12/19/2012 09:31 am Paolo Bonzini

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 copies
that existed. Leave include/net/tap.h as the interface for NICs, and
net/tap_int.h as the interface for OS-specific parts of the tap backend....

f8fe7964 12/19/2012 09:29 am Paolo Bonzini

janitor: do not include qemu-char everywhere

Touching char/char.h basically causes the whole of QEMU to
be rebuilt. Avoid this, it is usually unnecessary.

Signed-off-by: Paolo Bonzini <>

f0e3ac70 11/01/2012 12:00 pm Lei Li

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.
...

a245fc18 10/08/2012 02:59 pm Paolo Bonzini

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 interface
for tap. Then having both net/tap.h and include/net/tap.h does...

73062dfe 09/23/2012 09:37 am Stefan Weil

net/socket: Fix compiler warning (regression for MinGW)

Commit 213fd5087e2e4e2da10ad266df0ba950cf7618bf removed a type cast
which 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:...

863f678f 09/14/2012 10:40 am Stefan Hajnoczi

net: asynchronous send/receive infrastructure for net/socket.c

The net/socket.c net client is not truly asynchronous. This patch
borrows the qemu_set_fd_handler2() code from net/tap.c as the basis for
proper asynchronous send/receive.

Only read packets from the socket when the peer is able to receive....

213fd508 09/14/2012 10:40 am Stefan Hajnoczi

net: EAGAIN handling for net/socket.c UDP

Implement asynchronous send for UDP (or other SOCK_DGRAM) sockets. If
send fails with EAGAIN we wait for the socket to become writable again.

Signed-off-by: Stefan Hajnoczi <>

45a7f54a 09/14/2012 10:40 am Stefan Hajnoczi

net: EAGAIN handling for net/socket.c TCP

Replace spinning send_all() with a proper non-blocking send. When the
socket write buffer limit is reached, we should stop trying to send and
wait for the socket to become writable again.

Non-blocking TCP sockets can return in two different ways when the write...

a96ed02f 09/07/2012 09:15 am Nicholas Bellinger

monitor: Rename+move net_handle_fd_param -> monitor_handle_fd_param

This patch renames+moves the net_handle_fd_param() caller used to
obtain a file descriptor from either qemu_parse_fd() (the normal case)
or from monitor_get_fd() (migration case) into a generically prefixed...

e34cde35 08/01/2012 03:32 pm Zhi Yong Wu

net: fix the coding style

Signed-off-by: Zhi Yong Wu <>
Signed-off-by: Stefan Hajnoczi <>
Reviewed-by: Laszlo Ersek <>

011de2b5 08/01/2012 03:32 pm Zhi Yong Wu

net: add the support for -netdev socket, listen

The -net socket,listen option does not work with the newer -netdev
syntax:
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,...

4e68f7a0 08/01/2012 03:32 pm Stefan Hajnoczi

net: Rename VLANClientState to NetClientState

The vlan feature is no longer part of net core. Rename VLANClientState
to NetClientState because net clients are not explicitly associated with
a vlan at all, instead they have a peer net client to which they are...

d33d93b2 08/01/2012 02:28 pm Stefan Hajnoczi

net: Use hubs for the vlan feature

Stop using the special-case vlan code in net.c. Instead use the hub net
client to implement the vlan feature. The next patch will remove vlan
code from net.c completely.

Signed-off-by: Stefan Hajnoczi <>...

ab5f3f84 08/01/2012 02:28 pm Stefan Hajnoczi

net: Drop vlan argument to qemu_new_net_client()

Since hubs are now used to implement the 'vlan' feature and the vlan
argument is always NULL, remove the argument entirely and update all net
clients that use qemu_new_net_client().

Signed-off-by: Stefan Hajnoczi <>...

2be64a68 07/23/2012 01:55 pm Laszlo Ersek

hw, net: "net_client_type" -> "NetClientOptionsKind" (qapi-generated)

NET_CLIENT_TYPE_ -> NET_CLIENT_OPTIONS_KIND_

Signed-off-by: Laszlo Ersek <>
Signed-off-by: Stefan Hajnoczi <>

6687b79d 07/23/2012 01:55 pm Laszlo Ersek

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 a
Netdev or a NetLegacy. The original meat of net_client_init() is moved to
and simplified in net_client_init1():...

bef8e8fe 07/23/2012 01:55 pm Laszlo Ersek

convert net_init_socket() to NetClientOptions

I "reverse engineered" the following permissions between the -socket
sub-options:

fd  listen  connect  mcast  udp | localaddr
fd x . . . . | .
listen . x . . . | ....
1a0c0958 07/23/2012 01:55 pm Laszlo Ersek

remove unused QemuOpts parameter from net init functions

v1->v2:
- unchanged

v2->v3:
- keep "qemu-option.h" included in "net/slirp.h"

Signed-off-by: Laszlo Ersek <>
Signed-off-by: Stefan Hajnoczi <>

42dcc547 06/04/2012 07:49 pm Luiz Capitulino

net: purge the monitor object from all init functions

The only backend that really uses it is the socket one, which calls
monitor_get_fd(). But it can use 'cur_mon' instead.

Signed-off-by: Luiz Capitulino <>
Reviewed-By: Laszlo Ersek <>

da8d6057 02/10/2012 12:44 pm Benjamin MARSILI

net: remove extra spaces in help messages

Signed-off-by: Benjamin MARSILI <>
Signed-off-by: Stefan Hajnoczi <>

0e0e7fac 01/12/2012 06:34 pm Benjamin

Support for UDP unicast network backend

Signed-off-by: Benjamin MARSILI <>
Signed-off-by: Anthony Liguori <>

a46667ea 01/06/2012 05:07 pm Peter Maydell

net/socket.c: Fix fd leak in net_socket_listen_init() error paths

Fix a leak of a file descriptor due to missing closesocket() calls
in error paths in net_socket_listen_init().

Signed-off-by: Peter Maydell <>
Signed-off-by: Stefan Hajnoczi <>

9423a2e8 12/14/2011 03:59 pm Anthony Liguori

Merge remote-tracking branch 'stefanha/trivial-patches-next' into staging

842480d4 12/13/2011 01:06 am Stefan Hajnoczi

net: expand tabs in net/socket.c

In order to make later patches sane, expand the tab characters and
conform to QEMU coding style now.

Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Anthony Liguori <>

e5d1fca0 12/13/2011 01:06 am Stefan Hajnoczi

net: take ownership of fd in socket init functions

Today net/socket.c has no consistent policy for closing the socket file
descriptor when initialization fails. This means we leak the file
descriptor in some cases or we could also try to close it twice....

c7ee8f68 12/06/2011 11:56 am Zhi Hui Li

net/socket.c : fix memory leak

Signed-off-by: Li Zhi Hui <>
Signed-off-by: Stefan Hajnoczi <>

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

23ddf2bb 08/07/2011 02:06 pm Brad

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 \...

00aa0040 07/25/2011 05:38 pm Blue Swirl

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]...

6daf194d 06/24/2011 11:13 am Markus Armbruster

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 <>...

c7eb1f02 02/25/2011 05:13 pm Pavel Dovgaluk

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...
4d22c6c2 12/17/2010 11:03 pm Blue Swirl

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 <>

3a75e74c 12/09/2010 12:45 pm Mike Ryan

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....

1ecda02b 03/16/2010 05:58 pm Markus Armbruster

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...

2f792016 03/16/2010 05:55 pm Markus Armbruster

error: Move qemu_error & friends into their own header

62112d18 02/19/2010 08:12 pm Markus Armbruster

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...

40ff6d7e 12/03/2009 07:45 pm Kevin Wolf

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 <>
Signed-off-by: Anthony Liguori <>

564f63e3 12/03/2009 05:41 pm Mark McLoughlin

net: convert socket to NetClientInfo

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

42281ac9 12/03/2009 05:41 pm Mark McLoughlin

net: move socket backend code from net.c to net/socket.c

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>