[6/7] framework/packet: Fix tcpdump help parse
Commit Message
tcpdump version 4.99.3 puts several options in one line as follows:
> $ tcpdump --help
> tcpdump version 4.99.3
> libpcap version 1.10.3 (with TPACKET_V3)
> OpenSSL 3.0.5 5 Jul 2022
> Usage: tcpdump [-AbdDefhHIJKlLnNOpqStuUvxX#] [ -B size ] [ -c count ] [--count]
> [ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ]
> [ -i interface ] [ --immediate-mode ] [ -j tstamptype ]
> [ -M secret ] [ --number ] [ --print ] [ -Q in|out|inout ]
> [ -r file ] [ -s snaplen ] [ -T type ] [ --version ]
> [ -V file ] [ -w file ] [ -W filecount ] [ -y datalinktype ]
> [ --time-stamp-precision precision ] [ --micro ] [ --nano ]
> [ -z postrotate-command ] [ -Z user ] [ expression ]
This change allows to match a substring representing an option.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
framework/packet.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -1099,7 +1099,7 @@ def start_tcpdump(crb, intf, count=0, filters=None, lldp_forbid=True):
tcpdump_help = tcpdump_session.send_command("tcpdump -h")
for line in tcpdump_help.split("\n"):
- m = re.match(direct_param, line)
+ m = re.search(direct_param, line)
if m:
opt = re.search("-Q", m.group(2))
if opt: