Aiee :)
Hello!
Some times ago, someone noticed that were problems while compiling
the new (0.6.1) libpcap release against Linux systems, due to
different glibc versions installed (if glibc major is ! >= 2 and
minor is ! >= 1, netpacket/packet.h isn't available, while
linux/if_packet.h is).
Even if should be better to get new glibc versions proper installed
I thought that a little patch to libpcap source tree is harmless.
I did really fast-browse through the mailing list archive and
it seems to me that there wasn't submitted any kind of patch
(I didn't checked current CVS tree, tho); if I'm wrong, please
let me know and forgive me ;).
Patch attached.
This works fine on a 2.2 kernel series with libc 2.0.7.
bye bye
-- gg sullivan
--
Lorenzo Cavallaro `Gigi Sullivan' <[EMAIL PROTECTED]>
LibRNet Project Home Page: http://www.sikurezza.org/sullivan
LibRNet Mailing List: [EMAIL PROTECTED]
Until I loved, life had no beauty;
I did not know I lived until I had loved. (Theodor Korner)
--- configure.in.orig Fri Jan 26 14:33:39 2001
+++ configure.in Fri Jan 26 14:55:02 2001
@@ -116,7 +116,7 @@
;;
linux)
- AC_CHECK_HEADERS(netpacket/packet.h)
+ AC_CHECK_HEADERS(netpacket/packet.h linux/if_packet.h , break , )
AC_MSG_CHECKING(Linux kernel version)
if test "$cross_compiling" = yes; then
AC_CACHE_VAL(ac_cv_linux_vers,
--- config.h.in.orig Fri Jan 26 14:42:21 2001
+++ config.h.in Fri Jan 26 14:44:44 2001
@@ -24,6 +24,9 @@
/* Define if you have the <netpacket/packet.h> header file. */
#undef HAVE_NETPACKET_PACKET_H
+/* Define if you have the <linux/if_packet.h> header file. */
+#undef HAVE_LINUX_IF_PACKET_H
+
/* Define if you have the <sys/bufmod.h> header file. */
#undef HAVE_SYS_BUFMOD_H
--- pcap-linux.c.orig Fri Jan 26 14:36:46 2001
+++ pcap-linux.c Fri Jan 26 15:18:08 2001
@@ -69,6 +69,7 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/utsname.h>
+#include <asm/types.h>
#include <net/if.h>
#include <netinet/in.h>
#include <linux/if_ether.h>
@@ -76,12 +77,16 @@
#ifdef HAVE_NETPACKET_PACKET_H
#include <netpacket/packet.h>
+#include <net/ether.h>
+#endif
+#ifdef HAVE_LINUX_IF_PACKET_H
+#include <linux/if_packet.h>
#endif
#ifdef SO_ATTACH_FILTER
#include <linux/types.h>
#include <linux/filter.h>
#endif
-
+
#ifndef __GLIBC__
typedef int socklen_t;
#endif
@@ -110,12 +115,12 @@
/*
* Wrap some ioctl calls
*/
-#ifdef HAVE_NETPACKET_PACKET_H
+#if defined(HAVE_NETPACKET_PACKET_H) || defined(HAVE_LINUX_IF_PACKET_H)
static int iface_get_id(int fd, const char *device, char *ebuf);
#endif
static int iface_get_mtu(int fd, const char *device, char *ebuf);
static int iface_get_arptype(int fd, const char *device, char *ebuf);
-#ifdef HAVE_NETPACKET_PACKET_H
+#if defined(HAVE_NETPACKET_PACKET_H) || defined(HAVE_LINUX_IF_PACKET_H)
static int iface_bind(int fd, int ifindex, char *ebuf);
#endif
static int iface_bind_old(int fd, const char *device, char *ebuf);
@@ -221,7 +226,7 @@
pcap_read_packet(pcap_t *handle, pcap_handler callback, u_char *userdata)
{
int offset;
-#ifdef HAVE_NETPACKET_PACKET_H
+#if defined(HAVE_NETPACKET_PACKET_H) || defined(HAVE_LINUX_IF_PACKET_H)
struct sockaddr_ll from;
struct sll_header *hdrp;
#else
@@ -231,7 +236,7 @@
int packet_len, caplen;
struct pcap_pkthdr pcap_header;
-#ifdef HAVE_NETPACKET_PACKET_H
+#if defined(HAVE_NETPACKET_PACKET_H) || defined(HAVE_LINUX_IF_PACKET_H)
/*
* If this is a cooked device, leave extra room for a
* fake packet header.
@@ -270,7 +275,7 @@
}
}
-#ifdef HAVE_NETPACKET_PACKET_H
+#if defined(HAVE_NETPACKET_PACKET_H) || defined(HAVE_LINUX_IF_PACKET_H)
/*
* If this is from the loopback device, reject outgoing packets;
* we'll see the packet as an incoming packet as well, and
@@ -286,7 +291,7 @@
return 0;
#endif
-#ifdef HAVE_NETPACKET_PACKET_H
+#if defined(HAVE_NETPACKET_PACKET_H) || defined(HAVE_LINUX_IF_PACKET_H)
/*
* If this is a cooked device, fill in the fake packet header.
*/
@@ -606,7 +611,7 @@
live_open_new(pcap_t *handle, char *device, int promisc,
int to_ms, char *ebuf)
{
-#ifdef HAVE_NETPACKET_PACKET_H
+#if defined(HAVE_NETPACKET_PACKET_H) || defined(HAVE_LINUX_IF_PACKET_H)
int sock_fd = -1, device_id, mtu, arptype;
struct packet_mreq mr;
@@ -793,7 +798,7 @@
#endif
}
-#ifdef HAVE_NETPACKET_PACKET_H
+#if defined(HAVE_NETPACKET_PACKET_H) || defined(HAVE_LINUX_IF_PACKET_H)
/*
* Return the index of the given device name. Fill ebuf and return
* -1 on failure.
@@ -1196,7 +1201,7 @@
return ifr.ifr_hwaddr.sa_family;
}
-#ifdef HAVE_NETPACKET_PACKET_H
+#if defined(HAVE_NETPACKET_PACKET_H) || defined(HAVE_LINUX_IF_PACKET_H)
static int
fix_program(pcap_t *handle, struct sock_fprog *fcode)
{
PGP signature