The CoPP test builds layer-3 packets and calls send() with iface=sw01,
expecting Scapy to inject them through that test port. Scapy 2.6.0
deprecated iface for layer-3 send(), sr(), and sr1() because its
behavior was undefined:

https://github.com/secdev/scapy/pull/4196

Layer-3 send() instead uses Scapy's routing and neighbor resolution to
build the link-layer header.

This is observable in the NixOS VM test because the test driver assigns
192.168.1.1/24 to the VM's eth1, while the CoPP topology uses
192.168.1.1 for R1's logical router port. Linux's default ARP behavior
allows the VM root namespace to answer a request for an address owned
on another interface. Scapy's lookup therefore receives replies from
both the host-side ovs-sw01 peer and R1.

In the failing trace, the host reply arrived first. Scapy cached that
MAC and sent all traffic to the host-side peer instead of R1, so the
arp-resolve meter never observed traffic. Removing the address from
eth1 makes the unmodified test pass. Ubuntu CI runs the suite inside a
default-networked Podman container and has no such address collision,
which explains why the same Scapy 2.7.0 test passes there.

Construct the Ethernet header from the test port and router MAC
addresses, and use sendp() on sw01. Do this for all five sends because
they all rely on the same undefined layer-3 iface behavior.

Assisted-by: Codex gpt-5.6-sol high
Signed-off-by: Ihar Hrachyshka <[email protected]>
---
 tests/system-ovn.at | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/tests/system-ovn.at b/tests/system-ovn.at
index fd35ddd4a..9bf30cd67 100644
--- a/tests/system-ovn.at
+++ b/tests/system-ovn.at
@@ -7883,8 +7883,9 @@ reject: acl-meter
 ])
 
 ip netns exec sw01 scapy -H <<-EOF
-p = IP(src="192.168.1.2", dst="192.168.1.1") / UDP(dport = 12345) / 
Raw(b"X"*64)
-send (p, iface='sw01', loop = 0, verbose = 0, count = 20)
+p = Ether(src="f0:00:00:01:02:03", dst="00:00:01:01:02:03") / \
+    IP(src="192.168.1.2", dst="192.168.1.1") / UDP(dport = 12345) / 
Raw(b"X"*64)
+sendp(p, iface='sw01', loop = 0, verbose = 0, count = 20)
 EOF
 
 # 1pps
@@ -7900,8 +7901,9 @@ NETNS_START_TCPDUMP([sw01], [-n -i sw01 icmp -Q in], 
[reject])
 check ovn-nbctl --may-exist --wait=hv meter-add acl-meter drop 5 pktps 0
 OVS_WAIT_UNTIL([ovs-ofctl -O OpenFlow15 meter-stats br-int | grep -q 
packet_count:0])
 ip netns exec sw01 scapy -H <<-EOF
-p = IP(src="192.168.1.2", dst="192.168.1.1") / UDP(dport = 12345) / 
Raw(b"X"*64)
-send (p, iface='sw01', loop = 0, verbose = 0, count = 40)
+p = Ether(src="f0:00:00:01:02:03", dst="00:00:01:01:02:03") / \
+    IP(src="192.168.1.2", dst="192.168.1.1") / UDP(dport = 12345) / 
Raw(b"X"*64)
+sendp(p, iface='sw01', loop = 0, verbose = 0, count = 40)
 EOF
 
 # 10pps
@@ -7917,8 +7919,9 @@ NETNS_START_TCPDUMP([sw01], [-n -i sw01 icmp -Q in], 
[reject])
 check ovn-nbctl --wait=hv copp-del copp0 reject
 
 ip netns exec sw01 scapy -H <<-EOF
-p = IP(src="192.168.1.2", dst="192.168.1.1") / UDP(dport = 12345) / 
Raw(b"X"*64)
-send (p, iface='sw01', loop = 0, verbose = 0, count = 20)
+p = Ether(src="f0:00:00:01:02:03", dst="00:00:01:01:02:03") / \
+    IP(src="192.168.1.2", dst="192.168.1.1") / UDP(dport = 12345) / 
Raw(b"X"*64)
+sendp(p, iface='sw01', loop = 0, verbose = 0, count = 20)
 EOF
 
 OVS_WAIT_UNTIL([
@@ -7935,8 +7938,9 @@ arp-resolve: arp-meter
 ])
 
 ip netns exec sw01 scapy -H <<-EOF
-p = IP(src="192.168.1.2", dst="172.16.1.100") / TCP(dport = 80, flags="S") / 
Raw(b"X"*64)
-send (p, iface='sw01', loop = 0, verbose = 0, count = 100)
+p = Ether(src="f0:00:00:01:02:03", dst="00:00:01:01:02:03") / \
+    IP(src="192.168.1.2", dst="172.16.1.100") / TCP(dport = 80, flags="S") / 
Raw(b"X"*64)
+sendp(p, iface='sw01', loop = 0, verbose = 0, count = 100)
 EOF
 
 # 1pps
@@ -7954,8 +7958,9 @@ icmp4-error: icmp-meter
 
 NETNS_START_TCPDUMP([sw01], [-n -i sw01 icmp], [icmp])
 ip netns exec sw01 scapy -H <<-EOF
-p = IP(src="192.168.1.2", dst="172.16.1.100", ttl=1) / TCP(dport = 8080, 
flags="S") / Raw(b"X"*64)
-send (p, iface='sw01', loop = 0, verbose = 0, count = 100)
+p = Ether(src="f0:00:00:01:02:03", dst="00:00:01:01:02:03") / \
+    IP(src="192.168.1.2", dst="172.16.1.100", ttl=1) / TCP(dport = 8080, 
flags="S") / Raw(b"X"*64)
+sendp(p, iface='sw01', loop = 0, verbose = 0, count = 100)
 EOF
 
 # 1pps
-- 
2.54.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to