Ethereal-users: Re: [Ethereal-users] Capturing IPv6 without IPv4 address assigned?

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

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Tue, 31 Oct 2000 23:32:00 -0800
> Ethereal could either
> 
> 	1) let you do it and warn you *every time* with a message box,
> 	   which might get annoying;

		...

> 	3) let you do it and not warn you.

I've chosen 3).  (It uses a netmask of 0.  This means that filters that
check for IP broadcast addresses won't necessarily work correctly; so it
goes.)

For Tethereal, I have it warn the user, as warnings are less likely to
be irritating.

Here's a patch to do both of those, which I'll check in.
? errs
? wiretap/gzio.c
? wiretap/zlib-1.1.3
Index: capture.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/capture.c,v
retrieving revision 1.130
diff -c -r1.130 capture.c
*** capture.c	2000/10/21 04:20:07	1.130
--- capture.c	2000/11/01 07:28:04
***************
*** 1179,1187 ****
    if (cfile.cfilter && !ld.from_pipe) {
      /* A capture filter was specified; set it up. */
      if (pcap_lookupnet (cfile.iface, &netnum, &netmask, err_str) < 0) {
!       snprintf(errmsg, sizeof errmsg,
!         "Can't use filter:  Couldn't obtain netmask info (%s).", err_str);
!       goto error;
      }
      if (pcap_compile(pch, &cfile.fcode, cfile.cfilter, 1, netmask) < 0) {
        snprintf(errmsg, sizeof errmsg, "Unable to parse filter string (%s).",
--- 1179,1194 ----
    if (cfile.cfilter && !ld.from_pipe) {
      /* A capture filter was specified; set it up. */
      if (pcap_lookupnet (cfile.iface, &netnum, &netmask, err_str) < 0) {
!       /*
!        * Well, we can't get the netmask for this interface; it's used
!        * only for filters that check for broadcast IP addresses, so
!        * we just punt and use 0.  It might be nice to warn the user,
!        * but that's a pain in a GUI application, as it'd involve popping
!        * up a message box, and it's not clear how often this would make
!        * a difference (only filters that check for IP broadcast addresses
!        * use the netmask).
!        */
!       netmask = 0;
      }
      if (pcap_compile(pch, &cfile.fcode, cfile.cfilter, 1, netmask) < 0) {
        snprintf(errmsg, sizeof errmsg, "Unable to parse filter string (%s).",
Index: tethereal.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/tethereal.c,v
retrieving revision 1.52
diff -c -r1.52 tethereal.c
*** tethereal.c	2000/10/31 08:15:26	1.52
--- tethereal.c	2000/11/01 07:28:07
***************
*** 592,600 ****
    if (cfile.cfilter) {
      /* A capture filter was specified; set it up. */
      if (pcap_lookupnet (cfile.iface, &netnum, &netmask, err_str) < 0) {
!       snprintf(errmsg, sizeof errmsg,
!         "Can't use filter:  Couldn't obtain netmask info (%s).", err_str);
!       goto error;
      }
      if (pcap_compile(ld.pch, &cfile.fcode, cfile.cfilter, 1, netmask) < 0) {
        snprintf(errmsg, sizeof errmsg, "Unable to parse filter string (%s).",
--- 592,605 ----
    if (cfile.cfilter) {
      /* A capture filter was specified; set it up. */
      if (pcap_lookupnet (cfile.iface, &netnum, &netmask, err_str) < 0) {
!       /*
!        * Well, we can't get the netmask for this interface; it's used
!        * only for filters that check for broadcast IP addresses, so
!        * we just warn the user, and punt and use 0.
!        */
!       fprintf(stderr, 
!         "Warning:  Couldn't obtain netmask info (%s)\n.", err_str);
!       netmask = 0;
      }
      if (pcap_compile(ld.pch, &cfile.fcode, cfile.cfilter, 1, netmask) < 0) {
        snprintf(errmsg, sizeof errmsg, "Unable to parse filter string (%s).",