git: 44250a19c8fd - stable/12 - pfsync: Add CTLFLAG_VNET to carp_demotion_factor sysctl

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Mon, 11 Apr 2022 14:53:18 UTC
The branch stable/12 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=44250a19c8fd442e106aeb586bba33215caaedc5

commit 44250a19c8fd442e106aeb586bba33215caaedc5
Author:     Luiz Amaral <email@luiz.eng.br>
AuthorDate: 2022-04-02 10:09:06 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-04-11 14:52:51 +0000

    pfsync: Add CTLFLAG_VNET to carp_demotion_factor sysctl
    
    When trying to avoid a CARP demotion during a pfsync service restart, I
    noticed that a non-default value for the net.pfsync.carp_demotion_factor
    sysctl was not being applied during the demotion. The CARP was always
    demoted by 240.
    
    After investigating, I realized that the sysctl was using VNET_NAME()
    without the CTLFLAG_VNET.
    
    PR:             262983
    Reviewed by:    kp
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D34737
    
    (cherry picked from commit 654c1b8ef3c0fcbad3a77ea2a6f35c0dffc86e88)
---
 sys/netpfil/pf/if_pfsync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c
index b8886cd237a3..cc053b53204a 100644
--- a/sys/netpfil/pf/if_pfsync.c
+++ b/sys/netpfil/pf/if_pfsync.c
@@ -277,7 +277,7 @@ SYSCTL_NODE(_net, OID_AUTO, pfsync, CTLFLAG_RW, 0, "PFSYNC");
 SYSCTL_STRUCT(_net_pfsync, OID_AUTO, stats, CTLFLAG_VNET | CTLFLAG_RW,
     &VNET_NAME(pfsyncstats), pfsyncstats,
     "PFSYNC statistics (struct pfsyncstats, net/if_pfsync.h)");
-SYSCTL_INT(_net_pfsync, OID_AUTO, carp_demotion_factor, CTLFLAG_RW,
+SYSCTL_INT(_net_pfsync, OID_AUTO, carp_demotion_factor, CTLFLAG_VNET | CTLFLAG_RW,
     &VNET_NAME(pfsync_carp_adj), 0, "pfsync's CARP demotion factor adjustment");
 SYSCTL_ULONG(_net_pfsync, OID_AUTO, pfsync_buckets, CTLFLAG_RDTUN,
     &pfsync_buckets, 0, "Number of pfsync hash buckets");