aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-04-10introduce slirp_timer_new wrapperPaolo Bonzini5-6/+30
In order to support CFI, we would like to avoid passing function pointers out of libslirp, and instead use opaque integers for the timer callbacks. This patch introduces an internal API for creating a timer that is based on such a timer callback. For now, it receives the id (SLIRP_TIMER_RA is the only one) and calls slirp->cb->timer_new. The prototype of ra_timer_handler is changed slightly to fit better with the next patch which introduces a new libslirp function, to be called on timer expiration. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-04-10icmp6: make ndp_send_ra staticPaolo Bonzini2-12/+13
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-03-20Add sanitizers CI runsSamuel Thibault1-1/+19
2022-03-04Merge branch 'handle-econnaborted' into 'master'Samuel Thibault1-2/+2
Handle ECONNABORTED from recv See merge request slirp/libslirp!116
2022-03-04socket: Handle ECONNABORTED from recvRich1-2/+2
recv can return ECONNABORTED due to a time-out on the socket. The socket is no longer useable once it enters this state.
2022-02-17Merge branch 'bootp-has-prefix' into 'master'Samuel Thibault1-1/+1
bootp: fix g_str_has_prefix warning/critical See merge request slirp/libslirp!115
2022-02-17bootp: fix g_str_has_prefix warning/criticalMarc-André Lureau1-1/+1
Fixes: commit 60535013c3e ("bootp: add support for UEFI HTTP boot") Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-11slirp: Don't duplicate packet in tcp_reassBrett Nash1-3/+0
When debug is enabled, we duplicate the packet in tcp_reass, but ti is still pointing to the old buffer, resulting in a use after free. This makes valgrind debugging a little trickier, but makes it crash a lot less. Signed-off-by: Brett Nash <nash@fb.com>
2022-02-11Rename insque/remque -> slirp_[ins|rem]queBrett Nash10-56/+51
Avoid a macro translation when not needed, and potentially doing really weird things to headers.
2022-02-10Merge branch 'debug-fix' into 'master'Marc-André Lureau2-2/+2
mbuf: Use SLIRP_DEBUG to enable mbuf debugging instead of DEBUG See merge request slirp/libslirp!114
2022-02-10mbuf: Use SLIRP_DEBUG to enable mbuf debugging instead of DEBUG Brett Nash2-2/+2
DEBUG is set by a number of IDEs and development environments (*cough* xcode *cough*). This means we use mbuf duplication when we don't need (or expect) it. Change the name to SLIRP_DEBUG to enable this feature. Signed-off-by: Pablo Fiori <pablofiori@fb.com> Signed-off-by: Brett Nash <nash@fb.com>
2022-02-09Replace inet_ntoa() with safer inet_ntop()Marc-André Lureau4-17/+29
inet_ntoa() returns a static pointer which is subject to safety issues. Use the recommended alternative. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-02Merge branch 'libslirp-vmsend' into 'master'Samuel Thibault1-0/+4
Add VMS_END marker See merge request slirp/libslirp!112
2022-02-02Add VMS_END markerDr. David Alan Gilbert1-0/+4
The migration VMSTATE_END_OF_LIST marker relies on a NULL field to mark th eend of a list; that's a bit delicate when the marker is forgotten and the code hits a NULL by luck. Use an explicit flag to mark the end as well. See: https://lists.gnu.org/archive/html/qemu-devel/2022-01/msg03025.html Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2022-01-25Merge branch 'vendor-class-id' into 'master'Samuel Thibault2-0/+24
bootp: add support for UEFI HTTP boot See merge request slirp/libslirp!111
2022-01-25bootp: add support for UEFI HTTP bootIgnat Korchagin2-0/+24
Current bootp implementation is only one step away from supporting UEFI HTTP boot in QEMU. The only missing bit is that the UEFI specification [1] requires a vendor class identifier option (num 60) set to "HTTPClient" string present in the DHCP response. OVMF [2] indeed ignores the DHCP response and considers UEFI HTTP boot as failed, if this option is not present. With this change one would be able to configure QEMU user networking like below: $ qemu ... -nic user,tftp=tftp-root,bootfile=http://10.0.2.2/ipxe.efi and boot the VM using UEFI HTTP boot instead of TFTP. [1]: https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf [2]: https://github.com/tianocore/edk2/tree/5302bd81d9ba0c9e7f2371a81c438ec919ec8e1e/OvmfPkg Signed-off-by: Ignat Korchagin <ignat@cloudflare.com>
2022-01-24Merge branch 'dns6' into 'master'Samuel Thibault1-4/+131
IPv6 DNS proxying support Closes #55 See merge request slirp/libslirp!110
2022-01-24IPv6 DNS proxying supportNoah1-4/+131
2022-01-23Add missing scope_id in cachingSamuel Thibault1-7/+24
2021-12-12Drop fixed TODOSamuel Thibault1-1/+0
2021-12-12Merge branch 'hostfwd-unix' into 'master'Samuel Thibault2-8/+156
Support Unix sockets in hostfwd See merge request slirp/libslirp!103
2021-11-30socket: Move closesocket(so->s_aux) to sofreeNicholas Ngai3-6/+4
Signed-off-by: Nicholas Ngai <nicholas@ngai.me>
2021-11-29socket: Check so_type instead of so_tcpcb for Unix-to-inet translationNicholas Ngai1-3/+22
Signed-off-by: Nicholas Ngai <nicholas@ngai.me>
2021-11-29Merge branch 'master' into hostfwd-unixNicholas Ngai15-44/+613
Signed-off-by: Nicholas Ngai <nicholas@ngai.me>
2021-11-29socket: Add s_aux field to struct socket for storing auxilliary socketNicholas Ngai4-2/+11
Signed-off-by: Nicholas Ngai <nicholas@ngai.me>
2021-11-30Merge branch 'init-so-type' into 'master'Samuel Thibault8-12/+13
socket: Initialize so_type in socreate See merge request slirp/libslirp!109
2021-11-29socket: Initialize so_type in socreateNicholas Ngai8-12/+13
Signed-off-by: Nicholas Ngai <nicholas@ngai.me>
2021-11-27socket: Allocate Unix-to-TCP hostfwd port from OS by binding to port 0Nicholas Ngai1-4/+73
Signed-off-by: Nicholas Ngai <nicholas@ngai.me>
2021-11-20Merge branch 'disable-dhcp' into 'master'Samuel Thibault4-2/+13
Allow to disable internal DHCP server See merge request slirp/libslirp!22
2021-11-18Allow to disable internal DHCP serverRafael Gieschke4-2/+13
Setting `cfg->disable_dhcp` to `true` will disable the internal DHCP server. Signed-off-by: Rafael Gieschke <rafael@gieschke.de>
2021-11-11Merge branch 'pingtest' into 'master'Samuel Thibault2-0/+496
pingtest: Add a trivial ping test See merge request slirp/libslirp!91
2021-11-11Merge branch 'icmp_raw' into 'master'Samuel Thibault1-22/+38
icmp: Support falling back on trying a SOCK_RAW socket See merge request slirp/libslirp!92
2021-11-12slirp_pollfds_fill: Explain why dividing so_snd.sb_datalen by twoSamuel Thibault2-2/+8
2021-11-08Merge branch 'ci-slirp4netns' into 'master'Samuel Thibault1-0/+33
CI: run integration tests with slirp4netns Closes #50 See merge request slirp/libslirp!107
2021-11-08CI: run integration tests with slirp4netnsAkihiro Suda1-0/+33
Fix issue 50 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-10-12socket: Check address family for Unix-to-inet accept translationNicholas Ngai1-3/+11
Signed-off-by: Nicholas Ngai <nicholas@ngai.me>
2021-10-12socket: Add debug args for tcpx_listen (inet and Unix sockets)Nicholas Ngai1-0/+33
Signed-off-by: Nicholas Ngai <nicholas@ngai.me>
2021-10-12socket: Restore original definition of fhostNicholas Ngai2-13/+2
Signed-off-by: Nicholas Ngai <nicholas@ngai.me>
2021-10-12socket: Move <sys/un.h> include to socket.hNicholas Ngai2-1/+4
Signed-off-by: Nicholas Ngai <nicholas@ngai.me>
2021-10-07Merge branch 'master' into 'master'Samuel Thibault1-6/+12
resolv: fix IPv6 resolution on Darwin See merge request slirp/libslirp!104
2021-09-27Support Unix sockets in hostfwdNicholas Ngai4-14/+34
QEMU has an issue open (https://gitlab.com/qemu-project/qemu/-/issues/347) to forward a Unix domain socket to guest TCP port. Both of these protocols support stream modes of operation (and user-mode networking can only access the stream anyway), so this patch enables Unix-to-TCP hostfwds. Like with localhost hostfwds, the sotranslate_accept function will translate a Unix domain socket connection to a TCP connection originating from vhost_addr and a randomized ephemeral port. Signed-off-by: Nicholas Ngai <nicholas@ngai.me>
2021-09-26resolv: fix IPv6 resolution on Darwinosy1-6/+12
res_sockaddr_union() has a field for IPv4 and a field for IPv6. When we used `&servers[i].sin.sin_addr`, it does not return the right address for IPv6.
2021-09-18Use the exact sockaddr size in getnameinfo callSamuel Thibault1-2/+14
On NetBSD, the sockaddr size passed to getnameinfo must match the family. (reworked from the patch suggestion from Yorick Hardy) Fixes #52
2021-09-14Merge branch 'sin6_scope_fix' into 'master'Samuel Thibault1-0/+3
Initialize sin6_scope_id to zero See merge request slirp/libslirp!102
2021-09-14Initialize sin6_scope_id to zeroSaar Gross1-0/+3
sin6_scope_id is not explicitly set to zero in tcp_input() which should be OK for global IPv6 addresses, but seems to fail on Mac OS: if sin6_scope_id ends up with a value other than zero for global addresses, connect() will fail with "No route to host". Tested on Mac OS v11.5.2 but might be an issue on other versions as well. Signed-off-by: Saar Gross <saar@fb.com> Signed-off-by: Mohan Kumar Kumar <mohankm@fb.com>
2021-09-05slirp_socketpair_with_oob: Connect pair through 127.0.0.1Samuel Thibault1-1/+1
We do not need the socket to be exposed outside the localhost, and this reduces the attack surface. Suggested-by: Akihiro Suda <suda.kyoto@gmail.com>
2021-08-24Merge branch 'libresolv-leak-fix' into 'master'Marc-André Lureau1-1/+1
resolv: fix memory leak when using libresolv See merge request slirp/libslirp!100
2021-08-23resolv: fix memory leak when using libresolvosy1-1/+1
2021-07-05Merge branch 'master' into 'master'Samuel Thibault1-2/+8
Haiku: proper path to resolv.conf for DNS server See merge request slirp/libslirp!99
2021-07-05Haiku: proper path to resolv.conf for DNS serverRichard Zak1-2/+8