diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2020-03-30 19:00:45 +0700 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2020-03-30 19:00:45 +0700 |
commit | bbd1edccaeb2d8fbce82a1cf89d7d54ca3c4a569 (patch) | |
tree | 9a52b4f4c9b1dd40c6828c4825d991f9e742c317 /src/target | |
parent | 4162b27dae114eeaab82c05df4f2f0ba707e00c7 (diff) |
trx_toolkit/trx_sniff.py: pass the whole msg to burst_pass_filter()
Change-Id: I3da62249a4d62078b79ce5e79c86923e59c1e457
Diffstat (limited to 'src/target')
-rwxr-xr-x | src/target/trx_toolkit/trx_sniff.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/target/trx_toolkit/trx_sniff.py b/src/target/trx_toolkit/trx_sniff.py index 6671c351..5667df2a 100755 --- a/src/target/trx_toolkit/trx_sniff.py +++ b/src/target/trx_toolkit/trx_sniff.py @@ -4,7 +4,7 @@ # TRX Toolkit # Scapy-based TRX interface sniffer # -# (C) 2018-2019 by Vadim Yanitskiy <axilirator@gmail.com> +# (C) 2018-2020 by Vadim Yanitskiy <axilirator@gmail.com> # # All Rights Reserved # @@ -22,7 +22,7 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -APP_CR_HOLDERS = [("2018-2019", "Vadim Yanitskiy <axilirator@gmail.com>")] +APP_CR_HOLDERS = [("2018-2020", "Vadim Yanitskiy <axilirator@gmail.com>")] import logging as log import argparse @@ -119,8 +119,7 @@ class Application(ApplicationBase): return # Poke burst pass filter - rc = self.burst_pass_filter(l12trx, msg.fn, msg.tn) - if rc is False: + if not self.burst_pass_filter(msg): self.cnt_burst_dropped_num += 1 return @@ -136,25 +135,27 @@ class Application(ApplicationBase): if rc is True: self.shutdown() - def burst_pass_filter(self, l12trx, fn, tn): + def burst_pass_filter(self, msg): # Direction filter if self.argv.direction is not None: - if self.argv.direction == "TRX" and not l12trx: - return False - elif self.argv.direction == "L1" and l12trx: - return False + if self.argv.direction == "TRX": # L1 -> TRX + if not isinstance(msg, DATAMSG_L12TRX): + return False + elif self.argv.direction == "L1": # TRX -> L1 + if not isinstance(msg, DATAMSG_TRX2L1): + return False # Timeslot filter if self.argv.pf_tn is not None: - if tn != self.argv.pf_tn: + if msg.tn != self.argv.pf_tn: return False # Frame number filter if self.argv.pf_fn_lt is not None: - if fn > self.argv.pf_fn_lt: + if msg.fn > self.argv.pf_fn_lt: return False if self.argv.pf_fn_gt is not None: - if fn < self.argv.pf_fn_gt: + if msg.fn < self.argv.pf_fn_gt: return False # Burst passed ;) |