From nobody Tue Feb 6 16:25:26 2024 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 4TTpWV2vqZz59Y1G; Tue, 6 Feb 2024 16:25:26 +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 4TTpWV2QmJz4tsX; Tue, 6 Feb 2024 16:25:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707236726; 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=R2UN4lqdlJvdPLtD2/YZUqKKU5RlkoGRcS8wVWhicPU=; b=bdf9Shrd/X+7LUVKZUvU20wu/nKiTCCGRTiXFSQTv6wo+zK6F/PAwWHWGFbjhXZ54hdNAx +ucNneuIoHmRlt0KzLdVXJ4CcI+d2u7wobYel07MbpjhNgomBtUE6/azKkF47ZvKOYmqzR h4773i5QPg0lMw66NCWRCNdxaxtz7MXiiD2IfbtSrZ636JQ0E2etJGINhKqbKqs4xyGIV3 ue/NPQkDCM5R6iNu/xqQuYwLPq5Yi5Y5Uyo+3npAUaxF2rS8I8Uekqh5gfH3hUmwi5Cxb1 OEjYJYKjkFCXS2PvVuOcs1V62L9oheDEttTvFYY8otwQmcFqpwoaXz6/llz1nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707236726; 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=R2UN4lqdlJvdPLtD2/YZUqKKU5RlkoGRcS8wVWhicPU=; b=ZjESaMqkwHPG7vqWoSeFpAVdnlxBSWo0Dmrm8Isni8ygm+WdB1cDmZj+JCMqJAsQ7YnWSH FQp7xKq1IJitcA5ttCSNdy5zRIJMKyymbByJMZuuienNQe0+fA131Ye/B5RI8obJ3SgId/ WDgqEj5mwavdv0STBTrWx6krMiU5ryrn8408dh738G3RWDnILIlegNEJMAZRgIN72GOeNI x7nDkj8hOv2ZAQbx+9gK5tet8FuYeo6DpuU6vrAUbreNn85DJaum9cxlErv8SYhOc3RzUB G2LmgJjNvUY5EE7LwUnHW+QgNJVr263PWmwgEo6Ckjh1Wx/sYRbQZgT4n3lcew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707236726; a=rsa-sha256; cv=none; b=xpUm9zdW89Q3Hi583VgET4IOfg11aqq8a/vjUYfqu1d8aQqNSsf/IhGp3OISUKwnJu9mjQ uoGBG93AmS+6U9pWLqZzcbbM1xAycc3svN0mR0lB3YPXpVSMWy1AiuIWzx7kiXN+TCL8mf qraL40IJqkR4qKAZATJvYnJL7bL1x4OS3yKGqFFgzcVsO/o4sSMJrZBW6lLw/Td+wc/4ub 6avwgSgVIdr3yuAuJT7altcTtdz0zlO+lxygNaEJQfCJJZku5b1LVVVVTWscISe1wSb1Jo U/Efx4J2SIVtp/pjemWGgQ2MkkOBNPyBIGYXLjlMPhKTY8m5DOn+IJTrSRcRgQ== 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 4TTpWV1TZ9zWPv; Tue, 6 Feb 2024 16:25:26 +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 416GPQtZ066556; Tue, 6 Feb 2024 16:25:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 416GPQX8066553; Tue, 6 Feb 2024 16:25:26 GMT (envelope-from git) Date: Tue, 6 Feb 2024 16:25:26 GMT Message-Id: <202402061625.416GPQX8066553@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: 8a16fd431d83 - main - Revert "pf: Ensure that st->kif is obtained in a way which respects the r->rpool->mtx mutex" 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: 8a16fd431d832f4601000f927701612c5d6e0a41 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8a16fd431d832f4601000f927701612c5d6e0a41 commit 8a16fd431d832f4601000f927701612c5d6e0a41 Author: Kristof Provost AuthorDate: 2024-02-06 16:22:59 +0000 Commit: Kristof Provost CommitDate: 2024-02-06 16:22:59 +0000 Revert "pf: Ensure that st->kif is obtained in a way which respects the r->rpool->mtx mutex" This commit is correct, but was misattributed. Revert so we can re-apply with the correct author set. This reverts commit 6d4a140acfdf637bb559d371c583e4db478e1549. --- sys/netpfil/pf/pf.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 12b72f50aa02..9f2c07c614b3 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -413,22 +413,25 @@ VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); } while (0) static struct pfi_kkif * -BOUND_IFACE(struct pf_kstate *st, struct pfi_kkif *k) +BOUND_IFACE(struct pf_krule *r, struct pfi_kkif *k, struct pf_pdesc *pd) { /* Floating unless otherwise specified. */ - if (! (st->rule.ptr->rule_flag & PFRULE_IFBOUND)) + if (! (r->rule_flag & PFRULE_IFBOUND)) return (V_pfi_all); /* Don't overrule the interface for states created on incoming packets. */ - if (st->direction == PF_IN) + if (pd->dir == PF_IN) + return (k); + + /* No route-to, so don't overrrule. */ + if (r->rt != PF_ROUTETO) return (k); - /* No route-to, so don't overrule. */ - if (st->rt != PF_ROUTETO) + if (r->rpool.cur == NULL) return (k); /* Bind to the route-to interface. */ - return (st->rt_kif); + return (r->rpool.cur->kif); } #define STATE_INC_COUNTERS(s) \ @@ -5015,7 +5018,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, __func__, nr, sk, nk)); /* Swap sk/nk for PF_OUT. */ - if (pf_state_insert(BOUND_IFACE(s, kif), kif, + if (pf_state_insert(BOUND_IFACE(r, kif, pd), kif, (pd->dir == PF_IN) ? sk : nk, (pd->dir == PF_IN) ? nk : sk, s)) { REASON_SET(&reason, PFRES_STATEINS);