Eric Leblond [Fri, 9 Nov 2012 14:57:52 +0000 (15:57 +0100)]
coccinelle: improve run_check
This patch adds two features to run_check.sh, it is now posssible
to specify a list of files to check:
./run_check.sh ../../src/suricata.c ../../src/detect.c
It is also possible to ask a review of the files modified by a commit.
To so simply put the SHA1 as argument
./run_check.sh HEAD
./run_check 6af7d5f
It is also possible to check all the files for an arbitrary range:
./run_check.sh origin/master..buildbot-fixes
Last improvement of this patch is to get a real error message in case
of problem as 2 is not redirected anymore to /dev/null.
Eric Leblond [Wed, 31 Oct 2012 14:04:07 +0000 (15:04 +0100)]
ipfw: add missing include
RunmodeGetActive() was used but not declared. This patch fixes
bug #612: on amd64 implicit declaration was triggering the conversion
of an int to a pointer during assignement and this was causing an
invalid read.
Anoop Saldanha [Fri, 5 Oct 2012 05:12:56 +0000 (10:42 +0530)]
fix for bug #557.
In FFRv2, dereference flow from a packet using the new reference/dereference
util macros. This allows the decr use_cnt for flow and reseting the flow
pointer to NULL for the pseudo pkt to happen simultaneously, in case there we
fail to retrieve a pseudo_packet and have to return the already obtained
pseudo packets, back to the packetpool.
Victor Julien [Fri, 12 Oct 2012 14:40:43 +0000 (16:40 +0200)]
libhtp: don't use internal iterator
It violates thread safety. #601.
Suricata assures thread safety on the flow level for HTTP tracking. Part of the flow is (in case of HTTP) libhtp's htp_connp_t state. At startup the libhtp glue layer, app-layer-htp initializes as many htp_cfg_t instances as there are libhtp server configurations in the yaml. At HTTP session start, we look up the proper htp_cfg_t based on the server ip and pass it to htp_connp_create. A ptr to the relevant htp_cfg_t is part of the htp_connp_t. The htp_cfg_t contains "hooks". The are registered based on yaml config at init time.
The hooks have lists of type list_t. The list is run with a built in iterator. The iterator is reset at the start of each "hook_run_all". Since multiple flows share the same htp_cfg_t flow A can reset the iterator while flow B is using it. The flow lock has no effect as flows share the htp_cfg_t.
This has been observed in real traffic. hook_response_body_data was run on the same data multiple times, leading to corrupt extracted files.
Eric Leblond [Sun, 9 Sep 2012 20:48:46 +0000 (22:48 +0200)]
defrag: don't use message for repetitive error
When nothing can be fetch from the pool, this can repeat frequently.
Thus displaying a message in the log will not help. This patch
uses a counter instead of a log message. As this is a sort of memcap
this is conformed to what is done for other issues of the same type.
Eric Leblond [Fri, 7 Sep 2012 11:18:35 +0000 (13:18 +0200)]
ipfw: avoid critical error for broadcast
In some setup, suricata may receive broadcast packets and the call
to sendto may fail if the wrong interface is choosen by kernel.
This patch change the error treatment to avoid to leave when
this problem occurs.
Eric Leblond [Thu, 6 Sep 2012 05:53:52 +0000 (07:53 +0200)]
af-packet: fix kernel offset issue
It seems that, in some case, there is a read waiting but the
offset in the ring buffer is not correct and Suricata need to
walk the ring to find the correct place and make the read.
Eric Leblond [Thu, 16 Aug 2012 06:57:19 +0000 (08:57 +0200)]
stream-tcp: no checksum alert if validation is off
This patch disables checksum alert if checksum-validation is set
to no in the configuration file. Without this patch, when parsing
a pcap which checksum offloading, it was not possible to get rid
of event caused by checksum validation.
bug 508 - List (ack | cwr | ecn) combination to be accepted by our stream engine.
This isn't a perfect solution. More like we have patched this for the case we
are in tcp's established state. The right solution would be to accept states
based on the presence(using operator OR) of certain flags in the tcp header,
rather than list out all possible flag combinations.
Eric Leblond [Fri, 27 Jul 2012 09:29:37 +0000 (11:29 +0200)]
af-packet: loop on ring if there is data to read.
This patch should bring some improvements by looping on the
ring when there is some data available instead of getting back
to the poll. It also fix recovery in case of drops on the ring
because the poll command will not return correctly in this case.
Eric Leblond [Fri, 27 Jul 2012 09:22:03 +0000 (11:22 +0200)]
defrag: use IP ID in hash
This patch fixes the collision issue observed on an intensive network
trafic. When there is fragmentation it is the case for all data
exchanged between two hosts. Thus using a hash func only involving
IP addresses (and protocol) was leading to a collision for all
exchanges between the hosts. At a larger scale, it was resulting in
a packet loss. By using the IP ID instead of the protocol family, we
introduce a real difference between the trackers.
Eric Leblond [Thu, 5 Jul 2012 14:12:52 +0000 (16:12 +0200)]
Rename 'worker' running mode to 'workers'
This patch renamed the 'worker' running mode into 'workers'. Thus,
there is only one name in Suricata for the same thing. Backward
compatibility is ensured by replacing "worker" by "workers" when
the old name is used. A warning is printed in the log when the old
name is used.