summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/connect.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/connect.c b/lib/connect.c
index 251145ce1..f7aa26019 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -1574,6 +1574,20 @@ CURLcode Curl_socket(struct connectdata *conn,
}
#endif
+#if defined(__linux__) && defined(IP_RECVERR)
+ if(addr->socktype == SOCK_DGRAM) {
+ int one = 1;
+ switch(addr->family) {
+ case AF_INET:
+ setsockopt(*sockfd, SOL_IP, IP_RECVERR, &one, sizeof(one));
+ break;
+ case AF_INET6:
+ setsockopt(*sockfd, SOL_IPV6, IPV6_RECVERR, &one, sizeof(one));
+ break;
+ }
+ }
+#endif
+
return CURLE_OK;
}