Commit Graph

289 Commits

Author SHA1 Message Date
Jan Kiszka 460fec67ee 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
the following patches.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:49 -05:00
Jan Kiszka b5302e1a9d 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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:49 -05:00
Jan Kiszka f1d99bbdcd slirp: Clean up timeout handling around slirp_select_fill/poll
Again lot of dead code. Remove it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:49 -05:00
Jan Kiszka d918f23efa 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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:49 -05:00
Jan Kiszka 8ec7f4edcf 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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:49 -05:00
Jan Kiszka 285f7a62e4 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
ip_id to the persistent slirp state.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:48 -05:00
Jan Kiszka df46189412 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
get_dns_addr.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:47 -05:00
Jan Kiszka 9367964ae2 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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:47 -05:00
Jan Kiszka 20c24bf24d 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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:47 -05:00
Jan Kiszka ef2d54d8df 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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:47 -05:00
Jan Kiszka f8e3cbd3b5 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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:47 -05:00
Jan Kiszka ee9be58735 slirp: Drop unused icmp_var.h
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:47 -05:00
Jan Kiszka 9f349498af slirp: Cleanup and basic reanimation of debug code
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:46 -05:00
Jan Kiszka 0fe6a7f284 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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:46 -05:00
Jan Kiszka 0d62c4cfe2 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).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:46 -05:00
Jan Kiszka 6dbe553fe9 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.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:46 -05:00
Jan Kiszka 4a82347a47 slirp: Mark sockets of incoming TCP connections
Required for pretty-printing.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:46 -05:00
Jan Kiszka 9c12a6f24d 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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:46 -05:00
Jan Kiszka 6dd5ffb661 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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:45 -05:00
Jan Kiszka f932b6ce71 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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:45 -05:00
Jan Kiszka 3c6a05803c 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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:45 -05:00
Jan Kiszka 2ad82cf9e2 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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:45 -05:00
Jan Kiszka c92ef6a22d 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.
It also renames "redir" to "hostfwd" and "channel" to "guestfwd" in
order to (hopefully) clarify their meanings. The format of guestfwd is
extended so that the user can define not only the port but also the
virtual server's IP address the forwarding starts from.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:45 -05:00
Jan Kiszka a13a4126c8 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
addresses and masks. The user interface and default addresses remain
untouched in this step, they will be enhanced in the following patch.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:45 -05:00
Jan Kiszka ad196a9d0c slirp: Move smb, redir, tftp and bootp parameters and -net channel
So far a couple of slirp-related parameters were expressed via
stand-alone command line options. This it inconsistent and unintuitive.
Moreover, it prevents both dynamically reconfigured (host_net_add/
delete) and multi-instance slirp.

This patch refactors the configuration by turning -smb, -redir, -tftp
and -bootp as well as -net channel into options of "-net user". The old
stand-alone command line options are still processed, but no longer
advertised. This allows smooth migration of management applications to
to the new syntax and also the extension of that syntax later in this
series.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:44 -05:00
Jan Kiszka e15f4a992c Revert "User networking: Show active connections"
This reverts commit 1c6ed9f337.

It's redundant to slirp statistics, which are going to be split up /
reworked later on.

Conflicts:

	monitor.c
	net.c

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:44 -05:00
Jan Kiszka b35725c544 slirp: Refactor tcp_ctl
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:44 -05:00
Jan Kiszka 753a5f170d slirp: Drop redundant lines from udp_input
The socket faddr/fport is already updated a few lines below, so these
are completely redundant.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:44 -05:00
Blue Swirl c5b76b3810 Fix mingw32 build warnings
Work around buffer and ioctlsocket argument type signedness problems
Suppress a prototype which is unused on mingw32
Expand a macro to avoid warnings from some GCC versions

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-13 08:44:31 +00:00
Jan Kiszka b8e8af38ee slirp: Reorder initialization
This patch reorders the initialization of slirp itself as well as its
associated features smb and redirection. So far the first reference to
slirp triggered the initialization, independent of the actual -net user
option which may carry additional parameters. Now we save any request to
add a smb export or some redirections until the actual initialization of
the stack. This also allows to move a few parameters that were passed
via global variable into the argument list of net_slirp_init.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Alexander Graf 1c6ed9f337 User networking: Show active connections
In case you're wondering what connections exactly you have open
or maybe redir'ed in the past, you can't really find out from qemu
right now.

This patch enables you to see all current connections the host
only networking holds open, so you can kill them using the previous
patch.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-28 02:14:56 -05:00
Alexander Graf c1261d8d16 User Networking: Enable removal of redirections
Using the new host_net_redir command you can easily create redirections
on the fly while your VM is running.

While that's great, it's missing the removal of redirections, in case you
want to have a port closed again at a later point in time.

This patch adds support for removal of redirections.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-27 09:46:12 -05:00
Jan Kiszka 0928a95ffe slirp: Reassign same address to same DHCP client
In case a client restarts a DHCP recovery without releasing its old
address, reassign the same address to prevent consuming free addresses
and moving away from the standard client address.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2009-05-22 10:50:34 -05:00
malc 0a656f5f21 Cast pointer arguments of get/setsockopt, send to void * to keep GCC
from producing a warning about pointer type mismatches with Winsock

Signed-off-by: malc <av1474@comtv.ru>
2009-05-21 05:30:51 +04:00
Blue Swirl 001faf3269 Replace gcc variadic macro extension with C99 version
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-05-13 17:53:17 +00:00
aliguori b63c7f6b77 slirp: Handle DHCP requests for specific IP (Jan Kiszka)
This adds proper handling of the ciaddr field as well as the "Requested
IP Address" option to slirp's DHCP server. If the client requests an
invalid or used IP, a NAK reply is sent, if it requests a specific but
valid IP, this is now respected.

NAK'ing invalid IPs is specifically useful when changing the slirp IP
range via '-net user,ip=...' while the client saved its previously used
address and tries to reacquire it. Now this will be NAK'ed and the
client will start a new discovery round.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7198 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-21 19:56:20 +00:00
blueswir1 aeed97c4cf Use ANSI prototypes to please sparse
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7176 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-18 07:32:41 +00:00
blueswir1 aa80613232 Move bootp_filename to avoid a sparse warning
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7174 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-18 07:29:30 +00:00
blueswir1 b9e82a5946 Fix some win32 compile warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6984 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-05 18:03:31 +00:00
blueswir1 d78f399542 Delete some unused macros detected with -Wp,-Wunused-macros use
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6856 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-16 16:33:01 +00:00
aliguori 49dc768d4c Fix windows build and clean up use of <windows.h>
We want to globally define WIN_LEAN_AND_MEAN and WINVER to particular values so
let's do it in OS_CFLAGS.

Then, we can pepper in windows.h includes where using #includes that require it.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6783 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-08 16:26:59 +00:00
blueswir1 511d2b140f Sparse fixes: NULL use, header order, ANSI prototypes, static
Fix Sparse warnings:
 * use NULL instead of plain 0
 * rearrange header include order to avoid redefining types accidentally
 * ANSIfy SLIRP
 * avoid "restrict" keyword
 * add static



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6736 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-07 15:32:56 +00:00
aliguori 376253ece4 monitor: Rework API (Jan Kiszka)
Refactor the monitor API and prepare it for decoupled terminals:
term_print functions are renamed to monitor_* and all monitor services
gain a new parameter (mon) that will once refer to the monitor instance
the output is supposed to appear on. However, the argument remains
unused for now. All monitor command callbacks are also extended by a mon
parameter so that command handlers are able to pass an appropriate
reference to monitor output services.

For the case that monitor outputs so far happen without clearly
identifiable context, the global variable cur_mon is introduced that
shall once provide a pointer either to the current active monitor (while
processing commands) or to the default one. On the mid or long term,
those use case will be obsoleted so that this variable can be removed
again.

Due to the broad usage of the monitor interface, this patch mostly deals
with converting users of the monitor API. A few of them are already
extended to pass 'mon' from the command handler further down to internal
functions that invoke monitor_printf.

At this chance, monitor-related prototypes are moved from console.h to
a new monitor.h. The same is done for the readline API.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6711 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-05 23:01:23 +00:00
blueswir1 f2ba730e89 Fix SIGSEGV crash in slirp networking code
Fix SIGSEGV crash in networking code (bug was introduced in r6288).
Thanks to Gleb Natapov for finding this fix.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6545 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-06 21:37:40 +00:00
aliguori 2f5f899631 Remove the advertising clause from the slirp license
According to the FSF, the 4-clause BSD license, which slirp is covered under,
is not compatible with the GPL or LGPL[1].

[1] http://www.fsf.org/licensing/licenses/index_html#GPLIncompatibleLicenses

There are three declared copyright holders in slirp that use the 4-clause
BSD license, the Regents of UC Berkley, Danny Gasparovski, and Kelly Price.
Below are the appropriate permissions to remove the advertise clause from slirp
from each party.

Special thanks go to Richard Fontana from Red Hat for contacting all of the
necessary authors to resolve this issue!

Regents of UC Berkley:
From ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

July 22, 1999

To All Licensees, Distributors of Any Version of BSD:

As you know, certain of the Berkeley Software Distribution ("BSD") source
code files require that further distributions of products containing all or
portions of the software, acknowledge within their advertising materials
that such products contain software developed by UC Berkeley and its
contributors.

Specifically, the provision reads:

"     * 3. All advertising materials mentioning features or use of this software
      *    must display the following acknowledgement:
      *    This product includes software developed by the University of
      *    California, Berkeley and its contributors."

Effective immediately, licensees and distributors are no longer required to
include the acknowledgement within advertising materials.  Accordingly, the
foregoing paragraph of those BSD Unix files containing it is hereby deleted
in its entirety.

William Hoskins
Director, Office of Technology Licensing
University of California, Berkeley

Danny Gasparovski:

Subject: RE: Slirp license
Date: Thu, 8 Jan 2009 10:51:00 +1100
From: "Gasparovski, Daniel" <Daniel.Gasparovski@ato.gov.au>
To: "Richard Fontana" <rfontana@redhat.com>

Hi Richard,

I have no objection to having Slirp code in QEMU be licensed under the
3-clause BSD license.

Thanks for taking the effort to consult me about this.


Dan ...

Kelly Price:

Date: Thu, 8 Jan 2009 19:38:56 -0500
From: "Kelly Price" <strredwolf@gmail.com>
To: "Richard Fontana" <rfontana@redhat.com>
Subject: Re: Slirp license

Thanks for contacting me, Richard.  I'm glad you were able to find
Dan, as I've been "keeping the light on" for Slirp.  I have no use for
it now, and I have little time for it (now holding onto Keenspot's
Comic Genesis and having a regular US state government position). If
Dan would like to return to the project, I'd love to give it back to
him.

As for copyright, I don't own all of it.  Dan does, so I will defer to
him.  Any of my patches I will gladly license to the 3-part BSD
license.  My interest in re-licensing was because we didn't have ready
info to contact Dan.  If Dan would like to port Slirp back out of
QEMU, a lot of us 64-bit users would be grateful.

Feel free to share this email address with Dan.  I will be glad to
effect a transfer of the project to him and Mr. Bellard of the QEMU
project.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6451 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-26 19:37:41 +00:00
aurel32 6391e47e42 Use broadcast address for slirp dhcp replies
Windows Vista drops unicast dhcp replies to its yet-unconfigured address,
so use a broadcast address.  This behaviour is allowed by the RFC.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6430 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-24 18:16:18 +00:00
blueswir1 61dca5aa65 Fix _P use on OpenBSD
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6298 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-14 18:04:52 +00:00
blueswir1 429d0a3db8 Fix 64 bit issue in slirp
Signed-off-by: Gleb Natapov <gleb@redhat.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6288 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-13 19:48:42 +00:00
blueswir1 0580ac9160 Fix some SLIRP warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6272 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-12 17:51:06 +00:00
aliguori 062e55272e Add support for vmchannel socket migration (Gleb Natapov)
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6243 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-08 19:27:07 +00:00
aliguori a9ba3a856d Add slirp_restrict option (Gleb Natapov)
Add "slirp firewall" to permit connection only to vmchannel addresses.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6241 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-08 19:24:00 +00:00
aliguori e1c5a2b334 Redirect slirp traffic to/from qemu character device (Gleb Natapov)
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6240 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-08 19:18:21 +00:00
blueswir1 1d6198c3b0 Remove unnecessary trailing newlines
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6000 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-13 09:32:43 +00:00
aurel32 e8e880a72e slirp: fix CVE 2007-5729
The emulated network cards in QEMU allows local users to execute arbitrary
code by writing Ethernet frames with a size larger than the slirp's default
MTU, which triggers a heap-based buffer overflow in the slirp library.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5920 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-07 18:15:23 +00:00
aliguori bf9298b90e Make struct iovec universally available
Vectored IO APIs will require some sort of vector argument.  It makes sense to
use struct iovec and just define it globally for Windows.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5889 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-05 20:05:26 +00:00
blueswir1 36bae8dd95 Fix inline use warnings from sparse
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5540 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-26 15:26:09 +00:00
blueswir1 be15b141e0 Replace uses of strncpy (a GNU extension) with Qemu pstrcpy
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5531 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-25 11:21:28 +00:00
bellard d75a0b97e0 added explicit license
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5499 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-17 17:31:57 +00:00
bellard de806f0786 allow SLIRP to make an ARP request to get the client MAC address. It is useful if an inbound connection is done to a VM which did not send outbound IP packets
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5498 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-17 17:28:58 +00:00
blueswir1 66029f6a2f Fix warning about variables used uninitialized
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5378 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-01 19:39:40 +00:00
blueswir1 7ca699c8c0 Make some variables static
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5376 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-01 19:06:48 +00:00
blueswir1 393e0768e2 Remove unused variables
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5374 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-01 18:08:41 +00:00
blueswir1 674bb26172 Add some missing static qualifiers
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5363 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-30 18:18:27 +00:00
blueswir1 b55266b5a2 Suppress gcc 4.x -Wpointer-sign (included in -Wall) warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5275 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-20 08:07:15 +00:00
aliguori 03ff3ca30f Use common objects for qemu-img and qemu-nbd
Right now, we sprinkle #if defined(QEMU_IMG) && defined(QEMU_NBD) all over the
code.  It's ugly and causes us to have to build multiple object files for
linking against qemu and the tools.

This patch introduces a new file, qemu-tool.c which contains enough for
qemu-img, qemu-nbd, and QEMU to all share the same objects.

This also required getting qemu-nbd to be a bit more Windows friendly.  I also
changed the Windows block-raw to use normal IO instead of overlapping IO since
we don't actually do AIO yet on Windows.  I changed the various #if 0's to
 #if WIN32_AIO to make it easier for someone to eventually fix AIO on Windows.

After this patch, there are no longer any #ifdef's related to qemu-img and
qemu-nbd.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5226 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-15 15:51:35 +00:00
blueswir1 7ccfb2eb5f Fix warnings that would be caused by gcc flag -Wwrite-strings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5206 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-14 06:45:34 +00:00
blueswir1 eb38c52c2a Fix most warnings that would be caused by gcc flag -Wundef
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5173 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-06 17:47:39 +00:00
blueswir1 79383c9c08 Fix some warnings that would be generated by gcc -Wredundant-decls
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5115 c046a42c-6fe2-441c-8c8c-71466251a162
2008-08-30 09:51:20 +00:00
blueswir1 363a37d520 Fix OpenBSD linker warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5044 c046a42c-6fe2-441c-8c8c-71466251a162
2008-08-21 17:58:08 +00:00
blueswir1 8fcd36920e Fix some warnings that would be generated by gcc -Wmissing-prototypes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5022 c046a42c-6fe2-441c-8c8c-71466251a162
2008-08-17 20:26:25 +00:00
blueswir1 a5f1b965da Fix warnings that would be generated by gcc -Wstrict-prototypes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5021 c046a42c-6fe2-441c-8c8c-71466251a162
2008-08-17 20:21:51 +00:00
balrog 116842ee3e Missing include for Slirp on win32 (Eduardo Felipe).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4474 c046a42c-6fe2-441c-8c8c-71466251a162
2008-05-17 18:07:00 +00:00
balrog 242acf3af4 Special-case CTL_ALIAS instead of CTL_DNS in udp loopback test.
At the same time remove a bogus test (tested by Jason Wessel).
Quiet some gcc4 warnings from slirp compilation.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4402 c046a42c-6fe2-441c-8c8c-71466251a162
2008-05-10 01:49:53 +00:00
balrog f3ae070459 Treat DNS a special case among special addresses in slirp (Jason Wessel).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4267 c046a42c-6fe2-441c-8c8c-71466251a162
2008-04-27 21:45:18 +00:00
balrog 4a0d8278ca Fix slirp udp source address contamination (Jason Wessel)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4259 c046a42c-6fe2-441c-8c8c-71466251a162
2008-04-26 15:33:41 +00:00
aurel32 41a00ab195 Remove remaining .cvsignore files
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4159 c046a42c-6fe2-441c-8c8c-71466251a162
2008-04-03 03:13:16 +00:00
ths 4fddf62a74 Use WIN32_LEAN_AND_MEAN, by Stefan Weil.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3832 c046a42c-6fe2-441c-8c8c-71466251a162
2007-12-17 04:42:29 +00:00
balrog 3f9b2b1f63 Revert an accidental change in previous commit.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3634 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-13 01:56:12 +00:00
balrog 2f4a40e569 Prevent cpsr_write/_read be put out of line in op.o (fixes a segfault on some platforms).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3633 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-13 01:50:15 +00:00
bellard eb6a054076 removed warning
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3592 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-11 16:05:35 +00:00
ths 5850586c07 More .cvsignore.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3555 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-08 16:44:36 +00:00
bellard 5fa0ab8fcb use config-host.h instead of config.h
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3546 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-07 19:27:18 +00:00
blueswir1 7c829863fb Fix slirp compilation failure when using a newer gcc
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3505 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-01 19:23:51 +00:00
ths c9f103069e Declare function before use, reduces compiler warning noise.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3490 c046a42c-6fe2-441c-8c8c-71466251a162
2007-10-30 23:19:52 +00:00
blueswir1 7878ff6bc7 Add const etc. to places forgotten from the previous commit
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3453 c046a42c-6fe2-441c-8c8c-71466251a162
2007-10-26 19:34:46 +00:00
blueswir1 9634d9031c Use const and static as needed, disable unused code
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3452 c046a42c-6fe2-441c-8c8c-71466251a162
2007-10-26 19:01:16 +00:00
blueswir1 31a60e2275 Make Slirp statistics gathering and output conditional to LOG_ENABLED
Add 'info slirp' command to monitor to display statistics
Disable Slirp debugging code by default


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3451 c046a42c-6fe2-441c-8c8c-71466251a162
2007-10-26 18:42:59 +00:00
ths 3b46e62427 find -type f | xargs sed -i 's/[\t ]*$//g' # Yes, again. Note the star in the regex.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3177 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-17 08:09:54 +00:00
ths 5fafdf24ef find -type f | xargs sed -i 's/[\t ]$//g' # on most files
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-16 21:08:06 +00:00
ths cb4b976b82 Move network related includes to vl.c to help SLIRP-less builds.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3167 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-13 12:39:35 +00:00
ths 0db1137dbf Change -tftp option to take a root directory, by Anthony Liguori.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2441 c046a42c-6fe2-441c-8c8c-71466251a162
2007-02-20 00:12:07 +00:00
ths 1f697db9c3 Add OACK support to slirp TFTP server, by Anthony Liguori.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2440 c046a42c-6fe2-441c-8c8c-71466251a162
2007-02-20 00:07:50 +00:00
ths 47d5d01a45 Add -bootp option for slirp, by Anthony Liguori.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2439 c046a42c-6fe2-441c-8c8c-71466251a162
2007-02-20 00:05:08 +00:00
ths 54fd9cdfb4 Slirp UDP fix, by Jason Wessel.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2327 c046a42c-6fe2-441c-8c8c-71466251a162
2007-01-17 22:47:40 +00:00
ths 28d657fc0b Fix build warning on Windows.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2270 c046a42c-6fe2-441c-8c8c-71466251a162
2006-12-23 00:03:15 +00:00
ths eaf7e70b01 Enable TCP_NODELAY, by Daniel Jacobowitz.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2257 c046a42c-6fe2-441c-8c8c-71466251a162
2006-12-21 19:10:59 +00:00
bellard 38f3e7c2f5 suppressed unaligned accesses
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1911 c046a42c-6fe2-441c-8c8c-71466251a162
2006-05-10 19:21:58 +00:00
bellard c904d61f78 UDP broadcast translation error (Mark Jonckheere)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1899 c046a42c-6fe2-441c-8c8c-71466251a162
2006-05-03 20:53:46 +00:00
bellard 8dbca8dd8a separate alias_addr (10.0.2.2) from our_addr (Ed Swierk)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1895 c046a42c-6fe2-441c-8c8c-71466251a162
2006-05-03 19:58:17 +00:00
bellard e553272d75 > 32 KB packet handling (Ed Swierk)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1891 c046a42c-6fe2-441c-8c8c-71466251a162
2006-05-02 21:09:02 +00:00
bellard 4f552e3b9a do not delay TCP acks (Ed Swierk)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1882 c046a42c-6fe2-441c-8c8c-71466251a162
2006-05-01 11:18:01 +00:00
bellard 773f2cdd3c set TCP_MSS to 1460 (Ed Swierk)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1881 c046a42c-6fe2-441c-8c8c-71466251a162
2006-05-01 11:17:27 +00:00
bellard fedc54adaa fixed IP packet rassembly logic (Ed Swierk)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1880 c046a42c-6fe2-441c-8c8c-71466251a162
2006-05-01 11:02:11 +00:00
bellard 4b6ccfdec9 fixed realloc logic (Ed Swierk)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1879 c046a42c-6fe2-441c-8c8c-71466251a162
2006-05-01 10:59:02 +00:00
bellard 3f423c9c8f removed warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1871 c046a42c-6fe2-441c-8c8c-71466251a162
2006-04-30 21:34:15 +00:00
bellard ec530c81ef Solaris port (Ben Taylor)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1855 c046a42c-6fe2-441c-8c8c-71466251a162
2006-04-25 22:36:06 +00:00
pbrook f4e15b4b4b Fix slirp redirection on systems without a useful host IP address.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1837 c046a42c-6fe2-441c-8c8c-71466251a162
2006-04-23 19:41:17 +00:00
pbrook 0f8134bfd6 Downgrade DNS failure to a warning.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1815 c046a42c-6fe2-441c-8c8c-71466251a162
2006-04-16 13:02:00 +00:00
pbrook 115defd163 Set slirp client hostname.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1813 c046a42c-6fe2-441c-8c8c-71466251a162
2006-04-16 11:06:58 +00:00
pbrook b55669bf57 Set SO_REUSEADDR before calling bind().
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1783 c046a42c-6fe2-441c-8c8c-71466251a162
2006-03-11 20:48:36 +00:00
bellard df5f895699 improved user net performances
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1561 c046a42c-6fe2-441c-8c8c-71466251a162
2005-09-03 10:45:09 +00:00
bellard 51a36cb2cb win32 compile fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1500 c046a42c-6fe2-441c-8c8c-71466251a162
2005-07-03 17:08:43 +00:00
bellard 101c593562 64 bit fixes (initial patch by Gwenole Beauchesne)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1458 c046a42c-6fe2-441c-8c8c-71466251a162
2005-06-05 17:11:42 +00:00
bellard 34444131ad windows header fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1212 c046a42c-6fe2-441c-8c8c-71466251a162
2005-01-10 23:19:34 +00:00
bellard 7b91a17212 slirp fix for -smb command (Initial patch by Juergen Keil)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1172 c046a42c-6fe2-441c-8c8c-71466251a162
2004-12-12 11:45:10 +00:00
bellard 3bc2175dcc socket send fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1158 c046a42c-6fe2-441c-8c8c-71466251a162
2004-11-24 20:39:26 +00:00
bellard 17444c9c84 fixed invalid received length
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1155 c046a42c-6fe2-441c-8c8c-71466251a162
2004-11-21 20:02:08 +00:00
bellard ef6ff6b71e removed warning
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1142 c046a42c-6fe2-441c-8c8c-71466251a162
2004-11-14 18:58:04 +00:00
bellard f3ff649d3b openpty fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1119 c046a42c-6fe2-441c-8c8c-71466251a162
2004-10-10 18:00:00 +00:00
bellard 6d46bf8ae3 win32 fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1113 c046a42c-6fe2-441c-8c8c-71466251a162
2004-10-09 22:57:43 +00:00
bellard 02d2c54cd3 windows fixes (Gregory Alexander)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1102 c046a42c-6fe2-441c-8c8c-71466251a162
2004-10-07 23:27:35 +00:00
bellard 487be8a1a7 hack for bootp support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1089 c046a42c-6fe2-441c-8c8c-71466251a162
2004-10-03 11:44:41 +00:00
bellard e95c8d51c2 full system SPARC emulation (Blue Swirl)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1087 c046a42c-6fe2-441c-8c8c-71466251a162
2004-09-30 22:22:08 +00:00
bellard d981b88344 give a new address at DHCPREQUEST too (useful if the OS remembers its IP address
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1081 c046a42c-6fe2-441c-8c8c-71466251a162
2004-09-30 18:57:28 +00:00
bellard 99679ececc removed warning
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1071 c046a42c-6fe2-441c-8c8c-71466251a162
2004-09-18 19:33:56 +00:00
bellard c9a621176e memory leak fix (Juergen Keil)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1067 c046a42c-6fe2-441c-8c8c-71466251a162
2004-09-13 21:42:51 +00:00
bellard a3d4af03bb allow inetd like program exec
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1060 c046a42c-6fe2-441c-8c8c-71466251a162
2004-09-05 23:10:26 +00:00
bellard 9bf05444b2 port redirection support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1054 c046a42c-6fe2-441c-8c8c-71466251a162
2004-08-25 22:12:49 +00:00
bellard a3504c87ca removed gettimeofday usage
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1053 c046a42c-6fe2-441c-8c8c-71466251a162
2004-08-25 20:55:44 +00:00
bellard c7f746434f TFTP support (Magnus Damm)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1050 c046a42c-6fe2-441c-8c8c-71466251a162
2004-08-24 21:57:12 +00:00
bellard 379ff53dc9 win32 compile
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1016 c046a42c-6fe2-441c-8c8c-71466251a162
2004-07-12 22:33:07 +00:00
bellard ee2654ac24 removed unused includes - BSD port
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1014 c046a42c-6fe2-441c-8c8c-71466251a162
2004-07-12 21:11:45 +00:00
bellard 1d43a71773 forgot fclose()
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@979 c046a42c-6fe2-441c-8c8c-71466251a162
2004-07-05 21:18:42 +00:00
bellard 44bbf73f92 dhcp packet size fix (aka pump fix)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@888 c046a42c-6fe2-441c-8c8c-71466251a162
2004-06-04 15:30:48 +00:00
bellard 170c6f8705 header fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@873 c046a42c-6fe2-441c-8c8c-71466251a162
2004-06-03 12:53:17 +00:00
bellard 25b42e9d53 added missing copyright file
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@846 c046a42c-6fe2-441c-8c8c-71466251a162
2004-05-22 18:30:22 +00:00
bellard 512176dbd8 fixed dhcp for windows client
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@784 c046a42c-6fe2-441c-8c8c-71466251a162
2004-05-04 03:14:47 +00:00
bellard 9fafc9eaf0 avoid errno variable name
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@766 c046a42c-6fe2-441c-8c8c-71466251a162
2004-04-26 19:50:09 +00:00
bellard f0cbd3ec9f initial user mode network support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@733 c046a42c-6fe2-441c-8c8c-71466251a162
2004-04-22 00:10:48 +00:00