aboutsummaryrefslogtreecommitdiffstats
path: root/slirp
AgeCommit message (Collapse)AuthorFilesLines
2009-06-29slirp: Mark sockets of incoming TCP connectionsJan Kiszka2-0/+2
Required for pretty-printing. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29slirp: Do not allow to remove non-hostfwd socketsJan Kiszka1-9/+5
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-29slirp: Explicitely mark host-forwarding socketsJan Kiszka3-3/+4
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-29slirp: Prepare for persistent socket state flagsJan Kiszka5-13/+26
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-29slirp: Bind support for host forwarding rulesJan Kiszka7-25/+27
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-29slirp: Fix port comparision in slirp_remove_hostfwdJan Kiszka1-2/+6
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-29slirp: Rework external configuration interfaceJan Kiszka3-39/+38
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-29slirp: Rework internal configurationJan Kiszka13-142/+149
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-29slirp: Move smb, redir, tftp and bootp parameters and -net channelJan Kiszka5-6/+19
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-29Revert "User networking: Show active connections"Jan Kiszka2-28/+0
This reverts commit 1c6ed9f3379faac83da0ed3e95cbd49003ac0dd1. 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-29slirp: Refactor tcp_ctlJan Kiszka1-79/+30
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29slirp: Drop redundant lines from udp_inputJan Kiszka1-2/+0
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-13Fix mingw32 build warningsBlue Swirl2-2/+11
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-09slirp: Reorder initializationJan Kiszka2-2/+2
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-05-28User networking: Show active connectionsAlexander Graf2-0/+28
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-27User Networking: Enable removal of redirectionsAlexander Graf2-0/+24
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-22slirp: Reassign same address to same DHCP clientJan Kiszka1-3/+5
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-21Cast pointer arguments of get/setsockopt, send to void * to keep GCCmalc1-1/+1
from producing a warning about pointer type mismatches with Winsock Signed-off-by: malc <av1474@comtv.ru>
2009-05-13Replace gcc variadic macro extension with C99 versionBlue Swirl1-3/+3
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-04-21slirp: Handle DHCP requests for specific IP (Jan Kiszka)aliguori2-34/+95
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-18Use ANSI prototypes to please sparseblueswir12-17/+8
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7176 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-18Move bootp_filename to avoid a sparse warningblueswir11-0/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7174 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-05Fix some win32 compile warningsblueswir12-1/+6
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6984 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-16Delete some unused macros detected with -Wp,-Wunused-macros useblueswir13-3/+0
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6856 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-08Fix windows build and clean up use of <windows.h>aliguori1-1/+0
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-07Sparse fixes: NULL use, header order, ANSI prototypes, staticblueswir113-176/+94
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-05monitor: Rework API (Jan Kiszka)aliguori1-2/+2
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-02-06Fix SIGSEGV crash in slirp networking codeblueswir11-2/+1
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-01-26Remove the advertising clause from the slirp licensealiguori19-93/+18
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-24Use broadcast address for slirp dhcp repliesaurel321-0/+2
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-14Fix _P use on OpenBSDblueswir11-2/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6298 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-13Fix 64 bit issue in slirpblueswir111-207/+138
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-12Fix some SLIRP warningsblueswir13-5/+6
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6272 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-08Add support for vmchannel socket migration (Gleb Natapov)aliguori1-0/+227
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-08Add slirp_restrict option (Gleb Natapov)aliguori7-14/+57
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-08Redirect slirp traffic to/from qemu character device (Gleb Natapov)aliguori8-25/+156
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
2008-12-13Remove unnecessary trailing newlinesblueswir14-4/+0
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6000 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-07slirp: fix CVE 2007-5729aurel321-0/+3
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-05Make struct iovec universally availablealiguori2-8/+1
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-10-26Fix inline use warnings from sparseblueswir12-4/+4
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5540 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-25Replace uses of strncpy (a GNU extension) with Qemu pstrcpyblueswir11-2/+2
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5531 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-17added explicit licensebellard1-0/+23
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5499 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-17allow SLIRP to make an ARP request to get the client MAC address. It is ↵bellard1-8/+52
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-01Fix warning about variables used uninitializedblueswir11-0/+4
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5378 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-01Make some variables staticblueswir12-2/+2
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5376 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-01Remove unused variablesblueswir11-2/+0
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5374 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-30Add some missing static qualifiersblueswir11-2/+2
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5363 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-20Suppress gcc 4.x -Wpointer-sign (included in -Wall) warningsblueswir13-10/+13
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5275 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-15Use common objects for qemu-img and qemu-nbdaliguori1-14/+0
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-14Fix warnings that would be caused by gcc flag -Wwrite-stringsblueswir13-9/+6
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5206 c046a42c-6fe2-441c-8c8c-71466251a162