mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-04 17:57:07 +08:00
parent
45dfdc1c52
commit
584dd8d940
@ -207,8 +207,10 @@ cap_channel_t *capdns;
|
|||||||
static void error(FORMAT_STRING(const char *), ...) NORETURN PRINTFLIKE(1, 2);
|
static void error(FORMAT_STRING(const char *), ...) NORETURN PRINTFLIKE(1, 2);
|
||||||
static void warning(FORMAT_STRING(const char *), ...) PRINTFLIKE(1, 2);
|
static void warning(FORMAT_STRING(const char *), ...) PRINTFLIKE(1, 2);
|
||||||
static void exit_tcpdump(int) NORETURN;
|
static void exit_tcpdump(int) NORETURN;
|
||||||
|
#ifndef __rtems__
|
||||||
static RETSIGTYPE cleanup(int);
|
static RETSIGTYPE cleanup(int);
|
||||||
static RETSIGTYPE child_cleanup(int);
|
static RETSIGTYPE child_cleanup(int);
|
||||||
|
#endif /* __rtems__ */
|
||||||
static void print_version(void);
|
static void print_version(void);
|
||||||
static void print_usage(void);
|
static void print_usage(void);
|
||||||
static void show_tstamp_types_and_exit(pcap_t *, const char *device) NORETURN;
|
static void show_tstamp_types_and_exit(pcap_t *, const char *device) NORETURN;
|
||||||
@ -220,6 +222,7 @@ static void show_devices_and_exit (void) NORETURN;
|
|||||||
static void print_packet(u_char *, const struct pcap_pkthdr *, const u_char *);
|
static void print_packet(u_char *, const struct pcap_pkthdr *, const u_char *);
|
||||||
static void dump_packet_and_trunc(u_char *, const struct pcap_pkthdr *, const u_char *);
|
static void dump_packet_and_trunc(u_char *, const struct pcap_pkthdr *, const u_char *);
|
||||||
static void dump_packet(u_char *, const struct pcap_pkthdr *, const u_char *);
|
static void dump_packet(u_char *, const struct pcap_pkthdr *, const u_char *);
|
||||||
|
#ifndef __rtems__
|
||||||
static void droproot(const char *, const char *);
|
static void droproot(const char *, const char *);
|
||||||
|
|
||||||
#ifdef SIGNAL_REQ_INFO
|
#ifdef SIGNAL_REQ_INFO
|
||||||
@ -233,6 +236,7 @@ RETSIGTYPE requestinfo(int);
|
|||||||
#elif defined(HAVE_ALARM)
|
#elif defined(HAVE_ALARM)
|
||||||
static void verbose_stats_dump(int sig);
|
static void verbose_stats_dump(int sig);
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
static void info(int);
|
static void info(int);
|
||||||
static u_int packets_captured;
|
static u_int packets_captured;
|
||||||
@ -624,6 +628,7 @@ static const struct option longopts[] = {
|
|||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
/* Drop root privileges and chroot if necessary */
|
/* Drop root privileges and chroot if necessary */
|
||||||
static void
|
static void
|
||||||
@ -655,7 +660,6 @@ droproot(const char *username, const char *chroot_dir)
|
|||||||
fprintf(stderr, "dropped privs to %s\n", username);
|
fprintf(stderr, "dropped privs to %s\n", username);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#ifndef __rtems__
|
|
||||||
if (initgroups(pw->pw_name, pw->pw_gid) != 0 ||
|
if (initgroups(pw->pw_name, pw->pw_gid) != 0 ||
|
||||||
setgid(pw->pw_gid) != 0 || setuid(pw->pw_uid) != 0) {
|
setgid(pw->pw_gid) != 0 || setuid(pw->pw_uid) != 0) {
|
||||||
fprintf(stderr, "%s: Couldn't change to '%.32s' uid=%lu gid=%lu: %s\n",
|
fprintf(stderr, "%s: Couldn't change to '%.32s' uid=%lu gid=%lu: %s\n",
|
||||||
@ -668,7 +672,6 @@ droproot(const char *username, const char *chroot_dir)
|
|||||||
else {
|
else {
|
||||||
fprintf(stderr, "dropped privs to %s\n", username);
|
fprintf(stderr, "dropped privs to %s\n", username);
|
||||||
}
|
}
|
||||||
#endif /* __rtems__ */
|
|
||||||
#endif /* HAVE_LIBCAP_NG */
|
#endif /* HAVE_LIBCAP_NG */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -690,6 +693,7 @@ droproot(const char *username, const char *chroot_dir)
|
|||||||
|
|
||||||
}
|
}
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
getWflagChars(int x)
|
getWflagChars(int x)
|
||||||
@ -1294,15 +1298,19 @@ main(int argc, char **argv)
|
|||||||
int dlt;
|
int dlt;
|
||||||
const char *dlt_name;
|
const char *dlt_name;
|
||||||
struct bpf_program fcode;
|
struct bpf_program fcode;
|
||||||
|
#ifndef __rtems__
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
RETSIGTYPE (*oldhandler)(int);
|
RETSIGTYPE (*oldhandler)(int);
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* __rtems__ */
|
||||||
struct dump_info dumpinfo;
|
struct dump_info dumpinfo;
|
||||||
u_char *pcap_userdata;
|
u_char *pcap_userdata;
|
||||||
char ebuf[PCAP_ERRBUF_SIZE];
|
char ebuf[PCAP_ERRBUF_SIZE];
|
||||||
char VFileLine[PATH_MAX + 1];
|
char VFileLine[PATH_MAX + 1];
|
||||||
|
#ifndef __rtems__
|
||||||
char *username = NULL;
|
char *username = NULL;
|
||||||
char *chroot_dir = NULL;
|
char *chroot_dir = NULL;
|
||||||
|
#endif /* __rtems__ */
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
char *end;
|
char *end;
|
||||||
#ifdef HAVE_PCAP_FINDALLDEVS
|
#ifdef HAVE_PCAP_FINDALLDEVS
|
||||||
@ -1674,9 +1682,11 @@ main(int argc, char **argv)
|
|||||||
zflag = optarg;
|
zflag = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
case 'Z':
|
case 'Z':
|
||||||
username = optarg;
|
username = optarg;
|
||||||
break;
|
break;
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
case '#':
|
case '#':
|
||||||
ndo->ndo_packet_number = 1;
|
ndo->ndo_packet_number = 1;
|
||||||
@ -1973,6 +1983,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
init_print(ndo, localnet, netmask, timezone_offset);
|
init_print(ndo, localnet, netmask, timezone_offset);
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
(void)setsignal(SIGPIPE, cleanup);
|
(void)setsignal(SIGPIPE, cleanup);
|
||||||
(void)setsignal(SIGTERM, cleanup);
|
(void)setsignal(SIGTERM, cleanup);
|
||||||
@ -2040,6 +2051,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
}
|
}
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
if (pcap_setfilter(pd, &fcode) < 0)
|
if (pcap_setfilter(pd, &fcode) < 0)
|
||||||
error("%s", pcap_geterr(pd));
|
error("%s", pcap_geterr(pd));
|
||||||
@ -2147,6 +2159,7 @@ main(int argc, char **argv)
|
|||||||
pcap_userdata = (u_char *)ndo;
|
pcap_userdata = (u_char *)ndo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
#ifdef SIGNAL_REQ_INFO
|
#ifdef SIGNAL_REQ_INFO
|
||||||
/*
|
/*
|
||||||
* We can't get statistics when reading from a file rather
|
* We can't get statistics when reading from a file rather
|
||||||
@ -2171,6 +2184,7 @@ main(int argc, char **argv)
|
|||||||
alarm(1);
|
alarm(1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
if (RFileName == NULL) {
|
if (RFileName == NULL) {
|
||||||
/*
|
/*
|
||||||
@ -2344,6 +2358,7 @@ main(int argc, char **argv)
|
|||||||
exit_tcpdump(status == -1 ? 1 : 0);
|
exit_tcpdump(status == -1 ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
/* make a clean exit on interrupts */
|
/* make a clean exit on interrupts */
|
||||||
static RETSIGTYPE
|
static RETSIGTYPE
|
||||||
cleanup(int signo _U_)
|
cleanup(int signo _U_)
|
||||||
@ -2396,6 +2411,7 @@ child_cleanup(int signo _U_)
|
|||||||
wait(NULL);
|
wait(NULL);
|
||||||
}
|
}
|
||||||
#endif /* HAVE_FORK && HAVE_VFORK */
|
#endif /* HAVE_FORK && HAVE_VFORK */
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
info(register int verbose)
|
info(register int verbose)
|
||||||
@ -2756,6 +2772,7 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
|
|||||||
char Wpcap_version[]="3.1";
|
char Wpcap_version[]="3.1";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
#ifdef SIGNAL_REQ_INFO
|
#ifdef SIGNAL_REQ_INFO
|
||||||
RETSIGTYPE requestinfo(int signo _U_)
|
RETSIGTYPE requestinfo(int signo _U_)
|
||||||
{
|
{
|
||||||
@ -2784,6 +2801,7 @@ static void verbose_stats_dump(int sig _U_)
|
|||||||
alarm(1);
|
alarm(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
USES_APPLE_DEPRECATED_API
|
USES_APPLE_DEPRECATED_API
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user