git: 73fd0eaf5930 - main - pfsync: fix incorrect enabling of defer mode
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Dec 2021 12:25:49 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=73fd0eaf5930c5b8844ca122dd3068145ccef02c
commit 73fd0eaf5930c5b8844ca122dd3068145ccef02c
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2021-12-02 17:39:23 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
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 {