Eric Leblond [Thu, 30 Aug 2012 07:54:53 +0000 (09:54 +0200)]
doxygen: generate doc for acquisition modules
This patch sets some define to generate doc for the acquisition
modules. It also suppress the doc generation for unittests which
was polluting the output.
Eric Leblond [Wed, 29 Aug 2012 10:27:26 +0000 (12:27 +0200)]
pool: realize a block allocation for preallocated item.
This patch required a evolution of Pool API as it is needed to
proceed to alloc or init separetely. The PoolInit has been changed
with a new Init function parameter.
Eric Leblond [Wed, 22 Aug 2012 13:39:27 +0000 (15:39 +0200)]
l3proto: add unit tests
This patch adds a series of unit tests. First two check test the keyword
by checking packet on signatures using it. Last one adds is here to check
that there is no interaction of l3_proto and ip_proto.
Eric Leblond [Fri, 13 Jul 2012 13:46:02 +0000 (15:46 +0200)]
sig: add l3_proto keyword
This patch adds a l3_proto keyword to the signature language. It
can be used to specify if the signature has to match on IPv4, IPv6
or both. For example, one can write:
alert http any any -> any 22 (msg: "HTTP v6"; l3_proto:ip6; sid:14;)
Eric Leblond [Tue, 14 Aug 2012 07:49:07 +0000 (09:49 +0200)]
af-packet: detect MTU mismatch and warn user
If the MTU on the reception interface and the one on the transmission
interface are different, this will result in an error at transmission
when sending packet to the wire.
Eric Leblond [Fri, 27 Jul 2012 09:48:10 +0000 (11:48 +0200)]
af-packet: add optional emergency mode
Flush all waiting packets to be in sync with kernel when drop
occurs. This mode can be activated by setting use-emergency-flush
to yes in the interface configuration.
Eric Leblond [Thu, 19 Jul 2012 18:07:05 +0000 (20:07 +0200)]
af-packet: IPS and TAP feature
This patch adds a new feature to AF_PACKET capture mode. It is now
possible to use AF_PACKET in IPS and TAP mode: all traffic received
on a interface will be forwarded (at the Ethernet level) to an other
interface. To do so, Suricata create a raw socket and sends the receive
packets to a interface designed in the configuration file.
This patch adds two variables to the configuration of af-packet
interface:
copy-mode: ips or tap
copy-iface: eth1 #the interface where packet are copied
If copy-mode is set to ips then the packet wth action DROP are not
copied to the destination interface. If copy-mode is set to tap,
all packets are copied to the destination interface.
Any other value of copy-mode results in the feature to be unused.
There is no default interface for copy-iface and the variable has
to be set for the ids or tap mode to work.
For now, this feature depends of the release data system. This
implies you need to activate the ring mode and zero copy. Basically
use-mmap has to be set to yes.
This patch adds a peering of AF_PACKET sockets from the thread on
one interface to the threads on another interface. Peering is
necessary as if we use an other socket the capture socket receives
all emitted packets. This is made using a new AFPPeer structure to
avoid direct interaction between AFPTreadVars.
There is currently a bug in Linux kernel (prior to 3.6) and it is
not possible to use multiple threads.
You need to setup two interfaces with equality on the threads
variable. copy-mode variable must be set on the two interfaces
and use-mmap must be set to activated.
A valid configuration for an IPS using eth0 and vboxnet1 interfaces
will look like:
Eric Leblond [Fri, 15 Jun 2012 15:18:57 +0000 (17:18 +0200)]
capture: add data release mechanism
This patch adds a data release mechanism. If the capture module
has a call to indicate that userland has finished with the data,
it is possible to use this system. The data will then be released
when the treatment of the packet is finished.
To do so the Packet structure has been modified:
+ TmEcode (*ReleaseData)(ThreadVars *, struct Packet_ *);
If ReleaseData is null, the function is called when the treatment
of the Packet is finished.
Thus it is sufficient for the capture module to code a function
wrapping the data release mechanism and to assign it to ReleaseData
field.
This patch also includes an implementation of this mechanism for
AF_PACKET.
Eric Leblond [Thu, 5 Jul 2012 05:41:16 +0000 (07:41 +0200)]
af-packet: improve mmaped running mode.
The mmaped mode was using a too small ring buffer size which was
not able to handle burst of packets coming from the network. This
may explain the important packet loss rate observed by Edward
Fjellskål.
This patch increases the default value and adds a ring-size
variable which can be used to manually tune the value.
Eric Leblond [Fri, 10 Aug 2012 13:32:30 +0000 (15:32 +0200)]
Delay Detect threads initialization
This patch modifies the init of Detect threads. They are now started
with a dummy function and their initialisation is done after the
signatures are loaded. Just after this, the dummy function is switched
to normal one.
In IPS mode, this permit to route packets without waiting for the
signature to start and should fix #488.
Offline mode such as pcap file don't use this mode to be sure to
analyse all packets in the file.
The patch introduces a "delayed-detect" configuration variable
under detect-engine. It can be used to activate the feature
(set to "yes" to have signature loaded after capture is started).
Eric Leblond [Wed, 18 Jul 2012 13:13:49 +0000 (15:13 +0200)]
tls: keep pointers to all certificates in chain
When multiple certificates forming a chain are sent. A pointer to
the start of each certificate is kept. This will allow treatment
on certificates chains.
Eric Leblond [Mon, 16 Jul 2012 10:16:37 +0000 (12:16 +0200)]
Teredo tunnel supports
This patch should fix #480 by adding the support of Teredo tunnel.
The IPv6 content of the tunnel will be parsed in a similar way as
what is done the GRE tunnel. Signatures will then be matched on the
IPv6 content.
Eric Leblond [Tue, 21 Aug 2012 17:12:20 +0000 (19:12 +0200)]
autotools: rename configure.in to configure.ac
configure.in is deprecated since long and will be replaced by
configure.ac. For more information, see:
http://lists.gnu.org/archive/html/automake/2012-08/msg00023.html
Eric Leblond [Thu, 9 Aug 2012 14:24:18 +0000 (16:24 +0200)]
tm-thread: run thread init function sequentially.
On some setup you want to run each thread init function sequentially.
For example, if I use flow_cpu load balancing on AF_PACKET, my target
is to have CPU 0 (first socket in the group) to be link with the
thread 0 in detect cpu set (first thread to be initialised). A good
way to achieve this is to run only one thread init function at a time
to avoid any possible race condition.
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.