-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,
I need to specify packet direction for my sniffing application, but
current libpcap doesn't offer this functionality. I've found a patch[1],
which adds ability to set direction of packet capture.
The patch works good, but it modifies pcap_pkthdr struct from pcap.h,
which can be considered API change[2]. Therefore I streamlined this
patch, so now it doesn't change public structures. It adds just new
function:

int pcap_direction(pcap_t *p, direction_t d)

and new enum typedef - direction_t.
To specify direction pcap_direction() have to be called after
pcap_open_live() with desired direction (D_IN, D_OUT, D_INOUT). Default
direction, in case pcap_direction() was not called is D_INOUT.
Information about direction is not saved to dump file. I think of it as
promiscuous flag, which also isn't saved.

I've tested it on the latest libpcap from cvs (2005.04.28).

I've read that pcap-ng will allow to specify additional options, such as
direction, without changing the API and with ability to save pcap dumps
in portable way. But it seems pcap-ng won't be available too early, so
pcap_direction() could be used as temporary, but minimal and clean solution.

What do you people think about it?
Is there any chance for this to go into mainline libpcap? (if so, I
would be very happy :) )
My time and skills are limited, but if there are changes required, I
will do my best.

Pawel Pokrywka

[1] http://www.beonline.com.au/kb/pcap.html
[2] http://marc.theaimsgroup.com/?l=tcpdump-workers&m=108146017831222&w=2
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQD1AwUBQnN3iAYJ6m8RUpKnAQK6GwcAreJlvs94g1igI0ILXg9nsBLnFzeG04Zb
BlNf/oJDSWUzFb6c7iDqm20bSRb0sXi1371JKX4Sq1r2scn+/5ayYrWcrYuzeL0S
D85EJ+NM9OKRmFvok1ELQ0jnHbWJS5P3Uvue1tCvj2NVA+77V8PDshGpB4RGSWiy
qfSp3USnMzRw1rbaOI12qbZCMSI92eppO9LgWqD6SaFhxHKoHa9opr5aL70MCs0K
pMp5GFk832JBh3qtesKXrW01SeOqWPeB0baJLPv+uLz253Fv8/VLUZVD04M3uHxc
DtljhvA7HoM=
=wV6j
-----END PGP SIGNATURE-----

Attachment: libpcap-direction-minimal.patch.gz
Description: GNU Zip compressed data

-
This is the tcpdump-workers list.
Visit https://lists.sandelman.ca/ to unsubscribe.

Reply via email to