version 1.209, 2019/10/24 12:48:54 |
version 1.210, 2019/11/04 17:33:28 |
|
|
|
|
fprintf(stderr, "Connection to %s", host); |
fprintf(stderr, "Connection to %s", host); |
|
|
/* if there is something to report, print IP */ |
/* |
if (!nflag && (strcmp(host, ipaddr) != 0)) |
* if we aren't connecting thru a proxy and |
|
* there is something to report, print IP |
|
*/ |
|
if (!nflag && !xflag |
|
&& (strcmp(host, ipaddr) != 0)) |
fprintf(stderr, " (%s)", ipaddr); |
fprintf(stderr, " (%s)", ipaddr); |
|
|
fprintf(stderr, " %s port [%s/%s] succeeded!\n", |
fprintf(stderr, " %s port [%s/%s] succeeded!\n", |
|
|
|
|
set_common_sockopts(s, res->ai_family); |
set_common_sockopts(s, res->ai_family); |
|
|
if ((herr = getnameinfo(res->ai_addr, res->ai_addrlen, ipaddr, |
if (ipaddr != NULL) { |
NI_MAXHOST, NULL, 0, NI_NUMERICHOST)) != 0) { |
herr = getnameinfo(res->ai_addr, res->ai_addrlen, |
if (herr == EAI_SYSTEM) |
ipaddr, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); |
|
switch (herr) { |
|
case 0: |
|
break; |
|
case EAI_SYSTEM: |
err(1, "getnameinfo"); |
err(1, "getnameinfo"); |
else |
default: |
errx(1, "getnameinfo: %s", gai_strerror(herr)); |
errx(1, "getnameinfo: %s", gai_strerror(herr)); |
|
} |
} |
} |
|
|
if (timeout_connect(s, res->ai_addr, res->ai_addrlen) == 0) |
if (timeout_connect(s, res->ai_addr, res->ai_addrlen) == 0) |
|
|
|
|
if (vflag) { |
if (vflag) { |
/* only print IP if there is something to report */ |
/* only print IP if there is something to report */ |
if (nflag || (strncmp(host, ipaddr, NI_MAXHOST) == 0)) |
if (nflag || ipaddr == NULL || |
|
(strncmp(host, ipaddr, NI_MAXHOST) == 0)) |
warn("connect to %s port %s (%s) failed", host, |
warn("connect to %s port %s (%s) failed", host, |
port, uflag ? "udp" : "tcp"); |
port, uflag ? "udp" : "tcp"); |
else |
else |