tcpdump mailing list archives

Re: libpcap pcap_sendpacket support across platforms.


From: "Mark Pizzolato" <List-tcpdump-workers () subscriptions pizzolato net>
Date: Tue, 23 Mar 2004 17:59:48 -0800

The attached revised pcap-bpf.c now addresses the BIOCSHDRCMPLT  issue you
noticed.

- Mark Pizzolato

----- Original Message ----- 
From: "Mark Pizzolato" <List-tcpdump-workers () subscriptions pizzolato net>
To: "Guy Harris" <gharris () sonic net>
Cc: "Mike Schiffman" <mike () infonexus com>; "TCPdump Workers"
<tcpdump-workers () tcpdump org>
Sent: Tuesday, March 23, 2004 4:56 PM
Subject: Re: [tcpdump-workers] libpcap pcap_sendpacket support across
platforms.


On Tuesday, March 23, 2004 11:22 AM, Guy Harris wrote:

Attached is a revised patch, which keeps prior behaviors, while also
providing for pcap_sendpacket when possible.

I've merged your changes with a version I'd been working on, based on
libnet and some stuff we had at Network Appliance, and checked the
result in.  It implements *two* APIs - "pcap_inject()", from OpenBSD,
and "pcap_sendpacket()", from WinPcap.

Some issues:

on BPF, libpcap doesn't do anything with BIOCSHDRCMPLT - libnet
does;

Good catch.  I still had that in my application code.

on DLPI, there's #if'ed-out code to use the appropriate "raw
data" primitives on HP-UX - I don't have access to an HP-UX
system on which to test them;

I don't have access either.  What I sent does work on Solaris 8 (Both
Intel
and Sparc).

on Linux, the version I checked in uses "sendto()", as that's
what libnet did;

Hmmmm..  I didn't check with libnet since I had simple working code with a
very basic send().

What you checked in is broken.  It has an extra right paren on line 687,
and
after that is fixed, line 725 refers to an undefined sa instead of sa_pkt.
The attached cleans things up a bit.

I wonder where the sendto() stuff is really necessary.  The simple send()
worked for us on RH 7.3-Fedora Core1 on Intel.  And RH 6.2 on Sparc, and
numerous other linux environments.  We've never gotten a complaint....

on SunOS 4.x with STREAMS NIT, the code I checked in uses
"putmsg()" - libnet and your code used "sendto()", but, as I
remember, the Network Appliance code used "putmsg()", which is
what I'd expect to be the correct call to use on a STREAMS-based
mechanism.

Since I didn't have any other reference and don't have a test environment,
I
worked from what I presumed to be correct in libnet.

Attachment: pcap-bpf.c
Description:


Current thread: