]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
10 years agostream: fix bad last_ack update leading to gaps 1397/head
Victor Julien [Wed, 25 Mar 2015 21:29:10 +0000 (22:29 +0100)] 
stream: fix bad last_ack update leading to gaps

A bad last_ack update where it would be set beyond next_seq could
lead to rejection of valid segments and thus stream gaps.

Update tests to reflect new last_ack/next_seq behaviour.

10 years agodetect-state: cleanups and comments 1391/head
Victor Julien [Fri, 20 Mar 2015 20:58:50 +0000 (21:58 +0100)] 
detect-state: cleanups and comments

10 years agodetect-state: use f->protomap instead of FlowGetProtoMapping(f->proto)
Victor Julien [Fri, 20 Mar 2015 18:23:09 +0000 (19:23 +0100)] 
detect-state: use f->protomap instead of FlowGetProtoMapping(f->proto)

10 years agodetect-flowbits: locking update
Victor Julien [Fri, 20 Mar 2015 15:09:10 +0000 (16:09 +0100)] 
detect-flowbits: locking update

Make matches that can be in the POSTMATCH list aware of the lock hint.

10 years agodetect-flowint: conditional locking
Victor Julien [Fri, 20 Mar 2015 15:22:19 +0000 (16:22 +0100)] 
detect-flowint: conditional locking

10 years agodetect-state: handle 'post match' locking
Victor Julien [Fri, 20 Mar 2015 14:47:39 +0000 (15:47 +0100)] 
detect-state: handle 'post match' locking

The post match list was called with an unlocked flow until now.
However, recent de_state handling updates changed this. The stateful
detection code can now call the post match functions while keeping
the flow locked. The normal detection code still calls it with an
unlocked flow.

This patch adds a hint to the DetectEngineThreadCtx called
'flow_locked' that is set to true if the caller has already locked
the flow.

10 years agodetect-flowint: fix unlocked flow access
Victor Julien [Fri, 20 Mar 2015 14:23:18 +0000 (15:23 +0100)] 
detect-flowint: fix unlocked flow access

Some of the access to the flow and to structures retrieved from the
flow was unlocked.

This patch changes the logic to be wrapped in lock calls.

10 years agodetect-state: fix profiling
Victor Julien [Fri, 20 Mar 2015 13:30:00 +0000 (14:30 +0100)] 
detect-state: fix profiling

10 years agodns: optimize tx list walks
Victor Julien [Tue, 17 Mar 2015 22:05:07 +0000 (23:05 +0100)] 
dns: optimize tx list walks

The detection engine and log engines can walk the tx list indirectly,
by looping AppLayerParserGetTx. This would lead to new list walks in
the DNS tx list though. Leading to bad performance.

This patch stores the last returned tx and uses that to determine if
the next tx is what we need next. If so, we can return that w/o list
walk.

10 years agodetect-reload: enable unconditionally 1389/head
Victor Julien [Thu, 19 Mar 2015 16:20:27 +0000 (17:20 +0100)] 
detect-reload: enable unconditionally

Reloading is available unconditionally now.

10 years agodetect-reload: 0 detect threads is no error
Victor Julien [Mon, 16 Mar 2015 09:53:56 +0000 (10:53 +0100)] 
detect-reload: 0 detect threads is no error

The reload code would consider 0 detect threads to be an error,
but it's not in case of unix socket mode.

10 years agounix-socket: implement reload-rules
Victor Julien [Thu, 5 Mar 2015 15:25:09 +0000 (16:25 +0100)] 
unix-socket: implement reload-rules

Implement the reload-rules unix socket command. The unix command
thread signals the main thread to do the reload and it waits for
it to complete.

10 years agodetect reload: load config
Victor Julien [Thu, 5 Mar 2015 12:04:33 +0000 (13:04 +0100)] 
detect reload: load config

Load the YAML into a prefix "detect-engine-reloads.N" where N is the
reload counter. This way we can load the updated config w/o overwriting
the current one.

10 years agodetect: remove config at prefix
Victor Julien [Thu, 5 Mar 2015 12:00:33 +0000 (13:00 +0100)] 
detect: remove config at prefix

Remove config at prefix when freeing a detect engine.

10 years agorule vars: support prefix
Victor Julien [Mon, 2 Mar 2015 07:59:44 +0000 (08:59 +0100)] 
rule vars: support prefix

Support the detection engine's prefix when retrieving rule vars.

10 years agorule-vars: take detect engine as arg
Victor Julien [Sun, 1 Mar 2015 19:30:01 +0000 (20:30 +0100)] 
rule-vars: take detect engine as arg

10 years agodetect:pass DetectEngineCtx to port parsing
Victor Julien [Sun, 1 Mar 2015 11:34:11 +0000 (12:34 +0100)] 
detect:pass DetectEngineCtx to port parsing

Preparation for prefix handling in port parsing.

10 years agodetect: pass DetectEngineCtx to address parsing
Victor Julien [Sun, 1 Mar 2015 10:02:33 +0000 (11:02 +0100)] 
detect: pass DetectEngineCtx to address parsing

Preparation for prefix handling in address parsing.

10 years agodetect: initialize detection engine by prefix
Victor Julien [Fri, 16 Jan 2015 16:46:16 +0000 (17:46 +0100)] 
detect: initialize detection engine by prefix

Initalize detection engine by configuration prefix.

    DetectEngineCtxInitWithPrefix(const char *prefix)

Takes the detection engine configuration from:
<prefix>.<config>

If prefix is NULL the regular config will be used.

Update sure that DetectLoadCompleteSigPath considers the prefix when
retrieving the configuration.

10 years agoconf: add ConfYamlLoadFileWithPrefix
Victor Julien [Tue, 13 Jan 2015 10:59:21 +0000 (11:59 +0100)] 
conf: add ConfYamlLoadFileWithPrefix

Add function to load a yaml file and insert it into the conf tree at
a specific prefix.

Example YAML:
somefile: myfile.txt

If loaded using ConfYamlLoadFileWithPrefix with prefix "myprefix", it
can be retrieved by the name of "myprefix.somefile".

10 years agodetect: allow det_ctx->de_ctx to be NULL
Victor Julien [Thu, 29 Jan 2015 10:16:49 +0000 (11:16 +0100)] 
detect: allow det_ctx->de_ctx to be NULL

When freeing det_ctx, allow de_ctx to be NULL.

10 years agodetect: reload thread init cleanup
Victor Julien [Tue, 27 Jan 2015 11:33:21 +0000 (12:33 +0100)] 
detect: reload thread init cleanup

Rename the thread init function DetectEngineThreadCtxInitForLiveRuleSwap
to DetectEngineThreadCtxInitForReload and change it's logic to take the
new detection engine as argument and let it return the
DetectEngineThreadCtx or NULL on error.

The old approach used the thread init API format, but it wasn't used in
that way.

10 years agodetect reload: allow master update during reload
Victor Julien [Tue, 27 Jan 2015 10:30:08 +0000 (11:30 +0100)] 
detect reload: allow master update during reload

Add DetectEngineReference, which takes a reference to a detect engine,
and make DetectEngineThreadCtxInitForLiveRuleSwap use it. This way
reload will not depend on master staying the same. This allows master
to be updated in between w/o affecting the reload that is in progress.

10 years agodetect: remove old live reload implementation
Victor Julien [Sat, 17 Jan 2015 09:53:54 +0000 (10:53 +0100)] 
detect: remove old live reload implementation

Remove code that ran the reload in it's own thread. Simplify the
signal handling.

10 years agodetect: move reload into main loop
Victor Julien [Mon, 19 Jan 2015 21:09:59 +0000 (22:09 +0100)] 
detect: move reload into main loop

Use new DetectEngineReload() function. It's called from the main loop
instead of it being spawned into it's own temporary thread. This greatly
simplifies the signal handling.

An added advantage is that this seems to improve the memory usage.

Related to bug #1358

10 years agodetect: introduce 'minimal' detect engine
Victor Julien [Mon, 19 Jan 2015 13:54:11 +0000 (14:54 +0100)] 
detect: introduce 'minimal' detect engine

The minimal detect engine has only the minimal memory use and setup
time. It's to be used for 'delayed' detect where the first detection
engine is essentially empty.

The threads setup are also minimal.

10 years agothreading: remove 'dummy' slot logic
Victor Julien [Mon, 19 Jan 2015 11:11:22 +0000 (12:11 +0100)] 
threading: remove 'dummy' slot logic

Now that delayed detect is not using it anymore, the dummy logic
can be removed.

10 years agodetect: unify delayed detect and reload
Victor Julien [Mon, 19 Jan 2015 11:08:55 +0000 (12:08 +0100)] 
detect: unify delayed detect and reload

Instead of threading logic with dummy slots and all, use the regular
reload logic for delayed detect.

This means we pass a empty detect engine to the threads and then
reload (live swap) it as soon as the engine is running.

10 years agorunmodes: remove DetectEngineCtx passing from API
Victor Julien [Mon, 19 Jan 2015 09:27:34 +0000 (10:27 +0100)] 
runmodes: remove DetectEngineCtx passing from API

No longer pass a pointer to the current detection engine to the
runmode API calls.

Note: breaks delayed detect. Will be fixed in a future commit.

10 years agounittests: add exception to detect engine setup
Victor Julien [Tue, 20 Jan 2015 10:25:02 +0000 (11:25 +0100)] 
unittests: add exception to detect engine setup

Add code to allow for unittests not following the complete api.

Update replace tests as they don't use the unittests runmode that
powers the workaround based on RunmodeIsUnittests().

10 years agodetect: update detect engine management
Victor Julien [Sat, 17 Jan 2015 17:44:23 +0000 (18:44 +0100)] 
detect: update detect engine management

Update detect engine management to make it easier to reload the detect
engine.

Core of the new approach is a 'master' ctx, that keeps a list of one or
more detect engines. The detect engines will not be passed to any thread
directly, but instead will only be accessed through the detect engine
thread contexts. As we can replace those atomically, replacing a detect
engine becomes easier.

Each thread keeps a reference to its detect context. When a detect engine
is replaced or removed, it's added to a free list. Once its reference
count reaches 0, it is freed.

10 years agosuricatasc: allow for much longer response times
Victor Julien [Fri, 16 Jan 2015 18:25:24 +0000 (19:25 +0100)] 
suricatasc: allow for much longer response times

10 years agodetect: no exit on reference/classification errors
Victor Julien [Tue, 27 Jan 2015 15:34:16 +0000 (16:34 +0100)] 
detect: no exit on reference/classification errors

Don't exit on errors during classification and reference parsing.

Add some suppression of error messages when in unittest mode.

10 years agodetect: consolidate more setup into DetectEngineCtxInit
Victor Julien [Fri, 16 Jan 2015 18:28:44 +0000 (19:28 +0100)] 
detect: consolidate more setup into DetectEngineCtxInit

Loading of classifications, references and action order was done
unconditionally, so can be done in one place.

10 years agounix-command: fix duplicate registration error msg
Victor Julien [Thu, 29 Jan 2015 10:45:44 +0000 (11:45 +0100)] 
unix-command: fix duplicate registration error msg

10 years agoBug 1401: on midstream pickup, fix packet direction 1383/head
Victor Julien [Tue, 17 Mar 2015 10:48:17 +0000 (11:48 +0100)] 
Bug 1401: on midstream pickup, fix packet direction

On midstream SYN/ACK pickups, we would flip the direction of packets
after the first. This meant the first (pickup) packet's direction
was wrong.

This patch fixes that.

10 years agoBug 1417 - Record sequence nodes as sequences. 1380/head
Jason Ish [Tue, 17 Mar 2015 04:29:22 +0000 (22:29 -0600)] 
Bug 1417 - Record sequence nodes as sequences.

Nodes that are sequences weren't being recorded as such, causing
rules to fail to load.

Change sequence test name to reflect better what it tests, and
test that the sequence node is detected as a sequence.

10 years agodetect-state: implement tx state reset for reload 1375/head
Victor Julien [Tue, 10 Mar 2015 16:41:03 +0000 (17:41 +0100)] 
detect-state: implement tx state reset for reload

In case of Detect Reload, we need to reset active tx' state.

10 years agodetect-state: split flow and tx state
Victor Julien [Fri, 27 Feb 2015 14:21:17 +0000 (15:21 +0100)] 
detect-state: split flow and tx state

Use separate data structures for storing TX and FLOW (AMATCH) detect
state.

- move state storing into util funcs
- remove de_state_m
- simplify reset state logic on reload

10 years agomodbus: tx de_state
Victor Julien [Mon, 9 Mar 2015 14:58:07 +0000 (15:58 +0100)] 
modbus: tx de_state

10 years agosmtp: tx de_state
Victor Julien [Mon, 9 Mar 2015 14:45:39 +0000 (15:45 +0100)] 
smtp: tx de_state

10 years agodns: implement tx de_state
Victor Julien [Mon, 9 Mar 2015 14:32:40 +0000 (15:32 +0100)] 
dns: implement tx de_state

10 years agohttp: clean up tx destate at tx destroy
Victor Julien [Mon, 9 Mar 2015 10:08:47 +0000 (11:08 +0100)] 
http: clean up tx destate at tx destroy

10 years agohttp: support per TX destate storage
Victor Julien [Fri, 6 Mar 2015 18:37:55 +0000 (19:37 +0100)] 
http: support per TX destate storage

10 years agoapp-layer: per tx destate
Victor Julien [Fri, 6 Mar 2015 18:11:10 +0000 (19:11 +0100)] 
app-layer: per tx destate

Add API calls for storing detection state in the TX.

10 years agodetect-state: fix profiling
Victor Julien [Thu, 26 Feb 2015 17:40:31 +0000 (18:40 +0100)] 
detect-state: fix profiling

10 years agodetect-state: various cleanups
Victor Julien [Thu, 26 Feb 2015 17:38:04 +0000 (18:38 +0100)] 
detect-state: various cleanups

10 years agodetect-state: rip per sig detect out of ContinueDetect
Victor Julien [Thu, 26 Feb 2015 16:23:49 +0000 (17:23 +0100)] 
detect-state: rip per sig detect out of ContinueDetect

10 years agodetect-state: remove DeStateResetFileInspection
Victor Julien [Thu, 26 Feb 2015 16:32:36 +0000 (17:32 +0100)] 
detect-state: remove DeStateResetFileInspection

It was effectively unused.

10 years agodetect-state: remove redundant code
Victor Julien [Thu, 26 Feb 2015 16:49:30 +0000 (17:49 +0100)] 
detect-state: remove redundant code

10 years agodetect-state: add helper to test state
Victor Julien [Thu, 26 Feb 2015 15:11:31 +0000 (16:11 +0100)] 
detect-state: add helper to test state

Add little helper function StateIsValid() to test if the state
can be inspected safely.

Cleans up stateful detection loops.

10 years agodetect-state: add helper to indicate last tx
Victor Julien [Thu, 26 Feb 2015 14:58:43 +0000 (15:58 +0100)] 
detect-state: add helper to indicate last tx

Add little helper to indicate current tx is that last we have.

10 years agodetect-state: cleanup ContinueDetection
Victor Julien [Thu, 26 Feb 2015 14:23:41 +0000 (15:23 +0100)] 
detect-state: cleanup ContinueDetection

Only lock f->de_state->m when we start to access it. So after
declaration and initialization of local vars.

10 years agodetect-state: cleanup retvals
Victor Julien [Thu, 26 Feb 2015 14:02:21 +0000 (15:02 +0100)] 
detect-state: cleanup retvals

Use DETECT_ENGINE_INSPECT_SIG_* instead of 0, 1, 2 and 3.

10 years agomodbus: shrink data structure
Victor Julien [Mon, 9 Mar 2015 14:49:28 +0000 (15:49 +0100)] 
modbus: shrink data structure

10 years agofile: don't 'close' file if we need to track it
Victor Julien [Fri, 27 Feb 2015 16:10:09 +0000 (17:10 +0100)] 
file: don't 'close' file if we need to track it

10 years agohttp: add inspection engine for http request line
Victor Julien [Mon, 9 Mar 2015 13:56:24 +0000 (14:56 +0100)] 
http: add inspection engine for http request line

No MPM though.

10 years agohttp: fix stat_msg and stat_code state tracking
Victor Julien [Thu, 26 Feb 2015 23:04:11 +0000 (00:04 +0100)] 
http: fix stat_msg and stat_code state tracking

10 years agoRemove spinning PacketPoolWait 1374/head
Victor Julien [Sat, 21 Feb 2015 13:19:48 +0000 (14:19 +0100)] 
Remove spinning PacketPoolWait

PacketPoolWait in autofp can wait for considerable time. Until now
it was essentially spinning, keeping the CPU 100% busy.

This patch introduces a condition to wait in such cases.

Atomically flag pool that consumer is waiting, so that we can sync
the pending pool right away instead of waiting for the
MAX_PENDING_RETURN_PACKETS limit.

10 years agodrop json log: log out 'drop' signature 1365/head
Victor Julien [Tue, 21 Oct 2014 17:27:34 +0000 (19:27 +0200)] 
drop json log: log out 'drop' signature

If no normal sig was logged as the 'drop' reason, try the stored
drop signature instead, this will also log out 'noalert' sigs.

10 years agodrop json: make alerts logging optional
Victor Julien [Mon, 20 Oct 2014 13:43:42 +0000 (15:43 +0200)] 
drop json: make alerts logging optional

Make logging out alerts that caused the drop optional.

10 years agodrop json: add sids (if applicable)
Victor Julien [Mon, 20 Oct 2014 12:02:20 +0000 (14:02 +0200)] 
drop json: add sids (if applicable)

If a drop is caused by a SID match, add it to the drop record.

10 years agoalert json: move alert info into function
Victor Julien [Mon, 20 Oct 2014 11:59:28 +0000 (13:59 +0200)] 
alert json: move alert info into function

Move adding the alert info (sid,rev,gid,etc) into it's own function,
so it can be called from other outputs as well.

10 years agodetect: set action from utility function
Victor Julien [Tue, 21 Oct 2014 08:04:57 +0000 (10:04 +0200)] 
detect: set action from utility function

Set actions that are set directly from Signatures using the new
utility function DetectSignatureApplyActions. This will apply
the actions and also store info about the 'drop' that first made
the rule drop.

10 years agodetect: cleanup, remove unused order_id
Victor Julien [Tue, 21 Oct 2014 08:43:56 +0000 (10:43 +0200)] 
detect: cleanup, remove unused order_id

No longer used, so remove.

10 years agoflow-timeout: fix init of pseudo packet
Eric Leblond [Mon, 19 Jan 2015 18:16:49 +0000 (19:16 +0100)] 
flow-timeout: fix init of pseudo packet

The code was not checking if we had enough room in the direct
data. In case default_packet_size was set really small, this was
resulting in data being written over the data and causing a crash.

The patch fixes the issue by forcing an allocation if the direct
data size in the Packet is to small.

10 years agodecode: introduce PacketCallocExtPkt function
Eric Leblond [Thu, 12 Feb 2015 20:15:27 +0000 (21:15 +0100)] 
decode: introduce PacketCallocExtPkt function

In flow timeout handling we need a function that allocate and blank
a place that will be used to put constructed packet data. This new
function has no other goal.

10 years agoWhen re-opening a log file on HUP, always append.
Jason Ish [Fri, 27 Feb 2015 17:30:47 +0000 (11:30 -0600)] 
When re-opening a log file on HUP, always append.

This will prevent log files that have not been rotated by some
external tool from being deleted, but log files that were
rotated (moved out of the way) will be re-opened.

This is a better default behaviour, especially when not all
log files are rotated at the same time.

Thanks to iro on IRC.

10 years agoDon't attempt to load the rule files if the rule-files configuration
Jason Ish [Thu, 15 Jan 2015 20:43:45 +0000 (14:43 -0600)] 
Don't attempt to load the rule files if the rule-files configuration
node is not a sequence.  Instead log a warning as this is usually
a configuration error.

10 years agoNew function to test if a configuration node is a sequence or not.
Jason Ish [Thu, 15 Jan 2015 20:43:22 +0000 (14:43 -0600)] 
New function to test if a configuration node is a sequence or not.

10 years agoaf-packet: don't unlock twice the bpf mutex
Eric Leblond [Tue, 24 Feb 2015 16:46:06 +0000 (17:46 +0100)] 
af-packet: don't unlock twice the bpf mutex

10 years agojson-alert: use getter for appstate 1356/head
Eric Leblond [Fri, 6 Mar 2015 21:21:12 +0000 (22:21 +0100)] 
json-alert: use getter for appstate

10 years agoflow: constify getters param
Eric Leblond [Fri, 6 Mar 2015 21:17:30 +0000 (22:17 +0100)] 
flow: constify getters param

Some potential callers are already using constified values so it
is good to do it.

10 years agojson-alert: add SSH fields in alert logging
Eric Leblond [Fri, 6 Mar 2015 20:16:52 +0000 (21:16 +0100)] 
json-alert: add SSH fields in alert logging

10 years agojson-ssh: export logging function
Eric Leblond [Fri, 6 Mar 2015 20:05:51 +0000 (21:05 +0100)] 
json-ssh: export logging function

It will be use in alert logging to display SSH information.

10 years agojson-alert: log tls info in alert
Eric Leblond [Fri, 6 Mar 2015 19:03:13 +0000 (20:03 +0100)] 
json-alert: log tls info in alert

This patch adds the capabilities to log the TLS information the
same way it is currently possible to do with HTTP. As it is
quite hard to read ASN.1 directly in the stream, this will help
people to understand why suricata is firing on alert relative
to TLS.

10 years agojson-tls: refactor to export logging function
Eric Leblond [Fri, 6 Mar 2015 18:55:28 +0000 (19:55 +0100)] 
json-tls: refactor to export logging function

To be able to add TLS data in alert we need to do the same as what
is done with HTTP ie export the logging functions.

10 years agoInject pseudo packet periodically when there is not traffic in mPIPE. 1351/head
Ken Steele [Fri, 27 Feb 2015 04:22:35 +0000 (23:22 -0500)] 
Inject pseudo packet periodically when there is not traffic in mPIPE.

To prevent pseudo packets from not being processed when there is no traffic,
inject a pseudo packet if no traffic is seen by a thread for ~100ms.

10 years agoDefine _DEFAULT_SOURCE. Its the replacement for _BSD_SOURCE which
Jason Ish [Thu, 15 Jan 2015 15:44:45 +0000 (09:44 -0600)] 
Define _DEFAULT_SOURCE.  Its the replacement for _BSD_SOURCE which
which has been deprecated as of glibc 2.20.

10 years agobuild: don't link with libnfnetlink
Eric Leblond [Wed, 18 Feb 2015 10:45:12 +0000 (11:45 +0100)] 
build: don't link with libnfnetlink

Don't link suricata with libnfnetlink when we don't have support
for NFQUEUE or NFLOG. Previously, suricata was linked with this
library without reason.

10 years agoutil-magic: make unittests less specific
Victor Julien [Wed, 25 Feb 2015 06:37:54 +0000 (07:37 +0100)] 
util-magic: make unittests less specific

So they pass on CentOS 5.11 as well.

10 years agoapp-layer: init flow in tests
Victor Julien [Wed, 4 Mar 2015 16:06:59 +0000 (17:06 +0100)] 
app-layer: init flow in tests

10 years agopcap-file: add missing atomic init
Eric Leblond [Thu, 12 Feb 2015 21:27:07 +0000 (22:27 +0100)] 
pcap-file: add missing atomic init

It is mandatory to init all atomic to avoid problem on system
without atomic support.

10 years agorunmode-pcap-file: suppress useless include
Eric Leblond [Thu, 12 Feb 2015 21:18:23 +0000 (22:18 +0100)] 
runmode-pcap-file: suppress useless include

10 years agoflow-manager: init global atomics
Victor Julien [Wed, 4 Mar 2015 15:47:28 +0000 (16:47 +0100)] 
flow-manager: init global atomics

10 years agostream: fix unittests wrt flow
Victor Julien [Thu, 19 Feb 2015 19:58:36 +0000 (20:58 +0100)] 
stream: fix unittests wrt flow

10 years agoFix make distcheck on CentOS 5.11
Victor Julien [Thu, 19 Feb 2015 10:45:09 +0000 (11:45 +0100)] 
Fix make distcheck on CentOS 5.11

datarootdir was undefined. Define it.

10 years agoFix compiler warning on CentOS 5.11
Victor Julien [Thu, 19 Feb 2015 09:39:50 +0000 (10:39 +0100)] 
Fix compiler warning on CentOS 5.11

cc1: warnings being treated as errors
app-layer-smtp.c: In function â€˜SMTPParseCommandBDAT’:
app-layer-smtp.c:908: warning: dereferencing type-punned pointer will break strict-aliasing rules

10 years agoCentOS 5.11 pkg-config fix
Victor Julien [Thu, 19 Feb 2015 09:29:14 +0000 (10:29 +0100)] 
CentOS 5.11 pkg-config fix

Check for the minimal pkg-config 0.21 version. Without it, CentOS'
pkg-config will fail with the warning:

configure: error: The pkg-config script could not be found or is too old.

10 years agoutil-ioctl: don't build code RX ring on old system
Eric Leblond [Thu, 19 Feb 2015 08:37:23 +0000 (09:37 +0100)] 
util-ioctl: don't build code RX ring on old system

If ETHTOOL_GRXRINGS is undefined we will not be able to build the
RX rings code. So we can make the build conditional to the
definition of ETHTOOL_GRXRINGS.

10 years agohttp: add event for suspicious method delimeter 1346/head
Victor Julien [Wed, 18 Feb 2015 22:46:19 +0000 (23:46 +0100)] 
http: add event for suspicious method delimeter

Add event and rule for suspicious delim(s) between method and uri.

Add unittests as well.

10 years agohttp: add libhtp uri warning event
Victor Julien [Wed, 18 Feb 2015 15:45:20 +0000 (16:45 +0100)] 
http: add libhtp uri warning event

Add event for libhtp warning added 0.5.17 for URI's with suspicious
delimeters.

10 years agostream: init global config after flow engine
Victor Julien [Wed, 25 Feb 2015 10:06:41 +0000 (11:06 +0100)] 
stream: init global config after flow engine

Stream depends on flow engine.

10 years agohttp: remove unused and broken 'content-len' logic
Victor Julien [Fri, 23 Jan 2015 12:06:44 +0000 (13:06 +0100)] 
http: remove unused and broken 'content-len' logic

The HTTP tracking code would parse the content lenght and store it
in the TX user data. It didn't take the possibility or errors into
account though, leading to a possible negative int being cases to
unsigned int. Luckily, the result was unused.

This patch simply removes the offending code.

Reported-by: The Yahoo pentest team
10 years agodcerpc: don't exit() on malloc failure
Victor Julien [Fri, 23 Jan 2015 11:12:53 +0000 (12:12 +0100)] 
dcerpc: don't exit() on malloc failure

In 2 places we would exit() if malloc failed. We should never exit in
such cases. This patch silently handles it.

10 years agodcerpc: fix error handling for alloc errors
Victor Julien [Fri, 23 Jan 2015 11:09:29 +0000 (12:09 +0100)] 
dcerpc: fix error handling for alloc errors

Fix error handling of stub parsers. In case of SCRealloc error the
function would return a non-error code. This could possibly lead to
memory corruption.

Reported-By: The Yahoo pentest team
10 years agoflow: make TCP reuse handling in flow engine optional 1342/head
Victor Julien [Wed, 18 Feb 2015 07:50:01 +0000 (08:50 +0100)] 
flow: make TCP reuse handling in flow engine optional

In case of autofp (or more general, when flow and stream engine
run in different threads) the flow engine should not trigger a flow
reuse as this can lead to race conditions between the flow and the
stream engine.

In such cases, the flow engine can be far ahead of the stream engine
as packets are in a queue between the threads.

Observed:

Flow engine tags packet 10 as start of new flow. Flow is tagged as
'reused'.

Stream engine evaluates packet 5 which belongs to the old flow. It
rejects the flow as it's tagged 'reused'. Attaches packet 5 to the
new flow which is wrong.

Solution:

This patch connects the flow engines handling of reuse cases to
the runmode. It hooks into the RunmodeSetFlowStreamAsync() call to
notify the flow engine that it shouldn't handle the reuse.

10 years agotcp reuse: don't double 'reuse'
Victor Julien [Tue, 17 Feb 2015 12:01:52 +0000 (13:01 +0100)] 
tcp reuse: don't double 'reuse'

If the flow engine already reused a flow then the stream engine
won't have to do the same.

10 years agoflow: tag first packet in each direction
Victor Julien [Tue, 17 Feb 2015 11:47:01 +0000 (12:47 +0100)] 
flow: tag first packet in each direction

Set a flowflag for the first packet in each direction:

FLOW_PKT_TOSERVER_FIRST and FLOW_PKT_TOCLIENT_FIRST

10 years agotcp reuse: enable stream handling based on runmode
Victor Julien [Tue, 17 Feb 2015 09:34:53 +0000 (10:34 +0100)] 
tcp reuse: enable stream handling based on runmode

Add a way for runmodes to state that flow and stream run asynchorously.

In the stream engine, enable the TCP reuse handling only if that flag
is set.