aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/suricata/qa/coccinelle/struct-flags.cocci
diff options
context:
space:
mode:
authorAshlee Young <ashlee@onosfw.com>2015-09-09 22:21:41 -0700
committerAshlee Young <ashlee@onosfw.com>2015-09-09 22:21:41 -0700
commit8879b125d26e8db1a5633de5a9c692eb2d1c4f83 (patch)
treec7259d85a991b83dfa85ab2e339360669fc1f58e /framework/src/suricata/qa/coccinelle/struct-flags.cocci
parent13d05bc8458758ee39cb829098241e89616717ee (diff)
suricata checkin based on commit id a4bce14770beee46a537eda3c3f6e8e8565d5d0a
Change-Id: I9a214fa0ee95e58fc640e50bd604dac7f42db48f
Diffstat (limited to 'framework/src/suricata/qa/coccinelle/struct-flags.cocci')
-rw-r--r--framework/src/suricata/qa/coccinelle/struct-flags.cocci77
1 files changed, 77 insertions, 0 deletions
diff --git a/framework/src/suricata/qa/coccinelle/struct-flags.cocci b/framework/src/suricata/qa/coccinelle/struct-flags.cocci
new file mode 100644
index 00000000..45fab734
--- /dev/null
+++ b/framework/src/suricata/qa/coccinelle/struct-flags.cocci
@@ -0,0 +1,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)