Ethereal-dev: Re: [Ethereal-dev] Promiscuous-Mode Selection

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Tue, 19 Jun 2001 01:46:27 -0700
On Tue, Jun 19, 2001 at 09:39:05AM +0200, Gregor Glomm wrote:
> Here is the output from ps axlww when "Update list of packets in real
> time" selected:
> 
> 100     0   904   888   9   0 21288 17832 do_pol S   pts/1      0:02
> ethereal
> 100     0   917   904   9   0 20740 16528 do_sel S   pts/1      0:00
> ethereal-capture -i tr0 -w /tmp/etherXXXXC4yQtD -W 6 -c 0 -s 65535 -m
> -*-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-iso8859-1

No "-p" flag, so the "ethereal-capture" process - which is the one
actually doing the capture; the "ethereal" process is just reading what
the "ethereal-capture" process writes to the capture file, and
displaying it - should be doing the capture in promiscuous mode.  ("-p",
in Ethereal and Tethereal, means "turn promiscuous mode *off*", just as
it does in snoop and non-gratuitously-mutated versions of tcpdump.)

This is yet another undesired consequence of the changes to make the
initial setting of the promiscuous-mode flag a stored preference; if you
have source, the attached patch, applied to "gtk/main.c", should fix
the problem.
Index: gtk/main.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/gtk/main.c,v
retrieving revision 1.200
diff -c -r1.200 gtk/main.c
*** gtk/main.c	2001/06/05 07:38:37	1.200
--- gtk/main.c	2001/06/19 08:43:07
***************
*** 937,942 ****
--- 937,952 ----
    /* Read the preference files. */
    prefs = read_prefs(&gpf_open_errno, &gpf_path, &pf_open_errno, &pf_path);
  
+ #ifdef HAVE_LIBPCAP
+   /* If this is a capture child process, it should pay no attention
+      to the "prefs.capture_prom_mode" setting in the preferences file;
+      it should do what the parent process tells it to do, and if
+      the parent process wants it not to run in promiscuous mode, it'll
+      tell it so with a "-p" flag. */
+   if (capture_child)
+     prefs->capture_prom_mode = TRUE;
+ #endif
+ 
    /* Read the capture filter file. */
    read_filter_list(CFILTER_LIST, &cf_path, &cf_open_errno);
  
***************
*** 1103,1109 ****
          break;
        case 'p':        /* Don't capture in promiscuous mode */
  #ifdef HAVE_LIBPCAP
! 	prefs->capture_prom_mode = 0;
  #else
          capture_option_specified = TRUE;
          arg_error = TRUE;
--- 1113,1119 ----
          break;
        case 'p':        /* Don't capture in promiscuous mode */
  #ifdef HAVE_LIBPCAP
! 	prefs->capture_prom_mode = FALSE;
  #else
          capture_option_specified = TRUE;
          arg_error = TRUE;