Statistics
| Branch: | Revision:

root / slirp @ 19bf7c87

# Date Author Comment
d3b12f5d 10/21/2011 07:14 pm Paolo Bonzini

main-loop: create main-loop.c

Signed-off-by: Paolo Bonzini <>

2b440432 09/28/2011 02:11 pm Thomas Huth

slirp: Fix packet expiration

The two new variables "arp_requested" and "expiration_date" in the mbuf
structure have been added after the variable-sized "m_dat_" array. The
variables have to be added before the m_dat_ array instead.
Without this patch, the expiration_date gets clobbered by code that...

8d06d69b 09/28/2011 02:10 pm Jan Kiszka

slirp: Fix use after release on tcp_input

ti points into the m buffer. But the latter may already be released
right after the dodata: label. Move the test before the potential
release.

Signed-off-by: Jan Kiszka <>

39ba59c2 09/20/2011 11:18 pm Anthony Liguori

Merge remote-tracking branch 'kiszka/queues/slirp' into staging

b2bedb21 09/16/2011 04:25 pm Stefan Weil

Remove blanks before \n in output strings

Those blanks violate the coding conventions, see
scripts/checkpatch.pl.

Blanks missing after colons in the changed lines were added.

This patch does not try to fix tabs, long lines and other
problems in the changed lines, therefore checkpatch.pl reports...

144d192d 09/16/2011 01:16 am Jan Kiszka

slirp: Fill TCP/IP header template after SYN reception

This ensures we can cleanly signal the drop in case the connection timer
fires. So far we sent those frames to nowhere (target IP 0.0.0.0).

Found by the new assertion on invalid IPs in arp_table_search....

5a61cb60 09/09/2011 11:56 am Stefan Weil

Fix include statements for qemu-common.h

  • qemu-common.h is not a system include file, so it should be included
    with "" instead of <>. Otherwise incremental builds might fail
    because only local include files are checked for changes.
  • linux-user/syscall.c included the file twice....
541dc0d4 09/03/2011 01:45 pm Stefan Weil

Use new macro QEMU_PACKED for packed structures

Most changes were made using these commands:

git grep -la '__attribute__((packed))'|xargs perl -pi -e 's/__attribute__\(\(packed\)\)/QEMU_PACKED/'
git grep -la '__attribute__ ((packed))'|xargs perl -pi -e 's/__attribute__ \(\(packed\)\)/QEMU_PACKED/'...

2cc6e0a1 08/22/2011 06:17 pm Anthony Liguori

char: rename qemu_chr_write() -> qemu_chr_fe_write()

Signed-off-by: Anthony Liguori <>

aec7c6dc 08/21/2011 10:19 pm Blue Swirl

Merge branch 'queues/slirp' of git://git.kiszka.org/qemu

  • 'queues/slirp' of git://git.kiszka.org/qemu:
    slirp: Fix bit field types in IP header structs
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 <>

1b930bfa 08/15/2011 09:34 am Jan Kiszka

slirp: Fix bit field types in IP header structs

-mms-bitfields prevents that the bitfields in current IP header structs
are packed into a single byte as it is required. Fix this by using
uint8_t as backing type.

Signed-off-by: Jan Kiszka <>

e3a110b5 08/05/2011 03:05 pm Jan Kiszka

slirp: Only start packet expiration for delayed ones

The expiration timeout must only affect packets that are queued due to
pending ARP resolutions. The old version broke ping e.g.

Signed-off-by: Jan Kiszka <>

fd593879 08/05/2011 03:04 pm Jan Kiszka

slirp: Read current time only once per if_start call

No need to update the current time for each packet we send from the
queue. Processing time is comparably short.

Signed-off-by: Jan Kiszka <>

5a371a2e 08/05/2011 01:51 pm Jan Kiszka

slirp: Fix types of IP address parameters

Should be uint32_t for IPv4, not int. Also avoid in_addr_t without
proper includes. Fixes build regression on mingw32.

Signed-off-by: Jan Kiszka <>

1ab74cea 08/03/2011 01:57 pm Fabien Chouteau

Delayed IP packets

In the current implementation, if Slirp tries to send an IP packet to a client
with an unknown hardware address, the packet is simply dropped and an ARP
request is sent (if_encap in slirp/slirp.c).

With this patch, Slirp will send the ARP request, re-queue the packet and try...

1a0ca1e1 08/03/2011 01:57 pm Fabien Chouteau

Simple ARP table

This patch adds a simple ARP table in Slirp and also adds handling of
gratuitous ARP requests.

Signed-off-by: Fabien Chouteau <>
Signed-off-by: Jan Kiszka <>

cf2846b5 07/27/2011 12:10 pm Stefan Weil

slirp: Fix unusual "comments" in unused code

cppcheck detected two rather strange comments which were not
correctly written as C comments.

They did not cause any harm because they were framed by
#ifdef notdef ... #endif, so they were never compiled.

Fix them nevertheless (we could also remove the unused code)....

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

e6d43cfb 07/23/2011 06:19 pm Jan Kiszka

slirp: Forward ICMP echo requests via unprivileged sockets

Linux 3.0 gained support for unprivileged ICMP ping sockets. Use this
feature to forward guest pings to the outer world. The host admin has to
set the ping_group_range in order to grant access to those sockets. To...

12b513d8 07/23/2011 06:19 pm Jan Kiszka

slirp: Fix restricted mode

This aligns the code to what the documentation claims: Allow everything
but requests that would have to be routed outside of the virtual LAN.

So we need to drop the unneeded IP-level filter, allow TFTP requests,
and add the missing protocol-level filter to ICMP....

5a82362a 07/23/2011 06:19 pm Jan Kiszka

slirp: Strictly associate DHCP/BOOTP and TFTP with virtual host

Instead of accepting every DHCP/BOOTP and TFTP packet, only invoke the
built-in servers if the target is the virtual host.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

3acccfc6 07/23/2011 06:19 pm Jan Kiszka

slirp: Replace m_freem with m_free

Remove this pointless wrapping.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

565465fc 07/23/2011 06:19 pm Jan Kiszka

slirp: Put forked exec into separate process group

Recent smb daemons tend to terminate themselves via a process group
SIGTERM. If the daemon is still in qemu's group by that time, qemu will
die as well. Avoid this by always pushing fork_exec processes into a...

4d54ec78 03/29/2011 04:14 pm Paolo Bonzini

add a service to reap zombies, use it in SLIRP

SLIRP -smb support wants to fork a process and forget about reaping it.
To please it, add a generic service to register a process id and let
QEMU reap it. In the future it could be enhanced to pass a status,...

7bd427d8 03/21/2011 10:23 am Paolo Bonzini

change all rt_clock references to use millisecond resolution accessors

This was done with:

sed -i '/get_clock\>.*rt_clock/s/get_clock\>/get_clock_ms/' \
$(git grep -l 'get_clock\>.*rt_clock' )
sed -i '/new_timer\>.*rt_clock/s/new_timer\>/new_timer_ms/' \...
24ac3a7d 03/05/2011 02:00 pm Vincent Palatin

net: fix trace when debug is activated in slirp

make the code compile correctly when DEBUG is activated.

Signed-off-by: Vincent Palatin <>
Signed-off-by: Blue Swirl <>

89d2d3af 02/25/2011 05:58 pm Stefan Weil

slirp: Remove some type casts caused by bad declaration of x.tp_buf

x.tp_buf was declared as a uint8_t array, but always used as
a char array (which needed a lot of type casts).

The patch includes these changes:

  • Fix declaration of x.tp_buf and remove all type casts....
8fe3046f 02/14/2011 10:24 pm Anthony Liguori

Fix build from previous commit

I unfortunately got on an unnamed branch and pushed the wrong bits

Signed-off-by: Anthony Liguori <>

53fae6d2 02/14/2011 09:23 pm Bruce Rogers

PATCH] slirp: fix buffer overrun

Since the addition of the slirp member to struct mbuf, the value of
SLIRP_MSIZE and the initialization of m_size have not been correct,
resulting in overrunning the end of the malloc'd buffer in some cases.

Signed-off-by: Bruce Rogers <>...

64b85a8f 01/23/2011 06:21 pm Blue Swirl

Delete useless 'extern' qualifiers for functions

'extern' qualifier is useless for function declarations. Delete
them.

Signed-off-by: Blue Swirl <>

facf1a60 01/13/2011 12:38 pm Sergei Gavrikov

slirp: Use strcasecmp() to check tftp mode, tsize

According to RFC 1350 (TFTP Revision 2) the mode field can contain any
combination of upper and lower case; also RFC 2349 propagates that the
transfer size option ("tsize") is case in-sensitive too.

Current implementation of embedded TFTP server missed that what does...

8aaf42ed 01/10/2011 11:56 am Aurelien Jarno

slirp: fix unaligned access in bootp code

Slirp code tries to be smart an avoid data copy by using pointer to
the data. This solution leads to unaligned access, in this case
preq_addr, which is a 32-bit long structure. There is no real point
of avoiding data copy in a such case, as the value itself is smaller...

9eca6cc6 11/21/2010 05:16 pm Stefan Weil

slirp: Remove unused code for bad sprintf

Neither DECLARE_SPRINTF nor BAD_SPRINTF are needed for QEMU.

QEMU won't support systems with missing or bad declarations
for sprintf. The unused code was detected while looking for
functions with missing format checking. Instead of adding...

8b7968f7 10/03/2010 09:34 am Stefan Weil

Use GCC_FMT_ATTR (format checking)

Signed-off-by: Stefan Weil <>
Signed-off-by: Blue Swirl <>

4a2b39d3 10/03/2010 09:31 am Andreas Färber

slirp: Silence warning on Haiku

Haiku has O_BINARY in fcntl.h.

Signed-off-by: Andreas Färber <>
Cc: Jan Kiszka <>
Signed-off-by: Blue Swirl <>

0d491754 09/17/2010 01:46 pm Hervé Poussineau

Accept packets with TTL=1

Packets with TTL=1 may be directed to local network (DHCP/DNS servers for example), so don't discard them
This is required by old versions of NetBSD which send DHCP DISCOVER packets with TTL=1

Signed-off-by: Hervé Poussineau <>...

dbf3c4b4 09/17/2010 01:46 pm Hervé Poussineau

Make ARP replies at least 64 bytes long

IEEE 802.3 standard requires Ethernet frames to be at least 64 bytes long.
If it is not the case, they will be considered as runt frames, and may be ignored by netcard and/or OS

Signed-off-by: Hervé Poussineau <>...

7390cdfb 09/04/2010 12:45 pm Jes Sorensen

Change DPRINTF to do{}while(0) to avoid compiler warning

Signed-off-by: Jes Sorensen <>
Signed-off-by: Blue Swirl <>

b6dce92e 07/25/2010 05:59 pm Stefan Weil

slirp: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int types

There is no need to have a second set of integral types.
Replace them by the standard types from stdint.h.

Signed-off-by: Stefan Weil <>
Signed-off-by: Aurelien Jarno <>

08dc07a3 07/25/2010 05:59 pm Stefan Weil

slirp: Remove declarations which are no longer needed

The previous patches replaced u_int8_t, u_int16_t, u_int32_t, u_int64_t
by standard int types from stdint.h,
so we can now remove their declarations which are no longer needed.

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

0be71e32 07/06/2010 06:36 pm Alex Williamson

savevm: Add DeviceState param

When available, we'd like to be able to access the DeviceState
when registering a savevm. For buses with a get_dev_path()
function, this will allow us to create more unique savevm
id strings.

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

9678d950 04/25/2010 09:35 pm Blue Swirl

Remove dead assignments in various common files, spotted by clang analyzer

Value stored is never read.

Signed-off-by: Blue Swirl <>

ab07b980 04/20/2010 07:42 pm Juha Riihimäki

slirp: fix structure initialization in tcp_listen()

A data structure of type sockaddr_in is allocated from stack but not
properly initialized. This may lead to a failure in the bind() call
later on. Fixed by filling the contents of the structure with zeroes...

7107944a 04/18/2010 05:27 pm Blue Swirl

slirp: fix unused return value, spotted by clang

Fix clang errors like:
CC slirp/cksum.o
/src/qemu/slirp/cksum.c:78:3: error: expression result unused [-Wunused-value]
REDUCE;
/src/qemu/slirp/cksum.c:45:66: note: instantiated from:

Signed-off-by: Blue Swirl <>

8631b608 03/16/2010 05:55 pm Markus Armbruster

monitor: Separate "default monitor" and "current monitor" cleanly

Commits 376253ec..731b0364 introduced global variable cur_mon, which
points to the "default monitor" (if any), except during execution of
monitor_read() or monitor_control_read() it points to the monitor from...

7071ff32 03/07/2010 03:45 pm Blue Swirl

slirp: remove dead initialization, spotted by clang

Value stored during initialization is never read.

Signed-off-by: Blue Swirl <>

b0e04867 03/07/2010 03:45 pm Blue Swirl

slirp: remove dead nested assignment, spotted by clang

Although the value stored to 'r' is used in the enclosing expression,
the value is never actually read from 'r'.

Signed-off-by: Blue Swirl <>

369c86e7 03/07/2010 03:45 pm Blue Swirl

slirp: remove dead increments, spotted by clang

Value stored is never read.

Signed-off-by: Blue Swirl <>

aca9fcd2 03/07/2010 03:13 pm Blue Swirl

slirp: remove dead assignments, spotted by clang

Value stored is never read.

Signed-off-by: Blue Swirl <>

6265eb26 02/10/2010 10:00 pm Jim Meyering

don't dereference NULL after failed strdup

Most of these are obvious NULL-deref bug fixes, for example,
the ones in these files:

block/curl.c
net.c
slirp/misc.c

and the first one in block/vvfat.c.
The others in block/vvfat.c may not lead to an immediate segfault, but I...

d0f2c4c6 02/07/2010 01:03 am malc

Do not use dprintf

dprintf is already claimed by POSIX1, and on at least one system
is implemented as a macro

[1] http://www.opengroup.org/onlinepubs/9699919799/functions/dprintf.html

Signed-off-by: malc <>

1cb1a66a 01/14/2010 01:14 am Milan Plzik

Qemu's internal TFTP server breaks lock-step-iness of TFTP

According to RFC 1350 and RFC 2347, TFTP server should answer RRQ by
either OACK or DATA packet. Qemu's internal TFTP server answers RRQ with
additional options by sending both OACK and DATA packet, thus breaking...

bfe4e172 01/11/2010 09:41 pm Thomas Horsten

Handle TFTP ERROR from client

If a PXE client only wants to find out the size of a file, it will
open the file and then abort the transfer by sending a TFTP ERROR packet.

The ERROR packet should cause qemu to terminate the session. If not,
the sessions will soon run out and cause timeouts in the client....

f0d98b05 12/25/2009 08:19 pm Kirill A. Shutemov

slirp/misc.c: fix warning with _FORTIFY_SOURCE

CC    slirp/misc.o
cc1: warnings being treated as errors
slirp/misc.c: In function 'fork_exec':
slirp/misc.c:209: error: ignoring return value of 'write', declared with attribute warn_unused_result
make: *** [slirp/misc.o] Error 1...
9a0c6a33 12/19/2009 12:23 am Juha Riihimäki

fix networking on win32 host

At least under some mingw compilers slirp networking fails without declaring
these fields packed.

From: Juha Riihimäki <>
Signed-off-by: Juha Riihimäki <>
Signed-off-by: Riku Voipio <>...

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

e0cf6d15 11/21/2009 01:34 am Mark McLoughlin

slirp: fix use-after-free

460fec67ee introduced a use-after free in slirp.

Cc: Jan Kiszka <>
Signed-off-by: Mark McLoughlin <>
Signed-off-by: Aurelien Jarno <>

65528b19 09/30/2009 09:56 pm Michael S. Tsirkin

slirp: fix unmatched bracket in if 0

Fix unmatched bracket in commented out code

Signed-off-by: Michael S. Tsirkin <>
Signed-off-by: Blue Swirl <>

72cf2d4f 09/12/2009 10:36 am Blue Swirl

Fix sys-queue.h conflict for good

Problem: Our file sys-queue.h is a copy of the BSD file, but there are
some additions and it's not entirely compatible. Because of that, there have
been conflicts with system headers on BSD systems. Some hacks have been
introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...

1e6eec8b 09/05/2009 01:14 pm Blue Swirl

Fix Sparse warnings: add "static"

Signed-off-by: Blue Swirl <>

9e3a95ef 08/31/2009 06:41 pm Stefan Weil

Fix compiler warnings

Starting with commit df7a86ed735eafefbd046c8cad7134652fe3f600,
mingw32 builds result in a compiler warning for dns_addr:

CC    slirp/slirp.o
/home/stefan/src/qemu/savannah/qemu/slirp/slirp.c:50: warning: missing braces around initializer...
ce0bd027 08/28/2009 04:46 am Ed Swierk

slirp: Remove our_addr code

Three problems with our_addr:

- It's determined only once when qemu starts, but the address can change
(just like the DNS configuration can).

- It's supposed to be the IP address of a host network interface, but
there's no guarantee that gethostbyname(gethostname()) actually does...

df7a86ed 08/28/2009 04:46 am Ed Swierk

slirp: Read host DNS config on demand

Currently the qemu user-mode networking stack reads the host DNS
configuration (/etc/resolv.conf or the Windows equivalent) only once
when qemu starts. This causes name lookups in the guest to fail if the
host is moved to a different network from which the original DNS servers...

23534222 08/01/2009 01:13 pm Blue Swirl

Add missing "static"

Signed-off-by: Blue Swirl <>

7cba04f6 08/01/2009 01:13 pm Blue Swirl

More NULL pointer fixes

Signed-off-by: Blue Swirl <>

e2542fe2 07/27/2009 10:09 pm Juan Quintela

rename WORDS_BIGENDIAN to HOST_WORDS_BIGENDIAN

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

97df1ee5 07/27/2009 10:09 pm Ed Swierk

slirp: Remove UDP protocol emulation (talk, cuseeme)

The UDP emulation code for talk has been commented out since the
beginning of time, and unless someone who runs CU-SeeMe on qemu with
user-mode networking can vouch that the special magic (a) is necessary...

aaf10d9d 07/27/2009 10:09 pm Ed Swierk

slirp: Use monotonic clock if available (v2)

Calling gettimeofday() to compute a time interval can cause problems if
the system clock jumps forwards or backwards; replace updtime() with
qemu_get_clock(rt_clock), which calls clock_gettime(CLOCK_MONOTONIC) if...

bb53fc53 07/27/2009 10:08 pm Jan Kiszka

slirp: Fix guestfwd for incoming data

Unless a virtual server address was explicitly defined (which is
impossible with the legacy net channel format), guestfwd did not
properly forwarded host
>guest packets. This patch fixes it.

Signed-off-by: Jan Kiszka <>...

6cb9c6d3 07/01/2009 10:11 pm Blue Swirl

Fix breakage by obsolete _P() for good

Signed-off-by: Blue Swirl <>

74efd61a 06/29/2009 10:18 pm Jan Kiszka

slirp: tftp: Relax filename format check

[ Applies on top of my recently posted slirp series. ]

Allow tftp requests with filenames that do not start with a slash.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

b1c99fcd 06/29/2009 04:52 pm Jan Kiszka

slirp: Enable multiple instances

Once again this was a long journey to reach the destination: Allow to
instantiate slirp multiple times. But as in the past, the journey was
worthwhile, cleaning up, fixing and enhancing various parts of the user
space network stack along the way....

0a1f851e 06/29/2009 04:52 pm Jan Kiszka

slirp: Save/restore bootp client states

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

8ec7f4ed 06/29/2009 04:52 pm Jan Kiszka

slirp: Clean up updtime

Drop redundant typecasts in both variants and remove the pointless
round-up in the UNIX version.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

d918f23e 06/29/2009 04:52 pm Jan Kiszka

slirp: Kill slirp_is_inited

Avoid the need for slirp_is_inited by refactoring the protected
slirp_select_* functions. This also avoids the clearing of all fd sets
on select errors.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

f1d99bbd 06/29/2009 04:52 pm Jan Kiszka

slirp: Clean up timeout handling around slirp_select_fill/poll

Again lot of dead code. Remove it.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

b5302e1a 06/29/2009 04:52 pm Jan Kiszka

slirp: Drop link_up checks from if_output and slirp_socket_can_recv

link_up is true once slirp is initialized, so these check are really not
required.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

460fec67 06/29/2009 04:52 pm Jan Kiszka

slirp: Factor out internal state structure

The essence of this patch is to stuff (almost) all global variables of
the slirp stack into the structure Slirp. In this step, we still keep
the structure as global variable, directly accessible by the whole
stack. Changes to the external interface of slirp will be applied in...

9f8bd042 06/29/2009 04:52 pm Jan Kiszka

slirp: Use internal state in interface

This now also exports the internal state to the slirp users in qemu,
returning it from slirp_init and expecting it along with service
invocations. Additionally provide an opaque value interface for the
callbacks from slirp into the qemu core....

ad0d8c4c 06/29/2009 04:52 pm Jan Kiszka

slirp: Allocate/free stack instance dynamically

Allocate the internal slirp state dynamically and provide and call
slirp_cleanup to properly release it after use. This patch finally
unbreaks slirp release and re-instantiation via host_net_* monitor
commands....

285f7a62 06/29/2009 04:52 pm Jan Kiszka

slirp: Make IP packet ID consistent

Currently, ip_id is always initialized to 0 on slirp startup (despite
the broken attempt to derive it from the clock). This is good for
reproducibility. But it is not preserved across save/restore. This patch
therefore drops the dead initialization code from ip_init and introduces...

ee9be587 06/29/2009 04:52 pm Jan Kiszka

slirp: Drop unused icmp_var.h

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

f8e3cbd3 06/29/2009 04:52 pm Jan Kiszka

slirp: tftp: Cleanup tftp_prefix check

Perform check for set prefix early (if it's not given, tftp is disabled)
and drop redundant second check.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

ef2d54d8 06/29/2009 04:52 pm Jan Kiszka

slirp: tftp: Clean up tftp_send_error

The return code of tftp_send_error is not used, drop it. And also make
sure to always terminate the session.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

20c24bf2 06/29/2009 04:52 pm Jan Kiszka

slirp: tftp: Refactor tftp_handle_rrq

Specifically make the filename extraction more readable, and always
report errors back to the client.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

9367964a 06/29/2009 04:52 pm Jan Kiszka

slirp: tftp: Rework filename handling

This changes the filename handling from a static buffer in tftp_session
for the client-provided name + prefix to a dynamically allocated buffer
that keeps the combined path in one place.

Signed-off-by: Jan Kiszka <>...

df461894 06/29/2009 04:52 pm Jan Kiszka

slirp: Factor out one-time initialization

In order to prepare re-initialization and multi-instance slirp, factor
out init code that is of global scope and (at least for now) only need
to be run once.

This also fixes the potentially uninitialized use of our_addr in...

9c12a6f2 06/29/2009 04:52 pm Jan Kiszka

slirp: Do not allow to remove non-hostfwd sockets

Prevent that the users accidentally shoots down dynamic sockets. This
allows to remove looping for removals as there can now only be one
match.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

4a82347a 06/29/2009 04:52 pm Jan Kiszka

slirp: Mark sockets of incoming TCP connections

Required for pretty-printing.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

6dbe553f 06/29/2009 04:52 pm Jan Kiszka

slirp: Add info usernet for dumping connection states

Break out sockstats from the slirp statistics and present them under the
new info category "usernet". This patch also improves the current output
/wrt proper reporting connection source and destination....

0d62c4cf 06/29/2009 04:52 pm Jan Kiszka

slirp: Drop dead code

After all its years inside the qemu tree, there is no point in keeping
the dead code paths of slirp. This patch is a first round of removing
usually commented out code parts. More cleanups need to follow (and
maybe finally a proper reindention)....

0fe6a7f2 06/29/2009 04:52 pm Jan Kiszka

slirp: Drop statistic code

As agreed on the mailing list, there is no interest in keeping the
usually disabled slirp statistics in the tree. So this patch removes
them.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

9f349498 06/29/2009 04:52 pm Jan Kiszka

slirp: Cleanup and basic reanimation of debug code

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

a13a4126 06/29/2009 04:52 pm Jan Kiszka

slirp: Rework internal configuration

The user mode IP stack is currently only minimally configurable /wrt to
its virtual IP addresses. This is unfortunate if some guest has a fixed
idea of which IP addresses to use.

Therefore this patch prepares the stack for fully configurable IP...

c92ef6a2 06/29/2009 04:52 pm Jan Kiszka

slirp: Rework external configuration interface

With the internal IP configuration made more flexible, we can now
enhance the user interface. This patch adds a number of new options to
"-net user": net (address and mask), host, dhcpstart, dns and smbserver....

2ad82cf9 06/29/2009 04:52 pm Jan Kiszka

slirp: Fix port comparision in slirp_remove_hostfwd

For UDP host forwardings, fport is not stable, every outgoing packet of
the redirection can modify it. Use getsockname instead to look up the
port that is actually used on the host side.

Signed-off-by: Jan Kiszka <>...

3c6a0580 06/29/2009 04:52 pm Jan Kiszka

slirp: Bind support for host forwarding rules

Extend the hostfwd rule format so that the user can specify on which
host interface qemu should listen for incoming connections. If omitted,
binding will takes place against all interfaces.

Signed-off-by: Jan Kiszka <>...

f932b6ce 06/29/2009 04:52 pm Jan Kiszka

slirp: Prepare for persistent socket state flags

This prepares for adding flags to socket.so_state that must not be
removed during the lifetime of a socket.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

6dd5ffb6 06/29/2009 04:52 pm Jan Kiszka

slirp: Explicitely mark host-forwarding sockets

Mark sockets that describe host forwardings. This is required for their
(and only their) proper deletion and for pretty-printing.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>