From 1861679e8132a26ff1eb891e349856fdcea1f8be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Thu, 29 Dec 2022 06:04:00 +0000 Subject: dfilter: Optimize some scanner patterns Cleanup flex code. Optimize some patterns to avoid lookups for field matches for values that are not legal field names. Improve warning and add some comments. --- test/suite_dfilter/group_syntax.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/suite_dfilter/group_syntax.py b/test/suite_dfilter/group_syntax.py index a2494ae84f..77762fb8ea 100644 --- a/test/suite_dfilter/group_syntax.py +++ b/test/suite_dfilter/group_syntax.py @@ -193,11 +193,26 @@ class case_equality(unittest.TestCase): dfilter = 'frame[37] == fc:' checkDFilterCount(dfilter, 1) - def test_rhs_literal_bias_4(self, checkDFilterCount): + def test_rhs_bias_4(self, checkDFilterCount): # Protocol "Fibre Channel" on the RHS dfilter = 'frame[37] == .fc' checkDFilterCount(dfilter, 0) + def test_rhs_bias_5(self, checkDFilterSucceed): + # Protocol "Fibre Channel" on the RHS (with warning) + dfilter = 'frame contains fc' + checkDFilterSucceed(dfilter, 'Interpreting "fc" as Fibre Channel') + + def test_rhs_bias_6(self, checkDFilterSucceed): + # Protocol "Fibre Channel" on the RHS (without warning) + dfilter = 'frame contains .fc' + checkDFilterSucceed(dfilter) + + def test_rhs_bias_7(self, checkDFilterSucceed): + # Byte 0xFC on the RHS + dfilter = 'frame contains fc:' + checkDFilterSucceed(dfilter) + @fixtures.uses_fixtures class case_bitwise(unittest.TestCase): trace_file = "http.pcap" -- cgit v1.2.3