From nobody Mon Dec 06 12:25:49 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 647AE18CA797; Mon, 6 Dec 2021 12:25:50 +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 4J72hY3PsVz3GXq; Mon, 6 Dec 2021 12:25:49 +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 4CA193868; Mon, 6 Dec 2021 12:25:49 +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 1B6CPnrx048213; Mon, 6 Dec 2021 12:25:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B6CPn4W048212; Mon, 6 Dec 2021 12:25:49 GMT (envelope-from git) Date: Mon, 6 Dec 2021 12:25:49 GMT Message-Id: <202112061225.1B6CPn4W048212@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: 73fd0eaf5930 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 73fd0eaf5930c5b8844ca122dd3068145ccef02c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638793549; 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=1s2OYkRDhwncfwDQTTLPaMF2wNK9DLOSqUG16LndRTg=; b=NdPfm6ECdL4LP06vTUUCd6JPLVE5ag9U+EGU45zqIYtf535ZYW30LX67STz6Ez+5qfEdbs B9vM6VIRns4YzpoIhLN3JQtnAVyPqpK+RGfXHlJM3mQeurSjQlnIzrZsqVoLqNavovnQIh y2H2MbIKmE4KdkzBz9lB4lP6Z2k4Yh7va3mKSkljFkJSaXQDlkd8fGafeRUGPrbR23Pg/Z hyJk6Q3oAfDx2uICTHKKOIGtEsGPtqTjzq6GdZI9q40yQFXxAWMzLW41D5f8UluEVDq8ec BiI7MvMpcUx51YqBGRGDt8Itp2OMeUU53w3xwGdL5W6f0kWJVAlVNqEwK1Ta+Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638793549; a=rsa-sha256; cv=none; b=gvHtLfXpH8X2jTWGd0t07CiCCgRp/+aSKeFfq8jgd0GSeXdvw/AZvhoX8Ot+fj6BB6pt8w Gu2A7mQ9MqXzBSsROV74XkHGeM3RPyrF/cF/3hxElWsa0gP2HjfornkaK/os+Pk5QpY+HQ myIdQiE/N7slrtFi1SQppQZFWi8Nji+p/lQCc7qdERg8IR4uA0FqSlEt9D4zGVXa7KhxAK L51XpJPDjaNu2bwLNjKDbOPVFrbdImol7irv22TKN0fJS7ityk1atWTDzMB5XSsjdkqzWn Lf2wYDq+qxy3E5z4vVgnqmvjB6gGHFpNnzckiVO0lUupcPdyZqOpjdGAQz5UxA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=73fd0eaf5930c5b8844ca122dd3068145ccef02c commit 73fd0eaf5930c5b8844ca122dd3068145ccef02c Author: Kristof Provost AuthorDate: 2021-12-02 17:39:23 +0000 Commit: Kristof Provost CommitDate: 2021-12-06 12:25:14 +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 --- 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 918516940ee8..641300d2aeeb 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 {