]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
11 years agooutput: cleanups 806/head
Victor Julien [Thu, 30 Jan 2014 13:38:03 +0000 (14:38 +0100)] 
output: cleanups

Preparation of making output type for json logs configurable.

11 years agojson tls log: rename to output-json-tls
Victor Julien [Thu, 30 Jan 2014 12:58:28 +0000 (13:58 +0100)] 
json tls log: rename to output-json-tls

11 years agooutput: check for multiple instances of drop and tls
Victor Julien [Thu, 30 Jan 2014 12:49:42 +0000 (13:49 +0100)] 
output: check for multiple instances of drop and tls

Both the drop and tls logs are currently not designed to have multiple
instances running. So until that is changed, error out if more than one
instance is started.

11 years agojson drop log: rename to output-json-drop
Victor Julien [Thu, 30 Jan 2014 12:34:45 +0000 (13:34 +0100)] 
json drop log: rename to output-json-drop

11 years agojson dns: rename output-dnslog -> output-json-dns
Victor Julien [Thu, 30 Jan 2014 12:29:36 +0000 (13:29 +0100)] 
json dns: rename output-dnslog -> output-json-dns

11 years agojson: rename output-httplog -> output-json-http
Victor Julien [Thu, 30 Jan 2014 12:26:59 +0000 (13:26 +0100)] 
json: rename output-httplog -> output-json-http

11 years agojson outputs: cleanups 805/head
Victor Julien [Thu, 30 Jan 2014 12:20:47 +0000 (13:20 +0100)] 
json outputs: cleanups

Clean up header files and improve memory handling.

11 years agojansson file log: make file log module
Victor Julien [Thu, 30 Jan 2014 11:26:01 +0000 (12:26 +0100)] 
jansson file log: make file log module

Turn the libjansson based file logger into a file module, as a child
of eve-log.

11 years agotls json: turn into packet logger
Victor Julien [Thu, 30 Jan 2014 10:45:30 +0000 (11:45 +0100)] 
tls json: turn into packet logger

Like log-tls, turn the json tls logger into a packet logger as the
protocol parser is not tx aware.

Make it a child of eve-log as well.

11 years agooutput: simple name space support for sub modules
Victor Julien [Thu, 30 Jan 2014 09:59:51 +0000 (10:59 +0100)] 
output: simple name space support for sub modules

To avoid module name clashes, a submode abc of parent xyz, will now
register itself as xyz.abc.

11 years agodrop-json: make child of eve-log
Victor Julien [Thu, 30 Jan 2014 09:50:38 +0000 (10:50 +0100)] 
drop-json: make child of eve-log

Make drop json child of eve-log.

11 years agojson drop log: move into packet module
Victor Julien [Thu, 30 Jan 2014 09:15:59 +0000 (10:15 +0100)] 
json drop log: move into packet module

Move JSON drop log into a full packet module.

11 years agolog api: use AppProto instead of uint16_t
Victor Julien [Thu, 30 Jan 2014 08:18:12 +0000 (09:18 +0100)] 
log api: use AppProto instead of uint16_t

11 years agolog api: convert all names to const
Victor Julien [Thu, 30 Jan 2014 08:14:59 +0000 (09:14 +0100)] 
log api: convert all names to const

Instead of strdupping all names w/o a need, use const ptrs.

11 years agoalert json: make child of eve-log
Victor Julien [Wed, 29 Jan 2014 18:42:46 +0000 (19:42 +0100)] 
alert json: make child of eve-log

Enable alert json for eve-log by registering the module as a sub-
module of eve-log.

11 years agoalert-json: make full module out of json alert
Victor Julien [Wed, 29 Jan 2014 17:50:32 +0000 (18:50 +0100)] 
alert-json: make full module out of json alert

Make a full module out of the json alert code in output-json-alert.[ch].

11 years agooutput: sub-module support for other log api's
Victor Julien [Wed, 29 Jan 2014 17:19:27 +0000 (18:19 +0100)] 
output: sub-module support for other log api's

Packets:
void OutputRegisterPacketSubModule(const char *parent_name, char *name, char *conf_name,
    OutputCtx *(*InitFunc)(ConfNode *, OutputCtx *),
    PacketLogger LogFunc, PacketLogCondition ConditionFunc);

Files:
void OutputRegisterFileSubModule(const char *parent_name, char *name, char *conf_name,
    OutputCtx *(*InitFunc)(ConfNode *, OutputCtx *), FileLogger FileLogFunc);

Filedata:
void OutputRegisterFiledataSubModule(const char *parent_name, char *name, char *conf_name,
    OutputCtx *(*InitFunc)(ConfNode *, OutputCtx *), FiledataLogger FiledataLogFunc);

11 years agooutput: introduce concept of sub-modules
Victor Julien [Wed, 29 Jan 2014 16:38:04 +0000 (17:38 +0100)] 
output: introduce concept of sub-modules

To support the 'eve-log' idea, we need to be able to force all log
modules to be enabled by the master eve-log module, and need to be
able to make all logs go into a single file. This didn't fit the
API so far, so added the sub-module concept.

A sub-module is a regular module, that registers itself as a sub-
module of another module:

    OutputRegisterTxSubModule("eve-log", "JsonHttpLog", "http",
            OutputHttpLogInitSub, ALPROTO_HTTP, JsonHttpLogger);

The first argument is the name of the parent. The 4th argument is
the OutputCtx init function. It differs slightly from the non-sub
one. The different is that in addition to it's ConfNode, it gets
the OutputCtx from the parent. This way it can set the parents
LogFileCtx in it's own OutputCtx.

The runmode setup code will take care of all the extra setup. It's
possible to register a module both as a normal module and as a sub-
module, which can operate at the same time.

Only the TxLogger API is handled in this patch, the rest will be
updated later.

11 years agodns-json: turn logger to tx api
Victor Julien [Wed, 29 Jan 2014 14:29:15 +0000 (15:29 +0100)] 
dns-json: turn logger to tx api

Convert Json DNS logger into a Tx Logger API logger.

11 years agohttp-json: separate module using tx api
Victor Julien [Wed, 29 Jan 2014 13:36:22 +0000 (14:36 +0100)] 
http-json: separate module using tx api

Turn HTTP json logger into a Tx Logger API logger.

11 years agoVarious compile fixes after rebase with master
Victor Julien [Wed, 29 Jan 2014 10:32:10 +0000 (11:32 +0100)] 
Various compile fixes after rebase with master

11 years agojson: rebase fixes
Tom DeCanio [Fri, 17 Jan 2014 00:18:54 +0000 (16:18 -0800)] 
json: rebase fixes

- restore json output-file.[ch] as output-json-file.[ch] after rebase conflict
- fix Makefile.am after merge conflict
- some dev-log-api-v4.0 rebase json fallout cleanup

11 years agoRemaining JSON output pull request comment edits
Tom DeCanio [Tue, 19 Nov 2013 20:58:47 +0000 (12:58 -0800)] 
Remaining JSON output pull request comment edits

11 years agoaddress most initial JSON pull request comments
Tom DeCanio [Mon, 18 Nov 2013 22:36:52 +0000 (14:36 -0800)] 
address most initial JSON pull request comments

11 years agoadd "united" drop JSON log
Tom DeCanio [Thu, 14 Nov 2013 03:33:00 +0000 (19:33 -0800)] 
add "united" drop JSON log

11 years agoAdd "united" JSON files output
Tom DeCanio [Wed, 13 Nov 2013 19:17:03 +0000 (11:17 -0800)] 
Add "united" JSON files output

11 years agoFirst cut at "united" file log output in JSON
Tom DeCanio [Wed, 13 Nov 2013 06:43:19 +0000 (22:43 -0800)] 
First cut at "united" file log output in JSON

11 years agoJSON output cleanup
Tom DeCanio [Wed, 13 Nov 2013 02:48:37 +0000 (18:48 -0800)] 
JSON output cleanup

11 years agoremove unused http JSON code
Tom DeCanio [Wed, 13 Nov 2013 02:13:43 +0000 (18:13 -0800)] 
remove unused http JSON code

11 years agomore output JSON cleanup
Tom DeCanio [Wed, 13 Nov 2013 02:09:01 +0000 (18:09 -0800)] 
more output JSON cleanup

11 years agoremove dead JSON DNS output code
Tom DeCanio [Wed, 13 Nov 2013 01:45:56 +0000 (17:45 -0800)] 
remove dead JSON DNS output code

11 years agoJSON output cleanup
Tom DeCanio [Wed, 13 Nov 2013 01:43:00 +0000 (17:43 -0800)] 
JSON output cleanup

11 years agorename alert-json.[ch] output-json.[ch]
Tom DeCanio [Wed, 13 Nov 2013 01:28:16 +0000 (17:28 -0800)] 
rename alert-json.[ch] output-json.[ch]

11 years agofix compile errors w/o libjansson
Tom DeCanio [Wed, 13 Nov 2013 00:56:48 +0000 (16:56 -0800)] 
fix compile errors w/o libjansson

11 years agoremove unused JSON TMM_*JSON enumerations
Tom DeCanio [Tue, 12 Nov 2013 23:41:50 +0000 (15:41 -0800)] 
remove unused JSON TMM_*JSON enumerations

11 years agoAdd support for JSON output to syslog/unix_stream/unix_dgram
Tom DeCanio [Fri, 8 Nov 2013 19:39:49 +0000 (11:39 -0800)] 
Add support for JSON output to syslog/unix_stream/unix_dgram

11 years agoAdd "united" log to suricata.yaml.in
Tom DeCanio [Fri, 8 Nov 2013 19:27:52 +0000 (11:27 -0800)] 
Add "united" log to suricata.yaml.in

11 years agoJSON output cleanup
Tom DeCanio [Fri, 8 Nov 2013 19:24:18 +0000 (11:24 -0800)] 
JSON output cleanup

11 years agoadd united TLS JSON logging
Tom DeCanio [Wed, 6 Nov 2013 23:12:43 +0000 (15:12 -0800)] 
add united TLS JSON logging

11 years agoadd ICMP type and code support to JSON log
Tom DeCanio [Wed, 6 Nov 2013 02:45:11 +0000 (18:45 -0800)] 
add ICMP type and code support to JSON log

11 years agoSupport for configuration of JSON http output module
Tom DeCanio [Tue, 5 Nov 2013 22:48:39 +0000 (14:48 -0800)] 
Support for configuration of JSON http output module

11 years agoAdd vlan and pcap_cnt to JSON logs
Tom DeCanio [Tue, 5 Nov 2013 17:50:47 +0000 (09:50 -0800)] 
Add vlan and pcap_cnt to JSON logs

11 years agoFirst cut at united .yaml configuration
Tom DeCanio [Tue, 5 Nov 2013 04:33:51 +0000 (20:33 -0800)] 
First cut at united .yaml configuration

11 years agobeginning of JSON config alignment
Tom DeCanio [Mon, 4 Nov 2013 20:54:36 +0000 (12:54 -0800)] 
beginning of JSON config alignment

11 years agomove some JSON alert work outside of lock
Tom DeCanio [Mon, 4 Nov 2013 19:57:03 +0000 (11:57 -0800)] 
move some JSON alert work outside of lock

11 years agoJSON cleanup
Tom DeCanio [Mon, 4 Nov 2013 19:41:56 +0000 (11:41 -0800)] 
JSON cleanup

11 years agoAlert/HTTP/DNS JSON output working with Logstash
Tom DeCanio [Mon, 4 Nov 2013 16:22:51 +0000 (08:22 -0800)] 
Alert/HTTP/DNS JSON output working with Logstash

11 years agonested json alert output
Tom DeCanio [Sun, 27 Oct 2013 09:23:59 +0000 (02:23 -0700)] 
nested json alert output

11 years agocleanup fallout from upstream merge with alert json work
Tom DeCanio [Tue, 22 Oct 2013 11:52:39 +0000 (04:52 -0700)] 
cleanup fallout from upstream merge with alert json work

11 years agoChange JSON alert syslog level to INFO
Tom DeCanio [Tue, 25 Jun 2013 19:40:16 +0000 (12:40 -0700)] 
Change JSON alert syslog level to INFO

11 years agofix NULL string into JSON in alert-json
Tom DeCanio [Wed, 12 Jun 2013 18:04:11 +0000 (11:04 -0700)] 
fix NULL string into JSON in alert-json

11 years agochange srcport->sp dstport->dp
Tom DeCanio [Wed, 5 Jun 2013 16:25:06 +0000 (09:25 -0700)] 
change srcport->sp dstport->dp

11 years agoAdd JSON formatted alert output
Tom DeCanio [Thu, 30 May 2013 21:04:34 +0000 (14:04 -0700)] 
Add JSON formatted alert output

11 years agostream: add performance output for stream pools
Victor Julien [Tue, 28 Jan 2014 22:00:28 +0000 (23:00 +0100)] 
stream: add performance output for stream pools

Add info messages at shutdown that give an indication of pool use
for the various segment and chunk pools.

11 years agostream: configurable stream chunk prealloc 801/head
Victor Julien [Tue, 28 Jan 2014 16:13:05 +0000 (17:13 +0100)] 
stream: configurable stream chunk prealloc

The stream chunk pool contains preallocating stream chunks (StreamMsg).
These are used for raw reassembly, used in raw content inspection by
the detection engine. The default setting so far has been 250, which
was hardcoded. This meant that in setups that needed more, allocs and
frees would be happen constantly.

This patch introduces a yaml option to set the 'prealloc' value in the
pool. The default is still 250.

stream.reassembly.chunk-prealloc

Related to feature #1093.

11 years agostream: silence stream.reassembly.raw message
Victor Julien [Tue, 28 Jan 2014 16:12:38 +0000 (17:12 +0100)] 
stream: silence stream.reassembly.raw message

11 years agostream: configurable segment pools
Victor Julien [Tue, 28 Jan 2014 12:48:26 +0000 (13:48 +0100)] 
stream: configurable segment pools

The stream reassembly engine uses a set of pools in which preallocated
segments are stored. There are various pools each with different packet
sizes. The goal is to lower memory presure. Until now, these pools were
hardcoded.

This patch introduces the ability to configure them fully from the yaml.
There can be at max 256 of these pools.

Yaml layout is as follows:

stream:
  reassemble:
    segments:
      - size: 2048
        prealloc: 3000
      - size: 4
        prealloc: 1000
      - size: 1024
        prealloc: 2000

The size is the packet size. The prealloc value indicates how many
segments are set up at startup.

The pools have no limit wrt how many segments can be used of a certain
size. If the engine needs more than the prealloc size, segments are
malloc'd and free'd. The only limit here is the stream.reassemble.memcap.

If the yaml part if omitted, the default values are the same as before.

Feature #1093

11 years agolog-filestore: convert to FiledataLog API 797/head
Victor Julien [Thu, 16 Jan 2014 14:23:03 +0000 (15:23 +0100)] 
log-filestore: convert to FiledataLog API

This patch converts the log-filestore module to use the new
FiledataLog API.

11 years agoIntroduce Filedata Logger API
Victor Julien [Thu, 16 Jan 2014 14:20:09 +0000 (15:20 +0100)] 
Introduce Filedata Logger API

A new logger API for registering file storage handlers. Where the
FileLog handler is called once per file, this handler will be called
for each data chunk so that storing the entire file is possible.

The logger call in the API is as follows:
    typedef int (*FiledataLogger)(ThreadVars *, void *thread_data,
        const Packet *, const File *, const FileData *, uint8_t flags);

All data is const, thus should be read only. The final flags field
is used to indicate to the caller that the file is new, or if it's
being closed.

Files use an internal unique id 'file_id' which can be used by the
loggers to create unique file names. This id can use the 'waldo'
feature of the log-filestore module. This patch moves that waldo
loading and storing logic to this API's implementation. A new
configuration directive 'file-store-waldo: <filename>' is added,
but the existing waldo settings will also continue to work.

11 years agolog-filestore: cleanups
Victor Julien [Wed, 15 Jan 2014 15:24:25 +0000 (16:24 +0100)] 
log-filestore: cleanups

Remove unused code.
Make functions static.
Move registration to the bottom.

11 years agolog-filestore: tag truncated files as such
Victor Julien [Wed, 15 Jan 2014 15:17:15 +0000 (16:17 +0100)] 
log-filestore: tag truncated files as such

Tag truncated files as truncated in the same way log-file does.

11 years agotx-logger: speed up
Victor Julien [Wed, 15 Jan 2014 13:25:32 +0000 (14:25 +0100)] 
tx-logger: speed up

By bailing out early in case no logger is enabled for the protocol,
a significant speed up is reached.

11 years agoapp-layer: add logger check to API
Victor Julien [Wed, 15 Jan 2014 13:23:16 +0000 (14:23 +0100)] 
app-layer: add logger check to API

The new API call:
    int AppLayerParserProtocolHasLogger(uint8_t ipproto,
                                        AppProto alproto)

Returns TRUE if a logger is registered on the ip/alproto pair, and
FALSE otherwise.

11 years agoprofiling: add logger api labels
Victor Julien [Wed, 15 Jan 2014 13:14:01 +0000 (14:14 +0100)] 
profiling: add logger api labels

11 years agolog-file: convert to file-logger API
Victor Julien [Wed, 15 Jan 2014 12:28:43 +0000 (13:28 +0100)] 
log-file: convert to file-logger API

Use file logger API.

Also, check if the protocol is HTTP before getting the HTTP
fields.

11 years agoIntroduce 'file' logging API
Victor Julien [Wed, 15 Jan 2014 12:22:47 +0000 (13:22 +0100)] 
Introduce 'file' logging API

This patch introduces a new logging API for logging extracted file info.
It allows for registration of a callback that is called once per file:
when it's considered 'closed'.

Users of this API register their Log Function through:
    OutputRegisterFileModule()

The API uses a magic settings globally. This might be changed later.

11 years agolog-file: cleanups
Victor Julien [Wed, 15 Jan 2014 09:59:15 +0000 (10:59 +0100)] 
log-file: cleanups

Make all functions static.
Move registration to the bottom.

11 years agoprelude: convert to packet logger API
Victor Julien [Tue, 14 Jan 2014 16:14:27 +0000 (17:14 +0100)] 
prelude: convert to packet logger API

Convert prelude logger to use the packet logger API.

11 years agoprelude: fix configure and cleanup
Victor Julien [Tue, 14 Jan 2014 16:02:33 +0000 (17:02 +0100)] 
prelude: fix configure and cleanup

Fixes configure enabling of prelude. CFLAGS is reset, so the previous
adding of -DPRELUDE was nixed. Using AC_DEFINE now.

Cleanups:
- make functions static
- simplify handling of no prelude support
- move registration to the bottom

11 years agoalert-syslog: convert to packet logger API
Victor Julien [Tue, 14 Jan 2014 15:39:41 +0000 (16:39 +0100)] 
alert-syslog: convert to packet logger API

Convert Syslog alert logger to packet logger API.

11 years agoalert-syslog: cleanup
Victor Julien [Tue, 14 Jan 2014 15:30:06 +0000 (16:30 +0100)] 
alert-syslog: cleanup

Remove separate ipv4 and ipv6 registration functions.
Make all functions static.
Move registration function to the bottom.
Simplify OS_WIN32 wrappers usage.

11 years agoalert-pcapinfo: convert to packet logger API
Victor Julien [Tue, 14 Jan 2014 15:20:27 +0000 (16:20 +0100)] 
alert-pcapinfo: convert to packet logger API

Convert pcap-info to use the packet logger API.

11 years agoalert-pcapinfo: clean up
Victor Julien [Tue, 14 Jan 2014 15:08:47 +0000 (16:08 +0100)] 
alert-pcapinfo: clean up

Make functions static.
Move registration to the bottom.

11 years agoalert-debuglog: minor cleanups
Victor Julien [Tue, 14 Jan 2014 09:47:18 +0000 (10:47 +0100)] 
alert-debuglog: minor cleanups

Clean up log functions after packet logger conversion. No more
PacketQueue arguments.

11 years agoalert-debuglog: port to packet logger api
Victor Julien [Tue, 14 Jan 2014 09:43:07 +0000 (10:43 +0100)] 
alert-debuglog: port to packet logger api

Convert AlertDebugLog to Packet logger API. Convert packet args to
const.

11 years agoalert-debug log cleanups
Victor Julien [Tue, 14 Jan 2014 09:07:27 +0000 (10:07 +0100)] 
alert-debug log cleanups

Make all funcs but registration static.
Remove stale registation prototypes.
Move registation func to the bottom.

11 years agolog-tls: convert to packet logger API
Victor Julien [Mon, 13 Jan 2014 15:13:27 +0000 (16:13 +0100)] 
log-tls: convert to packet logger API

This patch converts log-tls to use the packet logger API. The packet
logger API was choosen as the TLS parser is not transaction aware.

To make sure the state is only logged once, the flag
SSL_AL_FLAG_STATE_LOGGED was added to the parser. This flag is checked
by the condition function, and set at the end of the Logger function.

11 years agolog-tls: clean ups
Victor Julien [Mon, 13 Jan 2014 14:18:42 +0000 (15:18 +0100)] 
log-tls: clean ups

Make all functions static. Remove separate ipv4 and ipv6 registration
functions. Move register function to the bottom so that we no longer
need function prototype declarations.

11 years agodns: convert dns logger to TX logger API
Victor Julien [Sat, 7 Dec 2013 10:43:08 +0000 (11:43 +0100)] 
dns: convert dns logger to TX logger API

Make sure to use the new logger TX API. For this the transaction
handling was improved as well.

11 years agoConvert log-drop to packet logger api.
Victor Julien [Fri, 6 Dec 2013 11:33:51 +0000 (12:33 +0100)] 
Convert log-drop to packet logger api.

11 years agoTX logging API: convert HTTP log
Victor Julien [Thu, 5 Dec 2013 17:35:27 +0000 (18:35 +0100)] 
TX logging API: convert HTTP log

Convert the HTTP log to the new TX logging API.

11 years agoIntroduce TX logging API
Victor Julien [Thu, 5 Dec 2013 17:08:53 +0000 (18:08 +0100)] 
Introduce TX logging API

This patch introduces a new API for logging transactions from
tx-aware app layer protocols. It runs all the registered loggers
from a single thread module. This thread module takes care of the
transaction handling and flow locking. The logger just gets a
transaction to log out.

All loggers for a protocol will be run at the same time, so there
will not be any timing differences.

Loggers will no longer act as Thread Modules in the strictest sense.
The Func is NULL, and SetupOuputs no longer attaches them to the
thread module chain individually. Instead, after registering through
OutputRegisterTxModule, the setup data is used in the single logging
module.

The logger (LogFunc) is called for each transaction once, at the end
of the transaction.

11 years agoPacket logging API: convert unified2
Victor Julien [Thu, 5 Dec 2013 15:55:17 +0000 (16:55 +0100)] 
Packet logging API: convert unified2

Convert unified2 alert to new logging API.

11 years agoIntroduce packet logging output API
Victor Julien [Thu, 5 Dec 2013 14:35:15 +0000 (15:35 +0100)] 
Introduce packet logging output API

This patch introduces a new API for outputs that log based on the
packet, such as alert outputs. In converts fast-log to the new API.

The API gets rid of the concept of each logger being a thread module,
but instead there is one thread module that runs all packet loggers.
Through the registration function OutputRegisterPacketModule a log
module can register itself to be considered for each packet.

Each logger registers itself to this new API with 2 functions and the
OutputCtx object that was already used in the old implementation.
The function pointers are:

LogFunc:       the log function

ConditionFunc: this function is called before the LogFunc and only
               if this returns TRUE the LogFunc is called.

For a simple alert logger like fast-log, the condition function will
simply return TRUE if p->alerts.cnt > 0.

11 years agono-detect: handle protocols that have no logger 796/head
Victor Julien [Mon, 27 Jan 2014 13:36:15 +0000 (14:36 +0100)] 
no-detect: handle protocols that have no logger

If a protocol parser is active without a logger when detection is
disabled, the transaction handling logic would fail. Now it will
return the proper tx id so we can clean up the complete transactions.

11 years agoAdd --disable-detection configure option
Victor Julien [Mon, 6 Jan 2014 14:09:21 +0000 (15:09 +0100)] 
Add --disable-detection configure option

Add --disable-detection configure option to compile Suricata with
detection disabled.

11 years agoError out if -s/-S are used with disable detect
Victor Julien [Mon, 6 Jan 2014 13:09:35 +0000 (14:09 +0100)] 
Error out if -s/-S are used with disable detect

When Suricata is started with --disabled-detection, the -s and -S
options make no sense. So error out.

11 years agodetect-less: disable raw reassembly
Victor Julien [Tue, 17 Dec 2013 11:59:38 +0000 (12:59 +0100)] 
detect-less: disable raw reassembly

When using --disable-detection automatically disable raw stream
reassembly by forcing stream.reassembly.raw to be false.

11 years agodetect-less: add log only TX handling function
Victor Julien [Sat, 11 Jan 2014 10:14:56 +0000 (11:14 +0100)] 
detect-less: add log only TX handling function

When running w/o detect, TX cleanup handling needs to ignore the
inspect_id as it's only updated by detect.

This patch introduces a new ActiveTx handler for logging only:
AppLayerTransactionGetActiveLogOnly

If --disable-detection is passed on the commandline, this function
is registered.

11 years agoUpdate main loop to handle detect-less
Victor Julien [Mon, 16 Dec 2013 16:37:09 +0000 (17:37 +0100)] 
Update main loop to handle detect-less

Update main startup and shutdown loops to work will when detect
is disabled. In this case de_ctx remains NULL.

11 years agoupdate runmodes to handle detect-less
Victor Julien [Mon, 16 Dec 2013 16:35:27 +0000 (17:35 +0100)] 
update runmodes to handle detect-less

In runmodes setup, consider a NULL de_ctx to mean detect is disabled.

11 years agoflow-time: handle detect-less case
Victor Julien [Mon, 16 Dec 2013 16:32:13 +0000 (17:32 +0100)] 
flow-time: handle detect-less case

Flow timeout code keeps track of thread module running detect, and
fails (hard) if it doesn't find it.

This changeset retrieves the global g_detect_disabled and passes
it to the timeout handling code during setup.

11 years agoIntroduce g_detect_disabled global
Victor Julien [Mon, 16 Dec 2013 16:25:11 +0000 (17:25 +0100)] 
Introduce g_detect_disabled global

This global will be set to TRUE if detect is disabled. The reason for
adding a global is that there currently is no clean way to pass
configuration options to management threads.

11 years agoAdd --disable-detection commandline option
Victor Julien [Mon, 16 Dec 2013 14:56:49 +0000 (15:56 +0100)] 
Add --disable-detection commandline option

Flags the SuriInstance that the detection engine should be disabled.
Actual disabling is not yet implemented.

11 years agoflow-timeout: change error logic 795/head
Victor Julien [Fri, 24 Jan 2014 17:09:46 +0000 (18:09 +0100)] 
flow-timeout: change error logic

If FlowForceReassemblyForFlowV2 can't get packets to inject into the
engine, until now it would bail and retry later. In case of resource
starvation issues, this would cause a lot of lock contention, as the
flow manager would try over and over again.

This patch limits FlowForceReassemblyForFlowV2 to one try per flow,
if it fails... bad luck. It will only fail in serious conditions,
which means we must prefer the health of the engine over the proper
inspection of the flow in question.

11 years agoapp-layer-proto: speed up
Victor Julien [Fri, 24 Jan 2014 10:40:06 +0000 (11:40 +0100)] 
app-layer-proto: speed up

AppLayer Proto detection code uses a mix of pattern search and
"probing parsers". The pattern search validates potential matches
using a single pattern search algo. The code was using SpmSearch
for this, but this made it inefficient as it builds a BoyerMoore
context for each search. This lead to significant memory pressure,
especially on high speed/bandwidth boxes.

This patch switches the search calls to BoyerMoore and BoyerMoore-
Nocase directly. This can be done as the ctx' were available already.

11 years agoapp-layer-event: refactor
Victor Julien [Thu, 23 Jan 2014 08:55:09 +0000 (09:55 +0100)] 
app-layer-event: refactor

Move app layer event handling into app-layer-event.[ch].
Convert 'Set' macro's to functions.
Get rid of duplication in Set and SetRaw. Set now calls SetRaw.
Fix potentential int overflow condition in the event storage.
Update callers.

11 years agoapp-layer: shrink AppLayerParserState
Victor Julien [Thu, 23 Jan 2014 08:31:56 +0000 (09:31 +0100)] 
app-layer: shrink AppLayerParserState

Change layout to be more efficient, shrinks structure with 8 bytes.

11 years agostream: use reassembly.memcap for stream chunks
Victor Julien [Wed, 22 Jan 2014 20:15:43 +0000 (21:15 +0100)] 
stream: use reassembly.memcap for stream chunks

Use the stream.reassembly.memcap for stream chunks (StreaMsg) as well.

11 years agostream: in SACK, always decrease memcap on free
Victor Julien [Wed, 22 Jan 2014 18:14:19 +0000 (19:14 +0100)] 
stream: in SACK, always decrease memcap on free

We should always decrease the stream memcap on freeing SACK records.