DNS: fix response name length logic

In some cases where the length would be calculated as 0 we'd loop until
we'd hit our loop limit.

Update name logic everywhere.
IPv4 decoder compile warning fix
stream: reduce scope of StreamTcpPseudoPacketSetupHeader
stream: fix IPv6 pseudo packet setup

Bug #1022: IPv6 pseudo packet setup using reverse logic of IPv4.
content inspection: introduce no_match label
profiling: introduce per keyword profiling

Initial version of per keyword profiling. Prints stats about
how ofter a keyword was checked and what the costs were.
detect: add tostring function for DETECT_SM_LIST_ enum.
profiling: per buffer profiling
profiling: add tracking of missing keywords
detect: don't do rule reload during delayed detect

When both rule reloads and delayed detect are enabled, make sure we don't
trigger a reload during delayed detect initialization.

Bug #1023.
Fix live rule reload confusing delayed detect

Fixes bug 1023 and the previous attempt to fix it.
http: don't decode + to space by default

Libhtp decodes the + character in the query string to a space by default.
Suricata rules (e.g. etpro sid 2806767) are expecting to see the space in
the http_uri buffer.

Added an option per htp config to reenable this default behavior:

    query-plusspace-decode: yes

Bug #1035.
Give Suricata priority to receive packets over Linux with mPIPE.

When installing the rules to tell mPIPE to send packet to Suricata,
give it a higher priority than the default used by Linux. This way if
Linux also tells mPIPE to send it packets, Suricata will get them
instead, as long as Suricata is running.
stream: fix sequence number on smsg

When multiple segments were put into a smsg, the seq would be updated
each time a segment was added. Because of this, the seq wasn't pointing
to the start of the data.

This caused some false negatives when the fast_pattern was in the raw
stream, but another part of the inspection was in the state. Because of
the wrong seq, the inspection of the smsg could be delayed. This in turn,
could make the inspection engine consider a TX inspected, even if it wasn't
fully yet.
Add Unit test to check TCPv4 and IPV4 checksums together.

Copied SigTest26TCPV4Keyword and added check for invalid IPV4 checksums.
Created new SigTest26TCPV4AndIPV4Keyword test with a new packet with valid
IPV4 checksums.
detect: only inspect smsg for valid tcp packets

Packets that are rejected by the stream engine are not considered
part of an established tcp session. By allowing them to inspect
an smsg, some smsgs would not be properly inspected.
Formatting and comment updates in flow files

Some reformatting to meet coding standards.

Added a few comments to make it more clear where p->flow gets set.
dns: detect case of request flooding

In the case where DNS requests are sent over the same flow w/o a
reply being received, we now set an event in the flow and refuse
to add more transactions to the state. This protects the DNS
handling from getting overloaded slowing down everything.

A new option to configure this behaviour was added:

app-layer:
  protocols:
    dnsudp:
       enabled: yes
       detection-ports:
         udp:
           toserver: 53
       request-flood: 750

The request-flood parameter can be 0 (disabling this feature) or a
positive integer. It defaults to 500.

This means that if 500 unreplied requests are seen in a row an event
is set. Rule 2240007 was added to dns-events.rules to match on this.
DNS: trigger logging for toserver dir when previous reply is lost.
dns: fix transaction handling

When logging is disabled, the app layer would still be flagged
as logging. This caused transactions not to be freed until the
end of the flow as the logged tx id would never increment.

This fix postpones the setting of the app layer parser "logger"
flag to the point where we know the logger is enabled.