From nobody Tue Sep 30 12:53:36 2025 X-Original-To: dev-commits-src-all@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 4cbdKD4Xwhz69486; Tue, 30 Sep 2025 12:53:36 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cbdKD3w0lz41dq; Tue, 30 Sep 2025 12:53:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759236816; 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=aCTMMjHC1qQk6GB3DE37sXNFfveZYMc+7NMI2GnHvlE=; b=LvpjEBatiO4Hf4wBYi5SZ3qSWmwPeFT678LudIxXbNoXmYW2UNDBND5rjvdIpcX+hJpM9Y v/CKn70dZGmEEy78Vj19EBDaz2SlPViNqRRJI2LOexDBQnlieiA24Bq+6y4z8AkXc44umN upaVzMd3ZNSkzLNx0JDBl34/x5NhRNXvvphttd+CP3D5u66xptC3eKt3lWyuFw0WuKPiA9 eHdrVfoWm1abANeKt2A8fhDux9seUj3AgJBylU1HfYjF/2TaXx8xtFVI8pv48QE3I7d8wp 5duJCwLC/Ad1LbReQFOxbFljBYSAC+AmD9i2pZLUqZFPgqETfolf2H14Do1TAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759236816; 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=aCTMMjHC1qQk6GB3DE37sXNFfveZYMc+7NMI2GnHvlE=; b=gisXDH27t2tNJVl3fToEjK5GkXtmGabNbXrZ5tNiOYHhLl6AQ1Lv+rR4matM08JrdPZqJk uTRyHpfuSYkvxCfDVCZ724sSPLLEY3a77KeBjnfRkkWnT9JcQ3Qw6hcoMM3MedcCeZx3iu 1npKcD4Xl64PijGnCcBgi1LEXVZ6hHNVhU7DZqydN4h0q4DE/eNMN/SktTLsCKLyO0MJrs bwUGnVDcaDDB7SMKy3fT44W8eew0XkUKFo2YZ/4XGhy22a4t6UglTUiIm8VOR/gxVYVNCw NjSJoQL7uLo281kBnLSdNMm7GL+Tto/l1qpmI4ywtubE12XEhbAbN0iPYaw1Ew== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759236816; a=rsa-sha256; cv=none; b=y1g8/eFDFltdHkGxo+CHzcBXyyAv0cjw3sH+cUASZ8qFMlfAxJAvEA7EToKVuTDOanXMbr 1ZXTblqhuxAGQtMFlCIgaHpwJfG6ufphBYQkg6JFmzTAjrCuw5hdyLw+h7VtSCDz0SKcH1 h4QXu7PjG03mPYnjhHRbUzrtXRmWiZYFDNzr9VPNSb4F1m7cYwPqRAVgbaSRO7boXTz4RU 8mlVQeQC8oPf3Wemgwoi1kpMqC6kH9lwYQAY7V6sP4bIKTY1S3Le/xtQg+sYrFJaXhvvDP URYdmHTepCklmNOSgUi5XLwN6BH2eCzqg0kxPTl93IQHwR3y8C7ShVM4bMn2og== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cbdKD39hzzdMl; Tue, 30 Sep 2025 12:53:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58UCraB7061763; Tue, 30 Sep 2025 12:53:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58UCraB0061760; Tue, 30 Sep 2025 12:53:36 GMT (envelope-from git) Date: Tue, 30 Sep 2025 12:53:36 GMT Message-Id: <202509301253.58UCraB0061760@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: a57f6ce4792f - main - pf tests: fix intermittent mld test failures List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a57f6ce4792f12bebdbe3e46d6d9d39da10055db Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a57f6ce4792f12bebdbe3e46d6d9d39da10055db commit a57f6ce4792f12bebdbe3e46d6d9d39da10055db Author: Kristof Provost AuthorDate: 2025-09-27 14:41:30 +0000 Commit: Kristof Provost CommitDate: 2025-09-30 12:53:21 +0000 pf tests: fix intermittent mld test failures We can't reliably check for the absence of replies to our MLD queries (because a host may announce its multicast subscriptions), so enable pf logging and check for the relevant error message instead. PR: 289821 MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D52762 --- tests/sys/netpfil/pf/Makefile | 2 +- tests/sys/netpfil/pf/mld.py | 35 +++++++++++++++-------------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index 99500fc90806..b363e0b17c76 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -72,7 +72,7 @@ ATF_TESTS_PYTEST+= tcp.py # Allow tests to run in parallel in their own jails TEST_METADATA+= execenv="jail" -TEST_METADATA+= execenv_jail_params="vnet allow.raw_sockets" +TEST_METADATA+= execenv_jail_params="vnet allow.raw_sockets allow.read_msgbuf" ${PACKAGE}FILES+= \ bsnmpd.conf \ diff --git a/tests/sys/netpfil/pf/mld.py b/tests/sys/netpfil/pf/mld.py index d118a34c8a7d..b3ef6c21b3de 100644 --- a/tests/sys/netpfil/pf/mld.py +++ b/tests/sys/netpfil/pf/mld.py @@ -32,23 +32,22 @@ from atf_python.sys.net.vnet import VnetTestTemplate class TestMLD(VnetTestTemplate): REQUIRED_MODULES = [ "pf" ] TOPOLOGY = { - "vnet1": {"ifaces": ["if1"]}, + "vnet1": {"ifaces": ["if1"], "opts": ["allow.read_msgbuf"]}, "vnet2": {"ifaces": ["if1"]}, "if1": {"prefixes6": [("2001:db8::2/64", "2001:db8::1/64")]}, } def vnet2_handler(self, vnet): ifname = vnet.iface_alias_map["if1"].name - #ToolsHelper.print_output("/sbin/pfctl -e") + ToolsHelper.print_output("/sbin/pfctl -e") ToolsHelper.pf_rules([ "pass", ]) ToolsHelper.print_output("/sbin/pfctl -x loud") - #ToolsHelper.print_output("echo \"j 230.0.0.1 %s\ns 3600\nq\" | /usr/sbin/mtest" % ifname) def find_mld_reply(self, pkt, ifname): pkt.show() - s = DelayedSend(pkt) + s = DelayedSend(pkt, ifname) found = False packets = self.sp.sniff(iface=ifname, timeout=5) @@ -66,7 +65,6 @@ class TestMLD(VnetTestTemplate): def test_router_alert(self): """Verify that we allow MLD packets with router alert extension header""" ifname = self.vnet.iface_alias_map["if1"].name - #ToolsHelper.print_output("/sbin/ifconfig %s inet6 -ifdisable" % ifname) ToolsHelper.print_output("/sbin/ifconfig") # Import in the correct vnet, so at to not confuse Scapy @@ -76,20 +74,17 @@ class TestMLD(VnetTestTemplate): self.sp = sp self.sc = sc - # A correct MLD query gets a reply - pkt = sp.IPv6(src="fe80::1%%%s" % ifname, dst="ff02::1", hlim=1) \ - / sp.RouterAlert(value=0) \ + # MLD packets with an incorrect hop limit get dropped. + pkt = sp.Ether() \ + / sp.IPv6(src="fe80::1%%%s" % ifname, dst="ff02::1", hlim=2) \ + / sp.IPv6ExtHdrHopByHop(options=[ \ + sp.RouterAlert(value=0) \ + ]) \ / sp.ICMPv6MLQuery2() - assert self.find_mld_reply(pkt, ifname) + # We can't reliably test this by checking for a reply, because + # the other jail may just send a spontaneous MLD reply. + self.find_mld_reply(pkt, ifname) - # The wrong extension header does not - pkt = sp.IPv6(src="fe80::1%%%s" % ifname, dst="ff02::1", hlim=1) \ - / sp.IPv6ExtHdrRouting() \ - / sp.ICMPv6MLQuery2() - assert not self.find_mld_reply(pkt, ifname) - - # Neither does an incorrect hop limit - pkt = sp.IPv6(src="fe80::1%%%s" % ifname, dst="ff02::1", hlim=2) \ - / sp.RouterAlert(value=0) \ - / sp.ICMPv6MLQuery2() - assert not self.find_mld_reply(pkt, ifname) + # Check if we logged dropping the MLD paacket + dmesg = ToolsHelper.get_output("/sbin/dmesg") + assert dmesg.find("Invalid MLD") != -1