From 715a81ac1c1e97c97843cb26bcdb8329a8a6f6fa Mon Sep 17 00:00:00 2001 From: Michael Tuexen <tuexen@fh-muenster.de> Date: Sun, 8 Jan 2017 20:42:53 +0100 Subject: [PATCH] When using IPv4-mapped IPv6 addresses, disable IPV6_V6ONLY. On FreeBSD IPv6 sockets have the IPV6_V6ONLY option enabled by default. To allow the scripts to select the address family via the --ip_version option transparently, disable the IPV6_V6ONLY option implicilty on all sockets. This fixes #132. Sponsored by: Netflix, Inc. --- gtests/net/packetdrill/run_system_call.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gtests/net/packetdrill/run_system_call.c b/gtests/net/packetdrill/run_system_call.c index 1ec42605..1e55e4c0 100644 --- a/gtests/net/packetdrill/run_system_call.c +++ b/gtests/net/packetdrill/run_system_call.c @@ -1996,7 +1996,14 @@ static int syscall_socket(struct state *state, struct syscall_spec *syscall, return STATUS_ERR; if (result >= 0) { + const int off = 0; + live_fd = result; + /* If IPv4-mapped IPv6 addresses are used, disable IPV6_V6ONLY */ + if (state->config->socket_domain == AF_INET6 && + state->config->wire_protocol == AF_INET) { + setsockopt(live_fd, IPPROTO_IPV6, IPV6_V6ONLY, &off, sizeof(int)); + } if (get_s32(syscall->result, &script_fd, error)) return STATUS_ERR; if (run_syscall_socket(state, domain, protocol, -- GitLab