X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/54d5fbec2c52d2e04cb549caa0a811ab1da5aa56..2fd7b16acb63b86d7291abb4c68c27e24bc50a85:/tcpdump.c diff --git a/tcpdump.c b/tcpdump.c index a7756be5..5e232197 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -157,7 +157,6 @@ The Regents of the University of California. All rights reserved.\n"; #include "netdissect.h" #include "interface.h" #include "addrtoname.h" -#include "machdep.h" #include "pcap-missing.h" #include "ascii_strcasecmp.h" @@ -705,6 +704,7 @@ show_remote_devices_and_exit(void) #define OPTION_FP_TYPE 135 #define OPTION_COUNT 136 #define OPTION_PRINT_SAMPLING 137 +#define OPTION_LENGTHS 138 static const struct option longopts[] = { #if defined(HAVE_PCAP_CREATE) || defined(_WIN32) @@ -753,12 +753,13 @@ static const struct option longopts[] = { { "number", no_argument, NULL, '#' }, { "print", no_argument, NULL, OPTION_PRINT }, { "print-sampling", required_argument, NULL, OPTION_PRINT_SAMPLING }, + { "lengths", no_argument, NULL, OPTION_LENGTHS }, { "version", no_argument, NULL, OPTION_VERSION }, { NULL, 0, NULL, 0 } }; #ifdef HAVE_PCAP_FINDALLDEVS_EX -#define LIST_REMOTE_INTERFACES_USAGE "[ --list-remote-interfaces remote-source ]" +#define LIST_REMOTE_INTERFACES_USAGE " [ --list-remote-interfaces remote-source ]" #else #define LIST_REMOTE_INTERFACES_USAGE #endif @@ -997,7 +998,7 @@ tstamp_precision_to_string(int precision) * that requires that it be able to do an F_GETFL fcntl() to read * the O_ flags. * - * Tcpdump uses ftell() to determine how much data has been written + * tcpdump uses ftell() to determine how much data has been written * to a file in order to, when used with -C, determine when it's time * to rotate capture files. ftell() therefore needs to do an lseek() * to find out the file offset and must, thanks to the aforementioned @@ -1565,16 +1566,6 @@ main(int argc, char **argv) error("Attempting to initialize Winsock failed"); #endif - /* - * On platforms where the CPU doesn't support unaligned loads, - * force unaligned accesses to abort with SIGBUS, rather than - * being fixed up (slowly) by the OS kernel; on those platforms, - * misaligned accesses are bugs, and we want tcpdump to crash so - * that the bugs are reported. - */ - if (abort_on_misalignment(ebuf, sizeof(ebuf)) < 0) - error("%s", ebuf); - /* * An explicit tzset() call is usually not needed as it happens * implicitly the first time we call localtime() or mktime(), @@ -1990,6 +1981,10 @@ main(int argc, char **argv) ndo->ndo_packet_number = 1; break; + case OPTION_LENGTHS: + ndo->ndo_lengths = 1; + break; + case OPTION_VERSION: print_version(stdout); exit_tcpdump(S_SUCCESS); @@ -2326,8 +2321,11 @@ main(int argc, char **argv) * on; this may be a non-Linux "any" device * that doesn't support DLT_LINUX_SLL2. */ - if (strcmp(device, "any") == 0) + if (strcmp(device, "any") == 0) { +DIAG_OFF_WARN_UNUSED_RESULT (void) pcap_set_datalink(pd, DLT_LINUX_SLL2); +DIAG_ON_WARN_UNUSED_RESULT + } } #endif i = pcap_snapshot(pd); @@ -2394,7 +2392,7 @@ main(int argc, char **argv) * devices, and can't just give users that permission, * you'd make tcpdump set-UID or set-GID). * - * Tcpdump doesn't necessarily write only to one savefile; + * tcpdump doesn't necessarily write only to one savefile; * the general only way to allow a -Z instance to write to * savefiles as the user under whose UID it's run, rather * than as the user specified with -Z, would thus be to switch @@ -3337,7 +3335,7 @@ print_usage(FILE *f) "\t\t[ -i interface ]" IMMEDIATE_MODE_USAGE j_FLAG_USAGE "\n"); #ifdef HAVE_PCAP_FINDALLDEVS_EX (void)fprintf(f, -"\t\t" LIST_REMOTE_INTERFACES_USAGE "\n"); +"\t\t[ --lengths ]" LIST_REMOTE_INTERFACES_USAGE "\n"); #endif #ifdef USE_LIBSMI (void)fprintf(f,