aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-05-25Merge branch 'fixes' into 'master'Samuel Thibault2-2/+2
Fix typos in comments See merge request slirp/libslirp!88
2021-05-25src/ip: Fix typos in commentsThomas Huth2-2/+2
Found with the "codespell" utility. Signed-off-by: Thomas Huth <thuth@redhat.com>
2021-05-19changelog: post-releaseMarc-André Lureau1-1/+11
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-05-19Merge branch '4.5.0' into 'master'Marc-André Lureau2-7/+22
Release v4.5.0 Closes #40 See merge request slirp/libslirp!87
2021-05-18Release v4.5.0v4.5.0Marc-André Lureau2-7/+22
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-05-09SlirpCb: explicit that it is fine for a guest to drop framesSamuel Thibault1-5/+5
2021-05-09Merge branch 'master' into 'master'Samuel Thibault1-1/+6
ndp_table: For unspecified address, return broadcast ethernet address See merge request slirp/libslirp!86
2021-05-09ndp_table: For unspecified address, return broadcast ethernet addressSamuel Thibault1-1/+6
We cannot let the guest crash libslirp by making it answer a tftp request such as shown in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33873 https://gitlab.com/qemu-project/qemu/-/issues/111 unspecified addresses may also be used for non-configured devices, so it makes sense to use the broadcast ethernet address in that case, just like we do with IPv4.
2021-05-07Merge branch 'philmd' into 'master'Marc-André Lureau1-5/+9
Remove alloca() call in get_dns_addr_resolv_conf() See merge request slirp/libslirp!84
2021-05-07Remove alloca() call in get_dns_addr_resolv_conf()Philippe Mathieu-Daudé1-5/+9
The ALLOCA(3) man-page mentions its "use is discouraged". For now get_dns_addr_resolv_conf() is called with pointer to a in_addr/in6_addr structure, and its size. Declare a union of these structures on the stack, able to hold both of them. This allows us to remove the alloca() call, keeping the buffer on the stack. Add an assertion in the unlikely case another inet address is handled by this function. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210507133212.1952121-1-philmd@redhat.com>
2021-04-12Merge branch 'lazy-ipv6-resolution' into 'master'Samuel Thibault6-13/+130
Perform lazy guest address resolution for IPv6 See merge request slirp/libslirp!81
2021-04-12Perform lazy guest address resolution for IPv6Doug Evans6-13/+130
Previously QEMU rejected IPv6 host-forward attempts that had an unspecified guest address. This is because for IPv6 the guest's IP address isn't necessarily known ahead of time: Libslirp only provides a "stateless" DHCPv6 server, which if the macaddr is random then the IPv6 address is random too. This patch changes this to do the address resolution lazily, in the hopes that the guest's IPv6 address is known at the time the user wants to connect to the guest. The request can still fail if the guest doesn't have an IPv6 address yet (e.g., it's still early in the boot). Such requests are immediately rejected. Signed-off-by: Doug Evans <dje@google.com>
2021-04-07Merge branch 'listen_v6only' into 'master'Samuel Thibault6-2/+18
Listen v6only See merge request slirp/libslirp!77
2021-04-06Merge branch 'newtcpcb-no-fail' into 'master'Samuel Thibault1-4/+1
tcpx_listen: tcp_newtcpcb doesn't fail See merge request slirp/libslirp!79
2021-04-06Merge branch 'listen-errno' into 'master'Samuel Thibault4-2/+14
slirp_add_host*fwd: Ensure all error paths set errno See merge request slirp/libslirp!80
2021-04-06slirp_add_host*fwd: Ensure all error paths set errnoDoug Evans4-2/+14
Debugging bind/listen failures without errno can get painful. Signed-off-by: Doug Evans <dje@google.com>
2021-03-29tcpx_listen: tcp_newtcpcb doesn't failDoug Evans1-4/+1
Signed-off-by: Doug Evans <dje@google.com>
2021-03-29Remove slirp_add/remove_ipv6_hostfwdSamuel Thibault7-102/+0
They are superseded by slirp_add/remove_hostxfwd Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2021-03-17Merge branch 'verbose-if-start' into 'master'Samuel Thibault3-1/+10
Move DEBUG_CALL("if_start") to DEBUG_VERBOSE_CALL See merge request slirp/libslirp!78
2021-03-17Merge branch 'hostxfwd' into 'master'Samuel Thibault3-1/+85
Add ipv4/ipv6-agnostic host forwarding functions See merge request slirp/libslirp!75
2021-03-17hostfwd: Add SLIRP_HOSTFWD_V6ONLY flagSamuel Thibault6-2/+18
That allows to request binding on v6 addresses only. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2021-03-17Move DEBUG_CALL("if_start") to DEBUG_VERBOSE_CALLDoug Evans3-1/+10
This debugging printf reduces the overall S/N ratio of debug output in the normal case, so separate it out. Signed-off-by: Doug Evans <dje@google.com>
2021-03-05Add ipv4/ipv6-agnostic host forwarding functionsSamuel Thibault3-1/+85
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2021-03-05udpx/tcpx_listen: Use struct sockaddr * typesSamuel Thibault4-22/+32
This actually makes most of the code simpler.
2021-03-04Merge branch 'neighbor-info' into 'master'Samuel Thibault9-23/+91
Neighbor info See merge request slirp/libslirp!71
2021-03-04Merge branch 'm-cleanup-list-prototype' into 'master'Samuel Thibault1-1/+1
m_cleanup_list: make static See merge request slirp/libslirp!76
2021-03-03New API routine slirp_neighbor_infoDoug Evans4-4/+50
This will be called from QEMU to dump the ARP/NDP tables. ndpentry.eth_addr type changed from unsigned char to uint8_t to be consistent with other macaddr objects. Ditto for slirp_arphdr.{ar_sha,ar_tha}. Signed-off-by: Doug Evans <dje@google.com>
2021-03-03m_cleanup_list: make staticDoug Evans1-1/+1
Was causing compilation failures with -Werror=missing-prototypes.
2021-03-02New utility slirp_ether_ntoaDoug Evans5-19/+41
... and call it everywhere a macaddr is pretty-printed. Signed-off-by: Doug Evans <dje@google.com>
2021-03-01sockaddr_*: add missing const qualifiersSamuel Thibault1-7/+7
2021-03-01udpx/tcpx_listen: Add missing const qualifierSamuel Thibault4-16/+16
2021-03-01Merge branch 'x_listen' into 'master'Samuel Thibault4-97/+86
Expose udpx_listen and tcpx_listen as taking sockaddr See merge request slirp/libslirp!74
2021-03-01Merge branch 'macos-pri' into 'master'Samuel Thibault1-3/+11
Disable polling for PRI on MacOS Closes #35 See merge request slirp/libslirp!73
2021-03-01Disable polling for PRI on MacOSSamuel Thibault1-3/+11
Fixes #35. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2021-02-28Expose udpx_listen and tcpx_listen as taking sockaddrSamuel Thibault4-97/+86
This generalizes adding hostfwd, and opens the path for cross ipv4/6 forward. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2021-02-28socket.h: add missing sbuf.h inclusionSamuel Thibault1-0/+1
to get struct sbuf Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2021-02-28TODO for generalizing the hostfwd callsSamuel Thibault3-0/+5
2021-02-24Merge branch 'macos-deployment-target' into 'master'Marc-André Lureau1-0/+5
Set macOS deployment target Closes #36 See merge request slirp/libslirp!72
2021-02-24Set macOS deployment target to macOS 10.4WaluigiWare641-0/+5
Without a macOS deployment target, the resulting library does not work on macOS versions lower than it was currently built on. For example, if libslirp was built on macOS 10.15, it would not work on macOS 10.14.
2021-02-24Merge branch 'gitignore-build' into 'master'Marc-André Lureau1-0/+1
Add /build/ to .gitignore See merge request slirp/libslirp!69
2021-02-23Add /build/ to .gitignoreDoug Evans1-0/+1
The docs suggest building in ./build, which is cool. Add build to .gitignore so it doesn't interfere with git. Signed-off-by: Doug Evans <dje@google.com>
2021-02-18Merge branch 'memory_leaks' into 'master'Samuel Thibault1-9/+14
m_cleanup: fix memory leaks See merge request slirp/libslirp!68
2021-02-18m_cleanup: set qh_link and qh_rlink to the list headjeremy marchand1-0/+2
This should ensure the lists are considered empty after the cleanup
2021-02-18m_cleanup: fix memory leaksjeremy marchand1-0/+2
m_cleanup didn't cleanup the if_batchq and if_fastq queues, resulting in a memory leak.
2021-02-18refactor m_cleanup as requested in slirp/libslirp!68jeremy marchand1-9/+9
2021-02-18m_free: remove the M_EXT flag after freeing the mbuf extended bufferjeremy marchand1-0/+1
mbufs added to the freelist shouldn't keep the M_EXT flag as they can be recycled and the new owner could try to access the freed extended buffer.
2021-02-18Merge branch 'ndp-leak' into 'master'Samuel Thibault1-0/+3
ip6_output: fix memory leak on fast-send See merge request slirp/libslirp!67
2021-02-18ip6_output: fix memory leak on fast-sendndp-leakSamuel Thibault1-0/+3
When emitting NDP Neighbour Sollicitations, ip6_output immediately calls if_encap without going through any queue. if_encap however does not free the mbuf, so ip6_output has to do it. This was leaking one mbuf per NDP NS sent by slirp. Hopefully the guest was not using more than NDP_TABLE_SIZE (16) IPv6 addresses, in which case it was limited to a bound number, but more addresses would result to leaks.
2021-02-16Merge branch 'reject-ipv6-addr-any' into 'master'Samuel Thibault1-0/+8
Reject host forwarding to ipv6 "addr-any" See merge request slirp/libslirp!66
2021-02-16Reject host forwarding to ipv6 "addr-any"Doug Evans1-0/+8
Libslirp currently only provides a stateless DHCPv6 server, and thus can't do the "addr-any -> guest IP address" translation that is done for ipv4. Until a stateful DHCPv6 server is available, reject addr-any. Signed-off-by: Doug Evans <dje@google.com>