From nobody Mon Dec 13 13:50:39 2021 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 5BD4818D19DA; Mon, 13 Dec 2021 13:50:41 +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 4JCNFD2Rfvz3CZ5; Mon, 13 Dec 2021 13:50:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AA113158EB; Mon, 13 Dec 2021 13:50:39 +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 1BDDodZQ037067; Mon, 13 Dec 2021 13:50:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BDDodWi037066; Mon, 13 Dec 2021 13:50:39 GMT (envelope-from git) Date: Mon, 13 Dec 2021 13:50:39 GMT Message-Id: <202112131350.1BDDodWi037066@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: c36006be5424 - stable/12 - pfsync: fix incorrect enabling of defer mode 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/12 X-Git-Reftype: branch X-Git-Commit: c36006be54242b3c4e07ac646bebb642555e5905 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639403440; 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=87H0wAs/9RWFZuH6MLZ/mv9k1DhL6FxM439DHF90Ja0=; b=Xw9lOU0BJF5cQqNcjOAE2yruqxleUWbz3MFXfcEKYBLXBWC8v7NyvyySFjCHVbVbOLjhN+ sBmiLHZinbrge8AzNdgHiWIzcLAi/lB8w4JTVCZs7HEZvFWA99htznAbHYWmvk43ivF++K yZ/qtd32Ky0a2lyrClC0cG/bJDAy0YhZG5PRWp/qkP/2ZJceE+NurkMZgjsyiUfntUOjzz GiFheU4b96bXFWVf8BIQeGpkT7+RiCDxZG8IBKflizNhiOroG8cYM2Vco8C1qTSyJxAOvE oUfjyzg6OlwSqB8wF7qA92wsmKiLiLK486TpC3XUGVpbDggGB9kRrVV4VKPWYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639403440; a=rsa-sha256; cv=none; b=UcYVrWXB4AIyDHf1LgOneDkjf4pCux0pe6xZRNwzFl5snrikpk2XRE8AYBDU5TAIvTt/kh GYpFoyK6xV1qjl1fVnDM3ZSZ9YDsZNdNAeoNj6DMBxIIWJMbvyWC+9kMUbJSRFuRFrPQRL N7IIhz02ihaVYgQmXSJkNxk6/6rzDtrE0gr1LlAuKIrRrzrk6IJDZxLirPtAxpgWG2CXpY PG6OnHQDK+2VZD7zRhLwlj4T/K8AgGOZim1pR6WsPtM+WGe9+jBoSU3xC1cNakZJ2Ifb/J xNRCDDmpHlikcrlrcsOh+3bJDDEPvawXPy2udoYTgKU+RRt9rMKyiwBGKNeX6g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c36006be54242b3c4e07ac646bebb642555e5905 commit c36006be54242b3c4e07ac646bebb642555e5905 Author: Kristof Provost AuthorDate: 2021-12-02 17:39:23 +0000 Commit: Kristof Provost CommitDate: 2021-12-13 08:54:16 +0000 pfsync: fix incorrect enabling of defer mode When we exposed the PFSYNCF_OK flag to userspace in 5f5bf88949d we unintentionally caused defer mode to always be enabled. The ioctl check only looked for nonzero, not for the PFSYNCF_DEFER flag. Fix this check and ensure ifconfig sets the flag. Reviewed by: glebius MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D33244 (cherry picked from commit 73fd0eaf5930c5b8844ca122dd3068145ccef02c) --- sbin/ifconfig/ifpfsync.c | 2 +- sys/netpfil/pf/if_pfsync.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/ifconfig/ifpfsync.c b/sbin/ifconfig/ifpfsync.c index 60e3d4360aa3..e3b5e6a30bbc 100644 --- a/sbin/ifconfig/ifpfsync.c +++ b/sbin/ifconfig/ifpfsync.c @@ -178,7 +178,7 @@ setpfsync_defer(const char *val, int d, int s, const struct afswtch *rafp) if (ioctl(s, SIOCGETPFSYNC, (caddr_t)&ifr) == -1) err(1, "SIOCGETPFSYNC"); - preq.pfsyncr_defer = d; + preq.pfsyncr_defer = d ? PFSYNCF_DEFER : 0; if (ioctl(s, SIOCSETPFSYNC, (caddr_t)&ifr) == -1) err(1, "SIOCSETPFSYNC"); } diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 44f84b811596..b8886cd237a3 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1401,7 +1401,7 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data) pfsyncr.pfsyncr_syncpeer.s_addr; sc->sc_maxupdates = pfsyncr.pfsyncr_maxupdates; - if (pfsyncr.pfsyncr_defer) { + if (pfsyncr.pfsyncr_defer & PFSYNCF_DEFER) { sc->sc_flags |= PFSYNCF_DEFER; V_pfsync_defer_ptr = pfsync_defer; } else {