git: 65cc5af1cf88 - main - sys tests: Add scapy as a required program

From: Jose Luis Duran <jlduran_at_FreeBSD.org>
Date: Wed, 12 Feb 2025 14:44:48 UTC
The branch main has been updated by jlduran:

URL: https://cgit.FreeBSD.org/src/commit/?id=65cc5af1cf88ed124ab16091624e918faa61c7f2

commit 65cc5af1cf88ed124ab16091624e918faa61c7f2
Author:     Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2025-02-12 14:38:44 +0000
Commit:     Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2025-02-12 14:40:43 +0000

    sys tests: Add scapy as a required program
    
    These atf-python tests rely on scapy to run.
    Add it as a required program.
    
    Reported by:    glebius, kp
    Reviewed by:    kp
    Approved by:    emaste (mentor)
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D48946
---
 tests/sys/netinet/carp.py     | 2 ++
 tests/sys/netinet/igmp.py     | 1 +
 tests/sys/netpfil/pf/frag6.py | 3 +++
 tests/sys/netpfil/pf/icmp.py  | 2 ++
 tests/sys/netpfil/pf/nat64.py | 4 ++++
 tests/sys/netpfil/pf/nat66.py | 2 ++
 6 files changed, 14 insertions(+)

diff --git a/tests/sys/netinet/carp.py b/tests/sys/netinet/carp.py
index 0db31e79ba84..e35c9470d035 100644
--- a/tests/sys/netinet/carp.py
+++ b/tests/sys/netinet/carp.py
@@ -39,6 +39,7 @@ class TestCarp(VnetTestTemplate):
             if p.src != "00:00:5e:00:01:01":
                 raise
 
+    @pytest.mark.require_progs(["scapy"])
     def test_source_mac(self):
         "Test carp packets source address"
 
@@ -52,6 +53,7 @@ class TestCarp(VnetTestTemplate):
 
         self.check_carp_src_mac(carp_pkts)
 
+    @pytest.mark.require_progs(["scapy"])
     def test_source_mac_vrrp(self):
         "Test VRRP packets source address"
 
diff --git a/tests/sys/netinet/igmp.py b/tests/sys/netinet/igmp.py
index 4a4e67211bd7..5d3b38cac38f 100644
--- a/tests/sys/netinet/igmp.py
+++ b/tests/sys/netinet/igmp.py
@@ -80,6 +80,7 @@ class TestIGMP(VnetTestTemplate):
             sp = _sp
         super().setup_method(method)
 
+    @pytest.mark.require_progs(["scapy"])
     def test_igmp3_join_leave(self):
         "Test that we send the expected join/leave IGMPv2 messages"
 
diff --git a/tests/sys/netpfil/pf/frag6.py b/tests/sys/netpfil/pf/frag6.py
index f274fc28a3bf..108b53874d0b 100644
--- a/tests/sys/netpfil/pf/frag6.py
+++ b/tests/sys/netpfil/pf/frag6.py
@@ -43,6 +43,7 @@ class TestFrag6(VnetTestTemplate):
         return False
 
     @pytest.mark.require_user("root")
+    @pytest.mark.require_progs(["scapy"])
     def test_dup_frag_hdr(self):
         "Test packets with duplicate fragment headers"
         srv_vnet = self.vnet_map["vnet2"]
@@ -64,6 +65,7 @@ class TestFrag6(VnetTestTemplate):
             assert not p.getlayer(sp.ICMPv6EchoReply)
 
     @pytest.mark.require_user("root")
+    @pytest.mark.require_progs(["scapy"])
     def test_overlong(self):
         "Test overly long fragmented packet"
 
@@ -112,6 +114,7 @@ class TestFrag6_Overlap(VnetTestTemplate):
         ])
 
     @pytest.mark.require_user("root")
+    @pytest.mark.require_progs(["scapy"])
     def test_overlap(self):
         "Ensure we discard packets with overlapping fragments"
 
diff --git a/tests/sys/netpfil/pf/icmp.py b/tests/sys/netpfil/pf/icmp.py
index e54f9f20a058..6ab649f62be7 100644
--- a/tests/sys/netpfil/pf/icmp.py
+++ b/tests/sys/netpfil/pf/icmp.py
@@ -86,6 +86,7 @@ class TestICMP(VnetTestTemplate):
         vnet.pipe.send("Got ICMP destination unreachable packet")
 
     @pytest.mark.require_user("root")
+    @pytest.mark.require_progs(["scapy"])
     def test_inner_match(self):
         vnet = self.vnet_map["vnet1"]
         dst_vnet = self.vnet_map["vnet3"]
@@ -160,6 +161,7 @@ class TestICMP(VnetTestTemplate):
         return
 
     @pytest.mark.require_user("root")
+    @pytest.mark.require_progs(["scapy"])
     def test_fragmentation_needed(self):
         ToolsHelper.print_output("/sbin/route add default 192.0.2.1")
 
diff --git a/tests/sys/netpfil/pf/nat64.py b/tests/sys/netpfil/pf/nat64.py
index 64ec5ae15262..070b7a82e6d9 100644
--- a/tests/sys/netpfil/pf/nat64.py
+++ b/tests/sys/netpfil/pf/nat64.py
@@ -93,6 +93,7 @@ class TestNAT64(VnetTestTemplate):
             "pass in on %s inet6 af-to inet from 192.0.2.1" % ifname])
 
     @pytest.mark.require_user("root")
+    @pytest.mark.require_progs(["scapy"])
     def test_tcp_rst(self):
         ToolsHelper.print_output("/sbin/route -6 add default 2001:db8::1")
 
@@ -126,6 +127,7 @@ class TestNAT64(VnetTestTemplate):
         assert "A" in tcp.flags
 
     @pytest.mark.require_user("root")
+    @pytest.mark.require_progs(["scapy"])
     def test_udp_port_closed(self):
         ToolsHelper.print_output("/sbin/route -6 add default 2001:db8::1")
 
@@ -147,6 +149,7 @@ class TestNAT64(VnetTestTemplate):
         assert udp.dport == 1222
 
     @pytest.mark.require_user("root")
+    @pytest.mark.require_progs(["scapy"])
     def test_address_unreachable(self):
         ToolsHelper.print_output("/sbin/route -6 add default 2001:db8::1")
 
@@ -172,6 +175,7 @@ class TestNAT64(VnetTestTemplate):
         assert ip6.hlim == 62
 
     @pytest.mark.require_user("root")
+    @pytest.mark.require_progs(["scapy"])
     def test_udp_checksum(self):
         ToolsHelper.print_output("/sbin/route -6 add default 2001:db8::1")
 
diff --git a/tests/sys/netpfil/pf/nat66.py b/tests/sys/netpfil/pf/nat66.py
index 3a037ac710fc..f93512b5b99c 100644
--- a/tests/sys/netpfil/pf/nat66.py
+++ b/tests/sys/netpfil/pf/nat66.py
@@ -140,6 +140,7 @@ class TestNAT66(VnetTestTemplate):
         assert found
 
     @pytest.mark.require_user("root")
+    @pytest.mark.require_progs(["scapy"])
     def test_npt_icmp(self):
         cl_vnet = self.vnet_map["vnet1"]
         ifname = cl_vnet.iface_alias_map["if1"].name
@@ -168,6 +169,7 @@ class TestNAT66(VnetTestTemplate):
         self.check_icmp_too_big(sp, 12000, 5000)
 
     @pytest.mark.require_user("root")
+    @pytest.mark.require_progs(["scapy"])
     def test_npt_route_to_icmp(self):
         cl_vnet = self.vnet_map["vnet1"]
         ifname = cl_vnet.iface_alias_map["if1"].name