aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-05-22build-sys: rename project to libslirpv4.0.0Marc-André Lureau1-1/+1
Let's follow gitlab project name. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-05-07Merge branch 'readme' into 'master'Samuel Thibault2-0/+68
Add README.md and gitignore See merge request slirp/libslirp!7
2019-05-07Add a README.md fileMarc-André Lureau1-0/+58
Fixes: https://gitlab.freedesktop.org/slirp/libslirp/issues/7 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-05-07maint: add more gitignore filesMarc-André Lureau1-3/+9
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-05-07maint: Add .gitignoreEric Blake1-0/+4
Ignore build artifacts during an in-tree build. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20190507143727.15640-1-eblake@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-05-06Merge branch 'emu-fix' into 'master'Marc-André Lureau1-32/+28
Memory fixes for slirp tcp_emu() See merge request slirp/libslirp!6
2019-05-06slirp: don't manipulate so_rcv in tcp_emu()Marc-André Lureau1-33/+26
For some reason, EMU_IDENT is not like other "emulated" protocols and tries to reconstitute the original buffer, if it came in multiple packets. Unfortunately, it does so wrongly, as it doesn't respect the sbuf circular buffer appending rules, nor does it maintain some of the invariants (rptr is incremented without bounds, etc): this leads to further memory corruption revealed by ASAN or various malloc errors. Furthermore, the so_rcv buffer is regularly flushed, so there is no guarantee that buffer reconstruction will do what is expected. Instead, do what the function comment says: "XXX Assumes the whole command came in one packet", and don't touch so_rcv. Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1664205 Cc: Prasad J Pandit <pjp@fedoraproject.org> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-05-04QEMU_PACKED: Remove gcc_struct attribute in Windows non x86 targetsCao Jiaxi1-1/+1
This attribute is for x86 only, and it generates an warning on ARM64 Clang/MinGW targets. Signed-off-by: Cao Jiaxi <driver1998@foxmail.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-05-03slirp: ensure there is enough space in mbuf to null-terminateMarc-André Lureau1-0/+3
Prevents from buffer overflows. Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1664205 Cc: Prasad J Pandit <pjp@fedoraproject.org> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-04-15Gcc 9 -O3 fixDr. David Alan Gilbert1-1/+4
Gcc 9 needs some convincing that sopreprbuf really is going to fill in iov in the call from soreadbuf, even though the failure case shouldn't happen. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20190415121740.9881-1-dgilbert@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-03-28Merge branch 'remove-qtailq' into 'master'Marc-André Lureau3-201/+0
remove qtailq.h See merge request slirp/libslirp!4
2019-03-28remove qtailq.hAkihiro Suda3-201/+0
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2019-03-27Merge branch 'next' into 'master'Samuel Thibault8-1/+227
Add meson build & gitlab CI See merge request slirp/libslirp!2
2019-03-27Merge branch 'clang-format' into 'master'Samuel Thibault1-0/+64
Add .clang-format See merge request slirp/libslirp!3
2019-03-26Add .gitlab-ci.ymlMarc-André Lureau1-0/+24
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-03-26build-sys: add version toolingMarc-André Lureau6-1/+63
Add SLIRP_CHECK_VERSION() macro, and slirp_version_string() helpers. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-03-26build-sys: add a meson buildMarc-André Lureau2-0/+140
Build a shared library, exporting only slirp_* symbols. Install API headers and a slirp.pc pkg-config. It has been tested to build on Linux and with mingw64 cross-compilation. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-03-25Add .clang-formatMarc-André Lureau1-0/+64
Add the .clang-format used for formatting the slirp code during the import from qemu. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-03-22slirp: is not maintained by Kelly Price for a long timeMarc-André Lureau1-2/+0
slirp has been maintained by the QEMU maintainers and will be maintained under an independent project soon. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kelly Price <strredwolf@gmail.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-03-22slirp: remove reference to COPYRIGHT fileMarc-André Lureau16-48/+0
The slirp COPYRIGHT file is a BSD-3 license. Instead of referring to another project file, the SPDX license notice present in all source files states that unequivocally. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2019-03-22slirp: clarify license of slirp files using SPDX: implicit via unstatedMarc-André Lureau12-0/+12
Add SPDX license identifier to clarify the license of files without explicit license header. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com>
2019-03-22slirp: clarify license of slirp files using SPDX: implicit via COPYRIGHTMarc-André Lureau11-0/+11
Add SPDX license identifier to clarify the license of files with reference to BSD license from slirp COPYRIGHT file. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com>
2019-03-22slirp: clarify license of slirp files using SPDX: explicit MITMarc-André Lureau9-0/+9
Add SPDX license identifier to clarify the license of files with explicit MIT license header. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com>
2019-03-22slirp: clarify license of slirp files using SPDX: explicit BSDMarc-André Lureau24-0/+24
Add SPDX license identifier to clarify the license of files with explicit 3-clause BSD license header. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com>
2019-03-22slirp: relicense GPL files to BSD-3Marc-André Lureau6-35/+170
In order to make slirp a standalone project, the project must have a clear license, and be compatible with the GPL or LGPL. Since commit 2f5f89963186d42a7ded253bc6cf5b32abb45cec ("Remove the advertising clause from the slirp license"), slirp is BSD-3. But new files have been added under slirp/ with QEMU GPL license since then. The copyright holders have been asked to relicense files to BSD-3 and gave their permission: - slirp/dhcpv6.{c,h} Subject: Re: Clearing slirp/ license To: "Marc-André Lureau" <marcandre.lureau@gmail.com>, QEMU <qemu-devel@nongnu.org>, Thomas Huth <thuth@redhat.com> Cc: Peter Maydell <peter.maydell@linaro.org>, Samuel Thibault <samuel.thibault@ens-lyon.org> References: <CAJ+F1CKBRNdLPb_wOLhURdUJd-j1RHY2toKSTEhCBt_zs4Xk1w@mail.gmail.com> From: "Cédric Le Goater" <clg@kaod.org> Message-ID: <e942cdab-fe1b-fdf4-3b9f-da16a4afa953@kaod.org> Date: Mon, 11 Mar 2019 16:23:25 +0100 > Could you reply that you have no objection in relicensing those files > are 3-Clause BSD? Fine for me. You can change the license of slirp/ncsi.c and slirp/ncsi-pkt.hto a 3-Clause BSD. Thanks, C. Subject: Re: [Qemu-devel] Clearing slirp/ license To: Peter Maydell <peter.maydell@linaro.org>, Shan Gavin <shan.gavin@gmail.com> Cc: Alexey Kardashevskiy <aik@ozlabs.ru>, "Marc-André Lureau" <marcandre.lureau@gmail.com>, Gavin Shan <gwshan@linux.vnet.ibm.com>, Thomas Huth <thuth@redhat.com>, QEMU <qemu-devel@nongnu.org>, Samuel Thibault <samuel.thibault@ens-lyon.org> References: <CAJ+F1CKBRNdLPb_wOLhURdUJd-j1RHY2toKSTEhCBt_zs4Xk1w@mail.gmail.com> <e942cdab-fe1b-fdf4-3b9f-da16a4afa953@kaod.org> <CAJ+F1C+hFfsa5gcSdttTP5J+uyDvNdYJWrm9OJM26+Zc1ZQkew@mail.gmail.com> <cc62e1fd-c564-e1b7-d10c-30665b481352@ozlabs.ru> <CAOL5TwkQXhPjdPP9v7n7mxAVxbDCSo6MEaG+E-Xys=MoD_pg2g@mail.gmail.com> <CAFEAcA_g=L2LSo=B_5dpJhJJrqFiOb6sswMVohQwpVGiKi_A7w@mail.gmail.com> From: "Cédric Le Goater" <clg@kaod.org> Message-ID: <4ddf6031-0df1-b3b5-965e-a181266e42b0@kaod.org> Date: Tue, 12 Mar 2019 11:49:21 +0100 > Is the code in question copyright you personally, or copyright > IBM as your employer at the time ? If the latter, it is IBM that > would need to approve the relicensing. That was done. I had our legal team approve the change of license. Thanks, C. From: Shan Gavin <shan.gavin@gmail.com> Date: Tue, 12 Mar 2019 15:04:54 +0800 Message-ID: <CAOL5TwkQXhPjdPP9v7n7mxAVxbDCSo6MEaG+E-Xys=MoD_pg2g@mail.gmail.com> Subject: Re: [Qemu-devel] Clearing slirp/ license To: Alexey Kardashevskiy <aik@ozlabs.ru> Cc: "Marc-André Lureau" <marcandre.lureau@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, gwshan@linux.vnet.ibm.com, Peter Maydell <peter.maydell@linaro.org>, Thomas Huth <thuth@redhat.com>, QEMU <qemu-devel@nongnu.org>, Samuel Thibault <samuel.thibault@ens-lyon.org> > Gavin, could you reply that you have no objection in relicensing > ncsi-pkt.h as 3-Clause BSD? No objection. Please go ahead with the relicensing. Cheers, Gavin - ncsi.c, ncsi-pkt.h Subject: Re: Clearing slirp/ license To: "Marc-André Lureau" <marcandre.lureau@gmail.com>, QEMU <qemu-devel@nongnu.org>, "Cédric Le Goater" <clg@kaod.org> Cc: Peter Maydell <peter.maydell@linaro.org>, Samuel Thibault <samuel.thibault@ens-lyon.org> References: <CAJ+F1CKBRNdLPb_wOLhURdUJd-j1RHY2toKSTEhCBt_zs4Xk1w@mail.gmail.com> From: Thomas Huth <thuth@redhat.com> Message-ID: <ed5a9f55-f2e5-298d-58ac-414759e9b491@redhat.com> Date: Wed, 13 Feb 2019 12:30:32 +0100 > Could you reply that you have no objection in relicensing those files > are 3-Clause BSD? Ok, for the records: I'm fine if you change the license of dhcpv6.[ch] to either 3-Clause BSD or 2-Clause BSD. Thomas - vmstate.{c,h} From: Juan Quintela <quintela@redhat.com> To: "Marc-André Lureau" <marcandre.lureau@gmail.com> Cc: QEMU <qemu-devel@nongnu.org>, Peter Maydell <peter.maydell@linaro.org>, Samuel Thibault <samuel.thibault@ens-lyon.org> Subject: Re: Clearing slirp/ license Date: Tue, 12 Mar 2019 12:43:17 +0100 Message-ID: <87k1h4qpwq.fsf@trasno.org> > Juan, Could you reply that you have no objection in relicensing the > vmstate files as 3-Clause BSD? No problem at all on my side. Later, Juan. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [ for the NC-SI files ] Reviewed-by: Cédric Le Goater <clg@kaod.org> Acked-by: Thomas Huth <thuth@redhat.com>
2019-03-22slirp: update COPYRIGHT to use full 3-Clause BSD LicenseMarc-André Lureau1-0/+3
According to commit 2f5f89963186d42a7ded253bc6cf5b32abb45cec ("Remove the advertising clause from the slirp license"), Danny Gasparovski gave permission to license slirp code under 3-clause BSD license: 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> I have no objection to having Slirp code in QEMU be licensed under the 3-clause BSD license. slirp/COPYRIGHT's initial version in 2004 (commit 5fafdf24) listed only 3 clauses BUT used the poisonous advertising clause for clause 3 which is the controversial clause of non-free 4-clause (that is, it appears that the BSD-4 license was copied, and then the WRONG clause was deleted, when creating COPYRIGHT. Perhaps explained as an easy mistake to make since 3-clause was created by removing clause 3 of the 4-clause, where you sometimes see the three-clause version with clauses 1, 2, 4; but more commonly see a renumbered version with clauses 1, 2, 3 to close the gap. If you pay attention only to clause numbers instead of content, it can be easy to confuse which clause to delete to go from 4-clause to 3-clause). Commit 2f5f89963 removed the poisonous wrong clause on the grounds of moving from 4-clause to 3-clause; but did not add the missing clause, which makes it LOOK like the 2-clause version. But I think we have a decent enough trail showing the intent for 3-clause. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com>
2019-03-13slirp: remove empty state.hv4.0.0-rc0Marc-André Lureau2-1/+0
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190313173949.2369-1-marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-03-07slirp: remove QEMU Makefile.objsMarc-André Lureau1-36/+0
QEMU no longer includes it, and treats slirp/ as a separate project. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190212162524.31504-8-marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-03-07slirp: add a standalone MakefileMarc-André Lureau1-0/+47
Add a simple Makefile to build libslirp.a, a static library version of libslirp, to be used by QEMU during a transition period, until a shared library is available. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190212162524.31504-6-marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-03-07slirp: move sources to src/ subdirectoryMarc-André Lureau58-30/+30
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-07slirp: use "slirp_" prefix for inet_aton() win32 implementationMarc-André Lureau3-5/+5
To avoid conflict with QEMU inet_aton() implementation, let's use the "slirp_" prefix. This allows to drop the WITH_QEMU, thus the source won't make a distinction when building with QEMU or not. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190212162524.31504-4-marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-03-07slirp: use libslirp migration codeMarc-André Lureau4-47/+32
slirp migration code uses QEMU vmstate so far, when building WITH_QEMU. Introduce slirp_state_{load,save,version}() functions to move the state saving handling to libslirp side. So far, the bitstream compatibility should remain equal with current QEMU, as this is effectively using the same code, with the same format etc. When libslirp is made standalone, we will need some mechanism to ensure bitstream compatibility regardless of the libslirp version installed. See the FIXME note in the code. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190212162524.31504-3-marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-03-07slirp: adapt a subset of QEMU vmstate codeMarc-André Lureau6-0/+952
Add vmstate serialization code adapted from QEMU. Keep only the bits that are required for libslirp. Introduce a IStream/OStream interface to replace QEMU QFile abstraction. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190212162524.31504-2-marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-03-06slirp: Mark pieces missing IPv6 supportSamuel Thibault6-0/+14
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-03-06slirp: fix big/little endian conversion in ident protocolSamuel Thibault1-1/+3
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- Based-on: <1551476756-25749-1-git-send-email-will@wbowling.info>
2019-03-06slirp: check sscanf result when emulating identWilliam Bowling1-4/+5
When emulating ident in tcp_emu, if the strchr checks passed but the sscanf check failed, two uninitialized variables would be copied and sent in the reply, so move this code inside the if(sscanf()) clause. Signed-off-by: William Bowling <will@wbowling.info> Cc: qemu-stable@nongnu.org Cc: secalert@redhat.com Message-Id: <1551476756-25749-1-git-send-email-will@wbowling.info> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2019-03-06slirp: check for ioctlsocket error and 0-length udp payload.Vic Lee1-1/+8
Sometimes sorecvfrom() is called from slirp.c because revents == G_IO_IN, but there is 0 bytes available and recvfrom could be blocking indefinitely. This is likely due to 0-length udp payload. This also adds an error checking for ioctlsocket. Signed-off-by: Vic Lee <llyzs.vic@gmail.com> Message-Id: <20190301064809.3074-1-llyzs.vic@gmail.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-03-06slirp: Fix build with gcc 9Greg Kurz1-1/+1
Build fails with gcc 9: CC slirp/ndp_table.o slirp/ndp_table.c: In function ‘ndp_table_add’: slirp/ndp_table.c:31:23: error: taking address of packed member of ‘struct ndpentry’ may result in an unaligned pointer value [-Werror=address-of-packed-member] 31 | if (in6_equal(&ndp_table->table[i].ip_addr, &ip_addr)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ slirp/ndp_table.c: In function ‘ndp_table_search’: slirp/ndp_table.c:75:23: error: taking address of packed member of ‘struct ndpentry’ may result in an unaligned pointer value [-Werror=address-of-packed-member] 75 | if (in6_equal(&ndp_table->table[i].ip_addr, &ip_addr)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors The ndpentry structure isn't used to model on-the-wire data or anything else that would care for the struct layout. It doesn't need to be packed actually. Just drop SLIRP_PACKED. Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <155143315831.102868.17515265400523392682.stgit@bahia.lan> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-12slirp: wrap the remaining socket functionsMarc-André Lureau2-11/+207
QEMU wraps the socket functions in os-win32.h, but in commit a9d8b3ec4385793815d71217857304, the header inclusion was dropped, breaking libslirp on Windows. Wrap the missing functions. Rename the wrapped function with "slirp_" prefix and "_wrap" suffix, for consistency and to avoid a clash with existing function (such as "slirp_socket"). Fixes: a9d8b3ec ("slirp: replace remaining qemu headers dependency") Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190212160953.29051-3-marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Tested-by: Howard Spoelstra
2019-02-12slirp: remove slirp_ prefix for socket wrappersMarc-André Lureau7-35/+43
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: API is extern CMarc-André Lureau1-1/+8
Make it possible to use headers easily with C++ projects. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07slirp: pass opaque to all callbacksMarc-André Lureau10-31/+38
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: use polling callbacks, drop glib requirementMarc-André Lureau2-49/+42
It would be legitimate to use libslirp without glib. Let's add_poll/get_revents pair of callbacks to provide the same functionality. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07slirp: remove slirp_instances listMarc-André Lureau1-5/+0
Now that polling is done per-instance, we don't need a global list of slirp instances. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07slirp: replace global polling with per-instance & notifierMarc-André Lureau2-283/+264
Remove hard-coded dependency on slirp in main-loop, and use a "poll" notifier instead. The notifier is registered per slirp instance. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07slirp: improve send_packet() callbackMarc-André Lureau4-8/+25
Use a more descriptive name for the callback. Reuse the SlirpWriteCb type. Wrap it to check that all data has been written. Return a ssize_t for potential error handling and data-loss reporting. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07slirp: prefer c99 types over BSD kindMarc-André Lureau16-69/+67
Replace: - u_char -> uint8_t - u_short -> uint16_t - u_long -> uint32_t - u_int -> unsigned - caddr_t -> char * 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é Lureau28-33/+30
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/+53
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: replace QEMU_BUILD_BUG_ON with G_STATIC_ASSERTSamuel Thibault3-9/+9
to remove another dependency on qemu. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>