Project

General

Profile

Actions

Feature #797

closed

Dynamic test on flag usage

Added by Eric Leblond about 11 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Effort:
Difficulty:
Label:

Description

The idea is to generalized: https://github.com/inliniac/suricata/pull/341

By adding some comments in the code, we will trigger the creation of a test checking the correct usage of flag for a given structure. For example, we could add before the declaration of flag:

/* coccinelle: TcpStream:flags:STREAMTCP_STREAM_FLAG_ */

This would result in creating a block of tests in a dynamically generated cocci file that would be put in the qa/coccinelle directory:
ssn->flags@p1 |= ssn_flags
|
ssn->flags@p1 & ssn_flags
|
ssn->flags@p1 &= ~ssn_flags

The script searching for the entry will be called by 'make check' previously to the run of cocci test.

Actions #1

Updated by Victor Julien about 11 years ago

  • Status changed from New to Assigned

Some flags to consider:

Packet->flowflags : FLOW_PKT_*
Signature->init_flags : SIG_FLAG_INIT_*

Interesting corner case:
Signature->flags and SignatureHeader->flags contain the same flags.

Actions #2

Updated by Eric Leblond almost 11 years ago

  • % Done changed from 0 to 90

All tests added. There is no issue with sharing flag as the test is to test for each structure and flags that is is starting with the associated constant.

Implementation available in PR: https://github.com/inliniac/suricata/pull/421

Actions #3

Updated by Victor Julien almost 11 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 90 to 100

Merged (and then fixed :)) https://github.com/inliniac/suricata/pull/421, thanks Eric!

Actions

Also available in: Atom PDF