Compare commits

..

2 Commits

Author SHA1 Message Date
3c66cc9884 clean: remove dns lookup 2025-11-19 08:11:46 -06:00
5da4efc3e8 clean: rename print_ping -> print_recv 2025-11-19 08:11:28 -06:00
5 changed files with 3 additions and 21 deletions

View File

@ -30,21 +30,5 @@ int dns_lookup(struct hostenv *host)
freeaddrinfo(responses);
return 0;
}
int dns_reverse_lookup(struct hostenv *host)
{
int ret = getnameinfo(
(struct sockaddr *)&host->ip, sizeof(host->ip),
host->reverse_dns, sizeof(host->reverse_dns),
NULL, 0, NI_NAMEREQD);
if (ret != 0)
{
print_err("reverse dns failed.");
return 1;
}
return 0;
}

View File

@ -2,5 +2,4 @@
#include "host.h"
int dns_lookup(struct hostenv *host);
int dns_reverse_lookup(struct hostenv *host);
int dns_lookup(struct hostenv *host);

View File

@ -7,5 +7,4 @@ struct hostenv {
char ipstr[INET_ADDRSTRLEN];
struct sockaddr_in ip;
char *hostname;
char reverse_dns[NI_MAXHOST];
};

View File

@ -49,7 +49,7 @@ void print_statistics(struct statistics const *stats, struct setting const *sett
);
}
void print_ping(const struct setting *settings, const struct icmphdr *header, const struct timeval *start, const struct timeval *stop)
void print_recv(const struct setting *settings, const struct icmphdr *header, const struct timeval *start, const struct timeval *stop)
{
printf("%zu bytes from %s: icmp_seq=%d ttl=%zu time=%.3f ms\n",

View File

@ -9,4 +9,4 @@ void print_err(const char *format, ...);
void print_header(struct setting const *settings);
void print_statistics(struct statistics const *stats, struct setting const *settings);
void print_ping(struct setting const *settings, struct icmphdr const *header, struct timeval const *start, struct timeval const *stop);
void print_recv(struct setting const *settings, struct icmphdr const *header, struct timeval const *start, struct timeval const *stop);