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 <weil@mail.berlios.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
slirp: Remove declarations which are no longer needed
The previous patches replaced u_int8_t, u_int16_t, u_int32_t, u_int64_tby standard int types from stdint.h,so we can now remove their declarations which are no longer needed.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>...
savevm: Add DeviceState param
When available, we'd like to be able to access the DeviceStatewhen registering a savevm. For buses with a get_dev_path()function, this will allow us to create more unique savevmid strings.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>...
Remove dead assignments in various common files, spotted by clang analyzer
Value stored is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
slirp: fix structure initialization in tcp_listen()
A data structure of type sockaddr_in is allocated from stack but notproperly initialized. This may lead to a failure in the bind() calllater on. Fixed by filling the contents of the structure with zeroes...
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:
monitor: Separate "default monitor" and "current monitor" cleanly
Commits 376253ec..731b0364 introduced global variable cur_mon, whichpoints to the "default monitor" (if any), except during execution ofmonitor_read() or monitor_control_read() it points to the monitor from...
slirp: remove dead initialization, spotted by clang
Value stored during initialization is never read.
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'.
slirp: remove dead increments, spotted by clang
slirp: remove dead assignments, spotted by clang
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...
Do not use dprintf
dprintf is already claimed by POSIX1, and on at least one systemis implemented as a macro
[1] http://www.opengroup.org/onlinepubs/9699919799/functions/dprintf.html
Signed-off-by: malc <av1474@comtv.ru>
Qemu's internal TFTP server breaks lock-step-iness of TFTP
According to RFC 1350 and RFC 2347, TFTP server should answer RRQ byeither OACK or DATA packet. Qemu's internal TFTP server answers RRQ withadditional options by sending both OACK and DATA packet, thus breaking...
Handle TFTP ERROR from client
If a PXE client only wants to find out the size of a file, it willopen 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....
slirp/misc.c: fix warning with _FORTIFY_SOURCE
CC slirp/misc.occ1: warnings being treated as errorsslirp/misc.c: In function 'fork_exec':slirp/misc.c:209: error: ignoring return value of 'write', declared with attribute warn_unused_resultmake: *** [slirp/misc.o] Error 1...
fix networking on win32 host
At least under some mingw compilers slirp networking fails without declaringthese fields packed.
From: Juha Riihimäki <juha.riihimaki@nokia.com>Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>Signed-off-by: Riku Voipio <riku.voipio@nokia.com>...
Don't leak file descriptors
We're leaking file descriptors to child processes. Set FD_CLOEXEC on filedescriptors that don't need to be passed to children to stop this misbehaviour.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
slirp: fix use-after-free
460fec67ee introduced a use-after free in slirp.
Cc: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
slirp: fix unmatched bracket in if 0
Fix unmatched bracket in commented out code
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there aresome additions and it's not entirely compatible. Because of that, there havebeen conflicts with system headers on BSD systems. Some hacks have beenintroduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...
Fix Sparse warnings: add "static"
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...
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, butthere's no guarantee that gethostbyname(gethostname()) actually does...
slirp: Read host DNS config on demand
Currently the qemu user-mode networking stack reads the host DNSconfiguration (/etc/resolv.conf or the Windows equivalent) only oncewhen qemu starts. This causes name lookups in the guest to fail if thehost is moved to a different network from which the original DNS servers...
Add missing "static"
More NULL pointer fixes
rename WORDS_BIGENDIAN to HOST_WORDS_BIGENDIAN
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
slirp: Remove UDP protocol emulation (talk, cuseeme)
The UDP emulation code for talk has been commented out since thebeginning of time, and unless someone who runs CU-SeeMe on qemu withuser-mode networking can vouch that the special magic (a) is necessary...
slirp: Use monotonic clock if available (v2)
Calling gettimeofday() to compute a time interval can cause problems ifthe system clock jumps forwards or backwards; replace updtime() withqemu_get_clock(rt_clock), which calls clock_gettime(CLOCK_MONOTONIC) if...
slirp: Fix guestfwd for incoming data
Unless a virtual server address was explicitly defined (which isimpossible with the legacy net channel format), guestfwd did notproperly forwarded host>guest packets. This patch fixes it.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
Fix breakage by obsolete _P() for good
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 <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
slirp: Enable multiple instances
Once again this was a long journey to reach the destination: Allow toinstantiate slirp multiple times. But as in the past, the journey wasworthwhile, cleaning up, fixing and enhancing various parts of the userspace network stack along the way....
slirp: Save/restore bootp client states
slirp: Clean up updtime
Drop redundant typecasts in both variants and remove the pointlessround-up in the UNIX version.
slirp: Kill slirp_is_inited
Avoid the need for slirp_is_inited by refactoring the protectedslirp_select_* functions. This also avoids the clearing of all fd setson select errors.
slirp: Clean up timeout handling around slirp_select_fill/poll
Again lot of dead code. Remove it.
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 notrequired.
slirp: Factor out internal state structure
The essence of this patch is to stuff (almost) all global variables ofthe slirp stack into the structure Slirp. In this step, we still keepthe structure as global variable, directly accessible by the wholestack. Changes to the external interface of slirp will be applied in...
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 serviceinvocations. Additionally provide an opaque value interface for thecallbacks from slirp into the qemu core....
slirp: Allocate/free stack instance dynamically
Allocate the internal slirp state dynamically and provide and callslirp_cleanup to properly release it after use. This patch finallyunbreaks slirp release and re-instantiation via host_net_* monitorcommands....
slirp: Make IP packet ID consistent
Currently, ip_id is always initialized to 0 on slirp startup (despitethe broken attempt to derive it from the clock). This is good forreproducibility. But it is not preserved across save/restore. This patchtherefore drops the dead initialization code from ip_init and introduces...
slirp: Drop unused icmp_var.h
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.
slirp: tftp: Clean up tftp_send_error
The return code of tftp_send_error is not used, drop it. And also makesure to always terminate the session.
slirp: tftp: Refactor tftp_handle_rrq
Specifically make the filename extraction more readable, and alwaysreport errors back to the client.
slirp: tftp: Rework filename handling
This changes the filename handling from a static buffer in tftp_sessionfor the client-provided name + prefix to a dynamically allocated bufferthat keeps the combined path in one place.
slirp: Factor out one-time initialization
In order to prepare re-initialization and multi-instance slirp, factorout init code that is of global scope and (at least for now) only needto be run once.
This also fixes the potentially uninitialized use of our_addr in...
slirp: Do not allow to remove non-hostfwd sockets
Prevent that the users accidentally shoots down dynamic sockets. Thisallows to remove looping for removals as there can now only be onematch.
slirp: Mark sockets of incoming TCP connections
Required for pretty-printing.
slirp: Add info usernet for dumping connection states
Break out sockstats from the slirp statistics and present them under thenew info category "usernet". This patch also improves the current output/wrt proper reporting connection source and destination....
slirp: Drop dead code
After all its years inside the qemu tree, there is no point in keepingthe dead code paths of slirp. This patch is a first round of removingusually commented out code parts. More cleanups need to follow (andmaybe finally a proper reindention)....
slirp: Drop statistic code
As agreed on the mailing list, there is no interest in keeping theusually disabled slirp statistics in the tree. So this patch removesthem.
slirp: Cleanup and basic reanimation of debug code
slirp: Rework internal configuration
The user mode IP stack is currently only minimally configurable /wrt toits virtual IP addresses. This is unfortunate if some guest has a fixedidea of which IP addresses to use.
Therefore this patch prepares the stack for fully configurable IP...
slirp: Rework external configuration interface
With the internal IP configuration made more flexible, we can nowenhance the user interface. This patch adds a number of new options to"-net user": net (address and mask), host, dhcpstart, dns and smbserver....
slirp: Fix port comparision in slirp_remove_hostfwd
For UDP host forwardings, fport is not stable, every outgoing packet ofthe redirection can modify it. Use getsockname instead to look up theport that is actually used on the host side.
slirp: Bind support for host forwarding rules
Extend the hostfwd rule format so that the user can specify on whichhost interface qemu should listen for incoming connections. If omitted,binding will takes place against all interfaces.
slirp: Prepare for persistent socket state flags
This prepares for adding flags to socket.so_state that must not beremoved during the lifetime of a socket.
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.
slirp: Drop redundant lines from udp_input
The socket faddr/fport is already updated a few lines below, so theseare completely redundant.
slirp: Refactor tcp_ctl
Revert "User networking: Show active connections"
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
slirp: Move smb, redir, tftp and bootp parameters and -net channel
So far a couple of slirp-related parameters were expressed viastand-alone command line options. This it inconsistent and unintuitive.Moreover, it prevents both dynamically reconfigured (host_net_add/...
Fix mingw32 build warnings
Work around buffer and ioctlsocket argument type signedness problemsSuppress a prototype which is unused on mingw32Expand a macro to avoid warnings from some GCC versions
slirp: Reorder initialization
This patch reorders the initialization of slirp itself as well as itsassociated features smb and redirection. So far the first reference toslirp triggered the initialization, independent of the actual -net useroption which may carry additional parameters. Now we save any request to...
User networking: Show active connections
In case you're wondering what connections exactly you have openor maybe redir'ed in the past, you can't really find out from qemuright now.
This patch enables you to see all current connections the hostonly networking holds open, so you can kill them using the previous...
User Networking: Enable removal of redirections
Using the new host_net_redir command you can easily create redirectionson the fly while your VM is running.
While that's great, it's missing the removal of redirections, in case youwant to have a port closed again at a later point in time....
slirp: Reassign same address to same DHCP client
In case a client restarts a DHCP recovery without releasing its oldaddress, reassign the same address to prevent consuming free addressesand moving away from the standard client address.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Cast pointer arguments of get/setsockopt, send to void * to keep GCCfrom producing a warning about pointer type mismatches with Winsock
Replace gcc variadic macro extension with C99 version
slirp: Handle DHCP requests for specific IP (Jan Kiszka)
This adds proper handling of the ciaddr field as well as the "RequestedIP Address" option to slirp's DHCP server. If the client requests aninvalid or used IP, a NAK reply is sent, if it requests a specific but...
Use ANSI prototypes to please sparse
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7176 c046a42c-6fe2-441c-8c8c-71466251a162
Move bootp_filename to avoid a sparse warning
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7174 c046a42c-6fe2-441c-8c8c-71466251a162
Fix some win32 compile warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6984 c046a42c-6fe2-441c-8c8c-71466251a162
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
Fix windows build and clean up use of <windows.h>
We want to globally define WIN_LEAN_AND_MEAN and WINVER to particular values solet'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>...
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
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 servicesgain a new parameter (mon) that will once refer to the monitor instancethe output is supposed to appear on. However, the argument remains...
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
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 LGPL1.
[1] http://www.fsf.org/licensing/licenses/index_html#GPLIncompatibleLicenses
There are three declared copyright holders in slirp that use the 4-clause...
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>...
Fix _P use on OpenBSD
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6298 c046a42c-6fe2-441c-8c8c-71466251a162
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
Fix some SLIRP warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6272 c046a42c-6fe2-441c-8c8c-71466251a162
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
Add slirp_restrict option (Gleb Natapov)
Add "slirp firewall" to permit connection only to vmchannel addresses.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6241 c046a42c-6fe2-441c-8c8c-71466251a162
Redirect slirp traffic to/from qemu character device (Gleb Natapov)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6240 c046a42c-6fe2-441c-8c8c-71466251a162
Remove unnecessary trailing newlines
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6000 c046a42c-6fe2-441c-8c8c-71466251a162
slirp: fix CVE 2007-5729
The emulated network cards in QEMU allows local users to execute arbitrarycode by writing Ethernet frames with a size larger than the slirp's defaultMTU, which triggers a heap-based buffer overflow in the slirp library.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>...
Make struct iovec universally available
Vectored IO APIs will require some sort of vector argument. It makes sense touse 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
Fix inline use warnings from sparse
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5540 c046a42c-6fe2-441c-8c8c-71466251a162
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
added explicit license
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5499 c046a42c-6fe2-441c-8c8c-71466251a162
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
Fix warning about variables used uninitialized
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5378 c046a42c-6fe2-441c-8c8c-71466251a162
Make some variables static
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5376 c046a42c-6fe2-441c-8c8c-71466251a162
Remove unused variables
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5374 c046a42c-6fe2-441c-8c8c-71466251a162
Add some missing static qualifiers
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5363 c046a42c-6fe2-441c-8c8c-71466251a162