From nobody Fri Nov 17 22:33:57 2023 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 4SXBX60K8vz51RdS; Fri, 17 Nov 2023 22:33:58 +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 4SXBX56nDZz4Gb5; Fri, 17 Nov 2023 22:33:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700260438; 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=HNecXuL3TZs7jefgwboLriYYjPAKHMSqhSqlPUpQX6w=; b=WKvqkqqbwiRH/jmnsJsuAZ/IV663JEI8Zxt0FZuaZ5rJkkjxmotw/u8Adwj11mSJg1ywjZ EezC5CGoDxjyakZgFDMJS/qZTc4hP3bLj25i+a70oyZIQzTv2eXea5rNiZoKoyq6sVb87w JglZ8OJC8nRd0CW4ZioVeh2DOwAKLidIb5xqpb9/pEAtGCft3yLl6hYdak7AFpzQAdOYTI dYZY7xCdbRzNfktavn29eZ1BgmoIE1ndb/tAuUxdw2fkCg6mUJmLszwrWDXL3HKmgTBM2U JkybbXrTf7kX9lFnmdd32yoynZgLU5SJgsOwDC15jTsFhhBi2WESPR9HjSNDRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700260438; 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=HNecXuL3TZs7jefgwboLriYYjPAKHMSqhSqlPUpQX6w=; b=VZ5vCeHnzHnwnum1DYfo+q/vEYFjKIF1WJflet8yGCoqbnkcDB9VbXVf6VghZJCEBWbgZ9 r2pH2FvU37VzfOl9DnpCln9WdBPqLUjqCR0+lpmVzXa30ZP2w7bv7ggz4WeLTBBe4Q/RJg yRG8hFBQbuRVpK+rfNfrGLJz1bcPSwu8pyLBUqCvUXf4jkZKgOCbI73FuylXNMLSOpsbnM M6Ym7AQyA0fiiFZGoD8heR83n/YpDue0a/RQULP2d/RRM+ERWPoH5Amfwdk+tr00FWPNnw b4R0lhPUvRbQtBOVBU+bYHf+Yg1RqO6SB+F8Z1EYZ45fLETtMEy0V4InCoR3zg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700260438; a=rsa-sha256; cv=none; b=TSK62SuEyJth+gaVdh8ATH/75TNAp4uGfbMW1ncd/3+cZzdLN+3q20bNI95iduXYIjnc0a cM9QANYvEpqxx7wzKPDW4BcLKTh8Xa+DGC/7pvZcPo38LP/nJcSuR1UI3NWmYGEfGYu49a naTqUU/TyqIOMWQNtKntRHaXK+AhZ9rNQxe0B+YfPOIhwfniTv7FoHPEpCfKhYYfuowbTV 5ZEb9IXb99IWfc/8pci25vS+23FStk+YKlYbE3qcQ/SBYEx/z31ljXnQf3KgNWiXL1sHH8 OC9izo01vi25uHHOzwqmqlSfxwpAyqgIVN17yuFrKDH33ajDToLcqA2gYuEkRw== 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 4SXBX55rSjz11gn; Fri, 17 Nov 2023 22:33:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3AHMXvb0027407; Fri, 17 Nov 2023 22:33:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AHMXvYj027404; Fri, 17 Nov 2023 22:33:57 GMT (envelope-from git) Date: Fri, 17 Nov 2023 22:33:57 GMT Message-Id: <202311172233.3AHMXvYj027404@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: 0fe663b2a815 - main - pf: always create multihomed states as floating 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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: 0fe663b2a815dcb41431543940ec51408f418392 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0fe663b2a815dcb41431543940ec51408f418392 commit 0fe663b2a815dcb41431543940ec51408f418392 Author: Kristof Provost AuthorDate: 2023-11-16 16:06:29 +0000 Commit: Kristof Provost CommitDate: 2023-11-17 22:33:43 +0000 pf: always create multihomed states as floating When we create a new state for multihomed sctp connections (i.e. based on INIT/INIT_ACK or ASCONF parameters) we cannot know what interfaces we'll be seeing that traffic on. Make those states floating, irrespective of state policy. MFC after: 1 week Sponsored by: Orange Business Services --- sys/netpfil/pf/pf.c | 8 ++++++-- tests/sys/netpfil/pf/sctp.py | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 9cb5fe03b5c2..a9870ebe166b 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6131,8 +6131,12 @@ again: j->pd.sctp_flags |= PFDESC_SCTP_ADD_IP; PF_RULES_RLOCK(); sm = NULL; - /* XXX: May generated unwanted abort if we try to insert a duplicate state. */ - ret = pf_test_rule(&r, &sm, kif, + /* + * New connections need to be floating, because + * we cannot know what interfaces it will use. + * That's why we pass V_pfi_all rather than kif. + */ + ret = pf_test_rule(&r, &sm, V_pfi_all, j->m, off, &j->pd, &ra, &rs, NULL); PF_RULES_RUNLOCK(); SDT_PROBE4(pf, sctp, multihome, test, kif, r, j->m, ret); diff --git a/tests/sys/netpfil/pf/sctp.py b/tests/sys/netpfil/pf/sctp.py index 5db52dd993f2..6042badffb64 100644 --- a/tests/sys/netpfil/pf/sctp.py +++ b/tests/sys/netpfil/pf/sctp.py @@ -372,6 +372,7 @@ class TestSCTP(VnetTestTemplate): ToolsHelper.print_output("/sbin/pfctl -e") ToolsHelper.pf_rules([ + "set state-policy if-bound", "block proto sctp", "pass inet proto sctp to 192.0.2.0/24"]) @@ -386,9 +387,9 @@ class TestSCTP(VnetTestTemplate): # Check that we have a state for 192.0.2.3 and 192.0.2.2 to 192.0.2.1, but also to 192.0.2.4 states = ToolsHelper.get_output("/sbin/pfctl -ss") print(states) - assert re.search(r"all sctp 192.0.2.1:.*192.0.2.3:1234", states) + assert re.search(r".*sctp 192.0.2.1:.*192.0.2.3:1234", states) assert re.search(r"all sctp 192.0.2.1:.*192.0.2.2:1234", states) - assert re.search(r"all sctp 192.0.2.4:.*192.0.2.3:1234", states) + assert re.search(r".*sctp 192.0.2.4:.*192.0.2.3:1234", states) assert re.search(r"all sctp 192.0.2.4:.*192.0.2.2:1234", states) class TestSCTPv6(VnetTestTemplate):