aboutsummaryrefslogtreecommitdiff
path: root/slirp/misc.c
AgeCommit message (Collapse)AuthorFilesLines
2022-09-26Remove the slirp submodule (i.e. compile only with an external libslirp)Thomas Huth1-0/+0
Since QEMU 7.1 we don't support Ubuntu 18.04 anymore, so the last big important Linux distro that did not have a pre-packaged libslirp has been dismissed. All other major distros seem to have a libslirp package in their distribution already - according to repology.org: Fedora 35: 4.6.1 CentOS 8 (RHEL-8): 4.4.0 Debian 11: 4.4.0 OpenSUSE Leap 15.3: 4.3.1 Ubuntu LTS 20.04: 4.1.0 FreeBSD Ports: 4.7.0 NetBSD pkgsrc: 4.7.0 Homebrew: 4.7.0 MSYS2 mingw: 4.7.0 The only one that was still missing a libslirp package is OpenBSD - but the next version (OpenBSD 7.2 which will be shipped in October) is going to include a libslirp package. Since QEMU 7.2 will be published after OpenBSD 7.2, we should be fine there, too. So there is no real urgent need for keeping the slirp submodule in the QEMU tree anymore. Thus let's drop the slirp submodule now and rely on the libslirp packages from the distributions instead. Message-Id: <20220824151122.704946-7-thuth@redhat.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-05-12slirp: bump submodule past 4.7 releasePaolo Bonzini1-0/+0
Version 4.7 of slirp provides a new timer API that works better with CFI, together with several other improvements: * Allow disabling the internal DHCP server !22 * Support Unix sockets in hostfwd !103 * IPv6 DNS proxying support !110 * bootp: add support for UEFI HTTP boot !111 and bugfixes. The submodule update also includes 2 commits to fix warnings in the Win32 build. Reviewed-by: Marc-André Lureau <malureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-08-03Update libslirp to v4.6.1Marc-André Lureau1-0/+0
Switch from stable-4.2 branch to upstream v4.6.1 release + fixes. ## [Unreleased] ### Fixed - Haiku fixes. !98 !99 - Fix a minor DHCP regression introduced in 4.6.0. !97 ## [4.6.1] - 2021-06-18 ### Fixed - Fix DHCP regression introduced in 4.6.0. !95 ## [4.6.0] - 2021-06-14 ### Added - mbuf: Add debugging helpers for allocation. !90 ### Changed - Revert "Set macOS deployment target to macOS 10.4". !93 ### Fixed - mtod()-related buffer overflows (CVE-2021-3592 #44, CVE-2021-3593 #45, CVE-2021-3594 #47, CVE-2021-3595 #46). - poll_fd: add missing fd registration for UDP and ICMP - ncsi: make ncsi_calculate_checksum work with unaligned data. !89 - Various typos and doc fixes. !88 ## [4.5.0] - 2021-05-18 ### Added - IPv6 forwarding. !62 !75 !77 - slirp_neighbor_info() to dump the ARP/NDP tables. !71 ### Changed - Lazy guest address resolution for IPv6. !81 - Improve signal handling when spawning a child. !61 - Set macOS deployment target to macOS 10.4. !72 - slirp_add_hostfwd: Ensure all error paths set errno. !80 - More API documentation. ### Fixed - Assertion failure on unspecified IPv6 address. !86 - Disable polling for PRI on MacOS, fixing some closing streams issues. !73 - Various memory leak fixes on fastq/batchq. !68 - Memory leak on IPv6 fast-send. !67 - Slow socket response on Windows. !64 - Misc build and code cleanups. !60 !63 !76 !79 !84 ## [4.4.0] - 2020-12-02 ### Added - udp, udp6, icmp: handle TTL value. !48 - Enable forwarding ICMP errors. !49 - Add DNS resolving for iOS. !54 ### Changed - Improve meson subproject() support. !53 - Removed Makefile-based build system. !56 ### Fixed - socket: consume empty packets. !55 - check pkt_len before reading protocol header (CVE-2020-29129). !57 - ip_stripoptions use memmove (fixes undefined behaviour). !47 - various Coverity-related changes/fixes. ## [4.3.1] - 2020-07-08 ### Changed - A silent truncation could occur in `slirp_fmt()`, which will now print a critical message. See also #22. ### Fixed - CVE-2020-10756 - Drop bogus IPv6 messages that could lead to data leakage. See !44 and !42. - Fix win32 builds by using the SLIRP_PACKED definition. - Various coverity scan errors fixed. !41 - Fix new GCC warnings. !43 ## [4.3.0] - 2020-04-22 ### Added - `SLIRP_VERSION_STRING` macro, with the git sha suffix when building from git - `SlirpConfig.disable_dns`, to disable DNS redirection #16 ### Changed - `slirp_version_string()` now has the git sha suffix when building form git - Limit DNS redirection to port 53 #16 ### Fixed - Fix build regression with mingw & NetBSD - Fix use-afte-free in `ip_reass()` (CVE-2020-1983) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Doug Evans <dje@google.com>
2020-11-27slirp: update to fix CVE-2020-29129 CVE-2020-29130Marc-André Lureau1-0/+0
An out-of-bounds access issue was found in the SLIRP user networking implementation of QEMU. It could occur while processing ARP/NCSI packets, if the packet length was shorter than required to accommodate respective protocol headers and payload. A privileged guest user may use this flaw to potentially leak host information bytes. Marc-André Lureau (1): Merge branch 'stable-4.2' into 'stable-4.2' Prasad J Pandit (1): slirp: check pkt_len before reading protocol header Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-07-28slirp: update to latest stable-4.2 branchMarc-André Lureau1-0/+0
Dr. David Alan Gilbert (1): ip_stripoptions use memmove Jindrich Novy (4): Fix possible infinite loops and use-after-free Use secure string copy to avoid overflow Be sure to initialize sockaddr structure Check lseek() for failure Marc-André Lureau (2): util: do not silently truncate Merge branch 'stable-4.2' into 'stable-4.2' Philippe Mathieu-Daudé (3): Fix win32 builds by using the SLIRP_PACKED definition Fix constness warnings Remove unnecessary break Ralf Haferkamp (2): Drop bogus IPv6 messages Fix MTU check Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-04-21slirp: update to fix CVE-2020-1983Marc-André Lureau1-0/+0
This is an update on the stable-4.2 branch of libslirp.git: git shortlog 55ab21c9a3..2faae0f778f81 Marc-André Lureau (1): Fix use-afte-free in ip_reass() (CVE-2020-1983) CVE-2020-1983 is actually a follow up fix for commit 126c04acbabd7ad32c2b018fe10dfac2a3bc1210 ("Fix heap overflow in ip_reass on big packet input") which was was included in qemu v4.1 (commit e1a4a24d262ba5ac74ea1795adb3ab1cd574c7fb "slirp: update with CVE-2019-14378 fix"). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20200421170227.843555-1-marcandre.lureau@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-03-22slirp: update submodule to v4.2.0+Marc-André Lureau1-0/+0
git shortlog 126c04acbabd7ad32c2b018fe10dfac2a3bc1210..55ab21c9a36852915b81f1b41ebaf3b6509dd8ba 5eraph (1): Use specific outbound IP address Akihiro Suda (8): remove confusing comment that exists from ancient slirp add slirp_new(SlirpConfig *, SlirpCb *, void *) allow custom MTU add disable_host_loopback (prohibit connections to 127.0.0.1) add SlirpConfig version emu: remove dead code emu: disable by default fix a typo in a comment Anders Waldenborg (1): state: fix loading of guestfwd state Giuseppe Scrivano (1): socket: avoid getpeername after shutdown(SHUT_WR) Jindrich Novy (1): Don't leak memory when reallocation fails. Jordi Pujol Palomer (1): fork_exec: correctly parse command lines that contain spaces Marc-André Lureau (60): Merge branch 'AkihiroSuda/libslirp-slirp4netns' Merge branch 'fix-typo' into 'master' meson: make it subproject friendly Merge branch 'meson' into 'master' misc: fix compilation warnings Merge branch 'fix-shutdown-wr' into 'master' sbuf: remove unused and undefined sbcopy() path sbuf: check more strictly sbcopy() bounds with offset sbuf: replace a comment with a runtime warning Replace remaining malloc/free user with glib tcp_attach() can no longer fail state: can't ENOMEM sbuf: use unsigned types sbuf: simplify sbreserve() dnssearch: use g_strv_length() vmstate: silence scan-build warning gitlab-ci: run scan-build Merge branch 'mem-cleanups' into 'master' libslirp.map: bind slirp_new to SLIRP_4.1 version meson: fix libtool versioning Release v4.1.0 Merge branch '4.1.0' into 'master' CHANGELOG: start unreleased section Merge branch 'add-unix' into 'master' util: add G_SIZEOF_MEMBER() macro Check bootp_filename is not going to be truncated bootp: remove extra cast bootp: replace simple snprintf() with strcpy() tftp: clarify what is actually OACK m_len tcp_emu: add more fixme/warnings comments util: add slirp_fmt() helpers dhcpv6: use slirp_fmt() misc: use slirp_fmt0() tftp: use slirp_fmt0() tcp_ctl: use slirp_fmt() tcp_emu: fix unsafe snprintf() usages misc: improve error report Use g_snprintf() util: add gnuc format function attribute to slirp_fmt* Merge branch 'aw-guestfwd-state' into 'master' Merge branch 'slirp-fmt' into 'master' socket: remove extra label and variable socket: factor out sotranslate ipv4/ipv6 handling socket: remove need for extra scope_id variable socket: do not fallback on host loopback if get_dns_addr() failed socket: do not fallback on loopback addr for addresses in our mask/prefix Prepare for v4.2.0 release Merge branch 'translate-fix' into 'master' Merge branch 'release-v4.2.0' into 'master' changelog: post-release changelog: fix link .gitlab-ci: add --werror, treat CI build warnings as errors Revert "socket: remove need for extra scope_id variable" Teach slirp_version_string() to return vcs version Merge branch 'mingw-fix' into 'master' Merge branch 'vcs-version' into 'master' meson: bump required version to 0.49 build-sys: fix NetBSD build regression Merge branch 'netbsd-fix' into 'master' build-sys: make libslirp-version.h depend on Makefile PanNengyuan (1): libslirp: fix NULL pointer dereference in tcp_sockclosed Philippe Mathieu-Daudé (1): Add a git-publish configuration file Prasad J Pandit (4): slirp: ncsi: compute checksum for valid data length slirp: use correct size while emulating IRC commands slirp: use correct size while emulating commands slirp: tftp: restrict relative path access Renzo Davoli (2): Add slirp_remove_guestfwd() Add slirp_add_unix() Samuel Thibault (14): ip_reass: explain why we should not always update the q pointer Merge branch 'comment' into 'master' Merge branch 'no-emu' into 'master' Fix bogus indent, no source change ip_reass: Fix use after free Merge branch 'reass2' into 'master' Make host receive broadcast packets arp: Allow 0.0.0.0 destination address Merge branch 'warnings' into 'master' Merge branch 'arp_0' into 'master' Merge branch 'broadcast' into 'master' tcp_emu: Fix oob access Merge branch 'oob' into 'master' Merge branch 'master' into 'master' Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-08-02slirp: update with CVE-2019-14378 fixMarc-André Lureau1-0/+0
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-05-09Update upstream slirpSamuel Thibault1-0/+0
Adds gitignore, README file, and fixes ident protocol parsing. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-05-04Update slirp submoduleSamuel Thibault1-0/+0
To fix Windows on ARM.
2019-05-03build-sys: move slirp as git submodule projectMarc-André Lureau1-0/+0
The slirp project is now hosted on freedesktop at: https://gitlab.freedesktop.org/slirp. The libslirp source was extracted from qemu/slirp filtered through clang-format (available in project tree). The qemu slirp directory can be swapped by a git submodule. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190424110041.8175-3-marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-03-07slirp: move sources to src/ subdirectoryMarc-André Lureau1-323/+0
Prepare for making slirp/ a standalone project. Remove some useless includes while at it. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190212162524.31504-5-marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-03-06slirp: Mark pieces missing IPv6 supportSamuel Thibault1-0/+3
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-12slirp: remove slirp_ prefix for socket wrappersMarc-André Lureau1-7/+7
QEMU wraps the socket functions in os-win32.h, but in commit a9d8b3ec4385793815d71217857304, the header inclusion was dropped, breaking libslirp on Windows. There are already a few socket functions that are wrapped in libslirp, with "slirp_" prefix, but many of them are missing, and we are going to wrap the missing functions in a second patch. Using "slirp_" prefix avoids the conflict with socket function #define wrappers in QEMU os-win32.h, but they are quite intrusive. In the end, the functions should behave the same as original one, but with errno being set. To avoid the churn, and potential confusion, remove the "slirp_" prefix. A series of #undef is necessary until libslirp is made standalone to prevent the #define conflict with QEMU. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190212160953.29051-2-marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07slirp: pass opaque to all callbacksMarc-André Lureau1-1/+1
This is friendlier for FFI bindings. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07slirp: replace remaining qemu headers dependencyMarc-André Lureau1-2/+0
Except for the migration code which is gated by WITH_QEMU, only include our own headers, so libslirp can be built standalone. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/Samuel Thibault1-0/+62
Only slirp actually needs it, and will need it along in libslirp. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-02-07slirp: remove now useless QEMU headers inclusionsMarc-André Lureau1-2/+0
Some of those could have been squashed earlier, but it is easier to do it all here. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07slirp: replace qemu_set_nonblock()Marc-André Lureau1-1/+2
Replace qemu_set_nonblock() with slirp_set_nonblock() qemu_set_nonblock() does some event registration with the main loop. Add a new callback register_poll_fd() for that reason. Always build the fd-register stub, to avoid #if WIN32. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07slirp: replace most qemu socket utilities with slirp own versionMarc-André Lureau1-10/+10
qemu_set_nonblock() is slightly more problematic and will be dealt with in a separate patch. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07slirp: generalize guestfwd with a callback based approachMarc-André Lureau1-14/+23
Instead of calling into QEMU chardev directly, and mixing it with slirp_add_exec() handling, add a new function slirp_add_guestfwd() which takes a write callback. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-01-14slirp: factor out guestfwd addition checksMarc-André Lureau1-7/+0
This will allow reusing the function in a following patch. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-01-14slirp: introduce SLIRP_DEBUG environment variableMarc-André Lureau1-8/+0
Learn to read SLIRP_DEBUG=call,misc,error (all or help also handled) to set the slirp_debug flags. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-01-14slirp: always build with debug statementsMarc-André Lureau1-1/+5
Make debug statements condiitonal only on slirp_debug flags, instead of the pre-processor DEBUG blocks, as it may introduce breakage easily, since the debug code isn't always compiled. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-01-14slirp: rename exec_listMarc-André Lureau1-3/+3
This list is not only used to handle command to execute on guest connection, it can also redirect to an arbitrary object, such as a chardev. Let's rename the struct and the field to "guestfwd". Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-01-14slirp: Enable fork_exec support on WindowsSamuel Thibault1-12/+2
g_spawn_async_with_fds is portable on Windows, so we can now enable fork_exec support there. Thanks Daniel P. Berrangé for the notice! Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-01-14slirp: replace error_report() with g_critical()Marc-André Lureau1-1/+1
Reduce dependency on QEMU. QEMU could use a custom log handler if it wants to redirect/filter it. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-01-14slirp: simplify fork_exec()Marc-André Lureau1-39/+36
Use g_spawn_async_with_fds() to setup the child. GSpawn handles reaping the child, and closing parent file descriptors. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-01-14slirp: replace error_report() with g_critical()Marc-André Lureau1-1/+1
Reduce dependency on QEMU. QEMU could use a custom log handler if it wants to redirect/filter it. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-01-14slirp: move socket pair creation in helper functionMarc-André Lureau1-71/+71
Originally, the patch was fixing a bunch of issues, but Peter beat me to it with earlier commit "slirp: fork_exec(): create and connect child socket before fork()". Factor out socket pair creation, to simplify the fork_exec() code. Use the name socketpair_with_oob() since the code is actually similar to what socketpair() would do, except that it uses TCP sockets, for SLIRP to be able to call send with MSG_OOB (since SO_OOBINLINE is set, this could probably be faked instead on regular unix sockets though). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-01-14slirp: replace the poor-man string split with g_strsplit()Marc-André Lureau1-18/+3
Use the glib function for the work, fix a potential crash on >256 words. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-01-14slirp: remove Monitor dependency, return a string for infoMarc-André Lureau1-10/+13
There is nothing performance-sensitive in returning an allocated string for info, and handling the monitor_printf() on the caller side. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-01-14slirp: use a dedicated field for chardev pointerMarc-André Lureau1-4/+7
Let's not mix command line and chardev pointers. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-01-14slirp: replace ex_pty with ex_chardevMarc-André Lureau1-1/+1
do_pty == 3 means to talk to a chardev. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-01-14slirp: remove do_pty from fork_exec()Marc-André Lureau1-39/+16
QEMU uses fork_exec() with do_pty values 0 or 3. Let's clean up some unused code. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2018-11-10slirp: fork_exec(): create and connect child socket before fork()Peter Maydell1-21/+34
Currently fork_exec() fork()s, and then creates and connects the child socket which it uses for communication with the parent in the child process. This is awkward because the child has no mechanism to report failure back to the parent, which might end up blocked forever in accept(). The child code also has an issue pointed out by Coverity (CID 1005727), where if the qemu_socket() call fails it will pass -1 as a file descriptor to connect(). Fix these issues by moving the creation of the child's end of the socket to before the fork(), where we are in a position to handle a possible failure. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2017-07-15slirp: fork_exec(): Don't close() a negative number in fork_exec()Peter Maydell1-1/+3
In a fork_exec() error path we try to closesocket(s) when s might be a negative number because the thing that failed was the qemu_socket() call. Add a guard so we don't do this. (Spotted by Coverity: CID 1005727 issue 1 of 2.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2016-07-12Use #include "..." for our own headers, <...> for othersMarkus Armbruster1-3/+2
Tracked down with an ugly, brittle and probably buggy Perl script. Also move includes converted to <...> up so they get included before ours where that's obviously okay. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2016-05-16slirp: Remove obsolete backward-compatibility cruftThomas Huth1-21/+0
The slirp code does not use index() and gethostid() anymore, so these parts can be removed without problems. memmove() and strerror() should be available on each of the supported platforms nowadays, too, so these wrappers are also not needed anymore. And we certainly also do not support Ultrix anymore, so no need to keep the code for this platform anymore. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2016-03-23Avoid embedding struct mbuf in other structuresSamuel Thibault1-5/+0
struct mbuf uses a C99 open char array to allow inlining data. Inlining this in another structure is however a GNU extension. The inlines used so far in struct Slirp were actually only needed as head of struct mbuf lists. This replaces these inline with mere struct quehead, and use casts as appropriate. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-02-04slirp: Clean up includesPeter Maydell1-0/+1
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-10-git-send-email-peter.maydell@linaro.org
2015-11-12slirp: Fix type casts and format strings in debug codeStefan Weil1-3/+3
Casting pointers to long won't work on 64 bit Windows. It is not needed with the right format strings. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Jason Wang <jasowang@redhat.com>
2015-06-22qerror: Move #include out of qerror.hMarkus Armbruster1-0/+1
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-08-24slirp/misc: Use the GLib memory allocation APIszhanghailiang1-17/+3
Here we don't check the return value of malloc() which may fail. Use the g_new() instead, which will abort the program when there is not enough memory. Also, use g_strdup instead of strdup and remove the unnecessary strdup function. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Benoît Canet <benoit.canet@nodalink.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-04-25slirp: Remove default_mon usageCole Robinson1-11/+2
These errors don't seem user initiated, so forcibly printing to the monitor doesn't seem right. Just use error_report. Drop lprint since it's now unused. Cc: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-10-02slirp: call socket_set_fast_reuse instead of setting SO_REUSEADDRSebastian Ottlik1-2/+1
SO_REUSEADDR should be avoided on Windows but is desired on other operating systems. So instead of setting it we call socket_set_fast_reuse that will result in the appropriate behaviour on all operating systems. Signed-off-by: Sebastian Ottlik <ottlik@fzi.de> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de>
2013-08-22aio / timers: Untangle include filesAlex Bligh1-0/+1
include/qemu/timer.h has no need to include main-loop.h and doing so causes an issue for the next patch. Unfortunately various files assume including timers.h will pull in main-loop.h. Untangle this mess. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-05-18remove some double-includesMichael Tokarev1-2/+0
Some source files #include the same header more than once for no good reason. Remove second #includes in such cases. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-04-02oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()Stefan Hajnoczi1-1/+1
The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets. Rename to qemu_set_nonblock() just like qemu_set_cloexec(). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-03-22MinGW: Replace setsockopt by qemu_setsocketoptStefan Weil1-2/+2
Instead of adding missing type casts which are needed by MinGW for the 4th argument, the patch uses qemu_setsockopt which was invented for this purpose. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>