components/snort/patches/solaris-build.patch
author Rich Burridge <rich.burridge@oracle.com>
Mon, 10 Nov 2014 19:14:43 -0800
changeset 2198 168b8acace5f
parent 1345 ee87318d9935
child 7650 2e39c59b83f8
permissions -rw-r--r--
PSARC 2014/346 Data Acquisition library (DAQ) 2.0.2 PSARC 2014/347 snort 2.9.6.2 16915792 The default state of the snort.conf file should be reexamined. 16915848 snort should put files under /etc/snort not directly under /etc 19557337 ipfw DAQ module shouldn't be enabled on Solaris 19696371 Update daq to version 2.0.2 19696436 Update snort to version 2.9.6.2

This patch does three things:

1/ Uses gethrtime() rather than trying to read the %tick register (the
   latter has issues in MP environments)
2/ Allows Studio to compile in 64-bit and normal optimization.
3/ Removed the need to define lines like "CFLAGS += -Du_int8_t=uint8_t"
   in the snort component Makefile.

It has been sent upstream for consideration by the snort maintainers for
a future release.

--- configure.in.orig	2014-09-25 08:05:35.171512464 -0700
+++ configure.in	2014-09-25 08:06:12.896272259 -0700
@@ -746,27 +746,8 @@
     AC_MSG_RESULT(no)
 fi
 
-# check for sparc %time register
-if eval "echo $host_cpu|grep -i sparc >/dev/null"; then
-    OLD_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS -mcpu=v9 "
-    AC_MSG_CHECKING([for sparc %time register])
-    AC_RUN_IFELSE(
-    [AC_LANG_PROGRAM(
-    [[]],
-    [[
-        int val;
-        __asm__ __volatile__("rd %%tick, %0" : "=r"(val));
-    ]])],
-    [sparcv9="yes"],
-    [sparcv9="no"])
-    AC_MSG_RESULT($sparcv9)
-    if test "x$sparcv9" = "xyes"; then
-        AC_DEFINE([SPARCV9],[1],[For sparc v9 with %time register])
-    else
-        CFLAGS="$OLD_CFLAGS"
-    fi
-fi
+# Check for the presence of the Solaris gethrtime routine.
+AC_CHECK_FUNCS(gethrtime)
 
 # modified from gnulib/m4/visibility.m4
 AC_DEFUN([CC_VISIBILITY],
--- src/cpuclock.h.orig	2014-09-25 08:07:00.139948870 -0700
+++ src/cpuclock.h	2014-09-25 08:08:38.401237764 -0700
@@ -84,26 +84,15 @@
     val = ((uint64_t)tbl) | (((uint64_t)tbu0) << 32);  \
 }
 #else
-/* SPARC */
-#ifdef SPARCV9
-#ifdef _LP64
+/* SOLARIS */
+#ifdef HAVE_GETHRTIME
 #define get_clockticks(val) \
 { \
-    __asm__ __volatile__("rd %%tick, %0" : "=r"(val)); \
+    val = gethrtime(); \
 }
 #else
-#define get_clockticks(val) \
-{ \
-    uint32_t a, b; \
-    __asm__ __volatile__("rd %%tick, %0\n" \
-                         "srlx %0, 32, %1" \
-                         : "=r"(a), "=r"(b)); \
-    val = ((uint64_t)a) | (((uint64_t)b) << 32); \
-}
-#endif /* _LP64 */
-#else
 #define get_clockticks(val)
-#endif /* SPARC */
+#endif /* HAVE_GETTHRTIME */
 #endif /* POWERPC || PPC */
 #endif /* IA64 && HPUX */
 #endif /* IA64 && GNUC */
--- src/sfutil/sf_ip.h.orig	2014-09-25 08:09:20.181312683 -0700
+++ src/sfutil/sf_ip.h	2014-09-25 08:09:41.442009279 -0700
@@ -39,6 +39,7 @@
 #endif
 
 #include "snort_debug.h" /* for inline definition */
+#include "sf_types.h"
 
 /* define SFIP_ROBUST to check pointers passed into the sfip libs.
  * Robustification should not be enabled if the client code is trustworthy.