Commit graph

6667 commits

Author SHA1 Message Date
Robin Sommer
b6991d405b Merge remote-tracking branch 'origin/fastpath' into topic/robin/master-test
* origin/fastpath:
  make version_ok return true for TLSv12
2012-07-23 15:46:04 -07:00
Jon Siwek
9b0fe744f2 Fix WriterBackend::WriterInfo serialization, reenable ascii start/end tags.
Instantiations of WriterInfo in RemoteSerializer::ProcessLogCreateWriter()
would leave the network_time member uninitialized which could later
cause localtime_r() calls in Ascii::Timestamp() to return a null pointer
due to the bizarre input and giving that to strftime() causes it to segfault.
2012-07-23 16:47:44 -05:00
Bernhard Amann
90735c3164 and just to be a little bit careful - add check if the field description is long enough.
Otherwise there might possibly be an access of uninitialized memory, when someone reads a file
that contains just #fields without any following field descriptions.
2012-07-23 12:51:07 -07:00
Bernhard Amann
8e453663dd Input framework now accepts escaped ascii values as input.
I managed to completely forget to add unescaping to the input framework -
this should fix it. It now works with the exact same escaping that is
used by the writers (\x##).

Includes one testcase that seems to work - everything else still passes.
2012-07-23 12:43:42 -07:00
Bernhard Amann
336990e234 make reading ascii logfiles work when the input separator is different from \t.
(Wrong escape character was used for reading header fields).
2012-07-23 11:27:08 -07:00
Robin Sommer
71fc2a1728 Another small change to MsgThread API.
Threads will now reliably get a call to DoFinish() no matter how the
thread terminates. This will always be called from within the thread,
whereas the destructor is called from the main thread after the child
thread has already terminated.

Also removing debugging code.

However, two problems remain with the ASCII writer (seeing them only
on MacOS):

    - the #start/#end timestamps contain only dummy values right now.
      The odd thing is that once I enable strftime() to print actual
      timestamps, I get crashes (even though strftime() is supposed to
      be thread-safe).

    - occassionally, there's still output missing in tests. In those
      cases, the file descriptor apparently goes bad: a write() will
      suddently return EBADF for reasons I don't understand yet.
2012-07-22 15:50:12 -07:00
Robin Sommer
053b307e24 Bug fix for BasicThread. 2012-07-22 13:42:31 -07:00
Bernhard Amann
642273bc58 Merge remote-tracking branch 'origin/fastpath' into fastpath 2012-07-20 14:37:53 -07:00
Bernhard Amann
58e2b70fc8 make version_ok return true for TLSv12
I think it is a bug that this was missing...
2012-07-20 14:37:14 -07:00
Robin Sommer
eef8b7d1c4 Merge remote-tracking branch 'remotes/origin/topic/seth/elasticsearch' into topic/robin/master-test
I've only tested that it compiles, not whether it still works. The
fact that we don't have any tests for this makes me uneasy ...

* remotes/origin/topic/seth/elasticsearch: (35 commits)
  Some documentation updates for elasticsearch plugin.
  Temporarily removing the ES timeout because it works with signals and is incompatible with Bro threads.
  Changed ES index names to localtime and added a meta index.
  New script for easily duplicating logs to ElasticSearch.
  Some better elasticsearch reliability.
  Fixed small elasticsearch problem in configure output.
  Re-adding the needed call to FinishedRotation in the ES writer plugin.
  Tiny updates.
  Bringing elasticsearch branch up to date with master.
  Adding a define to make the stdint C macros available.
  Adding an extra header.
  Fixed a bug with messed up time value passing to elasticsearch.
  Small updates and a little standardization for config.h.in naming.
  Bug fixes.
  Bug fix and feature.
  Forgot to call the parent method for DoHeartBeat.
  Changed the escaping method.
  Flush logs to ES daemon as Bro is shutting down.
  Reduce the batch size to 1000 and add a maximum time interval for batches.
  Reworked bulk operation string construction to use ODesc and added json escaping.
  ...
2012-07-20 07:43:05 -07:00
Robin Sommer
0a681367b7 Revert "Fixing calc_next_rotate to use UTC based time functions."
This reverts commit 6335dbb5e1.
2012-07-20 06:58:39 -07:00
Robin Sommer
450b49d14d Merge branch 'fastpath' of ssh://git.bro-ids.org/bro into fastpath 2012-07-20 06:58:33 -07:00
Robin Sommer
5cfb8d65c3 Updating tests for the #start/#end change. 2012-07-19 22:28:55 -07:00
Robin Sommer
87e10b5f97 Further threading and API restructuring for logging and input
frameworks.

There were a number of cases that weren't thread-safe. In particular,
we don't use std::string anymore for anything that's passed between
threads (but instead plain old const char*, with manual memmory
managmenet).

This is still a check-point commit, I'll do more testing.
2012-07-19 22:28:30 -07:00
Robin Sommer
490859cfef Reworking forceful thread termination.
Ctrl-C now kills a thread even if it hangs at termination. And readded
a (rather long) timeout to kill threads automatically that don't
shutdown.
2012-07-19 21:22:28 -07:00
Robin Sommer
e90918aa50 Moving the ASCII writer over to use UNIX I/O rather than stdio. 2012-07-19 21:22:28 -07:00
Robin Sommer
f6b883bafc Further reworking the thread API. 2012-07-19 21:22:28 -07:00
Robin Sommer
f7a6407ab1 Reworking thread termination logic.
Turns out the finish methods weren't called correctly, caused by a
mess up with method names which all sounded too similar and the wrong
one ended up being called. I've reworked this by changing the
thread/writer/reader interfaces, which actually also simplifies them
by getting rid of the requirement for writer backends to call their
parent methods (i.e., less opportunity for errors).

This commit also includes the following (because I noticed the problem
above when working on some of these):

     - The ASCII log writer now includes "#start <timestamp>" and
      "#end <timestamp> lines in the each file. The latter supersedes
      Bernhard's "EOF" patch.

      This required a number of tests updates. The standard canonifier
      removes the timestamps, but some tests compare files directly,
      which doesn't work if they aren't printing out the same
      timestamps (like the comm tests).

     - The above required yet another change to the writer API to
       network_time to methods.

     - Renamed ASCII logger "header" options to "meta".

     - Fixes #763 "Escape # when first character in log file line".

All btests pass for me on Linux FC15. Will try MacOS next.
2012-07-19 21:22:22 -07:00
Robin Sommer
c8789cff94 If a thread doesn't terminate, we log that but not longer proceed
(because it could hang later still).

Also logging to stderr as well to make sure one sees it.

Also adding code to the ASCII writer to catch termination
inconsistencies.
2012-07-19 21:21:53 -07:00
Robin Sommer
1ca0d970fc Removing the thread kill functionality.
Wasn't really used and has potential for trouble.
2012-07-19 21:21:53 -07:00
Robin Sommer
f73eb3b086 Reworking thread termination logic.
Turns out the finish methods weren't called correctly, caused by a
mess up with method names which all sounded too similar and the wrong
one ended up being called. I've reworked this by changing the
thread/writer/reader interfaces, which actually also simplifies them
by getting rid of the requirement for writer backends to call their
parent methods (i.e., less opportunity for errors).

This commit also includes the following (because I noticed the problem
above when working on some of these):

     - The ASCII log writer now includes "#start <timestamp>" and
      "#end <timestamp> lines in the each file. The latter supersedes
      Bernhard's "EOF" patch.

      This required a number of tests updates. The standard canonifier
      removes the timestamps, but some tests compare files directly,
      which doesn't work if they aren't printing out the same
      timestamps (like the comm tests).

     - The above required yet another change to the writer API to
       network_time to methods.

     - Renamed ASCII logger "header" options to "meta".

     - Fixes #763 "Escape # when first character in log file line".

All btests pass for me on Linux FC15. Will try MacOS next.
2012-07-19 21:21:53 -07:00
Seth Hall
0c4c5ff335 Temporarily removing the ES timeout because it works with signals and is incompatible with Bro threads. 2012-07-19 12:14:13 -04:00
Seth Hall
1826827359 Changed ES index names to localtime and added a meta index. 2012-07-18 15:42:23 -04:00
Seth Hall
6335dbb5e1 Fixing calc_next_rotate to use UTC based time functions. 2012-07-18 11:32:14 -04:00
Robin Sommer
50f5f8131d Revert "Fixed a couple of init-time mem leaks."
This reverts commit 750e1ddf69.
2012-07-18 07:29:01 -07:00
Seth Hall
1fa182c169 Some better elasticsearch reliability.
- Added a configurable option for timing out ES HTTP requests.

 - Stop sending reporter messages after one message for one failure.
2012-07-18 00:00:31 -04:00
Seth Hall
485e473561 Merge remote-tracking branch 'origin/master' into topic/seth/elasticsearch 2012-07-17 13:57:59 -04:00
Seth Hall
750e1ddf69 Fixed a couple of init-time mem leaks. 2012-07-16 15:51:47 -04:00
Robin Sommer
731292a7a9 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Fix overrides of TCP_ApplicationAnalyzer::EndpointEOF.
  Fix segfault when incrementing whole vector values.
  Remove baselines for some leak-detecting unit tests.
  Unblock SIGFPE, SIGILL, SIGSEGV and SIGBUS for threads.
2012-07-13 16:00:26 -07:00
Jon Siwek
0ef91538db Fix overrides of TCP_ApplicationAnalyzer::EndpointEOF.
In many cases, classes derived from TCP_ApplicationAnalyzer were
*overloading* instead of overriding EndpointEOF causing the parent
class version to become hidden in the child and also for the child's
version to never to called polymorphically from
TCP_Analyzer::EndpointEOF.  Clang gave a warning in each case.
2012-07-13 16:25:58 -05:00
Jon Siwek
353393f9bd Fix segfault when incrementing whole vector values.
Also removed RefExpr::Eval(Val*) method since it was never called
(Clang emitted warning about this hiding overloaded virtual function
UnaryExpr::Eval(Frame*)) and doesn't appear to be necessary even if it
was called to avoid the default vector handling of UnaryExpr::Eval
(as the comment suggests as the intention).
2012-07-13 14:32:50 -05:00
Jon Siwek
491c78e788 Merge branch 'master' into fastpath 2012-07-13 14:23:40 -05:00
Bernhard Amann
e1bd960926 Unblock SIGFPE, SIGILL, SIGSEGV and SIGBUS for threads.
According to POSIX, behavior is unspecified if a specific thread receives one of those signals (because of e.g. executing an invalid instruction) if the signal is blocked.

This resulted in segfaults in threads not propagating to the main thread.

Adresses #848
2012-07-13 02:20:41 -07:00
Seth Hall
5607e86ad3 Reporter warnings and error now print to stderr by default.
- Changed the geoip warnings to Info.
2012-07-12 12:55:34 -04:00
Robin Sommer
5d13e4f949 Merge remote-tracking branch 'origin/topic/seth/socks-fixes'
* origin/topic/seth/socks-fixes:
  Some small fixes to further reduce SOCKS false positive logs.

Closes #847.
2012-07-12 08:16:28 -07:00
Bernhard Amann
8ff8c66655 make pthread_mutex_unlock include the reason for why the unlock fails. 2012-07-11 20:10:49 -07:00
Seth Hall
a44612788e Some small fixes to further reduce SOCKS false positive logs. 2012-07-11 16:53:46 -04:00
Seth Hall
b31ef8cde5 Fixing memory leak. 2012-07-11 10:58:57 -04:00
Seth Hall
6e5382da54 Re-adding the needed call to FinishedRotation in the ES writer plugin. 2012-07-10 23:49:31 -04:00
Seth Hall
728888ad45 Merge remote-tracking branch 'origin/master' into topic/seth/elasticsearch 2012-07-10 20:32:42 -04:00
Robin Sommer
e3f6a467a4 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Add sorting canonifier to rotate-custom unit test. (addresses #846)
  Fix compiler warnings
  Fix segfault when there's an error/timeout resolving DNS requests.
2012-07-10 16:26:34 -07:00
Daniel Thayer
7f4b0b52f8 Fix compiler warnings
These changes eliminate 405 of 571 warnings seen on OS X 10.7.4 with clang.
2012-07-10 15:39:05 -05:00
Jon Siwek
c0bbd78ee1 Fix segfault when there's an error/timeout resolving DNS requests.
Addresses #846.
2012-07-10 11:15:48 -05:00
Seth Hall
9b70ee8799 Tiny updates. 2012-07-09 16:50:42 -04:00
Seth Hall
84e91b8b8d Bringing elasticsearch branch up to date with master. 2012-07-09 16:38:05 -04:00
Seth Hall
601d1cf37e Merge remote-tracking branch 'origin/master' into topic/seth/elasticsearch
Conflicts:
	aux/binpac
	aux/bro-aux
	aux/broccoli
	aux/broctl
	scripts/base/frameworks/logging/__load__.bro
	src/logging.bif
2012-07-06 12:01:16 -04:00
Robin Sommer
acb6c0a0a5 Merge branch 'robin/topic/writer-info'
* robin/topic/writer-info:
  Bugfix. Using a custom rotate function was broken.
2012-07-02 16:59:56 -07:00
Robin Sommer
d26a96bd47 Bugfix. Using a custom rotate function was broken. 2012-07-02 16:57:16 -07:00
Robin Sommer
3fcece44cb Tiny bugfix for returning writer name. 2012-07-02 16:36:09 -07:00
Robin Sommer
ff73f3a040 Fixing merge relicts. 2012-07-02 16:11:42 -07:00