aboutsummaryrefslogtreecommitdiff
path: root/slirp/misc.h
AgeCommit message (Collapse)Author
2022-09-26Remove the slirp submodule (i.e. compile only with an external libslirp)Thomas Huth
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 Bonzini
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é Lureau
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é Lureau
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é Lureau
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é Lureau
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é Lureau
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é Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-05-09Update upstream slirpSamuel Thibault
Adds gitignore, README file, and fixes ident protocol parsing. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-05-04Update slirp submoduleSamuel Thibault
To fix Windows on ARM.
2019-05-03build-sys: move slirp as git submodule projectMarc-André Lureau
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é Lureau
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-02-07slirp: generalize guestfwd with a callback based approachMarc-André Lureau
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: rename exec_listMarc-André Lureau
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: fix slirp_add_exec() leaksMarc-André Lureau
Free the list elements allocated in add_exec(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-01-14slirp: remove unused EMU_RSHMarc-André Lureau
EMU_RSH handling was dropped in commit 0d62c4cfe21752df4c1d6e2c2398f15d5eaa794a. The assignment, and subsequent free() of ex_ptr->ex_exec to so->extra looks unsafe (double free is likely to occur). 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é Lureau
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é Lureau
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é Lureau
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>
2016-07-12Clean up ill-advised or unusual header guardsMarkus Armbruster
Cleaned up with scripts/clean-header-guards.pl. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2016-03-23Avoid embedding struct mbuf in other structuresSamuel Thibault
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>
2014-08-24slirp/misc: Use the GLib memory allocation APIszhanghailiang
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>
2013-06-01slirp: cleanup leftovers from misc.hMichael Tokarev
There are quite a few leftover declarations in slirp/misc.h. Remove them. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-11-10slirp: remove unused function u_sleepBlue Swirl
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-25slirp: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int typesStefan Weil
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>
2009-07-27slirp: Remove UDP protocol emulation (talk, cuseeme)Ed Swierk
The UDP emulation code for talk has been commented out since the beginning of time, and unless someone who runs CU-SeeMe on qemu with user-mode networking can vouch that the special magic (a) is necessary and (b) works, let's get rid of the code. Signed-off-by: Ed Swierk <eswierk@aristanetworks.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-01Fix breakage by obsolete _P() for goodBlue Swirl
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-29slirp: Factor out internal state structureJan Kiszka
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-29slirp: Clean up timeout handling around slirp_select_fill/pollJan Kiszka
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-29slirp: Factor out one-time initializationJan Kiszka
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-29slirp: Drop dead codeJan Kiszka
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-29slirp: Rework internal configurationJan Kiszka
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>
2008-10-26Fix inline use warnings from sparseblueswir1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5540 c046a42c-6fe2-441c-8c8c-71466251a162
2008-08-30Fix some warnings that would be generated by gcc -Wredundant-declsblueswir1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5115 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-01 Fix slirp compilation failure when using a newer gccblueswir1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3505 c046a42c-6fe2-441c-8c8c-71466251a162
2007-10-26 Use const and static as needed, disable unused codeblueswir1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3452 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-16find -type f | xargs sed -i 's/[\t ]$//g' # on most filesths
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162
2004-10-10openpty fixbellard
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1119 c046a42c-6fe2-441c-8c8c-71466251a162
2004-04-22initial user mode network supportbellard
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@733 c046a42c-6fe2-441c-8c8c-71466251a162