mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 19:28:00 +00:00
sniff: Make sure monitor port is not phantom before we start the sniff.
And fix portmod showing Current flags.
This commit is contained in:
@@ -716,11 +716,9 @@ sub group_items {
|
||||
# Generic disassembly of lines created by show
|
||||
our @starting_exceptions = (
|
||||
# please keep these sorted
|
||||
"Advertising:",
|
||||
"Command:",
|
||||
"Conn Established:",
|
||||
"Conn Timeouts:",
|
||||
"Current:",
|
||||
"Cx Detected:",
|
||||
"DNS Servers:",
|
||||
"Endpoint [",
|
||||
@@ -737,7 +735,6 @@ our @starting_exceptions = (
|
||||
"Rx Pkts (On Wire):",
|
||||
"RX-Silence:",
|
||||
"Shelf: 1,",
|
||||
"Supported:",
|
||||
"TCP Retransmits:",
|
||||
"Tx Bytes:",
|
||||
"Tx Bytes (On Wire):",
|
||||
@@ -751,7 +748,11 @@ our @starting_exceptions = (
|
||||
# Generic disassembly of lines created by show
|
||||
our @port_starting_exceptions = (
|
||||
# please keep these sorted
|
||||
"Advertising:",
|
||||
"Current:",
|
||||
"Missed-Beacons:",
|
||||
"Partner:",
|
||||
"Supported:",
|
||||
"Tx-Excessive-Retry:",
|
||||
"Rx-Invalid-CRYPT:",
|
||||
"Rx-Invalid-MISC:",
|
||||
|
||||
22
lf_sniff.py
22
lf_sniff.py
@@ -228,6 +228,28 @@ def main():
|
||||
sflags = "0x02" # dumpcap, no terminal
|
||||
for m in monis_n:
|
||||
r = monis_r[idx]
|
||||
|
||||
# Wait for monitor to be non-phantom
|
||||
isph = True
|
||||
while isph:
|
||||
port_stats = subprocess.run(["./lf_portmod.pl", "--manager", lfmgr, "--card", r, "--port_name", m,
|
||||
"--show_port", "Current"], stdout=PIPE, stderr=PIPE);
|
||||
pss = port_stats.stdout.decode('utf-8', 'ignore');
|
||||
for line in pss.splitlines():
|
||||
#print("line: %s\n"%line)
|
||||
ma = re.search('Current:\s+(.*)', line)
|
||||
if (ma != None):
|
||||
cf = ma.group(1);
|
||||
isph = False
|
||||
for f in cf.split():
|
||||
if (f == "PHANTOM"):
|
||||
isph = True
|
||||
break
|
||||
if isph:
|
||||
print("Waiting for monitor port %s.%s to become non-phantom\n"%(r, m));
|
||||
sleep(1)
|
||||
|
||||
|
||||
print("Starting sniffer on port %s.%s for %s seconds, saving to file %s.pcap on resource %s\n"%(r, m, dur, m, r))
|
||||
subprocess.run(["./lf_portmod.pl", "--manager", lfmgr,
|
||||
"--cli_cmd", "sniff_port 1 %s %s NA %s %s.pcap %i"%(r, m, sflags, m, int(dur))]);
|
||||
|
||||
Reference in New Issue
Block a user