Changeset View
Changeset View
Standalone View
Standalone View
contrib/tcpdump/addrtoname.c
Context not available. | |||||
#include "config.h" | #include "config.h" | ||||
#endif | #endif | ||||
#ifdef HAVE_CASPER | |||||
#include <libcasper.h> | |||||
#include <casper/cap_dns.h> | |||||
#endif /* HAVE_CASPER */ | |||||
#include <netdissect-stdinc.h> | #include <netdissect-stdinc.h> | ||||
#ifdef USE_ETHER_NTOHOST | #ifdef USE_ETHER_NTOHOST | ||||
Context not available. | |||||
static uint32_t f_netmask; | static uint32_t f_netmask; | ||||
static uint32_t f_localnet; | static uint32_t f_localnet; | ||||
#ifdef HAVE_CASPER | |||||
extern cap_channel_t *capdns; | |||||
#endif | |||||
/* | /* | ||||
* Return a name for the IP address pointed to by ap. This address | * Return a name for the IP address pointed to by ap. This address | ||||
Context not available. | |||||
*/ | */ | ||||
if (!ndo->ndo_nflag && | if (!ndo->ndo_nflag && | ||||
(addr & f_netmask) == f_localnet) { | (addr & f_netmask) == f_localnet) { | ||||
hp = gethostbyaddr((char *)&addr, 4, AF_INET); | #ifdef HAVE_CASPER | ||||
if (capdns != NULL) { | |||||
hp = cap_gethostbyaddr(capdns, (char *)&addr, 4, | |||||
AF_INET); | |||||
} else | |||||
#endif | |||||
hp = gethostbyaddr((char *)&addr, 4, AF_INET); | |||||
if (hp) { | if (hp) { | ||||
char *dotp; | char *dotp; | ||||
Context not available. | |||||
* Do not print names if -n was given. | * Do not print names if -n was given. | ||||
*/ | */ | ||||
if (!ndo->ndo_nflag) { | if (!ndo->ndo_nflag) { | ||||
hp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET6); | #ifdef HAVE_CASPER | ||||
if (capdns != NULL) { | |||||
hp = cap_gethostbyaddr(capdns, (char *)&addr, | |||||
sizeof(addr), AF_INET6); | |||||
} else | |||||
#endif | |||||
hp = gethostbyaddr((char *)&addr, sizeof(addr), | |||||
AF_INET6); | |||||
if (hp) { | if (hp) { | ||||
char *dotp; | char *dotp; | ||||
Context not available. |