diff --git a/LANforge/Utils.pm b/LANforge/Utils.pm index 972dfb2e..4be253e8 100644 --- a/LANforge/Utils.pm +++ b/LANforge/Utils.pm @@ -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:", diff --git a/lf_sniff.py b/lf_sniff.py index 49973451..83787e04 100755 --- a/lf_sniff.py +++ b/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))]);