From nobody Thu Jun 15 06:36:43 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QhXd73Myjz4d8KC; Thu, 15 Jun 2023 06:36:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QhXd72YmBz43xV; Thu, 15 Jun 2023 06:36:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686811003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IYJDTXMFM1u83qjW85st05cGpj9Cn96xoIS917NPsCs=; b=Yp5Y1e1qKhLJ4G81tgYS0w8uQ5p1HZRxJl3ZW3dEzxcaqZOc/HEpnZ2BqS6O/Ml36tkjYR A176dd8oJyPB34B7oNIKyKbJ9LyOSTurSGShl8gdcI20FfNv4vl/u6rv+6K+0CK4bRFNVx rY6f8mFt1zXQYPMcz45qUiXfLHygMGyoU3SLFno43BFeMXzLgaaUQh8XVHDKr9olkL8HAZ E/axcLLrsa5XNhZCMD9OPRjRbasqfPM6aassc75zFpFvsxRxUItz8ZaBfGI3g/mMCfX/te NDeTHTIPsFZ5hw0DC9IIX1keHTTkL+z56Y65MExSv+0hJHFcCueM1V7BBJ9Zug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686811003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IYJDTXMFM1u83qjW85st05cGpj9Cn96xoIS917NPsCs=; b=RtnAz04QoRCHWIg2JNYmLRAonIEWoinJLDfWrg/2JHJ/Rf0OCVO2GMic1OXsZsRMHqdaOw gwfaBV72Hzspt2U9lg9KwJeSp0W3khklEE/SXLLXKdjkHztsVSoWX2dZ8aJoTcTVjmFkqT Mu7I4m8826t3USuroRpQSs0VfACFrU4RIrNxmJjX6A6tfCaLaiDJ1qGnv0cPY+LOQLkNL8 7YF2YOV8/eD2+8c4geAnYbCX3KadCdHf7emuUqYz6z8kg37s20jWeuTuSSkJxliT1pwCfJ K+WIi3ERqbO13eUbpiWzHCrXCQcMHIOr7o1GlX8fgGr4KGywwSTmJFQjynQ64g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686811003; a=rsa-sha256; cv=none; b=c4Qsrif34DIebpy9gbu97Htbgt0eAyqXJ0nUro1GUVy/FZJ3WUmbYzg39kTNaU+TcvrrtK sMf35N6rTBhSNQ1WcBOQYNrSZ5Pr7LN0Vo7BhdIOHOBmmsF0anepAU/bO9EhRAvOLWapJ5 fIJPEgsW+VecuGtLFGZNITtLmxG2bpTh74ETNFlwY5O3lpKN1zEIz28sBcpL52BfZYiSTW yJMWvXx2PYPaw9R1/JtpF7/vVp+0mVgCOeG5N06fvwYMO/XA0IYWQIozYMq94GHrc+4pVv LIQvagEnBB5A+PoyWEl4CxKUbnrnXg1SDQ9SRYw8j+mEJBnlUInnR4Z/lsj0yw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QhXd71dCLzbwT; Thu, 15 Jun 2023 06:36:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35F6ahKe096866; Thu, 15 Jun 2023 06:36:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35F6ahYh096865; Thu, 15 Jun 2023 06:36:43 GMT (envelope-from git) Date: Thu, 15 Jun 2023 06:36:43 GMT Message-Id: <202306150636.35F6ahYh096865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 84b41342da1f - main - ipfw: add eaction tests List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 84b41342da1ff3b9cf4eb785752201575c5e4391 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=84b41342da1ff3b9cf4eb785752201575c5e4391 commit 84b41342da1ff3b9cf4eb785752201575c5e4391 Author: Alexander V. Chernikov AuthorDate: 2023-06-15 06:36:16 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-06-15 06:36:16 +0000 ipfw: add eaction tests MFC after: 2 weeks --- sbin/ipfw/tests/test_add_rule.py | 33 ++++++++++++++++++++++++++++++ tests/atf_python/sys/netpfil/ipfw/ioctl.py | 6 ++++++ 2 files changed, 39 insertions(+) diff --git a/sbin/ipfw/tests/test_add_rule.py b/sbin/ipfw/tests/test_add_rule.py index 65b4e7d33646..42c594a83bcf 100755 --- a/sbin/ipfw/tests/test_add_rule.py +++ b/sbin/ipfw/tests/test_add_rule.py @@ -173,6 +173,39 @@ class TestAddRule(BaseTest): }, id="test_comment", ), + pytest.param( + { + "in": "add tcp-setmss 123 ip from any to 1.2.3.4", + "out": { + "objs": [ + NTlv(IpFwTlvType.IPFW_TLV_EACTION, idx=1, name="tcp-setmss"), + ], + "insns": [ + InsnIp(IpFwOpcode.O_IP_DST, ip="1.2.3.4"), + Insn(IpFwOpcode.O_EXTERNAL_ACTION, arg1=1), + Insn(IpFwOpcode.O_EXTERNAL_DATA, arg1=123), + ], + }, + }, + id="test_eaction_tcp-setmss", + ), + pytest.param( + { + "in": "add eaction ntpv6 AAA ip from any to 1.2.3.4", + "out": { + "objs": [ + NTlv(IpFwTlvType.IPFW_TLV_EACTION, idx=1, name="ntpv6"), + NTlv(0, idx=2, name="AAA"), + ], + "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), + ], + }, + }, + id="test_eaction_ntp", + ), ], ) def test_add_rule(self, rule): diff --git a/tests/atf_python/sys/netpfil/ipfw/ioctl.py b/tests/atf_python/sys/netpfil/ipfw/ioctl.py index 45ba96a7fb70..4c6d3f234c6c 100644 --- a/tests/atf_python/sys/netpfil/ipfw/ioctl.py +++ b/tests/atf_python/sys/netpfil/ipfw/ioctl.py @@ -90,6 +90,11 @@ class BaseTlv(object): for obj in self.obj_list: obj.print_obj(prepend) + def print_obj_hex(self, prepend=""): + print(prepend) + print() + print(" ".join(["x{:02X}".format(b) for b in bytes(self)])) + @classmethod def _validate(cls, data): if len(data) < sizeof(IpFwObjTlv): @@ -487,6 +492,7 @@ rule_attrs = prepare_attrs_map( [ AttrDescr(IpFwTlvType.IPFW_TLV_TBL_NAME, NTlv), AttrDescr(IpFwTlvType.IPFW_TLV_STATE_NAME, NTlv), + AttrDescr(IpFwTlvType.IPFW_TLV_EACTION, NTlv), ], True, ),