aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/suricata/qa/coccinelle/struct-flags.cocci
blob: 45fab73415da19cbf9a5f87ff96bdfe696501a23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
@flags@
SignatureHeader *struct0;
identifier struct_flags0 =~ "^(?!SIG_FLAG).+";
Signature *struct1;
identifier struct_flags1 =~ "^(?!SIG_FLAG).+";
Signature *struct2;
identifier struct_flags2 =~ "^(?!SIG_FLAG_INIT_).+";
Flow *struct3;
identifier struct_flags3 =~ "^(?!FLOW_).+";
TcpSegment *struct4;
identifier struct_flags4 =~ "^(?!SEGMENTTCP_FLAG).+";
TcpStream *struct5;
identifier struct_flags5 =~ "^(?!STREAMTCP_STREAM_FLAG_).+";
TcpSession *struct6;
identifier struct_flags6 =~ "^(?!STREAMTCP_FLAG).+";
Packet *struct7;
identifier struct_flags7 =~ "^(?!FLOW_PKT_).+";
position p1;
@@

(
struct0->flags@p1 |= struct_flags0
|
struct0->flags@p1 & struct_flags0
|
struct0->flags@p1 &= ~struct_flags0
|
struct1->flags@p1 |= struct_flags1
|
struct1->flags@p1 & struct_flags1
|
struct1->flags@p1 &= ~struct_flags1
|
struct2->init_flags@p1 |= struct_flags2
|
struct2->init_flags@p1 & struct_flags2
|
struct2->init_flags@p1 &= ~struct_flags2
|
struct3->flags@p1 |= struct_flags3
|
struct3->flags@p1 & struct_flags3
|
struct3->flags@p1 &= ~struct_flags3
|
struct4->flags@p1 |= struct_flags4
|
struct4->flags@p1 & struct_flags4
|
struct4->flags@p1 &= ~struct_flags4
|
struct5->flags@p1 |= struct_flags5
|
struct5->flags@p1 & struct_flags5
|
struct5->flags@p1 &= ~struct_flags5
|
struct6->flags@p1 |= struct_flags6
|
struct6->flags@p1 & struct_flags6
|
struct6->flags@p1 &= ~struct_flags6
|
struct7->flowflags@p1 |= struct_flags7
|
struct7->flowflags@p1 & struct_flags7
|
struct7->flowflags@p1 &= ~struct_flags7
)

@script:python@
p1 << flags.p1;
@@

print "Invalid usage of flags field at %s:%s, flags value is incorrect (wrong family)." % (p1[0].file, p1[0].line)
import sys
sys.exit(1)