From nobody Mon Dec 13 13:50:38 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 7D62C18D19DB; 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 4JCNFC5J2Xz3CnP; 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 C37DE15B26; Mon, 13 Dec 2021 13:50:38 +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 1BDDocCn037043; Mon, 13 Dec 2021 13:50:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BDDoc3o037042; Mon, 13 Dec 2021 13:50:38 GMT (envelope-from git) Date: Mon, 13 Dec 2021 13:50:38 GMT Message-Id: <202112131350.1BDDoc3o037042@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: 3836400a785f - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 3836400a785f070826b0eaa1e642d761192321bf Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639403439; 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=6zy6MjBv9n1zppo7gcC1OpW5ZApwtYNBh1mj+IWtBFE=; b=c26SPud+EY/kzsO+RkjcgnDJnNTVG7DuxyEyYm26uy3m+wb443lo8Dp/razHnOGY2bf8UD owfWtfX/g0FuT+CZeTa/5GFN7QyE/HAAsH3aYPvsF0hjKiBp8kDOaJY92xX9/OZYl6GpCZ M92jMXDTsbN+grXiZ5CIVPUkjqJ3mVx8ZCnPwoYEdsnqKEcUhoTKbGK5ad+Iuyg4wgp20p FIJjA/yxVeR3hBXxvXgwBgw9s/13Q+bX7yOddEgIlz2qqMHQkoO4teFZYVaHzWlbtT1pRF CjGZt6LMMndJey9LvGTnd+5A0eXZodvV1z1gtL4WD9U2+SjywRO+KxAKrTdULA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639403439; a=rsa-sha256; cv=none; b=dLC9BnqDJqbvUE71LHKsxZp2ijb3A8tr8UdIpqhH3Y1g+XcJJdn8r1Dj6bX0CAJVAX0a8q AD40avIZSyAYTL7YO24TELf/tGQAvKQTnIWq6YrYW71h2TgwenEcJpfZ5dNkNB8S8QgJWO /ruhCPcg8sjFcbOnw8Ztt9XUJCSRbIzjZUPvyuXiDnAD/wM/AwLuQtf2i9waaGfgso7L3X 3pXYo6aTNILRkbpoPvFXDxDBMkTZZsndTO0yo7h4mjbDZAelqC7K8cIN2f1Ti2+keMjltE 1YnPqTmT9nImnluY8lXSY0YG/HirFRME6+gXe/KyKLHZ1gxbxA5To4JdhQHxeg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3836400a785f070826b0eaa1e642d761192321bf commit 3836400a785f070826b0eaa1e642d761192321bf Author: Kristof Provost AuthorDate: 2021-12-02 17:39:23 +0000 Commit: Kristof Provost CommitDate: 2021-12-13 13:49:27 +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 455e1ad09e93..b4f25728d17b 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1399,7 +1399,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 {