]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Merge pull request #404 from qnet-herwin/print_radius_tag
authorDenis Ovsienko <[email protected]>
Sat, 6 Sep 2014 19:26:04 +0000 (20:26 +0100)
committerDenis Ovsienko <[email protected]>
Sat, 6 Sep 2014 19:26:04 +0000 (20:26 +0100)
aclocal.m4
configure
ip.h
machdep.c
netdissect.h
tcpdump.c

index 74fe833c58eea16dc6246739c075a307158bef91..80614cf21050b92f5c6e18020f30662ca82935e9 100644 (file)
@@ -443,7 +443,9 @@ AC_DEFUN(AC_LBL_LIBPCAP,
     lastdir=FAIL
     places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
        egrep '/libpcap-[[0-9]]+\.[[0-9]]+(\.[[0-9]]*)?([[ab]][[0-9]]*|-PRE-GIT)?$'`
-    for dir in $places $srcdir/../libpcap $srcdir/libpcap ; do
+    places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \
+       egrep '/libpcap-[[0-9]]+\.[[0-9]]+(\.[[0-9]]*)?([[ab]][[0-9]]*|-PRE-GIT)?$'`
+    for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do
            basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//' | \
                sed -e 's/-PRE-GIT$//' `
            if test $lastdir = $basedir ; then
@@ -526,13 +528,23 @@ AC_DEFUN(AC_LBL_LIBPCAP,
            $1=$libpcap
            places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
                        egrep '/libpcap-[[0-9]]*.[[0-9]]*(.[[0-9]]*)?([[ab]][[0-9]]*)?$'`
+           places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \
+                       egrep '/libpcap-[[0-9]]*.[[0-9]]*(.[[0-9]]*)?([[ab]][[0-9]]*)?$'`
+            pcapH=FAIL
            if test -r $d/pcap.h; then
-                   $2="-I$d $$2"
-           elif test -r $places/pcap.h; then
-                   $2="-I$places $$2"
+                    pcapH=$d
            else
-                    AC_MSG_ERROR(cannot find pcap.h, see INSTALL)
+                for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do
+                   if test -r $dir/pcap.h ; then
+                       pcapH=$dir
+                   fi
+                done
+            fi
+
+            if test $pcapH = FAIL ; then
+                    AC_MSG_ERROR(cannot find pcap.h: see INSTALL)
            fi
+            $2="-I$pcapH $$2"
            AC_MSG_RESULT($libpcap)
            AC_PATH_PROG(PCAP_CONFIG, pcap-config,, $d)
            if test -n "$PCAP_CONFIG"; then
index 91a03a7ca6b19271cb6be8b0ccafd8af8b4236c0..3e195e25c6a2b4480fe3c0ff0df311ff8ec1a339 100755 (executable)
--- a/configure
+++ b/configure
@@ -5806,7 +5806,9 @@ $as_echo_n "checking for local pcap library... " >&6; }
     lastdir=FAIL
     places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
        egrep '/libpcap-[0-9]+\.[0-9]+(\.[0-9]*)?([ab][0-9]*|-PRE-GIT)?$'`
-    for dir in $places $srcdir/../libpcap $srcdir/libpcap ; do
+    places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \
+       egrep '/libpcap-[0-9]+\.[0-9]+(\.[0-9]*)?([ab][0-9]*|-PRE-GIT)?$'`
+    for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do
            basedir=`echo $dir | sed -e 's/[ab][0-9]*$//' | \
                sed -e 's/-PRE-GIT$//' `
            if test $lastdir = $basedir ; then
@@ -6002,13 +6004,23 @@ $as_echo "found -- -I$d added" >&6; }
            V_PCAPDEP=$libpcap
            places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
                        egrep '/libpcap-[0-9]*.[0-9]*(.[0-9]*)?([ab][0-9]*)?$'`
+           places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \
+                       egrep '/libpcap-[0-9]*.[0-9]*(.[0-9]*)?([ab][0-9]*)?$'`
+            pcapH=FAIL
            if test -r $d/pcap.h; then
-                   V_INCLS="-I$d $V_INCLS"
-           elif test -r $places/pcap.h; then
-                   V_INCLS="-I$places $V_INCLS"
+                    pcapH=$d
            else
-                    as_fn_error see INSTALL "cannot find pcap.h" "$LINENO" 5
+                for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do
+                   if test -r $dir/pcap.h ; then
+                       pcapH=$dir
+                   fi
+                done
+            fi
+
+            if test $pcapH = FAIL ; then
+                    as_fn_error $? "cannot find pcap.h: see INSTALL" "$LINENO" 5
            fi
+            V_INCLS="-I$pcapH $V_INCLS"
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libpcap" >&5
 $as_echo "$libpcap" >&6; }
            # Extract the first word of "pcap-config", so it can be a program name with args.
diff --git a/ip.h b/ip.h
index 891a89cd2d4d57af775b25e7740be0685278e77e..72c8972680a3a27295fb294dae983a627f8f606f 100644 (file)
--- a/ip.h
+++ b/ip.h
@@ -36,6 +36,8 @@
 #ifndef TCPDUMP_IP_H
 #define TCPDUMP_IP_H
 
+#include "tcpdump-stdinc.h"
+
 /*
  * Definitions for internet protocol version 4.
  * Per RFC 791, September 1981.
index 3b8c9664f26669a38e5aaea3fc6903e61ece4e1c..7b259ae1c432089d714692ea3fe8cc7626e81b69 100644 (file)
--- a/machdep.c
+++ b/machdep.c
@@ -50,6 +50,15 @@ int snprintf(char *, size_t, const char *, ...)
 
 #include "machdep.h"
 
+/*
+ * On platforms where the CPU doesn't support unaligned loads, force
+ * unaligned accesses to abort with SIGBUS, rather than being fixed
+ * up (slowly) by the OS kernel; on those platforms, misaligned accesses
+ * are bugs, and we want tcpdump to crash so that the bugs are reported.
+ *
+ * The only OS on which this is necessary is DEC OSF/1^W^WDigital
+ * UNIX^W^WTru64 UNIX.
+ */
 int
 abort_on_misalignment(char *ebuf _U_, size_t ebufsiz _U_)
 {
index 55d45b2a9ea6b2d4bee497887758341fa88624f5..ceea4690ea23e47cf45ce84c8e29c9efa06384a1 100644 (file)
@@ -156,14 +156,18 @@ struct netdissect_options {
   /* pointer to void function to output stuff */
   void (*ndo_default_print)(netdissect_options *,
                      register const u_char *bp, register u_int length);
+
+  /* pointer to function to print ^T output */
   void (*ndo_info)(netdissect_options *, int verbose);
 
+  /* pointer to function to do regular output */
   int  (*ndo_printf)(netdissect_options *,
                     const char *fmt, ...)
 #ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
                     __attribute__ ((format (printf, 2, 3)))
 #endif
                     ;
+  /* pointer to function to output errors */
   void (*ndo_error)(netdissect_options *,
                    const char *fmt, ...)
 #ifdef __ATTRIBUTE___NORETURN_OK_FOR_FUNCTION_POINTERS
@@ -173,6 +177,7 @@ struct netdissect_options {
                     __attribute__ ((format (printf, 2, 3)))
 #endif /* __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS */
                     ;
+  /* pointer to function to output warnings */
   void (*ndo_warning)(netdissect_options *,
                      const char *fmt, ...)
 #ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
index 8d615d74cb8c2bbc3097521b855e5143193845bb..de0e320e675a7486a7e85a4eb527a77eacbdc2ee 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -951,6 +951,13 @@ main(int argc, char **argv)
        else
                program_name = argv[0];
 
+       /*
+        * On platforms where the CPU doesn't support unaligned loads,
+        * force unaligned accesses to abort with SIGBUS, rather than
+        * being fixed up (slowly) by the OS kernel; on those platforms,
+        * misaligned accesses are bugs, and we want tcpdump to crash so
+        * that the bugs are reported.
+        */
        if (abort_on_misalignment(ebuf, sizeof(ebuf)) < 0)
                error("%s", ebuf);