From nobody Fri Nov 24 14:10:47 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 4ScH2H6hjPz52b1n; Fri, 24 Nov 2023 14:10:47 +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 4ScH2H2wKXz3ffv; Fri, 24 Nov 2023 14:10:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700835047; 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=V3aMsUMjAeOGEAmA0vctcDyQzTeBRrZ1w6fMMLxaXgQ=; b=cWYmfC5p8abcP3CyezivNuEhnwTf83Faivbb9c66IABtgua3m2V6rQdW6UQVLFqB1CQeUE 2WGpSHVu52+m0fLMfkKDPHcNJEYOosdQPe1l2FdY+CELqQpehQvQJ02iDedu1ZKFmu7SvK W1Z9hjfbjVA7qRC6IaemF0hwMb3wxnW+oBtocoxMZZIv3NpBpCVJOkDm60aq27wFz0N13c Qr3muLPrDOm5lFXnoNOv2aqe44rDCU5KQEb6/jgVYiKRzBdK2cnUm5ls1shjems0/jM20Y 2jh7qTZpoKnBCOhS9f9gGMto28uu7KSlIM7ajWmtp8vvvOaIvz4UmKmYDf1uQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700835047; 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=V3aMsUMjAeOGEAmA0vctcDyQzTeBRrZ1w6fMMLxaXgQ=; b=o87V0pyoJ6mIuSgXCJdNuDAl3iTxg+TqevSKvO+4VSV2vmzb3hg9NXovLdXnCia8RwIJcl brlhBaTAyAGpzpwJTsM5Fyd7a4HQYXmvC/RxhSiYLZZkWZOi6g+TAYijvAnqabwNXqRB/M L03OW2w0vPbWTT7I0pwf9g3j+51KLfLpvpccwfwPamvdBSspM9fXy/tNXEpM0QMEmZRlV7 2ODw+aKkZoprjQV7gu67lt8p+aTJhvCsiwl4s22lhzJ7E9zRrFgte86pAALrOXFF3GHrgQ BMYm1MY4wjO5mGk6HLQZwcsDM7CFawB7fzPe8xNjSZzNNEpIPn4qjZBohAio2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700835047; a=rsa-sha256; cv=none; b=BJ2iw8ojCojzl5eiP74+aXUdMka0Ie6dkSM1IJ25oHTyogP6rMPh+ZYKGDZpG2P6mRU8vk rkGWTC5Og9jHlAZ2WUpvlDvGw0+LpFZorV0CdOJ9bL0MEPTVEJQ5fBscHUfr1soXINOGN1 YxD25kt4jb+3hCKl5QnrkfcujOjy6nM01gl0+SUol21TTHpOeaIUf8xrdyDDSODDpTCWTo SVhwZZVE8+/ZQZYwpj4FwuKC17cFfVZ7ylf1f3v9FaaQrZmbw6hU0WLTQ0Dn18VmUQUXU0 YiP86zEafy7uS/a46XIZxhsI8kPFULFbAB/RweYc5ZqREcbkOtiVF8KbXFrscA== 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 4ScH2H20hvznsb; Fri, 24 Nov 2023 14:10:47 +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 3AOEAlpv024999; Fri, 24 Nov 2023 14:10:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AOEAlXb024996; Fri, 24 Nov 2023 14:10:47 GMT (envelope-from git) Date: Fri, 24 Nov 2023 14:10:47 GMT Message-Id: <202311241410.3AOEAlXb024996@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 38663ae5ccc2 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 38663ae5ccc2b83677356306279dec294459614c Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=38663ae5ccc2b83677356306279dec294459614c commit 38663ae5ccc2b83677356306279dec294459614c Author: Kristof Provost AuthorDate: 2023-11-16 16:06:29 +0000 Commit: Kristof Provost CommitDate: 2023-11-24 09:19:55 +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 (cherry picked from commit 0fe663b2a815dcb41431543940ec51408f418392) --- 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):