]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Change HAVE_ETHER_HOSTTON to USE_ETHER_HOSTTON
authorfenner <fenner>
Fri, 27 Apr 2001 02:33:42 +0000 (02:33 +0000)
committerfenner <fenner>
Fri, 27 Apr 2001 02:33:42 +0000 (02:33 +0000)
Only define USE_ETHER_HOSTTON if ether_hostton() doesn't dump core.

acconfig.h
addrtoname.c
config.h.in
configure.in

index 6a033871e0bccd1ebe0d6943e9a04e1c35cc5456..ba38a4516f1a5ed34ed4b6d272aaab020fbbc381 100644 (file)
@@ -62,6 +62,9 @@
 /* define if you have both getipnodebyname() and getipnodebyaddr() */
 #undef USE_GETIPNODEBY
 
+/* define if you have ether_ntohost() and it works */
+#undef USE_ETHER_NTOHOST
+
 /* define if unaligned memory accesses fail */
 #undef LBL_ALIGN
 
index d5f71d3e3574a5f3aa1b5e5f7ca80afc9992074b..47e9d58d1172b968ac6b3ff595b7a67af6c099c8 100644 (file)
@@ -23,7 +23,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.71 2001-01-20 07:22:21 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.72 2001-04-27 02:33:43 fenner Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -404,7 +404,7 @@ etheraddr_string(register const u_char *ep)
        tp = lookup_emem(ep);
        if (tp->e_name)
                return (tp->e_name);
-#ifdef HAVE_ETHER_NTOHOST
+#ifdef USE_ETHER_NTOHOST
        if (!nflag) {
                char buf[128];
                if (ether_ntohost(buf, (struct ether_addr *)ep) == 0) {
@@ -667,7 +667,7 @@ init_etherarray(void)
 {
        register struct etherlist *el;
        register struct enamemem *tp;
-#ifdef HAVE_ETHER_NTOHOST
+#ifdef USE_ETHER_NTOHOST
        char name[256];
 #else
        register struct pcap_etherent *ep;
@@ -691,7 +691,7 @@ init_etherarray(void)
                if (tp->e_name != NULL)
                        continue;
 
-#ifdef HAVE_ETHER_NTOHOST
+#ifdef USE_ETHER_NTOHOST
                 /* Use yp/nis version of name if available */
                 if (ether_ntohost(name, (struct ether_addr *)el->addr) == 0) {
                         tp->e_name = strdup(name);
index 06983b1ce71879f98cdb149c344bcb93482e6b4c..1a4fbff4ad62e374951d37c3cb6c3bbe5b32b39d 100644 (file)
@@ -63,6 +63,9 @@
 /* define if you have both getipnodebyname() and getipnodebyaddr() */
 #undef USE_GETIPNODEBY
 
+/* define if you have ether_ntohost() and it works */
+#undef USE_ETHER_NTOHOST
+
 /* define if unaligned memory accesses fail */
 #undef LBL_ALIGN
 
index 176912395ae3d6cf3682d346e962927ee324fb19..36d3b6ceabe7fa59d71119158c08d2c30aaa813f 100644 (file)
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.135 2001-04-13 02:56:38 itojun Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.136 2001-04-27 02:33:43 fenner Exp $ (LBL)
 dnl
 dnl Copyright (c) 1994, 1995, 1996, 1997
 dnl    The Regents of the University of California.  All rights reserved.
@@ -6,7 +6,7 @@ dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl
 
-AC_REVISION($Revision: 1.135 $)
+AC_REVISION($Revision: 1.136 $)
 AC_PREREQ(2.13)
 AC_INIT(tcpdump.c)
 
@@ -47,6 +47,8 @@ esac
 
 AC_CHECK_HEADERS(smi.h)
 AC_CHECK_LIB(smi, smiInit)
+if test "$ac_cv_header_smi_h" = yes -a "$ac_cv_lib_smi_smiInit" = yes
+then
 AC_MSG_CHECKING([whether to enable libsmi])
         AC_TRY_RUN([ /* libsmi available check */
 #include <smi.h>
@@ -69,12 +71,21 @@ main()
 [ AC_MSG_RESULT(yes)
   AC_DEFINE(LIBSMI)
   libsmi=yes],
-[ AC_MSG_RESULT(no)
+dnl autoconf documentation says that $? contains the exit value.
+dnl reality is that it does not.  We leave this in just in case
+dnl autoconf ever comes back to match the documentation.
+[ case $? in
+  1) AC_MSG_RESULT(no - smiInit failed) ;;
+  2) AC_MSG_RESULT(no - header/library version mismatch) ;;
+  3) AC_MSG_RESULT(no - can't determine library version) ;;
+  4) AC_MSG_RESULT(no - too old) ;;
+  *) AC_MSG_RESULT(no) ;;
+  esac
   libsmi=no],
 [ AC_MSG_RESULT(not when cross-compiling)
   libsmi=no]
 )
-
+fi
 
 CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
 AC_MSG_CHECKING([whether to enable ipv6])
@@ -451,7 +462,32 @@ fi
 
 
 AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup)
-AC_CHECK_FUNCS(ether_ntohost setlinebuf)
+AC_CHECK_FUNCS(ether_ntohost, [
+    AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
+       AC_TRY_RUN([
+               #include <netdb.h>
+               #include <sys/types.h>
+               #include <sys/param.h>
+               #include <sys/socket.h>
+               #include <net/ethernet.h>
+
+               int
+               main(int argc, char **argv)
+               {
+                       u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
+                       char name[MAXHOSTNAMELEN];
+
+                       ether_ntohost(name, (struct ether_addr *)ea);
+                       exit(0);
+               }
+       ], [ac_cv_buggy_ether_ntohost=no],
+          [ac_cv_buggy_ether_ntohost=yes],
+          [ac_cv_buggy_ether_ntohost=not while cross-compiling])])
+    if test "$ac_cv_buggy_ether_ntohost" = "no"; then
+       AC_DEFINE(USE_ETHER_NTOHOST)
+    fi
+])
+AC_CHECK_FUNCS(setlinebuf)
 
 usegetipnodeby=yes
 AC_CHECK_FUNCS(getipnodebyname getipnodebyaddr freeaddrinfo,