On Wed, Jan 17, 2001 at 11:50:16AM +0100, Torsten Landschoff wrote:
> Following the latest discussions on this list I gather that I made
> some wrong decisions when writing pcap-linux.c - I thought that
> libpcap would be most portable by relying on the libc headers.
>
> Seems like that is wrong since libc includes kernel headers in turn
> making everything a nice mess. The question arises if I should change
> pcap-linux.c to rely solely on standard libc features and pull the
> kernel headers for the remainder (e.g. don't use netpacket/packet.h
> but linux/if_packet.h).
Yes, I'm kind of curious why there's a "netpacket/packet.h" that does
anything other than just include <linux/if_packet.h>. I guess it has
the advantage that it allows the Linux kernel developers to decide not
to have a "linux/if_packet.h" header any more - but if they did, that'd
break stuff that was written to work on libc5 systems as well, and that
therefore included <linux/if_packet.h> rather than <netpacket/packet.h>,
and there are other header files where the libc header file *does*
include a kernel header file, so there are other kernel header files
that can't disappear without breaking glibc.
One minor odd benefit it might provide is that, in at least some
versions of glibc, "netpacket/packet.h" appears to define some 2.4
kernel stuff (PACKET_RX_RING, PACKET_STATISTICS), so that, on *some*
platforms, it might be possible to compile on a 2.2[.x] system code that
can, when run on a 2.4[.x] kernel, use 2.4[.x] features.
I guess one other rationale might have been that maybe, in the future,
other systems will support PF_PACKET sockets, and if those systems use
<netpacket/packet.h> then that'd be a portable way of getting the stuff
for the PF_PACKET socket API.
But I'm not sure whether those are even strong enough to have a header
file other than <linux/if_packet.h> for this...
> BTW: Does anybody know why glibc has a copy of the structures and
> defines from if_packet.h in netpacket/packet.h? This only asks for
> getting out of sync.
...much less to have <netpacket/packet.h> do anything other than include
<linux/if_packet.h>.
You might want to ask the glibc folk what the rationale for this was; it
sure does look as if it runs the risk of getting out of sync.
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe