mirror of
https://github.com/curl/curl.git
synced 2026-07-23 00:57:24 +03:00
cf-socket: drop feature check for IPV6_V6ONLY on Windows
The macro is present in all supported Windows toolchains. It's present in mingw-w64 v3+, and in MS SDK 6.0A+ (maybe earlier). Also: - restrict this logic to `USE_WINSOCK` (was: `_WIN32`), to exclude alternate socket libraries (i.e. lwIP). lwIP supports `IPV6_V6ONLY` since its 2.0.0 (2016-11-10) release and it's disabled by default, unlike in Winsock. Ref:e65202f825- delete interim setter function/dummy macro `set_ipv6_v6only()`. Follow-up toa28f5f68b9#18010 Follow-up toca3f6decb9#10975 Closes #19769
This commit is contained in:
parent
fdf9937cef
commit
003689c3d3
1 changed files with 12 additions and 17 deletions
|
|
@ -83,22 +83,6 @@
|
|||
#include "curlx/strparse.h"
|
||||
|
||||
|
||||
#if defined(USE_IPV6) && defined(IPV6_V6ONLY) && defined(_WIN32)
|
||||
/* It makes support for IPv4-mapped IPv6 addresses.
|
||||
* Linux kernel, NetBSD, FreeBSD and Darwin: default is off;
|
||||
* Windows Vista and later: default is on;
|
||||
* DragonFly BSD: acts like off, and dummy setting;
|
||||
* OpenBSD and earlier Windows: unsupported.
|
||||
* Linux: controlled by /proc/sys/net/ipv6/bindv6only.
|
||||
*/
|
||||
static void set_ipv6_v6only(curl_socket_t sockfd, int on)
|
||||
{
|
||||
(void)setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&on, sizeof(on));
|
||||
}
|
||||
#else
|
||||
#define set_ipv6_v6only(x, y)
|
||||
#endif
|
||||
|
||||
static void tcpnodelay(struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
curl_socket_t sockfd)
|
||||
|
|
@ -1114,7 +1098,18 @@ static CURLcode cf_socket_open(struct Curl_cfilter *cf,
|
|||
|
||||
#ifdef USE_IPV6
|
||||
if(ctx->addr.family == AF_INET6) {
|
||||
set_ipv6_v6only(ctx->sock, 0);
|
||||
#ifdef USE_WINSOCK
|
||||
/* Turn on support for IPv4-mapped IPv6 addresses.
|
||||
* Linux kernel, NetBSD, FreeBSD, Darwin, lwIP: default is off;
|
||||
* Windows Vista and later: default is on;
|
||||
* DragonFly BSD: acts like off, and dummy setting;
|
||||
* OpenBSD and earlier Windows: unsupported.
|
||||
* Linux: controlled by /proc/sys/net/ipv6/bindv6only.
|
||||
*/
|
||||
int on = 0;
|
||||
(void)setsockopt(ctx->sock, IPPROTO_IPV6, IPV6_V6ONLY,
|
||||
(void *)&on, sizeof(on));
|
||||
#endif
|
||||
infof(data, " Trying [%s]:%d...", ctx->ip.remote_ip, ctx->ip.remote_port);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue