Commit graph

6667 commits

Author SHA1 Message Date
Robin Sommer
63b46a0ae2 Fixing a bunch of format strings.
Also leveraging GCC if available to check format specificier.

Closes #567.
2011-10-18 17:39:40 -07:00
Robin Sommer
3f286c2fc1 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Fix ref counting bug in dummy ID creation code for script docs.
2011-10-10 19:14:59 -07:00
Robin Sommer
15ab287436 Experimental code to better handle interpreter errors.
Currently, a lot of interpreter runtime errors, such as an access to
an unset optional record field, cause Bro to abort with an internal
error. This is an experimental branch that turns such errors into
non-fatal runtime errors by internally raising exceptions. These are
caught upstream and processing continues afterwards.

For now, not many errors actually raise exceptions (the example above
does though). We'll need to go through them eventually and adapt the
current Internal() calls (and potentially others). More generally, at
some point we should cleanup the interpreter error handling (unifying
errors reported at parse- and runtime; and switching to exceptions for
all Expr/Stmt/Vals). But that's a larger change and left for later.

The main question for now is if this code is already helpful enough to
go into 2.0. It will quite likely prevent a number of crashes due to
script errors.
2011-10-09 20:28:06 -07:00
Robin Sommer
0ec1fa6a53 Fixing more (small) memory leaks. 2011-10-09 17:01:35 -07:00
Robin Sommer
df4a22a27d Profiling support for DNS_Mgr and triggers.
With misc/profiling.bro, both now report a line in prof.log with some
counters on usage.
2011-10-09 17:01:04 -07:00
Robin Sommer
bd9c937236 Fixing DNS memory leaks.
Some of the changes only clean up at termination to make perftools
happt, but there were some "real" leaks as well.

This fixes all DNS leaks I could reproducem, including most likely
what's reported in #534. Closing #534.

I'm also adding a new btest subdir core/leaks with tests requiring
perftools support. These don't compare against base lines but abort
whenever perftools reports a leak (with stack information to track it
down). Right now, these are passing.
2011-10-09 17:00:57 -07:00
Robin Sommer
8fa059fb10 Fix in code for disabling analyzers.
Plus some refactoring.

Closes #577.
2011-10-07 17:19:36 -07:00
Jon Siwek
58692ef9e0 Fix ref counting bug in dummy ID creation code for script docs. 2011-10-07 15:05:13 -05:00
Robin Sommer
a08c478079 Fixing a number of reporter calls. 2011-10-06 21:26:49 -07:00
Robin Sommer
6fe2b2c0f3 DNS now raises DPD events.
Closes #577.
2011-10-06 17:53:03 -07:00
Robin Sommer
b790856a40 Fixing a bunch of compiler warnings. 2011-10-06 17:46:47 -07:00
Robin Sommer
f1ae48ea53 Remote logs are auto-flushed if the last write was longer than a
second ago. Addresses #498.
2011-10-06 17:40:35 -07:00
Robin Sommer
83ff7b65a6 Fix missing from previous MIME commit. 2011-10-06 17:30:07 -07:00
Robin Sommer
7e5254ee2f Merge remote-tracking branch 'origin/topic/jsiwek/comphash-func-determinism2'
Closes #636.

* origin/topic/jsiwek/comphash-func-determinism2:
  Make CompHash computation/recovery for functions deterministic
2011-10-06 17:07:32 -07:00
Robin Sommer
63e4ee3d81 Small tweak to make double formatting match what we had before. 2011-10-06 16:54:38 -07:00
Robin Sommer
9e673e1298 Optimizing some MIME code. 2011-10-06 16:11:08 -07:00
Robin Sommer
8aaccf1c95 Logging speed improvements.
We now use Google's replacement functions for slow printf-based
num-to-ascii conversion.
2011-10-06 15:55:45 -07:00
Jon Siwek
1cc675e30f Make CompHash computation/recovery for functions deterministic
Functions are now assigned a unique integer on construction which
CompositeHash can base hashes on.  Recovery then just involves
looking up the function pointer associated with that unique number.
2011-10-06 14:29:03 -05:00
Robin Sommer
91ed9ffa8f Fixing a bunch of memory leaks.
Courtesy of perftools. Most are not really relevant but cleanup  the
perftools output. There was a big one in the logging code as well
though.
2011-09-29 22:53:07 -07:00
Robin Sommer
2252e9d90b Fixing two memory leaks. 2011-09-29 15:28:41 -07:00
Robin Sommer
5f7aed6687 Merge remote-tracking branch 'origin/topic/jsiwek/http-multipart-byteranges'
* origin/topic/jsiwek/http-multipart-byteranges:
  Teach HTTP parser to derive content length of multipart/byteranges bodies.

Closes #448.
2011-09-28 17:40:36 -07:00
Robin Sommer
4d6a90ce89 Merge remote-tracking branch 'origin/topic/jsiwek/http-1xx-replies'
* origin/topic/jsiwek/http-1xx-replies:
  Change logging of HTTP 1xx responses to occur in their own columns.
  Fix handling of HTTP 1xx response codes (addresses #411).
2011-09-28 17:10:40 -07:00
Jon Siwek
64e821624b Fix handling of HTTP 1xx response codes (addresses #411).
Changed the parser to not treat 1xx response codes as a final answer
to an unanswered request -- a later response is still expected.

The scripting layer will also not finish a request-reply pair when
seeing 1xx's, instead it logs both the 1xx and final response messages
with associated information of the current request as they're seen.
2011-09-26 17:37:29 -05:00
Robin Sommer
03ffce66fe Merge branch 'master' of ssh://git.bro-ids.org/bro 2011-09-25 14:15:52 -07:00
Seth Hall
99a31ef21c EOF SSL protocol violations are only generated a single time now. 2011-09-25 02:11:04 -04:00
Robin Sommer
d289db34db Communication fix and extension.
- Removing unnecessary log flushing. Closes #498.

- Adding new BiF disconnect() that shuts a connection to a peer down.

- terminate_connection() now first flushes any still buffered log
  messages.
2011-09-24 21:23:25 -07:00
Jon Siwek
ee30268164 Teach HTTP parser to derive content length of multipart/byteranges bodies.
Addresses #488.
2011-09-23 10:31:20 -05:00
Robin Sommer
3b7806379c Adding &transient attribute to top-level SSL pac array type.
This avoids complete buffering of all SSL sessions in memory.

Closes #574.
2011-09-22 21:21:25 -07:00
Robin Sommer
c9b9bab473 Merge remote-tracking branch 'origin/topic/seth/notice-suppression'
* origin/topic/seth/notice-suppression:
  Updated a notice related baseline and added a necessary @load line.
  Notice suppression clean up and notice/cluster integrtion fixes.
  Updates for notice suppression to use the &create_expire attribute
  Small, mostly cosmetic updates and fixing a test.
  Fix crash on exit (addresses #607).
  Duplicate notice suppression.

Closes #623.
2011-09-22 19:20:34 -07:00
Robin Sommer
fc491c087b Merge branch 'master', remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Fix PktSrc setting next_timestamp even when no packet available
  Fix lack of NUL-termination in to_upper/to_lower BIF's return val.
  Fixing unit tests and some minor bugs.
  Fix broctl cluster log rotation (addresses #619)

* master:
2011-09-22 19:04:54 -07:00
Jon Siwek
73dcdbcfc5 Fix PktSrc setting next_timestamp even when no packet available
When pcap_next failed to return packet data, such as when a live packet
capture interface has no traffic, the next_timestamp member would still
be set to possibly uninitialized or meaningless data.

Maybe addresses #611.
2011-09-22 14:04:28 -05:00
Jon Siwek
928baf4b66 Fix lack of NUL-termination in to_upper/to_lower BIF's return val. 2011-09-22 13:56:16 -05:00
Jon Siwek
d2118200ea Fixing unit tests and some minor bugs. 2011-09-22 12:42:16 -05:00
Jon Siwek
39af63841b Fix broctl cluster log rotation (addresses #619)
Before Log::rotation_control was removed in fe38c22d, it was used to
lookup rotation inverval at the time of installing a rotation timer,
and could fall back on the &default=default_rotation_inverval.  But
now since filter rotation information is instead transferred to a Writer
when it's created, it also needed to be taught to fall back on the
default rotation interval.
2011-09-21 15:21:30 -05:00
Seth Hall
d18fdef2d4 Merge remote-tracking branch 'origin/master' into topic/seth/notice-suppression 2011-09-21 02:26:19 -04:00
Robin Sommer
bd2e30f521 Merge remote-tracking branch 'origin/topic/dist-cleanup'
* origin/topic/dist-cleanup:
  Updating INSTALL
  Updating README
  Remove $Id$ tags
  Remove policy.old directory, adresses #511
2011-09-18 16:17:42 -07:00
Robin Sommer
622f5d6953 Merge remote-tracking branch 'origin/topic/jsiwek/leak-fixes'
* origin/topic/jsiwek/leak-fixes:
  Memory leak fixes.

Closes #616.
2011-09-15 17:15:51 -07:00
Robin Sommer
c2e432c5fa Merge remote-tracking branch 'origin/topic/jsiwek/path-func-record-demote'
* origin/topic/jsiwek/path-func-record-demote:
  Fix filter path_func to allow record argument as a subset of stream's columns.

Conflicts:
	src/LogMgr.cc

Closes #600.
2011-09-15 16:45:41 -07:00
Robin Sommer
62581ede31 Merge remote-tracking branch 'origin/topic/jsiwek/filter-rotation'
* origin/topic/jsiwek/filter-rotation:
  Remove Log::rotation_control (addresses #572).
  Add an optional Log::RotationControl to Log::Filter records.

Closes #572.
2011-09-15 16:28:13 -07:00
Robin Sommer
8d10a76eba Merge remote-tracking branch 'origin/topic/jsiwek/index-opt-record'
* origin/topic/jsiwek/index-opt-record:
  Fix indexing for record types with optional fields

Closes #378.
2011-09-15 16:08:59 -07:00
Robin Sommer
2a2edb3eb4 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Remove malloc.c (closes #557).
2011-09-15 16:03:12 -07:00
Jon Siwek
8697615b81 Memory leak fixes.
Both related to Val lists constructed as arguments to events that were
not freed because the event function was never called (e.g. no handlers).

Addresses #574
2011-09-15 16:08:48 -05:00
Seth Hall
8006f26db2 Merge remote-tracking branch 'origin/master' into topic/seth/notice-suppression 2011-09-15 00:27:57 -04:00
Seth Hall
d656e2a8c4 Fixing a major memory utilization issue with the x509_verify bif.
- The check for the root_certs variable was recreating the certificate
  store over and over again which would eventually consume lots of memory
  in the x509_stores internal (c++) variable.  The index check uses the
  Val pointer value for comparison now.
2011-09-14 22:51:52 -04:00
Jon Siwek
a267c30fcd Fix crash on exit (addresses #607).
MutableVal's destructor now checks if the global scope still exists
before trying to remove an identifier from it.
2011-09-12 13:16:48 -05:00
Robin Sommer
83783c5ca7 Bugfix for log writer.
It didn't escape binary stuff in some situations.

Closes #585.
2011-09-11 21:33:09 -07:00
Jon Siwek
7ff2a3e115 Fix filter path_func to allow record argument as a subset of stream's columns.
This required adding the ability for RecordVal::CoerceTo functions to
optionally allow orphaning fields.  The default is to not allow it, but
now before writing to a log, the value of the stream's columns is coerced
down, if necessary, before passing it on to the filter's path_func.

Addresses #600.
2011-09-09 14:57:22 -05:00
Jon Siwek
bf5b5218a9 Remove malloc.c (closes #557). 2011-09-09 13:30:43 -05:00
Jon Siwek
eb3c5ee1a4 Fix indexing for record types with optional fields
Addresses #378
2011-09-09 13:06:45 -05:00
Jon Siwek
fe38c22d2b Remove Log::rotation_control (addresses #572).
Log rotation is now controlled directly through Filter records.

Also addressed a TODO in the default_path_func regarding the
LogMgr::AddFilter function generating internal filter path
suggestions/fallbacks.  Now, if the user doesn't explicitly set a filter
path, the filter's path will be the result of the first call to
default_path_func (happens during the first write to the log).  And in
that case the path suggestion argument to the path_func is an empty
string.
2011-09-08 15:00:31 -05:00