diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-09-15 05:32:49 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-09-15 05:32:49 +0000 |
commit | 00b4224ee0665561e4237e30caf3197c605201cf (patch) | |
tree | 76e449cda3b0a28bd8068623718c23dc64c36859 /tethereal.c | |
parent | f30b84ce2321a6071a2d254953befc75b14e4b6b (diff) |
Add a "-p" command-line option, and a checkbox in the "Capture
Preferences" dialog box, to control whether to put the interface in
promiscuous mode or not; Debian bug #34376 asked for this.
svn path=/trunk/; revision=2439
Diffstat (limited to 'tethereal.c')
-rw-r--r-- | tethereal.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tethereal.c b/tethereal.c index 04ecad0cf3..611ed2bbe6 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.45 2000/09/10 06:44:37 guy Exp $ + * $Id: tethereal.c,v 1.46 2000/09/15 05:32:19 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -126,6 +126,7 @@ capture_file cfile; FILE *data_out_file = NULL; guint main_ctx, file_ctx; ts_type timestamp_type = RELATIVE; +static int promisc_mode = TRUE; static void print_usage(void) @@ -135,7 +136,7 @@ print_usage(void) fprintf(stderr, "This is GNU t%s %s, compiled with %s\n", PACKAGE, VERSION, comp_info_str); #ifdef HAVE_LIBPCAP - fprintf(stderr, "t%s [ -vVh ] [ -c count ] [ -f <capture filter> ]\n", PACKAGE); + fprintf(stderr, "t%s [ -vVhp ] [ -c count ] [ -f <capture filter> ]\n", PACKAGE); fprintf(stderr, "\t[ -F <capture file type> ] [ -i interface ] [ -n ]\n"); fprintf(stderr, "\t[ -o <preference setting> ] ... [ -r infile ] [ -R <read filter> ]\n"); fprintf(stderr, "\t[ -s snaplen ] [ -t <time stamp format> ] [ -w savefile ] [ -x ]\n"); @@ -284,7 +285,7 @@ main(int argc, char *argv[]) ); /* Now get our args */ - while ((opt = getopt(argc, argv, "c:Df:F:hi:no:r:R:s:t:vw:Vx")) != EOF) { + while ((opt = getopt(argc, argv, "c:Df:F:hi:no:pr:R:s:t:vw:Vx")) != EOF) { switch (opt) { case 'c': /* Capture xxx packets */ #ifdef HAVE_LIBPCAP @@ -341,6 +342,14 @@ main(int argc, char *argv[]) break; } break; + case 'p': /* Don't capture in promiscuous mode */ +#ifdef HAVE_LIBPCAP + promisc_mode = 0; +#else + capture_option_specified = TRUE; + arg_error = TRUE; +#endif + break; case 'r': /* Read capture file xxx */ cf_name = g_strdup(optarg); break; @@ -526,7 +535,7 @@ capture(int packet_count, int out_file_type) ld.pdh = NULL; /* Open the network interface to capture from it. */ - ld.pch = pcap_open_live(cfile.iface, cfile.snap, 1, 1000, err_str); + ld.pch = pcap_open_live(cfile.iface, cfile.snap, promisc_mode, 1000, err_str); if (ld.pch == NULL) { /* Well, we couldn't start the capture. */ |