aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2022-02-25 19:37:53 +0000
committerA Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2022-03-22 12:58:04 +0000
commit16729be2c11f69f4a1f1bd4c93d44d566e418f62 (patch)
tree4425e2d8fec6838f392e2fd788c5602b2b21cffd /test
parent3e3db6cd3e916a23f60992f6ef5f0e80e04449ee (diff)
dfilter: Add bitwise masking of bits
Add support for masking of bits. Before the bitwise operator could only test bits, it did not support clearing bits. This allows testing if any combination of bits are set/unset more naturally with a single test. Previously this was only possible by combining several bitwise predicates. Bitwise is implemented as a test node, even though it is not. Maybe the test node should be renamed to something else. Fixes #17246.
Diffstat (limited to 'test')
-rw-r--r--test/suite_dfilter/group_syntax.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/suite_dfilter/group_syntax.py b/test/suite_dfilter/group_syntax.py
index 3c828464c3..b6ceae779c 100644
--- a/test/suite_dfilter/group_syntax.py
+++ b/test/suite_dfilter/group_syntax.py
@@ -140,3 +140,19 @@ class case_equality(unittest.TestCase):
def test_literal_2(self, checkDFilterCount):
dfilter = "udp contains <ce:13>"
checkDFilterCount(dfilter, 1)
+
+@fixtures.uses_fixtures
+class case_bitwise(unittest.TestCase):
+ trace_file = "http.pcap"
+
+ def test_exists_1(self, checkDFilterCount):
+ dfilter = "tcp.flags & 0x8"
+ checkDFilterCount(dfilter, 1)
+
+ def test_exists_1(self, checkDFilterCount):
+ dfilter = "tcp.flags & 0x0F == 8"
+ checkDFilterCount(dfilter, 1)
+
+ def test_exists_1(self, checkDFilterCount):
+ dfilter = "eth[0] & 1"
+ checkDFilterCount(dfilter, 0)