dts: only sniff inbound packets
PATCH 1/1 dts: only sniff inbound packets
Add a filter to the Scapy traffic generator sniffer which forces the sniffer to ignore outbound traffic, preventing double counting of packets. Without this change sniffing will double count packets when DTS is being run with a single link topology, because the Scapy packet transmission and Scapy sniffing is happening on the same port. The correct behavior is to only count inbound traffic which is being returned to the traffic generator by the DTS SUT.
--- dts/framework/testbed_model/traffic_generator/scapy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
dts/framework/testbed_model/traffic_generator/scapy.py +1 -1
@@ -203,7 +203,7 @@ def _sniff(self, recv_port: Port) -> None: ready_prompt = "Ready." self.send_command( "sniff(" - f'iface="{recv_port.logical_name}", quiet=True, store=False, ' + f'iface="{recv_port.logical_name}", filter="inbound", quiet=True, store=False, ' "prn=lambda p: bytes_base64(p.build()).decode(), " f'started_callback=lambda: print("{ready_prompt}")' ")",
Signature · 1 line
2.49.0
Quoted 35 lines · Patrick Robb
Add a filter to the Scapy traffic generator sniffer which forces the sniffer to ignore outbound traffic, preventing double counting of packets. Without this change sniffing will double count packets when DTS is being run with a single link topology, because the Scapy packet transmission and Scapy sniffing is happening on the same port. The correct behavior is to only count inbound traffic which is being returned to the traffic generator by the DTS SUT.
Fixes dfb667368077 ("dts: add Scapy asynchronous sniffer")Signed-off-by Patrick Robb <[email protected]>--- dts/framework/testbed_model/traffic_generator/scapy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)dts/framework/testbed_model/traffic_generator/scapy.py +1
-1@@ -203,7 +203,7 @@ def _sniff(self, recv_port: Port) -> None: ready_prompt = "Ready." self.send_command( "sniff(" - f'iface="{recv_port.logical_name}", quiet=True, store=False, ' + f'iface="{recv_port.logical_name}", filter="inbound",quiet=True, store=False, '
"prn=lambda p: bytes_base64(p.build()).decode(), " f'started_callback=lambda: print("{ready_prompt}")' ")",--
2.49.0