Compare commits
2 Commits
ca80a82d96
...
3c66cc9884
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c66cc9884 | |||
| 5da4efc3e8 |
16
src/dns.c
16
src/dns.c
@ -32,19 +32,3 @@ int dns_lookup(struct hostenv *host)
|
||||
|
||||
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;
|
||||
}
|
||||
@ -3,4 +3,3 @@
|
||||
#include "host.h"
|
||||
|
||||
int dns_lookup(struct hostenv *host);
|
||||
int dns_reverse_lookup(struct hostenv *host);
|
||||
@ -7,5 +7,4 @@ struct hostenv {
|
||||
char ipstr[INET_ADDRSTRLEN];
|
||||
struct sockaddr_in ip;
|
||||
char *hostname;
|
||||
char reverse_dns[NI_MAXHOST];
|
||||
};
|
||||
@ -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",
|
||||
|
||||
@ -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);
|
||||
Reference in New Issue
Block a user