Skip to contentSkip to conversation

dts: only sniff inbound packets

PATCH In review Patrick Robb 3 participants 3 messages Mar 10 – Mar 11

lore
Share & tools
lore
#0 lore raw

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.

Fixes dfb667368077 ("dts: add Scapy asynchronous sniffer")
---
 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
index 9e15a31c00..c6e9006205 100644
@@ -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
Tested-by Reviewed-by on v1 1/1
#1 lore raw
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")
---
 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
index 9e15a31c00..c6e9006205 100644
@@ -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