Partially revert r323866.

Using HAVE_* is a internal tcpdump style standard.
We want to be consistent with the standard to upstream those changes in
the future.

Requested by: glebius@
This commit is contained in:
Mariusz Zaborski 2017-10-04 21:05:44 +00:00
parent 7b9f317cf3
commit b01988a5f5
4 changed files with 16 additions and 16 deletions

View File

@ -26,10 +26,10 @@
#include "config.h"
#endif
#ifdef WITH_CASPER
#ifdef HAVE_CASPER
#include <libcasper.h>
#include <casper/cap_dns.h>
#endif /* WITH_CASPER */
#endif /* HAVE_CASPER */
#include <netdissect-stdinc.h>
@ -202,7 +202,7 @@ intoa(uint32_t addr)
static uint32_t f_netmask;
static uint32_t f_localnet;
#ifdef WITH_CASPER
#ifdef HAVE_CASPER
extern cap_channel_t *capdns;
#endif
@ -250,7 +250,7 @@ getname(netdissect_options *ndo, const u_char *ap)
*/
if (!ndo->ndo_nflag &&
(addr & f_netmask) == f_localnet) {
#ifdef WITH_CASPER
#ifdef HAVE_CASPER
if (capdns != NULL) {
hp = cap_gethostbyaddr(capdns, (char *)&addr, 4,
AF_INET);
@ -311,7 +311,7 @@ getname6(netdissect_options *ndo, const u_char *ap)
* Do not print names if -n was given.
*/
if (!ndo->ndo_nflag) {
#ifdef WITH_CASPER
#ifdef HAVE_CASPER
if (capdns != NULL) {
hp = cap_gethostbyaddr(capdns, (char *)&addr,
sizeof(addr), AF_INET6);

View File

@ -82,10 +82,10 @@ The Regents of the University of California. All rights reserved.\n";
#include <sys/ioccom.h>
#include <net/bpf.h>
#include <libgen.h>
#ifdef WITH_CASPER
#ifdef HAVE_CASPER
#include <libcasper.h>
#include <casper/cap_dns.h>
#endif /* WITH_CASPER */
#endif /* HAVE_CASPER */
#endif /* HAVE_CAPSICUM */
#include <pcap.h>
#include <signal.h>
@ -176,7 +176,7 @@ static int infoprint;
char *program_name;
#ifdef WITH_CASPER
#ifdef HAVE_CASPER
cap_channel_t *capdns;
#endif
@ -730,7 +730,7 @@ get_next_file(FILE *VFile, char *ptr)
return ret;
}
#ifdef WITH_CASPER
#ifdef HAVE_CASPER
static cap_channel_t *
capdns_setup(void)
{
@ -757,7 +757,7 @@ capdns_setup(void)
return (capdnsloc);
}
#endif /* WITH_CASPER */
#endif /* HAVE_CASPER */
#ifdef HAVE_PCAP_SET_TSTAMP_PRECISION
static int
@ -1839,10 +1839,10 @@ main(int argc, char **argv)
exit_tcpdump(0);
}
#ifdef WITH_CASPER
#ifdef HAVE_CASPER
if (!ndo->ndo_nflag)
capdns = capdns_setup();
#endif /* WITH_CASPER */
#endif /* HAVE_CASPER */
init_print(ndo, localnet, netmask, timezone_offset);
@ -2066,11 +2066,11 @@ main(int argc, char **argv)
#ifdef HAVE_CAPSICUM
cansandbox = (VFileName == NULL && zflag == NULL);
#ifdef WITH_CASPER
#ifdef HAVE_CASPER
cansandbox = (cansandbox && (ndo->ndo_nflag || capdns != NULL));
#else
cansandbox = (cansandbox && ndo->ndo_nflag);
#endif /* WITH_CASPER */
#endif /* HAVE_CASPER */
if (cansandbox && cap_enter() < 0 && errno != ENOSYS)
error("unable to enter the capability mode");
#endif /* HAVE_CAPSICUM */

View File

@ -190,7 +190,7 @@ LIBADD= l pcap
.if ${MK_CASPER} != "no"
LIBADD+= casper
LIBADD+= cap_dns
CFLAGS+=-DWITH_CASPER
CFLAGS+=-DHAVE_CASPER
.endif
.if ${MK_OPENSSL} != "no"
LIBADD+= crypto

View File

@ -18,7 +18,7 @@
/* Casper library support available */
/* See Makefile */
/* #undef WITH_CASPER */
/* #undef HAVE_CASPER */
/* Define to 1 if you have the `cap_enter' function. */
#define HAVE_CAP_ENTER 1