test,freebsd: skip udp_dual_stack if not supported
By default, FreeBSD has net.inet6.ip6.v6only set to 1 (i.e., no dual stack support). A new function can_ipv6_ipv4_dual is added to check its value and decide whether `udp_dual_stack` test must be skipped or not. PR-URL: https://github.com/libuv/libuv/pull/614 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
parent
81072b98f5
commit
4052c74797
@ -26,6 +26,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#define CHECK_HANDLE(handle) \
|
||||
ASSERT((uv_udp_t*)(handle) == &server \
|
||||
|| (uv_udp_t*)(handle) == &client \
|
||||
@ -43,6 +47,18 @@ static int send_cb_called;
|
||||
static int recv_cb_called;
|
||||
static int close_cb_called;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
static int can_ipv6_ipv4_dual() {
|
||||
int v6only;
|
||||
size_t size = sizeof(int);
|
||||
|
||||
if (sysctlbyname("net.inet6.ip6.v6only", &v6only, &size, NULL, 0))
|
||||
return 0;
|
||||
|
||||
return v6only != 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void alloc_cb(uv_handle_t* handle,
|
||||
size_t suggested_size,
|
||||
@ -150,6 +166,11 @@ TEST_IMPL(udp_dual_stack) {
|
||||
if (!can_ipv6())
|
||||
RETURN_SKIP("IPv6 not supported");
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
if (!can_ipv6_ipv4_dual())
|
||||
RETURN_SKIP("IPv6-IPv4 dual stack not supported");
|
||||
#endif
|
||||
|
||||
do_test(ipv6_recv_ok, 0);
|
||||
|
||||
ASSERT(recv_cb_called == 1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user