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