The following patch fixes two separate problems that prevent a recently
updated CVS tree of libpcap from building on my machine:

1) pcap-linux uses a symbol, "devlist", which isn't defined anywhere. I think
   perhaps the function's parameter name was changed? In any case it seems to
   work if I change it to alldevsp which is the name of the function parameter
   which is the right type and otherwise unused.

2) inet.c uses the autoconf test for the ifaddrs.h header inappropriately. It
   should actually test if the function getifaddrs is available using
   AC_CHECK_FUNCS, not merely assume it must be available if the header is
   present. On my system for example the header is present because another
   piece of software includes it but the function isn't actually available.

With these two changes libpcap builds and tcpdump builds against it and
appears to work.



Index: config.h.in
===================================================================
RCS file: /tcpdump/master/libpcap/config.h.in,v
retrieving revision 1.9
diff -u -p -u -r1.9 config.h.in
--- config.h.in 2002/06/28 10:34:36     1.9
+++ config.h.in 2002/07/12 05:12:38
@@ -23,6 +23,9 @@
 /* Define if you have the <ifaddrs.h> header file.  */
 #undef HAVE_IFADDRS_H
 
+/* Define if you have the getifaddrs function available in libc.  */
+#undef HAVE_GETIFADDRS
+
 /* Define if you have the <limits.h> header file.  */
 #undef HAVE_LIMITS_H
 
Index: configure.in
===================================================================
RCS file: /tcpdump/master/libpcap/configure.in,v
retrieving revision 1.95
diff -u -p -u -r1.95 configure.in
--- configure.in        2002/06/28 10:34:36     1.95
+++ configure.in        2002/07/12 05:12:39
@@ -26,6 +26,7 @@ dnl test for it and set "HAVE_SYS_IOCCOM
 dnl "AC_LBL_FIXINCLUDES" won't work on some platforms such as Solaris.
 dnl
 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h ifaddrs.h limits.h netinet/if_ether.h)
+AC_CHECK_FUNCS(getifaddrs)
 
 AC_LBL_FIXINCLUDES
 
Index: inet.c
===================================================================
RCS file: /tcpdump/master/libpcap/inet.c,v
retrieving revision 1.48
diff -u -p -u -r1.48 inet.c
--- inet.c      2002/07/11 09:06:35     1.48
+++ inet.c      2002/07/12 05:12:40
@@ -67,7 +67,7 @@ struct rtentry;               /* declarations in <net
 #else
 #define INT_MAX                2147483647
 #endif
-#ifdef HAVE_IFADDRS_H
+#if HAVE_IFADDRS_H && HAVE_GETIFADDRS
 #include <ifaddrs.h>
 #endif
 
@@ -442,7 +442,7 @@ pcap_add_if(pcap_if_t **devlist, char *n
  * The list, as returned through "alldevsp", may be null if no interfaces
  * were up and could be opened.
  */
-#ifdef HAVE_IFADDRS_H
+#if HAVE_IFADDRS_H && HAVE_GETIFADDRS
 int
 pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf)
 {
@@ -488,10 +488,12 @@ pcap_findalldevs(pcap_if_t **alldevsp, c
                 * non-null on a non-point-to-point
                 * interface.
                 */
+#if 0
                if (ifa->ifa_flags & IFF_BROADCAST)
                        broadaddr = ifa->ifa_broadaddr;
                else
                        broadaddr = NULL;
+#endif
                if (ifa->ifa_flags & IFF_POINTOPOINT)
                        dstaddr = ifa->ifa_dstaddr;
                else
Index: pcap-linux.c
===================================================================
RCS file: /tcpdump/master/libpcap/pcap-linux.c,v
retrieving revision 1.83
diff -u -p -u -r1.83 pcap-linux.c
--- pcap-linux.c        2002/07/11 09:06:38     1.83
+++ pcap-linux.c        2002/07/12 05:12:41
@@ -744,7 +744,7 @@ static const char any_descr[] = "Pseudo-
 int
 pcap_platform_finddevs(pcap_if_t **alldevsp, char *errbuf)
 {
-       if (pcap_add_if(&devlist, "any", 0, any_descr, errbuf) < 0)
+       if (pcap_add_if(alldevsp, "any", 0, any_descr, errbuf) < 0)
                return (-1);
 
        return (0);


-- 
greg

-
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

Reply via email to