diff options
author | Bruce A. Mah <bmah@es.net> | 2014-06-16 08:32:18 -0700 |
---|---|---|
committer | Bruce A. Mah <bmah@es.net> | 2014-06-16 08:32:18 -0700 |
commit | bef5ef87f58a4953a7165d3a5242f2a49cec32cf (patch) | |
tree | 38cda2bfd6da3bc83e2db7a683502467cd213c91 /src/net.c | |
parent | 147d3369a0a9f448875088915e74a284a46436ab (diff) | |
download | iperf3-bef5ef87f58a4953a7165d3a5242f2a49cec32cf.tar.gz |
Don't try to do IPV6_V6ONLY on OpenBSD either.
setsockopt(3) returns an error if passing 0 to this option (which
we do if no address family is specified when we bind to the wildcard
address, say by invoking "iperf3 -s" with no other options). This
is because OpenBSD explicitly does not support IPv4-mapped addresses,
so even though the IPV6_V6ONLY socket options exists, it only works
with a non-zero argument.
Fixes #196.
Diffstat (limited to 'src/net.c')
-rw-r--r-- | src/net.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -146,9 +146,12 @@ netannounce(int domain, int proto, char *local, int port) /* * If we got an IPv6 socket, figure out if it should accept IPv4 * connections as well. We do that if and only if no address - * family was specified explicitly. + * family was specified explicitly. Note that we can only + * do this if the IPV6_V6ONLY socket option is supported. Also, + * OpenBSD explicitly omits support for IPv4-mapped addresses, + * even though it implements IPV6_V6ONLY. */ -#ifdef IPV6_V6ONLY +#if defined(IPV6_V6ONLY) && !defined(__OpenBSD__) if (res->ai_family == AF_INET6 && (domain == AF_UNSPEC || domain == AF_INET6)) { if (domain == AF_UNSPEC) opt = 0; |