tcpdump mailing list archives

Patch for handling multiple interfaces


From: Guy Thornley <guy () esphion com>
Date: Tue, 16 Mar 2004 13:50:34 +1300

Hi,

Here is a patch for tcpdump to handle multiple '-i' options
semi-intelligently.

Only tested on Linux 2.4.21, glibc 2.3.2

The patch is againt 3.8.1. I also have a patch against 3.7.2, since that is
what we are still using internally, but the 3.8.1 patch is probably more
interesting for you folks. The 3.7.2 patch is available on request.

In a nutshell, multiple -i options make it do select() after performing
pcap_setnonblocking() on each pcap_t. When activity is noticed,
pcap_dispatch() is run on all devices in turn until none of the devices have
any more activity, which than falls back to select() until more activity
occurs.

A single (or no) -i option, or presence of -r makes it fall back to the
previous mechanism of pcap_loop()

All devices must have the same link type.

If theres any cleanups you would like before you are particularly
interested, let me know.

Guy Thornley

Attachment: tcpdump.c-3.8.1.diff
Description:


Current thread: