diff options
| author | Kristof Provost <kp@FreeBSD.org> | 2021-12-02 17:39:23 +0000 |
|---|---|---|
| committer | Kristof Provost <kp@FreeBSD.org> | 2021-12-13 08:54:16 +0000 |
| commit | c36006be54242b3c4e07ac646bebb642555e5905 (patch) | |
| tree | 3c12a62f5da99861afba44ab8a116471ced7b445 | |
| parent | 7164b77ce2f3ecc3697a5ea9a225ff15a6a421ab (diff) | |
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)
| -rw-r--r-- | sbin/ifconfig/ifpfsync.c | 2 | ||||
| -rw-r--r-- | 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 { |
