Fix tests with upstream patches
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
This commit is contained in:
parent
575cf2e570
commit
a5e543409b
33
0001-unix-ignore-ifaddrs-with-NULL-ifa_addr-4218.patch
Normal file
33
0001-unix-ignore-ifaddrs-with-NULL-ifa_addr-4218.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From b963f0a75bd6c95fbfa0ac17e46ab1f9d1a787c4 Mon Sep 17 00:00:00 2001
|
||||
From: Stephen Gallagher <sgallagh@redhat.com>
|
||||
Date: Tue, 14 Nov 2023 04:23:28 -0500
|
||||
Subject: [PATCH 1/2] unix: ignore ifaddrs with NULL ifa_addr (#4218)
|
||||
|
||||
Passing this to uv__is_ipv6_link_local() is causing a segmentation
|
||||
fault. Note that the documentation for getifaddrs() explicitly states
|
||||
that this value may be NULL.
|
||||
|
||||
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
|
||||
---
|
||||
src/unix/tcp.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/unix/tcp.c b/src/unix/tcp.c
|
||||
index a6b53e5913271d0c83e1d7f7e4cb8140f5f3936d..29f4532e747db50146a8b821389f4d45304c5cd0 100644
|
||||
--- a/src/unix/tcp.c
|
||||
+++ b/src/unix/tcp.c
|
||||
@@ -233,8 +233,9 @@ static int uv__ipv6_link_local_scope_id(void) {
|
||||
return 0;
|
||||
|
||||
for (p = ifa; p != NULL; p = p->ifa_next)
|
||||
- if (uv__is_ipv6_link_local(p->ifa_addr))
|
||||
- break;
|
||||
+ if (p->ifa_addr != NULL)
|
||||
+ if (uv__is_ipv6_link_local(p->ifa_addr))
|
||||
+ break;
|
||||
|
||||
rv = 0;
|
||||
if (p != NULL) {
|
||||
--
|
||||
2.41.0
|
||||
|
58
0002-test-check-if-ipv6-link-local-traffic-is-routable.patch
Normal file
58
0002-test-check-if-ipv6-link-local-traffic-is-routable.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From 21e403424060d71e97ee1ef328288fdb9d24a191 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Noordhuis <info@bnoordhuis.nl>
|
||||
Date: Tue, 14 Nov 2023 10:58:02 +0100
|
||||
Subject: [PATCH 2/2] test: check if ipv6 link-local traffic is routable
|
||||
|
||||
Fixes: https://github.com/libuv/libuv/issues/4211
|
||||
---
|
||||
test/test-tcp-connect6-error.c | 17 +++++++++++++++++
|
||||
1 file changed, 17 insertions(+)
|
||||
|
||||
diff --git a/test/test-tcp-connect6-error.c b/test/test-tcp-connect6-error.c
|
||||
index 1e6d7c78da999d5d6d1f5e1e57646e34aba4a33b..dc2fce82f8958ac5afaeafafa8f2efccf2a1e1ec 100644
|
||||
--- a/test/test-tcp-connect6-error.c
|
||||
+++ b/test/test-tcp-connect6-error.c
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "task.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
|
||||
|
||||
static int connect_cb_called = 0;
|
||||
@@ -75,9 +76,13 @@ TEST_IMPL(tcp_connect6_error_fault) {
|
||||
|
||||
|
||||
TEST_IMPL(tcp_connect6_link_local) {
|
||||
+ uv_interface_address_t* ifs;
|
||||
+ uv_interface_address_t* p;
|
||||
struct sockaddr_in6 addr;
|
||||
uv_connect_t req;
|
||||
uv_tcp_t server;
|
||||
+ int ok;
|
||||
+ int n;
|
||||
|
||||
if (!can_ipv6())
|
||||
RETURN_SKIP("IPv6 not supported");
|
||||
@@ -90,6 +95,18 @@ TEST_IMPL(tcp_connect6_link_local) {
|
||||
RETURN_SKIP("Test does not currently work in QEMU");
|
||||
#endif /* defined(__QEMU__) */
|
||||
|
||||
+ /* Check there's an interface that routes link-local (fe80::/10) traffic. */
|
||||
+ ASSERT_OK(uv_interface_addresses(&ifs, &n));
|
||||
+ for (p = ifs; p < &ifs[n]; p++)
|
||||
+ if (p->address.address6.sin6_family == AF_INET6)
|
||||
+ if (!memcmp(&p->address.address6.sin6_addr, "\xfe\x80", 2))
|
||||
+ break;
|
||||
+ ok = (p < &ifs[n]);
|
||||
+ uv_free_interface_addresses(ifs, n);
|
||||
+
|
||||
+ if (!ok)
|
||||
+ RETURN_SKIP("IPv6 link-local traffic not supported");
|
||||
+
|
||||
ASSERT_OK(uv_ip6_addr("fe80::0bad:babe", 1337, &addr));
|
||||
ASSERT_OK(uv_tcp_init(uv_default_loop(), &server));
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
16
libuv.spec
16
libuv.spec
@ -1,5 +1,5 @@
|
||||
# Run the tests by default
|
||||
%bcond_without tests
|
||||
%bcond tests 1
|
||||
|
||||
Name: libuv
|
||||
Epoch: 1
|
||||
@ -27,6 +27,14 @@ Source1: https://dist.libuv.org/dist/v%{version}/%{name}-v%{version}.tar.
|
||||
Source2: keysuv.gpg
|
||||
Source3: libuv.abignore
|
||||
|
||||
# Test fix for IPv6 interfaces with a NULL ifa_addr
|
||||
# https://github.com/libuv/libuv/pull/4218
|
||||
Patch: 0001-unix-ignore-ifaddrs-with-NULL-ifa_addr-4218.patch
|
||||
|
||||
# test: check if ipv6 link-local traffic is routable
|
||||
# https://github.com/libuv/libuv/pull/4220
|
||||
Patch: 0002-test-check-if-ipv6-link-local-traffic-is-routable.patch
|
||||
|
||||
BuildRequires: cmake
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gnupg2
|
||||
@ -59,7 +67,7 @@ Static library (.a) version of libuv.
|
||||
|
||||
%prep
|
||||
gpgv2 --keyring %{SOURCE2} %{SOURCE1} %{SOURCE0}
|
||||
%autosetup -n %{name}-v%{version}
|
||||
%autosetup -n %{name}-v%{version} -p1
|
||||
|
||||
%build
|
||||
%if %{with tests}
|
||||
@ -87,8 +95,8 @@ rm %{buildroot}/%{_docdir}/libuv/LICENSE-extra
|
||||
|
||||
%check
|
||||
%if %{with tests}
|
||||
env UV_TEST_TIMEOUT_MULTIPLIER=3 ./%{__cmake_builddir}/uv_run_tests
|
||||
env UV_TEST_TIMEOUT_MULTIPLIER=3 ./%{__cmake_builddir}/uv_run_tests_a
|
||||
env UV_TEST_TIMEOUT_MULTIPLIER=10 ./%{__cmake_builddir}/uv_run_tests
|
||||
env UV_TEST_TIMEOUT_MULTIPLIER=10 ./%{__cmake_builddir}/uv_run_tests_a
|
||||
%endif
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user