Commit graph

103 commits

Author SHA1 Message Date
Jon Siwek
e60ceea87c Fix errors/warnings when compiling with -std=c++11
These are compatibility changes only.
2014-10-27 12:54:17 -05:00
Robin Sommer
e9692958f0 Merge remote-tracking branch 'origin/topic/jsiwek/improve_comm_loop'
* origin/topic/jsiwek/improve_comm_loop:
  Add a simple FD_Set wrapper/helper class.
  Fix Pipe copy/assignment to make a copy of flags.
  Fix possible abort on writing to a full pipe.
  Remove timeouts from remote communication loop.
2014-09-25 12:46:48 -07:00
Jon Siwek
59c54a0fc6 Add a simple FD_Set wrapper/helper class. 2014-09-09 16:28:04 -05:00
Jon Siwek
cf66bd8b69 Merge branch 'master' into topic/jsiwek/improve_comm_loop
Conflicts:
	src/CMakeLists.txt
	src/FlowSrc.cc
	src/FlowSrc.h
	src/IOSource.h
	src/PktSrc.cc
	src/PktSrc.h
	src/iosource/Manager.cc
2014-09-09 14:19:43 -05:00
Robin Sommer
4a66a8e341 Bugfixes and test updates. 2014-09-05 18:20:23 -07:00
Robin Sommer
c1c4e6eb63 Merge remote-tracking branch 'origin/master' into topic/robin/pktsrc 2014-09-05 16:01:23 -07:00
Jon Siwek
26887dd71b Merge branch 'master' into topic/jsiwek/improve_comm_loop 2014-09-03 09:20:38 -05:00
Jon Siwek
d57b161c40 Fix a memory leak when bind() fails due to EADDRINUSE. 2014-09-02 16:18:55 -05:00
Jon Siwek
675fba3fde Remove timeouts from remote communication loop.
The select() now blocks until there's work to do instead of relying on a
small timeout value which can cause unproductive use of cpu cycles.
2014-08-28 13:13:30 -05:00
Robin Sommer
bf6dd2e9ca Merge remote-tracking branch 'origin/master' into topic/robin/pktsrc
Conflicts:
	configure
	src/CMakeLists.txt
	src/Net.cc
	src/PacketSort.cc
	src/PacketSort.h
	src/RemoteSerializer.cc
	src/Sessions.cc
	src/Sessions.h
2014-08-22 15:41:42 -07:00
Robin Sommer
f4cbcb9b03 Converting log writers and input readers to plugins. 2014-07-20 19:17:58 +02:00
Robin Sommer
ba7af428a7 Merge remote-tracking branch 'origin/master' into topic/robin/dynamic-plugins-2.3 2014-06-13 09:27:02 -07:00
Jon Siwek
8383828b02 Fix potential mem leak in remote function/event unserialization.
I say potential because a code path to get in the required state is
not obvious (if one even exists).
2014-05-28 15:12:38 -05:00
Robin Sommer
bbd409d274 Merge remote-tracking branch 'origin/master' into topic/robin/dynamic-plugins-2.3
(Never good to name a branch after version anticipated to include it ...)
2014-05-14 16:23:04 -07:00
Jon Siwek
70131b5c84 Refactor SerializationFormat::EndWrite and ChunkedIO::Chunk mem mgmt.
SerializationFormat::EndWrite now transfers ownership of the buffer
to the caller instead of doing a memcpy.

ChunkedIO::Chunk is no longer a POD type, hopefully the ctor/dtor
make it easier to manage its associated memory.  It also now
tracks how to deallocate its buffer (i.e. delete vs. free).
2014-03-18 14:42:38 -05:00
Bernhard Amann
3f584a08fd Remove packet sorter. Addresses BIT-700 2014-02-25 19:20:42 -08:00
Robin Sommer
191b63e334 Merge branch 'topic/robin/dynamic-plugins-2.3' into topic/robin/pktsrc 2014-01-27 09:31:15 -08:00
Robin Sommer
93d9dde969 IOSource reorg.
A bunch of infrastructure work to move IOSource, IOSourceRegistry (now
iosource::Manager) and PktSrc/PktDumper code into iosource/, and over
to a plugin structure.

Other IOSources aren't touched yet, they are still in src/*.

It compiles and does something with a small trace, but that's all I've
tested so far. There are quite certainly a number of problems left, as
well as various TODOs and cleanup; and nothing's cast in stone yet.

Will continue to work on this.
2013-12-11 18:00:34 -08:00
Robin Sommer
555df1e7ea Checkpointing the dynamic plugin code.
This is essentially the code from the dynamic-plugin branch except for
some pieces that I have split out into separate, earlier commits.

I'm going to updatre things in this branch going forward.
2013-11-26 14:04:29 -08:00
Jon Siwek
38ae7c98b4 Fix misc. issues reported by Coverity.
Some uninitialized values, a possible null pointer dereference, and
time-of-check-time-of-use on reading random seed file.
2013-10-14 14:02:39 -05:00
Robin Sommer
d6855dc4eb Pass over the InternalError() changes. 2013-10-11 15:11:06 -07:00
Jon Siwek
b828a6ddc7 Review usage of Reporter::InternalError, addresses BIT-1045.
Replaced some with InternalWarning or InternalAnalyzerError, the later
being a new method which signals the analyzer to not process further
input.  Some usages I just removed if they didn't make sense or clearly
couldn't happen.  Also did some minor refactors of related code while
reviewing/exploring ways to get rid of InternalError usages.

Also, for TCP content file write failures there's a new event:
"contents_file_write_failure".
2013-10-10 14:45:06 -05:00
Jon Siwek
775ec6795e Fix uninitialized (or unused) fields. 2013-09-27 10:13:52 -05:00
Jon Siwek
64f3bef96d Remove logically dead code. 2013-09-25 13:37:46 -05:00
Jon Siwek
735d2c402a Fix/improve dereference-before-null-checks. 2013-09-13 16:41:41 -05:00
Jon Siwek
a99e873d5c Fix double-free and deallocator mismatch. 2013-09-13 14:30:22 -05:00
Jon Siwek
0b97343ff7 Fix various potential memory leaks.
Though I expect most not to be exercised in practice.
2013-09-12 15:23:52 -05:00
Jon Siwek
1fbeefedbc Fix two use-after-free bugs. 2013-09-10 13:30:23 -05:00
Robin Sommer
4494643296 Fix a compiler warning. 2013-06-02 20:13:51 -07:00
Robin Sommer
90fc5c97e5 Reporting warnings if kill/waitpid fail in communication system. Also
replace bzero with memset(). Patches from Bill Parker.
2012-12-05 15:50:15 -08:00
Jon Siwek
f403e537ec Fix segfault: uninitialized identifiers w/ &synchronized (addresses #66)
Synchronization of state between connecting peers now skips over
identifiers that aren't initialized with a value yet.  If they're
assigned a value later, that will be synchronized like usual.
2012-12-05 12:36:09 -06:00
Jon Siwek
a6f7fd9c87 Fix memory leak of serialized IDs when compiled with --enable-debug.
When using --enable-debug, values keep track of the last identifier
to which they were bound by storing a ref'd ID pointer.  This could
lead to some circular dependencies in which an ID is never reclaimed
because the Val is bound to the ID and the ID is bound to the Val, with
both holding references to each other.

There might be more cases where this feature of --enable-debug caused
a leak, but it showed up in particular when running the
core.leaks.remote unit test due to the internal
SendID("peer_description") call during the handshake between remote
processes.  Other tests showed the send_id() BIF leaked more generally.

Tracking the ID last bound to a Val through just the identifier string
instead of a ref'd ID pointer fixes the leak.
2012-08-16 15:59:26 -05:00
Jon Siwek
7b2c3db488 Improve log filter compatibility with remote logging.
If a log filter attempts to write to a path for which a writer is
already instantiated due to remote logging, it will re-use the writer
as long as the fields of the filter and writer are compatible, else
the filter path will be auto-adjusted to not conflict with existing
writer's.  Conflicts between two local filters are still always
auto-adjusted even if field types agree (since they could still
be semantically different).

Addresses #842.
2012-07-30 13:17:49 -05:00
Jon Siwek
734e5f68d3 Add more error handling for close() calls. 2012-07-26 12:40:12 -05: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
90763bb2f2 Merge branch 'robin/topic/writer-info'
* robin/topic/writer-info:
  Extending the log writer DoInit() API.
  Reworking log writer API to make it easier to pass additional information to a writer's initialization method.

Conflicts:
	src/logging/WriterBackend.cc
	src/logging/WriterBackend.h
	src/logging/WriterFrontend.cc
2012-07-02 15:20:37 -07:00
Robin Sommer
9f6cf1ad90 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Fix inconsistencies in random number generation.
  Updating input framework unit tests.
  Add front-end name to InitMessage from WriterFrontend to Backend.
  Small tweak to make test complete quicker.
  Drain events before terminating log/thread managers.
  Fix strict-aliasing warning in RemoteSerializer.cc (fixes #834).
  Fix typos in event documentation
  Fix typos in NEWS for Bro 2.1 beta
2012-07-02 14:51:31 -07:00
Jon Siwek
a651185ff9 Fix strict-aliasing warning in RemoteSerializer.cc (fixes #834). 2012-06-27 11:35:32 -05:00
Robin Sommer
b38d1e1ec2 Reworking log writer API to make it easier to pass additional
information to a writer's initialization method.

However, for now the information provided is still the same.
2012-06-21 11:57:45 -07:00
Jon Siwek
60875adfc5 Fix format specifier on RemoteSerializer::Connect.
This caused 32-bit systems to show a warning at compile-time, and
fail when connecting to peers.
2012-05-31 11:31:01 -05:00
Robin Sommer
f7261a7851 Merge remote-tracking branch 'origin/topic/jsiwek/ipv6-comm'
* origin/topic/jsiwek/ipv6-comm:
  Enable Bro to communicate with peers over non-global IPv6 addresses.
  Add unit tests for Broccoli SSL and Broccoli IPv6 connectivity.
  Remove AI_ADDRCONFIG getaddrinfo hints flag for listening sockets.
  Undo communication protocol version bump.
  Add support to Bro for connecting with peers over IPv6.

Closes #820.

Conflicts:
	src/bro.bif
2012-05-24 17:01:34 -07:00
Jon Siwek
74f3a32321 Enable Bro to communicate with peers over non-global IPv6 addresses.
This usually requires specifying an additional zone identifier
(see RFC 4007).  The connect() and listen() BIFs have been
changed to accept this zone identifier as an argument.
2012-05-17 12:59:20 -05:00
Jon Siwek
2338a32288 Remove AI_ADDRCONFIG getaddrinfo hints flag for listening sockets.
Because, according to RFC 3493, that will cause getaddrinfo to
overlook the ::1 loopback if there's not some other interface with
a global IPv6 address.  The rationale being that the flag helps
prevent unnecessary AAAA lookups, but since I set AI_NUMERICHOST,
lookups aren't going to happen anyway.

Also update the IPv6 Bro communication test to get it to work more
reliably.
2012-05-10 10:47:39 -05:00
Jon Siwek
8bb62eaaa2 Undo communication protocol version bump.
Looks like it wasn't necessary because no message between remote peers
needed to be changed to support IPv6, just messages between Bro
parent and child processes were changed.
2012-05-09 16:09:16 -05:00
Jon Siwek
1e66fe905a Add support to Bro for connecting with peers over IPv6.
- Communication::listen_ipv6 needs to be redef'd to true in order
  for IPv6 listening sockets to be opened.

- Added Communication::listen_retry option as an interval at which
  to retry binding to socket addresses that were already in use.

- Added some explicit baselines to check in the istate.events
  and istate.events-ssl tests -- the SSL test was incorrectly
  passing because it compared two empty files.  (The files being
  empty because "http/base" was given as an argument to Bro which
  it couldn't handle because that script doesn't exist anymore).
2012-05-09 15:08:36 -05:00
Robin Sommer
c63d23f3af Preventing Bro processes that do neither local logging nor request
remote logs from spawning threads.

This applies to the proxy, which was still opening all the log files
with then idle threads.
2012-04-05 15:30:40 -07:00
Robin Sommer
c92dc7e6af Reverting SocketComm change tuning I/O behaviour.
Not sure that's right.
2012-04-04 19:27:43 -07:00
Jon Siwek
256c0af98e Merge branch 'master' into topic/robin/log-threads
Conflicts:
	cmake
2012-03-30 12:02:32 -05:00
Robin Sommer
c382439079 Switching log buffer size back to normal 2012-03-28 15:43:41 -07:00
Robin Sommer
42066cc1fd Teaching cmake to always link in tcmalloc if it finds it.
Also renaming --enable-perftools to --enable-perftool-debug to
indicate that the switch is only relevant for debugging the heap. It's
not needed to pick up tcmalloc for better performance.

--with-perftools can still (and always) be used to give a hint where
to find the libraries.

With the threading, using tcmalloc improves memory usage on FreeBSD
significantly when running on a trace. If it fixes the live problems,
remains to be seen ...
2012-03-28 15:42:09 -07:00