Skip to content

Commit

Permalink
ping: Disable reverse DNS lookup for each reply
Browse files Browse the repository at this point in the history
ping does reverse DNS lookup for each reply via getnameinfo() without
NI_NUMERICH flag for each ICMP ECHO REPLY (for both IPv4 and IPv6)
+ for each IPv6 Node Information Queries request.

This is unnecessary slowdown, which can cause ping to hang with random
DNS problems.

Fixes: iputils#414
Fixes: 3337034 ("Initial import of iputils")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
  • Loading branch information
pevik committed Mar 14, 2024
1 parent dd214fd commit 9225817
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ping/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@ int ping4_parse_reply(struct ping_rts *rts, struct socket_st *sock,
wrong_source = 1;
if (gather_statistics(rts, (uint8_t *)icp, sizeof(*icp), cc,
ntohs(icp->un.echo.sequence),
reply_ttl, 0, tv, pr_addr(rts, from, sizeof *from),
reply_ttl, 0, tv, pr_raw_addr(rts, from, sizeof *from),
pr_echo_reply, rts->multicast, wrong_source)) {
fflush(stdout);
return 0;
Expand Down
4 changes: 2 additions & 2 deletions ping/ping6_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ int ping6_parse_reply(struct ping_rts *rts, socket_st *sock,

if (gather_statistics(rts, (uint8_t *)icmph, sizeof(*icmph), cc,
ntohs(icmph->icmp6_seq),
hops, 0, tv, pr_addr(rts, from, sizeof *from),
hops, 0, tv, pr_raw_addr(rts, from, sizeof *from),
pr_echo_reply,
rts->multicast, wrong_source)) {
fflush(stdout);
Expand All @@ -879,7 +879,7 @@ int ping6_parse_reply(struct ping_rts *rts, socket_st *sock,
return 1;
if (gather_statistics(rts, (uint8_t *)icmph, sizeof(*icmph), cc,
seq,
hops, 0, tv, pr_addr(rts, from, sizeof *from),
hops, 0, tv, pr_raw_addr(rts, from, sizeof *from),
pr_niquery_reply,
rts->multicast, 0))
return 0;
Expand Down

0 comments on commit 9225817

Please sign in to comment.