[Iftop-users] Kudos and Question

Paul Warren pdw at ex-parrot.com
Fri, 23 May 2003 17:03:42 +0100


--n8g4imXOkfNTN/H1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, May 23, 2003 at 10:01:24AM -0500, Jonathan Abbey wrote:
> Hi everyone.  Just wanted to drop a line and say that we're extremely
> pleased to have iftop here at ARL:UT.  I, personally, have been
> wanting something like this for some time, and seeing it on freshmeat
> yesterday was really fantastic.
> 
> I do have a question, however.  We're running it on Solaris 8, and
> while I understand that it's necessary to use -p to run it in
> promiscuous mode to see the outgoing packets, even when this is done,
> I still see nothing but flatline on the cummulative and peak TX stats
> on the bottom of the display.
> 
> This even in the case where I'm seeing outgoing statistics in the
> bar-graph display.

OK, this is pretty much expected.  Presumably when you start up (or
after you quit) you see a message saying that it was unable to get the
hardware address and/or the IP address?

The problem is that if it can't figure out the above, it doesn't know
which way packets are moving across the interface, so assumed that they
were picked up in promiscuous mode (between two other hosts) and
accounts them as incoming, having assigned the direction in the above
display arbitrarily.

Getting the hardware address is real PITA because there seem to be more
ways of doing it than there are platforms in the world.  Currently it's
only working on linux.  Can you try the attached patch, which is meant
to work on Solaris, and let me know how you get on.  I'm afraid I don't
have access to a Solaris box to test this on.

cheers,

Paul



--n8g4imXOkfNTN/H1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=iftop-patch

diff -c -r1.45 iftop.c
*** iftop.c	21 May 2003 21:14:00 -0000	1.45
--- iftop.c	23 May 2003 16:02:19 -0000
***************
*** 452,457 ****
--- 452,468 ----
          memcpy(if_hw_addr, ifr.ifr_hwaddr.sa_data, 6);
          have_hw_addr = 1;
      }
+ #elif defined(SIOCGENADDR) /* Solaris */
+     if (ioctlsocket(s, SIOCGENADDR, &ifr) < 0)
+     {
+         fprintf(stderr, "Error getting hardware address for interface: %s\n", options.interface); 
+         perror("ioctl(SIOCGIFHWADDR)");
+     }
+     else
+     {
+         memcpy(if_hw_addr, ifr.ifr_hwaddr.sa_data, 6);
+         have_hw_addr = 1;
+     }
  #else
      fprintf(stderr, "Cannot obtain hardware address on this platform\n");
  #endif

--n8g4imXOkfNTN/H1--