mirror of
https://github.com/curl/curl.git
synced 2026-08-02 07:30:29 +03:00
ntop w/o result
This commit is contained in:
parent
2f082acebc
commit
cf28c0b7f0
7 changed files with 15 additions and 13 deletions
|
|
@ -1033,11 +1033,11 @@ static CURLcode ftp_port_default_host(struct Curl_easy *data,
|
|||
switch(sa->sa_family) {
|
||||
#ifdef USE_IPV6
|
||||
case AF_INET6:
|
||||
r = curlx_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, hbuflen);
|
||||
r = curlx_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, hbuflen, NULL);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
r = curlx_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, hbuflen);
|
||||
r = curlx_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, hbuflen, NULL);
|
||||
break;
|
||||
}
|
||||
if(!r)
|
||||
|
|
|
|||
|
|
@ -182,14 +182,16 @@ void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf,
|
|||
case AF_INET: {
|
||||
const struct sockaddr_in *sa4 = (const void *)ai->ai_addr;
|
||||
const struct in_addr *ipaddr4 = &sa4->sin_addr;
|
||||
(void)curlx_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize);
|
||||
(void)curlx_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize,
|
||||
NULL);
|
||||
break;
|
||||
}
|
||||
#ifdef USE_IPV6
|
||||
case AF_INET6: {
|
||||
const struct sockaddr_in6 *sa6 = (const void *)ai->ai_addr;
|
||||
const struct in6_addr *ipaddr6 = &sa6->sin6_addr;
|
||||
(void)curlx_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf, bufsize);
|
||||
(void)curlx_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf, bufsize,
|
||||
NULL);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ static CURLcode httpsrr_print_addr(struct dynbuf *dyn,
|
|||
CURLcode result = CURLE_OK;
|
||||
|
||||
for(i = 0; (i < (total_len / alen)) && !result; ++i) {
|
||||
if(!curlx_inet_ntop(ai_family, addr + (i * alen), buf, sizeof(buf)))
|
||||
if(!curlx_inet_ntop(ai_family, addr + (i * alen), buf, sizeof(buf), NULL))
|
||||
result = curlx_dyn_add(dyn, "<error parsing address>");
|
||||
else
|
||||
result = curlx_dyn_addf(dyn, "%s%s", sep, buf);
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ if2ip_result_t Curl_if2ip(int af,
|
|||
addr =
|
||||
&((struct sockaddr_in *)(void *)iface->ifa_addr)->sin_addr;
|
||||
res = IF2IP_FOUND;
|
||||
ip = curlx_inet_ntop(af, addr, ipstr, sizeof(ipstr));
|
||||
ip = curlx_inet_ntop(af, addr, ipstr, sizeof(ipstr), NULL);
|
||||
curl_msnprintf(buf, buf_size, "%s%s", ip, scope);
|
||||
break;
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ if2ip_result_t Curl_if2ip(int af,
|
|||
|
||||
s = (struct sockaddr_in *)(void *)&req.ifr_addr;
|
||||
memcpy(&in, &s->sin_addr, sizeof(in));
|
||||
r = curlx_inet_ntop(s->sin_family, &in, buf, buf_size);
|
||||
r = curlx_inet_ntop(s->sin_family, &in, buf, buf_size, NULL);
|
||||
|
||||
sclose(dummy);
|
||||
if(!r)
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ UNITTEST CURLUcode ipv6_parse(struct Curl_URL *u, char *hostname,
|
|||
hostname[hlen] = 0; /* end the address there */
|
||||
if(curlx_inet_pton(AF_INET6, hostname, dest) != 1)
|
||||
return CURLUE_BAD_IPV6;
|
||||
if(curlx_inet_ntop(AF_INET6, dest, hostname, hlen + 1)) {
|
||||
if(curlx_inet_ntop(AF_INET6, dest, hostname, hlen + 1, NULL)) {
|
||||
hlen = strlen(hostname); /* might be shorter now */
|
||||
hostname[hlen + 1] = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -508,7 +508,7 @@ create_resp(int qid, const struct sockaddr *addr, curl_socklen_t addrlen,
|
|||
const char *ip;
|
||||
if(add_answer(&resp->body, store, sizeof(ipv4_pref), QTYPE_A))
|
||||
goto error;
|
||||
ip = curlx_inet_ntop(AF_INET, store, addrbuf, sizeof(addrbuf));
|
||||
ip = curlx_inet_ntop(AF_INET, store, addrbuf, sizeof(addrbuf), NULL);
|
||||
logmsg("[%d] response A (%x) '%s'", qid, (unsigned int)QTYPE_A,
|
||||
ip ? ip : "(null)");
|
||||
}
|
||||
|
|
@ -521,7 +521,7 @@ create_resp(int qid, const struct sockaddr *addr, curl_socklen_t addrlen,
|
|||
const char *ip;
|
||||
if(add_answer(&resp->body, store, sizeof(ipv6_pref), QTYPE_AAAA))
|
||||
goto error;
|
||||
ip = curlx_inet_ntop(AF_INET6, store, addrbuf, sizeof(addrbuf));
|
||||
ip = curlx_inet_ntop(AF_INET6, store, addrbuf, sizeof(addrbuf), NULL);
|
||||
logmsg("[%d] response AAAA (%x) '%s'", qid, (unsigned int)QTYPE_AAAA,
|
||||
ip ? ip : "(null)");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ static int test_ntop(void)
|
|||
ipv4a[2] = 0x64;
|
||||
ipv4a[3] = 0x01;
|
||||
ipv4a[4] = 0x01;
|
||||
ipv4ptr = curlx_inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res));
|
||||
ipv4ptr = curlx_inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res), NULL);
|
||||
if(!ipv4ptr)
|
||||
return 1; /* fail */
|
||||
if(ipv4ptr != ipv4res)
|
||||
|
|
@ -80,7 +80,7 @@ static int test_ntop(void)
|
|||
ipv6a[14] = 0x76;
|
||||
ipv6a[15] = 0xc8;
|
||||
ipv6a[25] = 0x01;
|
||||
ipv6ptr = curlx_inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res));
|
||||
ipv6ptr = curlx_inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res), NULL);
|
||||
if(!ipv6ptr)
|
||||
return 1; /* fail */
|
||||
if(ipv6ptr != ipv6res)
|
||||
|
|
@ -96,7 +96,7 @@ static int test_ntop(void)
|
|||
ipv6a[13] = 0x0;
|
||||
ipv6a[14] = 0x0;
|
||||
ipv6a[15] = 0x01;
|
||||
ipv6ptr = curlx_inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res));
|
||||
ipv6ptr = curlx_inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res), NULL);
|
||||
if(!ipv6ptr)
|
||||
return 1; /* fail */
|
||||
if(ipv6ptr != ipv6res)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue