Created attachment 232871 [details] carp_demotion_factor flag patch During a maintenance to move our pfsync connection, I tried to set "net.pfsync.carp_demotion_factor" to 0 in order to avoid a CARP demotion while the pfsync service restarted, but to my surprise, the CARP still got demoted by the default value of 240. The server is acting as a router, running GENERIC kernel, version 13.0-RELEASE-p6. Upon investigation, I noticed that this sysctl was missing the flag CTLFLAG_VNET on its declaration. After patching the code in sys/netpfil/pf/if_pfsync.c to include the flag, the sysctl started behaving as expected. Reproduction steps: $ sysctl net.pfsync.carp_demotion_factor=0 $ service pfsync restart $ grep carp /var/log/syslog Observe the carp still getting demoted by the default value, 240. 2022-03-31T09:09:16.428406+00:00 router-awtest-02 kernel: carp: demoted by 240 to 240 (pfsync bulk start) 2022-03-31T09:09:16.428423+00:00 router-awtest-02 kernel: carp: demoted by -240 to 0 (pfsync bulk done) After applying the patch, the same steps should yield a demotion by 0: 2022-04-01T10:05:35.764685+00:00 router-awtest-02 kernel: carp: demoted by 0 to 0 (pfsync bulk start) 2022-04-01T10:05:35.764701+00:00 router-awtest-02 kernel: carp: demoted by 0 to 0 (pfsync bulk done) The patch was applied to 13.0-RELEASE, but should also apply cleanly on CURRENT.
Code review request created: https://reviews.freebsd.org/D34737
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=654c1b8ef3c0fcbad3a77ea2a6f35c0dffc86e88 commit 654c1b8ef3c0fcbad3a77ea2a6f35c0dffc86e88 Author: Luiz Amaral <email@luiz.eng.br> AuthorDate: 2022-04-02 10:09:06 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2022-04-02 10:11:32 +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 sys/netpfil/pf/if_pfsync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
I'm moving back to In Progress as I realized that there is the MFC pending.
A commit in branch stable/12 references this bug: 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(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=68efe27ffaec8bec9968800f2eddeca2940b78e4 commit 68efe27ffaec8bec9968800f2eddeca2940b78e4 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:33 +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(-)
Mark closed again, has been MFC'd