detect: per port and proto rule grouping

Replace tree based approach for rule grouping with a per port (tcp/udp)
and per protocol approach.

Grouping now looks like:

               +----+
               |icmp+--->
               +----+
               |gre +--->
               +----+
               |esp +--->
               +----+
          other|... |
        +----->-----+
        |      |N   +--->
        |      +----+
        |
        | tcp  +----+   +----+
        +----->+ 80 +-->+ 139+-->
        |      +----+   +----+
        |
        | udp  +----+   +----+
    +---+----->+ 53 +-->+ 135+-->
    |          +----+   +----+
    |toserver
+--->
    |toclient
    |
    +--->

So the first 'split' in the rules is the direction: toserver or toclient.
Rules that don't have a direction, are in both branches.

Then the split is between tcp/udp and the other protocols. For tcp and
udp port lists are used. For the other protocols, grouping is simply per
protocol.

The ports used are the destination ports for toserver sigs and source
ports for toclient sigs.
pull/1978/head
Victor Julien 10 years ago
parent 27e63a1e11
commit fd5a06017d

File diff suppressed because it is too large Load Diff

@ -525,8 +525,9 @@ typedef struct DetectEngineIPOnlyCtx_ {
} DetectEngineIPOnlyCtx; } DetectEngineIPOnlyCtx;
typedef struct DetectEngineLookupFlow_ { typedef struct DetectEngineLookupFlow_ {
DetectAddressHead *src_gh[256]; /* a head for each protocol */ DetectPort *tcp;
DetectAddressHead *tmp_gh[256]; DetectPort *udp;
struct SigGroupHead_ *sgh[256];
} DetectEngineLookupFlow; } DetectEngineLookupFlow;
/* Flow status /* Flow status

Loading…
Cancel
Save