Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/net/Net_Slirp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@
.timer_new = SlirpCbTimerNew,
.timer_free = SlirpCbTimerFree,
.timer_mod = SlirpCbTimerMod,
.register_poll_fd = SlirpCbRegisterPollFD,

Check warning on line 138 in src/net/Net_Slirp.cpp

View workflow job for this annotation

GitHub Actions / arm64

'register_poll_fd' is deprecated [-Wdeprecated-declarations]

Check warning on line 138 in src/net/Net_Slirp.cpp

View workflow job for this annotation

GitHub Actions / x86_64

'register_poll_fd' is deprecated [-Wdeprecated-declarations]
.unregister_poll_fd = SlirpCbUnregisterPollFD,

Check warning on line 139 in src/net/Net_Slirp.cpp

View workflow job for this annotation

GitHub Actions / arm64

'unregister_poll_fd' is deprecated [-Wdeprecated-declarations]

Check warning on line 139 in src/net/Net_Slirp.cpp

View workflow job for this annotation

GitHub Actions / x86_64

'unregister_poll_fd' is deprecated [-Wdeprecated-declarations]
.notify = SlirpCbNotify
};

Expand Down Expand Up @@ -205,6 +205,7 @@
*(u16*)&udpheader[6] = htons(tmp);
}

#if !SLIRP_CHECK_VERSION(4, 9, 1)
void Net_Slirp::HandleDNSFrame(u8* data, int len) noexcept
{
u8* ipheader = &data[0xE];
Expand Down Expand Up @@ -361,6 +362,7 @@
if (Callback)
Callback(resp, framelen);
}
#endif

int Net_Slirp::SendPacket(u8* data, int len) noexcept
{
Expand All @@ -372,6 +374,7 @@
return 0;
}

#if !SLIRP_CHECK_VERSION(4, 9, 1)
u16 ethertype = ntohs(*(u16*)&data[0xC]);

if (ethertype == 0x800)
Expand All @@ -387,6 +390,7 @@
}
}
}
#endif

slirp_input(Ctx, data, len);
return len;
Expand Down Expand Up @@ -449,7 +453,7 @@
{
u32 timeout = 0;
PollListSize = 0;
slirp_pollfds_fill(Ctx, &timeout, SlirpCbAddPoll, this);

Check warning on line 456 in src/net/Net_Slirp.cpp

View workflow job for this annotation

GitHub Actions / build

'void slirp_pollfds_fill(Slirp*, uint32_t*, SlirpAddPollCb, void*)' is deprecated [-Wdeprecated-declarations]

Check warning on line 456 in src/net/Net_Slirp.cpp

View workflow job for this annotation

GitHub Actions / arm64

'slirp_pollfds_fill' is deprecated [-Wdeprecated-declarations]

Check warning on line 456 in src/net/Net_Slirp.cpp

View workflow job for this annotation

GitHub Actions / x86_64

'slirp_pollfds_fill' is deprecated [-Wdeprecated-declarations]
int res = poll(PollList, PollListSize, timeout);
slirp_pollfds_poll(Ctx, res<0, SlirpCbGetREvents, this);
}
Expand Down
47 changes: 45 additions & 2 deletions src/net/libslirp/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,48 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.8.0] - TODO
## [4.9.1] - 2025-05-28

### Fixed

- meson: use boolean defaults for boolean options !149
- meson: specify that C++ is only used for host binaries !149
- meson: add dependency override for libslirp !150
- Do not link tests with libslirp.map #84
- apple: Fix getting IPv4 DNS server address when IPv4 and IPv4 are
interleaved #85
- Windows: Fix ICMP generation #87 #88
- tcp: Fix starting the linger2 timer on socket shutdown #86

### Changed

- tcp: on input, reset TCPT_KEEP to TCPTV_KEEP_IDLE rather than
TCPTV_KEEPINTVL
- tcp: on input during init, reset TCPT_KEEP to TCPTV_KEEP_INIT
- tcp: Reduce linger time to two minutes

## [4.9.0] - 2025-01-30

### Added

- Add SlirpAddPollSocketCb and {,un}register_poll_socket that can be used from
SLIRP_CONFIG_VERSION_MAX 6 to properly support socket handles on win64.

### Fixed

- bootp: Fill siaddr with tftp addr as per RFC2131 !135
- tcp_listen: Fix host forwarding on Windows !137
- tftp: Fix address returned in proxying #82 !147

### Changed

- Fix build on mold #77
- Fix static linking !134
- slirp_os_socket abstraction for Windows !136
- cksum: Update implementation to include 64-bit computation support !144
- reduce compilation warnings on Windows !143

## [4.8.0] - 2024-05-09

## Security

Expand Down Expand Up @@ -224,7 +265,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Standalone project, removing any QEMU dependency.
- License clarifications.

[Unreleased]: https://gitlab.freedesktop.org/slirp/libslirp/compare/v4.8.0...master
[Unreleased]: https://gitlab.freedesktop.org/slirp/libslirp/compare/v4.9.1...master
[4.9.1]: https://gitlab.freedesktop.org/slirp/libslirp/compare/v4.9.0...v4.9.1
[4.9.0]: https://gitlab.freedesktop.org/slirp/libslirp/compare/v4.8.0...v4.9.0
[4.8.0]: https://gitlab.freedesktop.org/slirp/libslirp/compare/v4.7.0...v4.8.0
[4.7.0]: https://gitlab.freedesktop.org/slirp/libslirp/compare/v4.6.1...v4.7.0
[4.6.1]: https://gitlab.freedesktop.org/slirp/libslirp/compare/v4.6.0...v4.6.1
Expand Down
4 changes: 2 additions & 2 deletions src/net/libslirp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16)

project(libslirp VERSION 4.8.0 LANGUAGES C)
project(libslirp VERSION 4.9.1 LANGUAGES C)

set(SLIRP_MAJOR_VERSION "${libslirp_VERSION_MAJOR}")
set(SLIRP_MINOR_VERSION "${libslirp_VERSION_MINOR}")
Expand Down Expand Up @@ -47,7 +47,7 @@ set(SOURCES
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/libslirp-version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/libslirp-version.h")

add_library(slirp STATIC ${SOURCES})
target_compile_definitions(slirp PUBLIC LIBSLIRP_STATIC_BUILD)
target_compile_definitions(slirp PUBLIC LIBSLIRP_STATIC)

target_include_directories(slirp SYSTEM PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/glib")
target_include_directories(slirp SYSTEM PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src")
Expand Down
33 changes: 2 additions & 31 deletions src/net/libslirp/COPYRIGHT
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,9 @@ potential donation to your favorite charity. In fact, I encourage
favorite charity (for example, GreenPeace). This is not a requirement, but
a suggestion from someone who highly values the service they provide.

The copyright terms and conditions:
See LICENSE for the full copyright terms and conditions.

---BEGIN---

Copyright (c) 1995,1996 Danny Gasparovski. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
DANNY GASPAROVSKI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

---END---

This basically means you can do anything you want with the software, except
They basically mean you can do anything you want with the software, except
1) call it your own, and 2) claim warranty on it. There is no warranty for
this software. None. Nada. If you lose a million dollars while using
Slirp, that's your loss not mine. So, ***USE AT YOUR OWN RISK!***.
Expand Down
24 changes: 24 additions & 0 deletions src/net/libslirp/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 1995,1996 Danny Gasparovski. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
DANNY GASPAROVSKI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 changes: 12 additions & 0 deletions src/net/libslirp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ running CI etc.
Alternatively, you may send patches to slirp@lists.freedesktop.org
mailing list.

## Debugging

To make slirp emit debugging prints, one can use for instance:

```
export G_MESSAGES_DEBUG=Slirp
export SLIRP_DEBUG=call
```

`SLIRP_DEBUG` can contain a colons/spaces/commas-separated list of `call`,
`misc`, `error`, `tftp`, `verbose_call`

## Versioning

We intend to use [libtool's
Expand Down
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_icmp6/ndp.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_icmp6/ndp.pcap

This file was deleted.

1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_ip-header/dhcp.pkt

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_ip-header/dhcp.pkt
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_ip-header/dhcp_capture.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_ip-header/dhcp_capture.pcap
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_ip-header/icmp_capture.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_ip-header/icmp_capture.pcap

This file was deleted.

1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_ip-header/nc-ident.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_ip-header/nc-ident.pcap
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_ip-header/ping_10-0-2-2.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_ip-header/ping_10-0-2-2.pcap
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_ip-header/tcp_qemucapt.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_ip-header/tcp_qemucapt.pcap
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_ip-header/tftp-get-blah.pkt

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_ip-header/tftp-get-blah.pkt
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_ip-header/tftp_capture.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_ip-header/tftp_capture.pcap

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_ip6-header/icmp_capture.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_ip6-header/icmp_capture.pcap
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_ip6-header/ping_10-0-2-2.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_ip6-header/ping_10-0-2-2.pcap
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_ip6-header/tcp_qemucapt.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_ip6-header/tcp_qemucapt.pcap
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_ip6-header/tftp_capture.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_ip6-header/tftp_capture.pcap

This file was deleted.

1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_tcp-d

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_tcp-d
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_tcp-h

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_tcp-h
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_tcp6-d

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_tcp6-d
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_tcp6-h

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_tcp6-h
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_udp-h

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_udp-h
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_udp/dhcp.pkt

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_udp/dhcp.pkt
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_udp/dhcp_capture.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_udp/dhcp_capture.pcap
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_udp/tftp-get-blah.pkt

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_udp/tftp-get-blah.pkt
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_udp/tftp_capture.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_udp/tftp_capture.pcap
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_udp/tftp_get_libslirp-txt.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_udp/tftp_get_libslirp-txt.pcap
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_udp6-h

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_udp6-h
1 change: 0 additions & 1 deletion src/net/libslirp/fuzzing/IN_udp6/tftp_capture.pcap

This file was deleted.

1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/IN_udp6/tftp_capture.pcap

This file was deleted.

2 changes: 1 addition & 1 deletion src/net/libslirp/fuzzing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Current state
We chose to use libFuzzer because of its custom mutator feature, which allows to keep coherent informations inside the packets being sent to libslirp. This ease the process of fuzzing as packets are less likely to be rejected early during processing them.

In the current state, the `meson.build` file is not compatible with the original one used by libSlirp main repository but it should be easy to merge them in a clean way. Also **in the current state, it seems that there is a memory leak inside the fuzzing code**, which make it run out of memory. The current goal is to find and get rid of this leak to allow fuzzing for longer without the process being interrupted because of it.
In the current state, the `meson.build` file is not compatible with the original one used by libSlirp main repository but it should be easy to merge them in a clean way.

Six harness are currently available, more are to be added later to focus on other parts of the code :

Expand Down
Empty file modified src/net/libslirp/fuzzing/coverage.py
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions src/net/libslirp/fuzzing/fuzz-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ int main(int argc, char **argv)
g_print("%s...\n", name);
for (j = 0; j < MIN_NUMBER_OF_RUNS; j++) {
if (LLVMFuzzerTestOneInput((void *)buf, size) == EXIT_TEST_SKIP) {
g_free(buf);
return EXIT_TEST_SKIP;
}
}
Expand Down
Loading
Loading