1 # Copyright (c) 2013 by Gilbert Ramirez <gram@alumni.rice.edu>
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 from suite_dfilter
.dfiltertest
import *
9 class TestDfilterEther
:
10 trace_file
= "ipx_rip.pcap"
12 ### Note: Bytes test does not yet test FT_INT64.
14 def test_eq_1(self
, checkDFilterCount
):
15 dfilter
= "eth.dst == ff:ff:ff:ff:ff:ff"
16 checkDFilterCount(dfilter
, 1)
18 def test_eq_2(self
, checkDFilterCount
):
19 dfilter
= "eth.src == ff:ff:ff:ff:ff:ff"
20 checkDFilterCount(dfilter
, 0)
22 def test_ne_1(self
, checkDFilterCount
):
23 dfilter
= "eth.dst != ff:ff:ff:ff:ff:ff"
24 checkDFilterCount(dfilter
, 0)
26 def test_ne_2(self
, checkDFilterCount
):
27 dfilter
= "eth.src != ff:ff:ff:ff:ff:ff"
28 checkDFilterCount(dfilter
, 1)
30 def test_gt_1(self
, checkDFilterCount
):
31 dfilter
= "eth.src > 00:aa:00:a3:e3:ff"
32 checkDFilterCount(dfilter
, 0)
34 def test_gt_2(self
, checkDFilterCount
):
35 dfilter
= "eth.src > 00:aa:00:a3:e3:a4"
36 checkDFilterCount(dfilter
, 0)
38 def test_gt_3(self
, checkDFilterCount
):
39 dfilter
= "eth.src > 00:aa:00:a3:e3:00"
40 checkDFilterCount(dfilter
, 1)
42 def test_ge_1(self
, checkDFilterCount
):
43 dfilter
= "eth.src >= 00:aa:00:a3:e3:ff"
44 checkDFilterCount(dfilter
, 0)
46 def test_ge_2(self
, checkDFilterCount
):
47 dfilter
= "eth.src >= 00:aa:00:a3:e3:a4"
48 checkDFilterCount(dfilter
, 1)
50 def test_ge_3(self
, checkDFilterCount
):
51 dfilter
= "eth.src >= 00:aa:00:a3:e3:00"
52 checkDFilterCount(dfilter
, 1)
54 def test_lt_1(self
, checkDFilterCount
):
55 dfilter
= "eth.src < 00:aa:00:a3:e3:ff"
56 checkDFilterCount(dfilter
, 1)
58 def test_lt_2(self
, checkDFilterCount
):
59 dfilter
= "eth.src < 00:aa:00:a3:e3:a4"
60 checkDFilterCount(dfilter
, 0)
62 def test_lt_3(self
, checkDFilterCount
):
63 dfilter
= "eth.src < 00:aa:00:a3:e3:00"
64 checkDFilterCount(dfilter
, 0)
66 def test_le_1(self
, checkDFilterCount
):
67 dfilter
= "eth.src <= 00:aa:00:a3:e3:ff"
68 checkDFilterCount(dfilter
, 1)
70 def test_le_2(self
, checkDFilterCount
):
71 dfilter
= "eth.src <= 00:aa:00:a3:e3:a4"
72 checkDFilterCount(dfilter
, 1)
74 def test_le_3(self
, checkDFilterCount
):
75 dfilter
= "eth.src <= 00:aa:00:a3:e3:00"
76 checkDFilterCount(dfilter
, 0)
78 def test_slice_1(self
, checkDFilterCount
):
79 dfilter
= "eth.src[0:3] == 00:aa:00"
80 checkDFilterCount(dfilter
, 1)
82 def test_slice_2(self
, checkDFilterCount
):
83 dfilter
= "eth.src[-3:3] == a3:e3:a4"
84 checkDFilterCount(dfilter
, 1)
86 def test_slice_3(self
, checkDFilterCount
):
87 dfilter
= "eth.src[1:4] == aa:00:a3:e3"
88 checkDFilterCount(dfilter
, 1)
90 def test_slice_4(self
, checkDFilterCount
):
91 dfilter
= "eth.src[0] == 00"
92 checkDFilterCount(dfilter
, 1)
94 def test_contains_1(self
, checkDFilterCount
):
95 dfilter
= "ipx.src.node contains a3"
96 checkDFilterCount(dfilter
, 1)
98 def test_contains_2(self
, checkDFilterCount
):
99 dfilter
= "ipx.src.node contains a3:e3"
100 checkDFilterCount(dfilter
, 1)
102 def test_contains_3(self
, checkDFilterCount
):
103 dfilter
= "ipx.src.node contains 00:aa:00:a3:e3:a4"
104 checkDFilterCount(dfilter
, 1)
106 def test_contains_4(self
, checkDFilterCount
):
107 dfilter
= "ipx.src.node contains aa:e3"
108 checkDFilterCount(dfilter
, 0)