tcpdump mailing list archives
Re: libpcap pcap_sendpacket support across platforms.
From: Guy Harris <gharris () sonic net>
Date: Tue, 23 Mar 2004 11:22:41 -0800
On Sat, Mar 13, 2004 at 06:46:33AM -0800, Mark Pizzolato wrote:
However, that problem can easily be solved with the following:
[...]
fd = open(device, O_RDWR);
if (fd < 0 && errno == EACCES)
fd = open(device, O_RDONLY);
[...]
This would then leave the pcap connection to behave in a more consistent way
across all platforms (i.e. you can write to the connection when you have
privilege/authority to do so).
OK.
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;
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;
on Linux, the version I checked in uses "sendto()", as that's
what libnet did;
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.
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe
Current thread:
- libpcap pcap_sendpacket support across plaatforms. Mark Pizzolato (Mar 12)
- Re: libpcap pcap_sendpacket support across plaatforms. Guy Harris (Mar 12)
- Re: libpcap pcap_sendpacket support across platforms. Mark Pizzolato (Mar 13)
- Re: libpcap pcap_sendpacket support across platforms. Guy Harris (Mar 23)
- Re: libpcap pcap_sendpacket support across platforms. Michael Richardson (Mar 23)
- Re: libpcap pcap_sendpacket support across platforms. Jefferson Ogata (Mar 23)
- Re: libpcap pcap_sendpacket support across platforms. Guy Harris (Mar 23)
- Re: libpcap pcap_sendpacket support across platforms. Guy Harris (Mar 23)
- Message not available
- Re: libpcap pcap_sendpacket support across platforms. Guy Harris (Mar 23)
- Re: libpcap pcap_sendpacket support across platforms. Michael Richardson (Mar 23)
- Re: libpcap pcap_sendpacket support across platforms. Mark Pizzolato (Mar 13)
- Re: libpcap pcap_sendpacket support across plaatforms. Guy Harris (Mar 12)
- Re: libpcap pcap_sendpacket support across platforms. Richard Sharpe (Mar 23)
- Re: libpcap pcap_sendpacket support across platforms. Michael Richardson (Mar 23)
- Message not available
- Message not available
- Message not available
- Re: libpcap pcap_sendpacket support across platforms. Ste Jones (Mar 26)
- Re: libpcap pcap_sendpacket support across platforms. Stephen Donnelly (Mar 23)
