Changeset View
Changeset View
Standalone View
Standalone View
traceroute/traceroute.c
Context not available. | |||||
#include <arpa/inet.h> | #include <arpa/inet.h> | ||||
#ifdef HAVE_LIBCASPER | #ifdef WITH_CASPER | ||||
#include <libcasper.h> | #include <libcasper.h> | ||||
#include <casper/cap_dns.h> | #include <casper/cap_dns.h> | ||||
#endif | #endif | ||||
Context not available. | |||||
extern int opterr; | extern int opterr; | ||||
extern char *optarg; | extern char *optarg; | ||||
#ifdef HAVE_LIBCASPER | #ifdef WITH_CASPER | ||||
static cap_channel_t *capdns; | static cap_channel_t *capdns; | ||||
#endif | #endif | ||||
Context not available. | |||||
int requestPort = -1; | int requestPort = -1; | ||||
int sump = 0; | int sump = 0; | ||||
int sockerrno; | int sockerrno; | ||||
#ifdef HAVE_LIBCASPER | #ifdef WITH_CASPER | ||||
const char *types[] = { "NAME", "ADDR" }; | const char *types[] = { "NAME", "ADDR" }; | ||||
int families[1]; | int families[1]; | ||||
cap_channel_t *casper; | cap_channel_t *casper; | ||||
Context not available. | |||||
exit(1); | exit(1); | ||||
} | } | ||||
#ifdef HAVE_LIBCASPER | #ifdef WITH_CASPER | ||||
casper = cap_init(); | casper = cap_init(); | ||||
if (casper == NULL) | if (casper == NULL) | ||||
errx(1, "unable to create casper process"); | errx(1, "unable to create casper process"); | ||||
Context not available. | |||||
families[0] = AF_INET; | families[0] = AF_INET; | ||||
if (cap_dns_family_limit(capdns, families, 1) < 0) | if (cap_dns_family_limit(capdns, families, 1) < 0) | ||||
errx(1, "unable to limit access to system.dns service"); | errx(1, "unable to limit access to system.dns service"); | ||||
#endif /* HAVE_LIBCASPER */ | #endif /* WITH_CASPER */ | ||||
#ifdef IPCTL_DEFTTL | #ifdef IPCTL_DEFTTL | ||||
{ | { | ||||
Context not available. | |||||
max_ttl = 30; | max_ttl = 30; | ||||
#endif | #endif | ||||
#ifdef HAVE_LIBCASPER | #ifdef WITH_CASPER | ||||
cap_close(casper); | cap_close(casper); | ||||
#endif | #endif | ||||
Context not available. | |||||
exit(1); | exit(1); | ||||
} | } | ||||
#ifdef HAVE_LIBCASPER | #ifdef WITH_CASPER | ||||
cansandbox = true; | cansandbox = true; | ||||
#else | #else | ||||
if (nflag) | if (nflag) | ||||
Context not available. | |||||
else { | else { | ||||
cp = strchr(domain, '.'); | cp = strchr(domain, '.'); | ||||
if (cp == NULL) { | if (cp == NULL) { | ||||
#ifdef HAVE_LIBCASPER | #ifdef WITH_CASPER | ||||
if (capdns != NULL) | if (capdns != NULL) | ||||
hp = cap_gethostbyname(capdns, domain); | hp = cap_gethostbyname(capdns, domain); | ||||
else | else | ||||
Context not available. | |||||
} | } | ||||
} | } | ||||
if (!nflag && in.s_addr != INADDR_ANY) { | if (!nflag && in.s_addr != INADDR_ANY) { | ||||
#ifdef HAVE_LIBCASPER | #ifdef WITH_CASPER | ||||
if (capdns != NULL) | if (capdns != NULL) | ||||
hp = cap_gethostbyaddr(capdns, (char *)&in, sizeof(in), | hp = cap_gethostbyaddr(capdns, (char *)&in, sizeof(in), | ||||
AF_INET); | AF_INET); | ||||
Context not available. | |||||
return (hi); | return (hi); | ||||
} | } | ||||
#ifdef HAVE_LIBCASPER | #ifdef WITH_CASPER | ||||
if (capdns != NULL) | if (capdns != NULL) | ||||
hp = cap_gethostbyname(capdns, hostname); | hp = cap_gethostbyname(capdns, hostname); | ||||
else | else | ||||
Context not available. |