]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Print both the name and the description of a link-layer type (the name
authorguy <guy>
Tue, 18 Nov 2003 23:09:42 +0000 (23:09 +0000)
committerguy <guy>
Tue, 18 Nov 2003 23:09:42 +0000 (23:09 +0000)
isn't always very suggestive - for example, somebody might think
"EN10MB" is always 10 MB/s, and might not know that "IEEE802" is Token
Ring), using "pcap_datalink_val_to_description()".  Supply our own
"pcap_datalink_val_to_description()" if libpcap doesn't have it (even if
it has "pcap_datalink_name_to_val()").

acconfig.h
aclocal.m4
config.h.in
configure
missing/dlnames.c
pcap-missing.h
tcpdump.c

index d9dcffc1cf58237d6837befd5f9158cf75a64e87..09e8351566af80e24a2fd7039fc97661be703076 100644 (file)
@@ -83,6 +83,9 @@
 /* define if libpcap has pcap_datalink_name_to_val() */
 #undef HAVE_PCAP_DATALINK_NAME_TO_VAL
 
+/* define if libpcap has pcap_datalink_val_to_description() */
+#undef HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION
+
 /* define if unaligned memory accesses fail */
 #undef LBL_ALIGN
 
index ac30b283db947e534ffc306a61a2df1d5fd9102f..0d6c18def89cd3b2519fbab21bee1656e891b333 100644 (file)
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.100 2003-11-16 09:44:20 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.101 2003-11-18 23:09:42 guy Exp $ (LBL)
 dnl
 dnl Copyright (c) 1995, 1996, 1997, 1998
 dnl    The Regents of the University of California.  All rights reserved.
@@ -331,7 +331,12 @@ AC_DEFUN(AC_LBL_LIBPCAP,
     AC_CHECK_FUNC(pcap_set_datalink,
        AC_DEFINE(HAVE_PCAP_SET_DATALINK))
     AC_CHECK_FUNC(pcap_datalink_name_to_val,
-       AC_DEFINE(HAVE_PCAP_DATALINK_NAME_TO_VAL),
+       [
+           AC_DEFINE(HAVE_PCAP_DATALINK_NAME_TO_VAL)
+           AC_CHECK_FUNC(pcap_datalink_val_to_description,
+               AC_DEFINE(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION),
+               LIBOBJS="$LIBOBJS dlnames.o")
+       ],
        LIBOBJS="$LIBOBJS dlnames.o")
 
     dnl
index bb522b939a46a5986a3fb5f922de336d0f5b7f8c..2b2ad137c64bb9f031b7bddf7e2ffff45260a59b 100644 (file)
@@ -71,6 +71,9 @@
 /* define if libpcap has pcap_datalink_name_to_val() */
 #undef HAVE_PCAP_DATALINK_NAME_TO_VAL
 
+/* define if libpcap has pcap_datalink_val_to_description() */
+#undef HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION
+
 /* define if unaligned memory accesses fail */
 #undef LBL_ALIGN
 
index 62ee290d91264731954c7a4348e140a1686d65f5..255f9b67775baf1acfe35f2dfb2973b540374194 100755 (executable)
--- a/configure
+++ b/configure
@@ -3891,10 +3891,64 @@ fi
 
 if eval "test \"`echo '$ac_cv_func_'pcap_datalink_name_to_val`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+  
+           cat >> confdefs.h <<\EOF
 #define HAVE_PCAP_DATALINK_NAME_TO_VAL 1
 EOF
 
+           echo $ac_n "checking for pcap_datalink_val_to_description""... $ac_c" 1>&6
+echo "configure:3901: checking for pcap_datalink_val_to_description" >&5
+if eval "test \"`echo '$''{'ac_cv_func_pcap_datalink_val_to_description'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3906 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char pcap_datalink_val_to_description(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char pcap_datalink_val_to_description();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_pcap_datalink_val_to_description) || defined (__stub___pcap_datalink_val_to_description)
+choke me
+#else
+pcap_datalink_val_to_description();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_pcap_datalink_val_to_description=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_pcap_datalink_val_to_description=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'pcap_datalink_val_to_description`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS dlnames.o"
+fi
+
+       
 else
   echo "$ac_t""no" 1>&6
 LIBOBJS="$LIBOBJS dlnames.o"
@@ -3904,12 +3958,12 @@ fi
                         for ac_func in pcap_breakloop
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3908: checking for $ac_func" >&5
+echo "configure:3962: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3913 "configure"
+#line 3967 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3932,7 +3986,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3971,9 +4025,9 @@ done
 # to rename it.
 #
 echo $ac_n "checking for inet_ntop""... $ac_c" 1>&6
-echo "configure:3975: checking for inet_ntop" >&5
+echo "configure:4029: checking for inet_ntop" >&5
 cat > conftest.$ac_ext <<EOF
-#line 3977 "configure"
+#line 4031 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -3984,7 +4038,7 @@ char src[4], dst[128];
 inet_ntop(AF_INET, src, dst, sizeof(dst));
 ; return 0; }
 EOF
-if { (eval echo configure:3988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -3996,9 +4050,9 @@ else
 fi
 rm -f conftest*
 echo $ac_n "checking for inet_pton""... $ac_c" 1>&6
-echo "configure:4000: checking for inet_pton" >&5
+echo "configure:4054: checking for inet_pton" >&5
 cat > conftest.$ac_ext <<EOF
-#line 4002 "configure"
+#line 4056 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -4009,7 +4063,7 @@ char src[128], dst[4];
 inet_pton(AF_INET, src, dst);
 ; return 0; }
 EOF
-if { (eval echo configure:4013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -4021,9 +4075,9 @@ else
 fi
 rm -f conftest*
 echo $ac_n "checking for inet_aton""... $ac_c" 1>&6
-echo "configure:4025: checking for inet_aton" >&5
+echo "configure:4079: checking for inet_aton" >&5
 cat > conftest.$ac_ext <<EOF
-#line 4027 "configure"
+#line 4081 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <netinet/in.h>
@@ -4034,7 +4088,7 @@ struct in_addr dst;
 inet_aton(src, &dst);
 ; return 0; }
 EOF
-if { (eval echo configure:4038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -4048,12 +4102,12 @@ rm -f conftest*
 
 
        echo $ac_n "checking if sockaddr struct has sa_len member""... $ac_c" 1>&6
-echo "configure:4052: checking if sockaddr struct has sa_len member" >&5
+echo "configure:4106: checking if sockaddr struct has sa_len member" >&5
        if eval "test \"`echo '$''{'ac_cv_sockaddr_has_sa_len'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4057 "configure"
+#line 4111 "configure"
 #include "confdefs.h"
 
 #              include <sys/types.h>
@@ -4062,7 +4116,7 @@ int main() {
 u_int i = sizeof(((struct sockaddr *)0)->sa_len)
 ; return 0; }
 EOF
-if { (eval echo configure:4066: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_sockaddr_has_sa_len=yes
 else
@@ -4089,12 +4143,12 @@ fi
 for ac_func in pcap_findalldevs pcap_dump_flush pcap_lib_version
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4093: checking for $ac_func" >&5
+echo "configure:4147: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4098 "configure"
+#line 4152 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4117,7 +4171,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4175: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4143,9 +4197,9 @@ done
 
 if test $ac_cv_func_pcap_lib_version = "no" ; then
     echo $ac_n "checking whether pcap_version is defined by libpcap""... $ac_c" 1>&6
-echo "configure:4147: checking whether pcap_version is defined by libpcap" >&5
+echo "configure:4201: checking whether pcap_version is defined by libpcap" >&5
     cat > conftest.$ac_ext <<EOF
-#line 4149 "configure"
+#line 4203 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -4160,7 +4214,7 @@ return_pcap_version(void)
        
 ; return 0; }
 EOF
-if { (eval echo configure:4164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_lbl_cv_pcap_version_defined=yes
 else
@@ -4181,9 +4235,9 @@ EOF
     fi
 fi
 echo $ac_n "checking whether pcap_debug is defined by libpcap""... $ac_c" 1>&6
-echo "configure:4185: checking whether pcap_debug is defined by libpcap" >&5
+echo "configure:4239: checking whether pcap_debug is defined by libpcap" >&5
 cat > conftest.$ac_ext <<EOF
-#line 4187 "configure"
+#line 4241 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -4198,7 +4252,7 @@ return_pcap_debug(void)
    
 ; return 0; }
 EOF
-if { (eval echo configure:4202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_lbl_cv_pcap_debug_defined=yes
 else
@@ -4220,9 +4274,9 @@ else
        # OK, what about "yydebug"?
        #
        echo $ac_n "checking whether yydebug is defined by libpcap""... $ac_c" 1>&6
-echo "configure:4224: checking whether yydebug is defined by libpcap" >&5
+echo "configure:4278: checking whether yydebug is defined by libpcap" >&5
        cat > conftest.$ac_ext <<EOF
-#line 4226 "configure"
+#line 4280 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -4237,7 +4291,7 @@ int main() {
           
 ; return 0; }
 EOF
-if { (eval echo configure:4241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_lbl_cv_yydebug_defined=yes
 else
@@ -4260,12 +4314,12 @@ fi
 for ac_func in bpf_dump
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4264: checking for $ac_func" >&5
+echo "configure:4318: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4269 "configure"
+#line 4323 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4288,7 +4342,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4345,12 +4399,12 @@ if test -f /dev/bpf0 ; then
 fi
 
 echo $ac_n "checking for int8_t using $CC""... $ac_c" 1>&6
-echo "configure:4349: checking for int8_t using $CC" >&5
+echo "configure:4403: checking for int8_t using $CC" >&5
     if eval "test \"`echo '$''{'ac_cv_lbl_have_int8_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4354 "configure"
+#line 4408 "configure"
 #include "confdefs.h"
 
 #      include "confdefs.h"
@@ -4363,7 +4417,7 @@ int main() {
 int8_t i
 ; return 0; }
 EOF
-if { (eval echo configure:4367: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4421: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_lbl_have_int8_t=yes
 else
@@ -4383,12 +4437,12 @@ EOF
 
     fi
 echo $ac_n "checking for u_int8_t using $CC""... $ac_c" 1>&6
-echo "configure:4387: checking for u_int8_t using $CC" >&5
+echo "configure:4441: checking for u_int8_t using $CC" >&5
     if eval "test \"`echo '$''{'ac_cv_lbl_have_u_int8_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4392 "configure"
+#line 4446 "configure"
 #include "confdefs.h"
 
 #      include "confdefs.h"
@@ -4401,7 +4455,7 @@ int main() {
 u_int8_t i
 ; return 0; }
 EOF
-if { (eval echo configure:4405: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4459: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_lbl_have_u_int8_t=yes
 else
@@ -4421,12 +4475,12 @@ EOF
 
     fi
 echo $ac_n "checking for int16_t using $CC""... $ac_c" 1>&6
-echo "configure:4425: checking for int16_t using $CC" >&5
+echo "configure:4479: checking for int16_t using $CC" >&5
     if eval "test \"`echo '$''{'ac_cv_lbl_have_int16_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4430 "configure"
+#line 4484 "configure"
 #include "confdefs.h"
 
 #      include "confdefs.h"
@@ -4439,7 +4493,7 @@ int main() {
 int16_t i
 ; return 0; }
 EOF
-if { (eval echo configure:4443: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4497: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_lbl_have_int16_t=yes
 else
@@ -4459,12 +4513,12 @@ EOF
 
     fi
 echo $ac_n "checking for u_int16_t using $CC""... $ac_c" 1>&6
-echo "configure:4463: checking for u_int16_t using $CC" >&5
+echo "configure:4517: checking for u_int16_t using $CC" >&5
     if eval "test \"`echo '$''{'ac_cv_lbl_have_u_int16_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4468 "configure"
+#line 4522 "configure"
 #include "confdefs.h"
 
 #      include "confdefs.h"
@@ -4477,7 +4531,7 @@ int main() {
 u_int16_t i
 ; return 0; }
 EOF
-if { (eval echo configure:4481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4535: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_lbl_have_u_int16_t=yes
 else
@@ -4497,12 +4551,12 @@ EOF
 
     fi
 echo $ac_n "checking for int32_t using $CC""... $ac_c" 1>&6
-echo "configure:4501: checking for int32_t using $CC" >&5
+echo "configure:4555: checking for int32_t using $CC" >&5
     if eval "test \"`echo '$''{'ac_cv_lbl_have_int32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4506 "configure"
+#line 4560 "configure"
 #include "confdefs.h"
 
 #      include "confdefs.h"
@@ -4515,7 +4569,7 @@ int main() {
 int32_t i
 ; return 0; }
 EOF
-if { (eval echo configure:4519: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4573: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_lbl_have_int32_t=yes
 else
@@ -4535,12 +4589,12 @@ EOF
 
     fi
 echo $ac_n "checking for u_int32_t using $CC""... $ac_c" 1>&6
-echo "configure:4539: checking for u_int32_t using $CC" >&5
+echo "configure:4593: checking for u_int32_t using $CC" >&5
     if eval "test \"`echo '$''{'ac_cv_lbl_have_u_int32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4544 "configure"
+#line 4598 "configure"
 #include "confdefs.h"
 
 #      include "confdefs.h"
@@ -4553,7 +4607,7 @@ int main() {
 u_int32_t i
 ; return 0; }
 EOF
-if { (eval echo configure:4557: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4611: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_lbl_have_u_int32_t=yes
 else
@@ -4613,12 +4667,12 @@ EOF
     fi
 
 echo $ac_n "checking if sockaddr struct has sa_len member""... $ac_c" 1>&6
-echo "configure:4617: checking if sockaddr struct has sa_len member" >&5
+echo "configure:4671: checking if sockaddr struct has sa_len member" >&5
     if eval "test \"`echo '$''{'ac_cv_lbl_sockaddr_has_sa_len'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4622 "configure"
+#line 4676 "configure"
 #include "confdefs.h"
 
 #      include <sys/types.h>
@@ -4627,7 +4681,7 @@ int main() {
 u_int i = sizeof(((struct sockaddr *)0)->sa_len)
 ; return 0; }
 EOF
-if { (eval echo configure:4631: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_lbl_sockaddr_has_sa_len=yes
 else
@@ -4648,7 +4702,7 @@ EOF
     fi
 
 echo $ac_n "checking if unaligned accesses fail""... $ac_c" 1>&6
-echo "configure:4652: checking if unaligned accesses fail" >&5
+echo "configure:4706: checking if unaligned accesses fail" >&5
     if eval "test \"`echo '$''{'ac_cv_lbl_unaligned_fail'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4744,12 +4798,12 @@ EOF
 
 
        echo $ac_n "checking for h_errno""... $ac_c" 1>&6
-echo "configure:4748: checking for h_errno" >&5
+echo "configure:4802: checking for h_errno" >&5
        if eval "test \"`echo '$''{'ac_cv_var_h_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4753 "configure"
+#line 4807 "configure"
 #include "confdefs.h"
 
 #              include <sys/types.h>
@@ -4758,7 +4812,7 @@ int main() {
 int foo = h_errno;
 ; return 0; }
 EOF
-if { (eval echo configure:4762: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4816: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_var_h_errno=yes
 else
@@ -4786,7 +4840,7 @@ if test "${with_crypto+set}" = set; then
 else
   
 echo $ac_n "checking for SSLeay""... $ac_c" 1>&6
-echo "configure:4790: checking for SSLeay" >&5
+echo "configure:4844: checking for SSLeay" >&5
 ac_cv_ssleay_path=no
 incdir=no
 for dir in /usr/${host_alias} /usr /usr/local /usr/local/ssl /usr/pkg; do
@@ -4827,7 +4881,7 @@ if test "$ac_cv_ssleay_path" != no; then
                LIBS="$LIBS -lrsaref"
        fi
        echo $ac_n "checking for des_cbc_encrypt in -lcrypto""... $ac_c" 1>&6
-echo "configure:4831: checking for des_cbc_encrypt in -lcrypto" >&5
+echo "configure:4885: checking for des_cbc_encrypt in -lcrypto" >&5
 ac_lib_var=`echo crypto'_'des_cbc_encrypt | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4835,7 +4889,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcrypto  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4839 "configure"
+#line 4893 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4846,7 +4900,7 @@ int main() {
 des_cbc_encrypt()
 ; return 0; }
 EOF
-if { (eval echo configure:4850: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4879,17 +4933,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4883: checking for $ac_hdr" >&5
+echo "configure:4937: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4888 "configure"
+#line 4942 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4947: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4939,7 +4993,7 @@ fi
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:4943: checking for a BSD compatible install" >&5
+echo "configure:4997: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
index e2623b041a64dd6a1e30380ad465df5ad55bcf85..32072b784f957010a54e6c56113c9bf9b299c014 100644 (file)
@@ -33,7 +33,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/missing/dlnames.c,v 1.4 2003-11-16 09:36:47 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/missing/dlnames.c,v 1.5 2003-11-18 23:09:43 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -49,83 +49,93 @@ static const char rcsid[] _U_ =
 
 struct dlt_choice {
        const char *name;
+       const char *description;
        int     dlt;
 };
 
-#define DLT_CHOICE(code) { #code, code }
-#define DLT_CHOICE_SENTINEL { NULL, 0 }
+#define DLT_CHOICE(code, description) { #code, description, code }
+#define DLT_CHOICE_SENTINEL { NULL, NULL, 0 }
 
 static struct dlt_choice dlt_choices[] = {
-       DLT_CHOICE(DLT_ARCNET),
-       DLT_CHOICE(DLT_EN10MB),
-       DLT_CHOICE(DLT_SLIP),
+       DLT_CHOICE(DLT_NULL, "BSD loopback"),
+       DLT_CHOICE(DLT_EN10MB, "Ethernet"),
+       DLT_CHOICE(DLT_IEEE802, "Token ring"),
+       DLT_CHOICE(DLT_ARCNET, "ARCNET"),
+       DLT_CHOICE(DLT_SLIP, "SLIP"),
+       DLT_CHOICE(DLT_PPP, "PPP"),
+       DLT_CHOICE(DLT_FDDI, "FDDI"),
+       DLT_CHOICE(DLT_ATM_RFC1483, "RFC 1483 IP-over-ATM"),
+       DLT_CHOICE(DLT_RAW, "Raw IP"),
 #ifdef DLT_SLIP_BSDOS
-       DLT_CHOICE(DLT_SLIP_BSDOS),
+       DLT_CHOICE(DLT_SLIP_BSDOS, "BSD/OS SLIP"),
 #endif
-       DLT_CHOICE(DLT_NULL),
-#ifdef DLT_LOOP
-       DLT_CHOICE(DLT_LOOP),
+#ifdef DLT_PPP_BSDOS
+       DLT_CHOICE(DLT_PPP_BSDOS, "BSD/OS PPP"),
 #endif
-       DLT_CHOICE(DLT_PPP),
-#ifdef DLT_C_HDLC
-       DLT_CHOICE(DLT_C_HDLC),
+#ifdef DLT_ATM_CLIP
+       DLT_CHOICE(DLT_ATM_CLIP, "Linux Classical IP-over-ATM"),
 #endif
 #ifdef DLT_PPP_SERIAL
-       DLT_CHOICE(DLT_PPP_SERIAL),
+       DLT_CHOICE(DLT_PPP_SERIAL, "PPP over serial"),
 #endif
 #ifdef DLT_PPP_ETHER
-       DLT_CHOICE(DLT_PPP_ETHER),
+       DLT_CHOICE(DLT_PPP_ETHER, "PPPoE"),
 #endif
-#ifdef DLT_PPP_BSDOS
-       DLT_CHOICE(DLT_PPP_BSDOS),
+#ifdef DLT_C_HDLC
+       DLT_CHOICE(DLT_C_HDLC, "Cisco HDLC"),
 #endif
-       DLT_CHOICE(DLT_FDDI),
-       DLT_CHOICE(DLT_IEEE802),
 #ifdef DLT_IEEE802_11
-       DLT_CHOICE(DLT_IEEE802_11),
-#endif
-#ifdef DLT_PRISM_HEADER
-       DLT_CHOICE(DLT_PRISM_HEADER),
+       DLT_CHOICE(DLT_IEEE802_11, "802.11"),
 #endif
-#ifdef DLT_IEEE802_11_RADIO
-       DLT_CHOICE(DLT_IEEE802_11_RADIO),
+#ifdef DLT_FRELAY
+       DLT_CHOICE(DLT_FRELAY, "Frame Relay"),
 #endif
-       DLT_CHOICE(DLT_ATM_RFC1483),
-#ifdef DLT_ATM_CLIP
-       DLT_CHOICE(DLT_ATM_CLIP),
+#ifdef DLT_LOOP
+       DLT_CHOICE(DLT_LOOP, "OpenBSD loopback"),
 #endif
-#ifdef DLT_SUNATM
-       DLT_CHOICE(DLT_SUNATM),
+#ifdef DLT_ENC
+       DLT_CHOICE(DLT_ENC, "OpenBSD encapsulated IP"),
 #endif
-       DLT_CHOICE(DLT_RAW),
 #ifdef DLT_LINUX_SLL
-       DLT_CHOICE(DLT_LINUX_SLL),
+       DLT_CHOICE(DLT_LINUX_SLL, "Linux cooked"),
 #endif
 #ifdef DLT_LTALK
-       DLT_CHOICE(DLT_LTALK),
+       DLT_CHOICE(DLT_LTALK, "Localtalk"),
+#endif
+#ifdef DLT_PFLOG
+       DLT_CHOICE(DLT_PFLOG, "OpenBSD pflog file"),
+#endif
+#ifdef DLT_PRISM_HEADER
+       DLT_CHOICE(DLT_PRISM_HEADER, "802.11 plus Prism header"),
 #endif
 #ifdef DLT_IP_OVER_FC
-       DLT_CHOICE(DLT_IP_OVER_FC),
+       DLT_CHOICE(DLT_IP_OVER_FC, "RFC 2625 IP-over-Fibre Channel"),
 #endif
-#ifdef DLT_FRELAY
-       DLT_CHOICE(DLT_FRELAY),
+#ifdef DLT_SUNATM
+       DLT_CHOICE(DLT_SUNATM, "Sun raw ATM"),
+#endif
+#ifdef DLT_IEEE802_11_RADIO
+       DLT_CHOICE(DLT_IEEE802_11_RADIO, "802.11 plus radio information header"),
+#endif
+#ifdef DLT_ARCNET_LINUX
+       DLT_CHOICE(DLT_ARCNET_LINUX, "Linux ARCNET"),
+#endif
+#ifdef DLT_LINUX_IRDA
+       DLT_CHOICE(DLT_LINUX_IRDA, "Linux IrDA"),
 #endif
-
 #ifdef DLT_LANE8023
-       DLT_CHOICE(DLT_LANE8023),
+       DLT_CHOICE(DLT_LANE8023, "Linux 802.3 LANE"),
 #endif
 #ifdef DLT_CIP
-       DLT_CHOICE(DLT_CIP),
+       DLT_CHOICE(DLT_CIP, "Linux Classical IP-over-ATM"),
 #endif
 #ifdef DLT_HDLC
-       DLT_CHOICE(DLT_HDLC),
-#endif
-#ifdef DLT_PFLOG
-       DLT_CHOICE(DLT_PFLOG),
+       DLT_CHOICE(DLT_HDLC, "Cisco HDLC"),
 #endif
        DLT_CHOICE_SENTINEL
 };
 
+#ifndef HAVE_PCAP_DATALINK_NAME_TO_VAL
 int
 pcap_datalink_name_to_val(const char *name)
 {
@@ -150,3 +160,16 @@ pcap_datalink_val_to_name(int dlt)
        }
        return (NULL);
 }
+#endif
+
+const char *
+pcap_datalink_val_to_description(int dlt)
+{
+       int i;
+
+       for (i = 0; dlt_choices[i].name != NULL; i++) {
+               if (dlt_choices[i].dlt == dlt)
+                       return (dlt_choices[i].description);
+       }
+       return (NULL);
+}
index 9a86110c66765361d72ad1f52df0093a08f12477..64e5b00bd2e6a4b825d578055b5ee30e3587e2e4 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/pcap-missing.h,v 1.1 2002-12-19 09:27:57 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/pcap-missing.h,v 1.2 2003-11-18 23:09:42 guy Exp $ (LBL)
  */
 
 #ifndef tcpdump_pcap_missing_h
@@ -40,6 +40,10 @@ extern int pcap_datalink_name_to_val(const char *);
 extern const char *pcap_datalink_val_to_name(int);
 #endif
 
+#ifndef HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION
+extern const char *pcap_datalink_val_to_description(int);
+#endif
+
 #endif
 
 
index a8b2fcae18a1a793359fb5806469972a0788aece..b00683a8e762ebaddb8bcca2bd65116f95ec3090 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -30,7 +30,7 @@ static const char copyright[] _U_ =
     "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
 The Regents of the University of California.  All rights reserved.\n";
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.219 2003-11-18 08:53:19 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.220 2003-11-18 23:09:43 guy Exp $ (LBL)";
 #endif
 
 /*
@@ -256,7 +256,8 @@ show_dlts_and_exit(pcap_t *pd)
        while (--n_dlts >= 0) {
                dlt_name = pcap_datalink_val_to_name(dlts[n_dlts]);
                if (dlt_name != NULL) {
-                       (void) fprintf(stderr, "  %s", dlt_name);
+                       (void) fprintf(stderr, "  %s (%s)", dlt_name,
+                           pcap_datalink_val_to_description(dlts[n_dlts]));
 
                        /*
                         * OK, does tcpdump handle that type?
@@ -634,10 +635,14 @@ main(int argc, char **argv)
                        error("%s", ebuf);
                dlt = pcap_datalink(pd);
                dlt_name = pcap_datalink_val_to_name(dlt);
-               if (dlt_name == NULL)
-                       dlt_name = "???";
-                printf("reading from file %s, link-type %u (%s)\n",
-                      RFileName, dlt, dlt_name);
+               if (dlt_name == NULL) {
+                       printf("reading from file %s, link-type %u\n",
+                           RFileName, dlt);
+               } else {
+                       printf("reading from file %s, link-type %s (%s)\n",
+                           RFileName, dlt_name,
+                           pcap_datalink_val_to_description(dlt));
+               }
                localnet = 0;
                netmask = 0;
                if (fflag != 0)
@@ -783,10 +788,14 @@ main(int argc, char **argv)
                        (void)fprintf(stderr, "%s: ", program_name);
                dlt = pcap_datalink(pd);
                dlt_name = pcap_datalink_val_to_name(dlt);
-               if (dlt_name == NULL)
-                       dlt_name = "???";
-               (void)fprintf(stderr, "listening on %s, link-type %u (%s), capture size %u bytes\n",
-                   device, dlt, dlt_name, snaplen);
+               if (dlt_name == NULL) {
+                       (void)fprintf(stderr, "listening on %s, link-type %u, capture size %u bytes\n",
+                           device, dlt, snaplen);
+               } else {
+                       (void)fprintf(stderr, "listening on %s, link-type %s (%s), capture size %u bytes\n",
+                           device, dlt_name,
+                           pcap_datalink_val_to_description(dlt), snaplen);
+               }
                (void)fflush(stderr);
        }
 #endif /* WIN32 */