git: 01d5a6f30ce8 - main - tests/ipfw: Update regression tests to match new 32-bit size rule numbers

From: Olivier Cochard <olivier_at_FreeBSD.org>
Date: Fri, 03 Oct 2025 11:09:00 UTC
The branch main has been updated by olivier:

URL: https://cgit.FreeBSD.org/src/commit/?id=01d5a6f30ce8f5006bd9d5528a487ef4d79c48c3

commit 01d5a6f30ce8f5006bd9d5528a487ef4d79c48c3
Author:     Olivier Cochard <olivier@FreeBSD.org>
AuthorDate: 2025-10-03 10:56:27 +0000
Commit:     Olivier Cochard <olivier@FreeBSD.org>
CommitDate: 2025-10-03 11:06:49 +0000

    tests/ipfw: Update regression tests to match new 32-bit size rule numbers
    
    Commit 4a77657cbc01 increased the size of several opcodes to ipfw_insn_u32.
    
    Approved by:    ae
    Sponsored by:   Netflix
    Differential Revision:  https://reviews.freebsd.org/D52876
---
 sbin/ipfw/tests/test_add_rule.py           | 25 +++++++++++++------------
 tests/atf_python/sys/netpfil/ipfw/insns.py | 19 +++++++++++--------
 2 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/sbin/ipfw/tests/test_add_rule.py b/sbin/ipfw/tests/test_add_rule.py
index 60c8cebaceaa..c2c4bf0b360c 100755
--- a/sbin/ipfw/tests/test_add_rule.py
+++ b/sbin/ipfw/tests/test_add_rule.py
@@ -36,6 +36,7 @@ from atf_python.sys.netpfil.ipfw.insns import InsnProb
 from atf_python.sys.netpfil.ipfw.insns import InsnProto
 from atf_python.sys.netpfil.ipfw.insns import InsnReject
 from atf_python.sys.netpfil.ipfw.insns import InsnTable
+from atf_python.sys.netpfil.ipfw.insns import InsnU32
 from atf_python.sys.netpfil.ipfw.insns import IpFwOpcode
 from atf_python.sys.netpfil.ipfw.ioctl import CTlv
 from atf_python.sys.netpfil.ipfw.ioctl import CTlvRule
@@ -152,8 +153,8 @@ class TestAddRule(BaseTest):
                             NTlv(IpFwTlvType.IPFW_TLV_TBL_NAME, idx=2, name="BBB"),
                         ],
                         "insns": [
-                            InsnTable(IpFwOpcode.O_IP_SRC_LOOKUP, arg1=1),
-                            InsnTable(IpFwOpcode.O_IP_DST_LOOKUP, arg1=2),
+                            InsnU32(IpFwOpcode.O_IP_SRC_LOOKUP, u32=1),
+                            InsnU32(IpFwOpcode.O_IP_DST_LOOKUP, u32=2),
                             InsnEmpty(IpFwOpcode.O_ACCEPT),
                         ],
                     },
@@ -182,7 +183,7 @@ class TestAddRule(BaseTest):
                         ],
                         "insns": [
                             InsnIp(IpFwOpcode.O_IP_DST, ip="1.2.3.4"),
-                            Insn(IpFwOpcode.O_EXTERNAL_ACTION, arg1=1),
+                            InsnU32(IpFwOpcode.O_EXTERNAL_ACTION, u32=1),
                             Insn(IpFwOpcode.O_EXTERNAL_DATA, arg1=123),
                         ],
                     },
@@ -199,8 +200,8 @@ class TestAddRule(BaseTest):
                         ],
                         "insns": [
                             InsnIp(IpFwOpcode.O_IP_DST, ip="1.2.3.4"),
-                            Insn(IpFwOpcode.O_EXTERNAL_ACTION, arg1=1),
-                            Insn(IpFwOpcode.O_EXTERNAL_INSTANCE, arg1=2),
+                            InsnU32(IpFwOpcode.O_EXTERNAL_ACTION, u32=1),
+                            InsnU32(IpFwOpcode.O_EXTERNAL_INSTANCE, u32=2),
                         ],
                     },
                 },
@@ -227,7 +228,7 @@ class TestAddRule(BaseTest):
                         ],
                         "insns": [
                             InsnComment(comment="test comment"),
-                            Insn(IpFwOpcode.O_CHECK_STATE, arg1=1),
+                            InsnU32(IpFwOpcode.O_CHECK_STATE, u32=1),
                         ],
                     },
                 },
@@ -241,9 +242,9 @@ class TestAddRule(BaseTest):
                             NTlv(IpFwTlvType.IPFW_TLV_STATE_NAME, idx=1, name="OUT"),
                         ],
                         "insns": [
-                            Insn(IpFwOpcode.O_PROBE_STATE, arg1=1),
+                            InsnU32(IpFwOpcode.O_PROBE_STATE, u32=1),
                             Insn(IpFwOpcode.O_PROTO, arg1=6),
-                            Insn(IpFwOpcode.O_KEEP_STATE, arg1=1),
+                            InsnU32(IpFwOpcode.O_KEEP_STATE, u32=1),
                             InsnEmpty(IpFwOpcode.O_ACCEPT),
                         ],
                     },
@@ -259,7 +260,7 @@ class TestAddRule(BaseTest):
                         ],
                         "insns": [
                             Insn(IpFwOpcode.O_PROTO, arg1=6),
-                            Insn(IpFwOpcode.O_KEEP_STATE, arg1=1),
+                            InsnU32(IpFwOpcode.O_KEEP_STATE, u32=1),
                             InsnEmpty(IpFwOpcode.O_ACCEPT),
                         ],
                     },
@@ -370,7 +371,7 @@ class TestAddRule(BaseTest):
             ),
             pytest.param(("pipe 42", Insn(IpFwOpcode.O_PIPE, arg1=42)), id="pipe_42"),
             pytest.param(
-                ("skipto 42", Insn(IpFwOpcode.O_SKIPTO, arg1=42)), id="skipto_42"
+                ("skipto 42", InsnU32(IpFwOpcode.O_SKIPTO, u32=42)), id="skipto_42"
             ),
             pytest.param(
                 ("netgraph 42", Insn(IpFwOpcode.O_NETGRAPH, arg1=42)), id="netgraph_42"
@@ -386,7 +387,7 @@ class TestAddRule(BaseTest):
             ),
             pytest.param(("tee 42", Insn(IpFwOpcode.O_TEE, arg1=42)), id="tee_42"),
             pytest.param(
-                ("call 420", Insn(IpFwOpcode.O_CALLRETURN, arg1=420)), id="call_420"
+                ("call 420", InsnU32(IpFwOpcode.O_CALLRETURN, u32=420)), id="call_420"
             ),
             # TOK_FORWARD
             pytest.param(
@@ -400,7 +401,7 @@ class TestAddRule(BaseTest):
             ),
             pytest.param(("reass", InsnEmpty(IpFwOpcode.O_REASS)), id="reass"),
             pytest.param(
-                ("return", InsnEmpty(IpFwOpcode.O_CALLRETURN, is_not=True)), id="return"
+                ("return", InsnU32(IpFwOpcode.O_CALLRETURN, is_not=True)), id="return"
             ),
         ],
     )
diff --git a/tests/atf_python/sys/netpfil/ipfw/insns.py b/tests/atf_python/sys/netpfil/ipfw/insns.py
index 12f145f49393..f8a56de901ae 100644
--- a/tests/atf_python/sys/netpfil/ipfw/insns.py
+++ b/tests/atf_python/sys/netpfil/ipfw/insns.py
@@ -510,7 +510,7 @@ class InsnIp6(Insn):
 
 insn_attrs = prepare_attrs_map(
     [
-        AttrDescr(IpFwOpcode.O_CHECK_STATE, Insn),
+        AttrDescr(IpFwOpcode.O_CHECK_STATE, InsnU32),
         AttrDescr(IpFwOpcode.O_ACCEPT, InsnEmpty),
         AttrDescr(IpFwOpcode.O_COUNT, InsnEmpty),
 
@@ -521,16 +521,19 @@ insn_attrs = prepare_attrs_map(
         AttrDescr(IpFwOpcode.O_COUNT, InsnEmpty),
         AttrDescr(IpFwOpcode.O_QUEUE, Insn),
         AttrDescr(IpFwOpcode.O_PIPE, Insn),
-        AttrDescr(IpFwOpcode.O_SKIPTO, Insn),
+        AttrDescr(IpFwOpcode.O_SKIPTO, InsnU32),
         AttrDescr(IpFwOpcode.O_NETGRAPH, Insn),
         AttrDescr(IpFwOpcode.O_NGTEE, Insn),
         AttrDescr(IpFwOpcode.O_DIVERT, Insn),
         AttrDescr(IpFwOpcode.O_TEE, Insn),
-        AttrDescr(IpFwOpcode.O_CALLRETURN, Insn),
+        AttrDescr(IpFwOpcode.O_CALLRETURN, InsnU32),
         AttrDescr(IpFwOpcode.O_SETFIB, Insn),
         AttrDescr(IpFwOpcode.O_SETDSCP, Insn),
         AttrDescr(IpFwOpcode.O_REASS, InsnEmpty),
-        AttrDescr(IpFwOpcode.O_SETMARK, Insn),
+        AttrDescr(IpFwOpcode.O_SETMARK, InsnU32),
+
+        AttrDescr(IpFwOpcode.O_EXTERNAL_ACTION, InsnU32),
+        AttrDescr(IpFwOpcode.O_EXTERNAL_INSTANCE, InsnU32),
 
 
 
@@ -545,11 +548,11 @@ insn_attrs = prepare_attrs_map(
         AttrDescr(IpFwOpcode.O_IP_DST, InsnIp),
         AttrDescr(IpFwOpcode.O_IP6_DST, InsnIp6),
         AttrDescr(IpFwOpcode.O_IP6_SRC, InsnIp6),
-        AttrDescr(IpFwOpcode.O_IP_SRC_LOOKUP, InsnTable),
-        AttrDescr(IpFwOpcode.O_IP_DST_LOOKUP, InsnTable),
+        AttrDescr(IpFwOpcode.O_IP_SRC_LOOKUP, InsnU32),
+        AttrDescr(IpFwOpcode.O_IP_DST_LOOKUP, InsnU32),
         AttrDescr(IpFwOpcode.O_IP_SRCPORT, InsnPorts),
         AttrDescr(IpFwOpcode.O_IP_DSTPORT, InsnPorts),
-        AttrDescr(IpFwOpcode.O_PROBE_STATE, Insn),
-        AttrDescr(IpFwOpcode.O_KEEP_STATE, Insn),
+        AttrDescr(IpFwOpcode.O_PROBE_STATE, InsnU32),
+        AttrDescr(IpFwOpcode.O_KEEP_STATE, InsnU32),
     ]
 )