Small updates and a little standardization for config.h.in naming.

This commit is contained in:
Seth Hall 2012-06-17 22:55:11 -04:00
parent 57980c86e6
commit cb7eac212e
7 changed files with 32 additions and 18 deletions

View file

@ -122,13 +122,13 @@ if (LINTEL_FOUND AND DATASERIES_FOUND AND LIBXML2_FOUND)
list(APPEND OPTLIBS ${LibXML2_LIBRARIES}) list(APPEND OPTLIBS ${LibXML2_LIBRARIES})
endif() endif()
set(USE_LIBCURL false) set(USE_CURL false)
find_package(CURL) find_package(CURL)
if (CURL_FOUND) if (CURL_FOUND)
set(USE_LIBCURL true) set(USE_CURL true)
include_directories(BEFORE ${CURL_INCLUDE_DIR}) include_directories(BEFORE ${CURL_INCLUDE_DIR})
list(APPEND OPTLIBS ${CURL_LIBRARIES}) list(APPEND OPTLIBS ${CURL_LIBRARIES})
set(INSTALL_ELASTICSEARCH true) set(USE_ELASTICSEARCH true)
endif() endif()
if (ENABLE_PERFTOOLS_DEBUG) if (ENABLE_PERFTOOLS_DEBUG)
@ -218,13 +218,14 @@ message(
"\nBroccoli: ${INSTALL_BROCCOLI}" "\nBroccoli: ${INSTALL_BROCCOLI}"
"\nBroctl: ${INSTALL_BROCTL}" "\nBroctl: ${INSTALL_BROCTL}"
"\nAux. Tools: ${INSTALL_AUX_TOOLS}" "\nAux. Tools: ${INSTALL_AUX_TOOLS}"
"\nElasticSearch: ${INSTALL_ELASTICSEARCH}"
"\n" "\n"
"\nGeoIP: ${USE_GEOIP}" "\nGeoIP: ${USE_GEOIP}"
"\nGoogle perftools: ${USE_PERFTOOLS}" "\nGoogle perftools: ${USE_PERFTOOLS}"
"\n debugging: ${USE_PERFTOOLS_DEBUG}" "\n debugging: ${USE_PERFTOOLS_DEBUG}"
"\ncURL: ${USE_CURL}"
"\n"
"\nDataSeries: ${USE_DATASERIES}" "\nDataSeries: ${USE_DATASERIES}"
"\nlibCURL: ${USE_LIBCURL}" "\nElasticSearch: ${USE_ELASTICSEARCH}"
"\n" "\n"
"\n================================================================\n" "\n================================================================\n"
) )

View file

@ -114,11 +114,14 @@
/* Analyze Mobile IPv6 traffic */ /* Analyze Mobile IPv6 traffic */
#cmakedefine ENABLE_MOBILE_IPV6 #cmakedefine ENABLE_MOBILE_IPV6
/* Use libCurl. */
#cmakedefine USE_CURL
/* Use the DataSeries writer. */ /* Use the DataSeries writer. */
#cmakedefine USE_DATASERIES #cmakedefine USE_DATASERIES
/* Build the ElasticSearch writer. */ /* Use the ElasticSearch writer. */
#cmakedefine INSTALL_ELASTICSEARCH #cmakedefine USE_ELASTICSEARCH
/* Version number of package */ /* Version number of package */
#define VERSION "@VERSION@" #define VERSION "@VERSION@"

1
configure vendored
View file

@ -98,7 +98,6 @@ append_cache_entry BRO_SCRIPT_INSTALL_PATH STRING $prefix/share/bro
append_cache_entry BRO_ETC_INSTALL_DIR PATH $prefix/etc append_cache_entry BRO_ETC_INSTALL_DIR PATH $prefix/etc
append_cache_entry ENABLE_DEBUG BOOL false append_cache_entry ENABLE_DEBUG BOOL false
append_cache_entry ENABLE_PERFTOOLS_DEBUG BOOL false append_cache_entry ENABLE_PERFTOOLS_DEBUG BOOL false
append_cache_entry INSTALL_ELASTICSEARCH BOOL false
append_cache_entry BinPAC_SKIP_INSTALL BOOL true append_cache_entry BinPAC_SKIP_INSTALL BOOL true
append_cache_entry BUILD_SHARED_LIBS BOOL true append_cache_entry BUILD_SHARED_LIBS BOOL true
append_cache_entry INSTALL_AUX_TOOLS BOOL true append_cache_entry INSTALL_AUX_TOOLS BOOL true

View file

@ -26,16 +26,15 @@ ElasticSearch with::
Compiling Bro with ElasticSearch Support Compiling Bro with ElasticSearch Support
---------------------------------------- ----------------------------------------
First, ensure that you have libcurl installed. Secondly, set the First, ensure that you have libcurl installed the run configure.::
``--enable-elasticsearch`` option::
# ./configure --enable-elasticsearch # ./configure
[...] [...]
====================| Bro Build Summary |===================== ====================| Bro Build Summary |=====================
[...] [...]
ElasticSearch: true cURL: true
[...] [...]
libCURL: true ElasticSearch: true
[...] [...]
================================================================ ================================================================

View file

@ -17,7 +17,7 @@
#include "writers/Ascii.h" #include "writers/Ascii.h"
#include "writers/None.h" #include "writers/None.h"
#ifdef INSTALL_ELASTICSEARCH #ifdef USE_ELASTICSEARCH
#include "writers/ElasticSearch.h" #include "writers/ElasticSearch.h"
#endif #endif
@ -40,7 +40,7 @@ WriterDefinition log_writers[] = {
{ BifEnum::Log::WRITER_NONE, "None", 0, writer::None::Instantiate }, { BifEnum::Log::WRITER_NONE, "None", 0, writer::None::Instantiate },
{ BifEnum::Log::WRITER_ASCII, "Ascii", 0, writer::Ascii::Instantiate }, { BifEnum::Log::WRITER_ASCII, "Ascii", 0, writer::Ascii::Instantiate },
#ifdef INSTALL_ELASTICSEARCH #ifdef USE_ELASTICSEARCH
{ BifEnum::Log::WRITER_ELASTICSEARCH, "ElasticSearch", 0, writer::ElasticSearch::Instantiate }, { BifEnum::Log::WRITER_ELASTICSEARCH, "ElasticSearch", 0, writer::ElasticSearch::Instantiate },
#endif #endif

View file

@ -2,7 +2,7 @@
#include "config.h" #include "config.h"
#ifdef INSTALL_ELASTICSEARCH #ifdef USE_ELASTICSEARCH
#include <string> #include <string>
#include <errno.h> #include <errno.h>
@ -261,7 +261,7 @@ CURL* ElasticSearch::HTTPSetup()
// HTTP 1.1 likes to use chunked encoded transfers, which aren't good for speed. The best (only?) way to disable that is to // HTTP 1.1 likes to use chunked encoded transfers, which aren't good for speed. The best (only?) way to disable that is to
// just use HTTP 1.0 // just use HTTP 1.0
curl_easy_setopt(handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); //curl_easy_setopt(handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
return handle; return handle;
} }
@ -275,8 +275,8 @@ bool ElasticSearch::HTTPSend()
{ {
CURLcode return_code; CURLcode return_code;
curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE_LARGE, buffer.Len());
curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, buffer.Bytes()); curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, buffer.Bytes());
curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, buffer.Len());
return_code = curl_easy_perform(curl_handle); return_code = curl_easy_perform(curl_handle);
switch ( return_code ) switch ( return_code )

View file

@ -12,6 +12,10 @@
#include <getopt.h> #include <getopt.h>
#endif #endif
#ifdef USE_CURL
#include <curl/curl.h>
#endif
#ifdef USE_IDMEF #ifdef USE_IDMEF
extern "C" { extern "C" {
#include <libidmef/idmefxml.h> #include <libidmef/idmefxml.h>
@ -716,6 +720,10 @@ int main(int argc, char** argv)
SSL_library_init(); SSL_library_init();
SSL_load_error_strings(); SSL_load_error_strings();
#ifdef USE_CURL
curl_global_init(CURL_GLOBAL_ALL);
#endif
// FIXME: On systems that don't provide /dev/urandom, OpenSSL doesn't // FIXME: On systems that don't provide /dev/urandom, OpenSSL doesn't
// seed the PRNG. We should do this here (but at least Linux, FreeBSD // seed the PRNG. We should do this here (but at least Linux, FreeBSD
// and Solaris provide /dev/urandom). // and Solaris provide /dev/urandom).
@ -1066,6 +1074,10 @@ int main(int argc, char** argv)
done_with_network(); done_with_network();
net_delete(); net_delete();
#ifdef USE_CURL
curl_global_cleanup();
#endif
terminate_bro(); terminate_bro();
// Close files after net_delete(), because net_delete() // Close files after net_delete(), because net_delete()