mirror of
https://github.com/curl/curl.git
synced 2024-11-27 05:50:21 +08:00
parent
710bb89cf3
commit
119037325d
@ -619,7 +619,7 @@ static bool getaddressinfo(struct sockaddr* sa, char* addr,
|
|||||||
|
|
||||||
switch (sa->sa_family) {
|
switch (sa->sa_family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
si = (struct sockaddr_in*) sa;
|
si = (struct sockaddr_in*)(void*) sa;
|
||||||
if(Curl_inet_ntop(sa->sa_family, &si->sin_addr,
|
if(Curl_inet_ntop(sa->sa_family, &si->sin_addr,
|
||||||
addr, MAX_IPADR_LEN)) {
|
addr, MAX_IPADR_LEN)) {
|
||||||
us_port = ntohs(si->sin_port);
|
us_port = ntohs(si->sin_port);
|
||||||
@ -629,7 +629,7 @@ static bool getaddressinfo(struct sockaddr* sa, char* addr,
|
|||||||
break;
|
break;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef ENABLE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
si6 = (struct sockaddr_in6*)sa;
|
si6 = (struct sockaddr_in6*)(void*) sa;
|
||||||
if(Curl_inet_ntop(sa->sa_family, &si6->sin6_addr,
|
if(Curl_inet_ntop(sa->sa_family, &si6->sin6_addr,
|
||||||
addr, MAX_IPADR_LEN)) {
|
addr, MAX_IPADR_LEN)) {
|
||||||
us_port = ntohs(si6->sin6_port);
|
us_port = ntohs(si6->sin6_port);
|
||||||
|
@ -538,7 +538,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||||||
/* this "cast increases required alignment of target type" but
|
/* this "cast increases required alignment of target type" but
|
||||||
we consider it OK anyway */
|
we consider it OK anyway */
|
||||||
struct curl_slist* list = array_state?
|
struct curl_slist* list = array_state?
|
||||||
(struct curl_slist*)array_value:
|
(struct curl_slist*)(void*)array_value:
|
||||||
va_arg(params, struct curl_slist*);
|
va_arg(params, struct curl_slist*);
|
||||||
|
|
||||||
if(current_form->contentheader)
|
if(current_form->contentheader)
|
||||||
|
12
lib/if2ip.c
12
lib/if2ip.c
@ -68,7 +68,7 @@ unsigned int Curl_ipv6_scope(const struct sockaddr *sa)
|
|||||||
(void) sa;
|
(void) sa;
|
||||||
#else
|
#else
|
||||||
if(sa->sa_family == AF_INET6) {
|
if(sa->sa_family == AF_INET6) {
|
||||||
const struct sockaddr_in6 * sa6 = (const struct sockaddr_in6 *) sa;
|
const struct sockaddr_in6 * sa6 = (const struct sockaddr_in6 *)(void *) sa;
|
||||||
const unsigned char * b = sa6->sin6_addr.s6_addr;
|
const unsigned char * b = sa6->sin6_addr.s6_addr;
|
||||||
unsigned short w = (unsigned short) ((b[0] << 8) | b[1]);
|
unsigned short w = (unsigned short) ((b[0] << 8) | b[1]);
|
||||||
|
|
||||||
@ -152,11 +152,12 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = &((struct sockaddr_in6 *)iface->ifa_addr)->sin6_addr;
|
addr =
|
||||||
|
&((struct sockaddr_in6 *)(void *)iface->ifa_addr)->sin6_addr;
|
||||||
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
|
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
|
||||||
/* Include the scope of this interface as part of the address */
|
/* Include the scope of this interface as part of the address */
|
||||||
scopeid =
|
scopeid = ((struct sockaddr_in6 *)(void *)iface->ifa_addr)
|
||||||
((struct sockaddr_in6 *)iface->ifa_addr)->sin6_scope_id;
|
->sin6_scope_id;
|
||||||
|
|
||||||
/* If given, scope id should match. */
|
/* If given, scope id should match. */
|
||||||
if(remote_scope_id && scopeid != remote_scope_id) {
|
if(remote_scope_id && scopeid != remote_scope_id) {
|
||||||
@ -171,7 +172,8 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
addr = &((struct sockaddr_in *)iface->ifa_addr)->sin_addr;
|
addr =
|
||||||
|
&((struct sockaddr_in *)(void *)iface->ifa_addr)->sin_addr;
|
||||||
res = IF2IP_FOUND;
|
res = IF2IP_FOUND;
|
||||||
ip = (char *) Curl_inet_ntop(af, addr, ipstr, sizeof(ipstr));
|
ip = (char *) Curl_inet_ntop(af, addr, ipstr, sizeof(ipstr));
|
||||||
snprintf(buf, buf_size, "%s%s", ip, scope);
|
snprintf(buf, buf_size, "%s%s", ip, scope);
|
||||||
|
@ -603,7 +603,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
|
|||||||
if(hp->ai_family == AF_INET) {
|
if(hp->ai_family == AF_INET) {
|
||||||
socksreq[len++] = 1; /* ATYP: IPv4 = 1 */
|
socksreq[len++] = 1; /* ATYP: IPv4 = 1 */
|
||||||
|
|
||||||
saddr_in = (struct sockaddr_in*)hp->ai_addr;
|
saddr_in = (struct sockaddr_in*)(void*)hp->ai_addr;
|
||||||
for(i = 0; i < 4; i++) {
|
for(i = 0; i < 4; i++) {
|
||||||
socksreq[len++] = ((unsigned char*)&saddr_in->sin_addr.s_addr)[i];
|
socksreq[len++] = ((unsigned char*)&saddr_in->sin_addr.s_addr)[i];
|
||||||
infof(data, "%d\n", socksreq[len-1]);
|
infof(data, "%d\n", socksreq[len-1]);
|
||||||
@ -613,7 +613,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
|
|||||||
else if(hp->ai_family == AF_INET6) {
|
else if(hp->ai_family == AF_INET6) {
|
||||||
socksreq[len++] = 4; /* ATYP: IPv6 = 4 */
|
socksreq[len++] = 4; /* ATYP: IPv6 = 4 */
|
||||||
|
|
||||||
saddr_in6 = (struct sockaddr_in6*)hp->ai_addr;
|
saddr_in6 = (struct sockaddr_in6*)(void*)hp->ai_addr;
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 16; i++) {
|
||||||
socksreq[len++] = ((unsigned char*)&saddr_in6->sin6_addr.s6_addr)[i];
|
socksreq[len++] = ((unsigned char*)&saddr_in6->sin6_addr.s6_addr)[i];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user