X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/efd50b3e143aa6a2dad1a78a795174a71d6fb18b..b8c56aa09228ee6c59af9bd2565bc66b69ac7943:/addrtoname.c diff --git a/addrtoname.c b/addrtoname.c index 6975b713..85cbf7b7 100644 --- a/addrtoname.c +++ b/addrtoname.c @@ -26,6 +26,11 @@ #include "config.h" #endif +#ifdef HAVE_CASPER +#include +#include +#endif /* HAVE_CASPER */ + #include #ifdef USE_ETHER_NTOHOST @@ -197,6 +202,9 @@ intoa(uint32_t addr) static uint32_t f_netmask; 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 @@ -242,7 +250,13 @@ getname(netdissect_options *ndo, const u_char *ap) */ if (!ndo->ndo_nflag && (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) { char *dotp; @@ -297,7 +311,14 @@ getname6(netdissect_options *ndo, const u_char *ap) * Do not print names if -n was given. */ 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) { char *dotp;