diff options
author | Daniel Stenberg <daniel@haxx.se> | 2011-01-11 00:14:36 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2011-01-11 00:14:36 +0100 |
commit | 08a65b10fbbee20926211a9deb99b1ce8328d91a (patch) | |
tree | 5b9b2cb584f12736e544b61c27885edd0b5965ce | |
parent | 1238edaeaf947b896aafd9ddffc8430dea179c3a (diff) |
connect: use UDP correctly
The idea that the protocol and socktype is part of name resolving in the
libc functions is nuts. We keep the name resolver functions assume
TCP/STREAM and we make sure that when we want to connect to a UDP
service we use the correct UDP/DGRAM set instead. This bug was because
the ->protocol field was not always set correctly.
This bug was only affecting ipv6-disabled non-cares non-threaded builds.
Bug: http://curl.haxx.se/bug/view.cgi?id=3154436
Reported by: "dperham"
-rw-r--r-- | lib/connect.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/connect.c b/lib/connect.c index 604bb2a1a..bcc1ed74a 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -857,7 +857,7 @@ singleipconnect(struct connectdata *conn, addr.family = ai->ai_family; addr.socktype = conn->socktype; - addr.protocol = ai->ai_protocol; + addr.protocol = conn->socktype==SOCK_DGRAM?IPPROTO_UDP:ai->ai_protocol; addr.addrlen = ai->ai_addrlen; if(addr.addrlen > sizeof(struct Curl_sockaddr_storage)) |