[Openvpn-devel,07/17] Split pf_check_reload check and check timer in process_coarse_timers

Message ID 20200810143707.5834-8-arne@rfc2549.org
State Accepted
Headers show
Series
  • OpenVPN refactoring
Related show

Commit Message

Arne Schwabe Aug. 10, 2020, 2:36 p.m.
This move the timer check into process_coarse_timers and makes in line
with the other functions. The the pf.enabled check is also moved
process_coarse_timers to make it more clear this only is used if
pf is enabled at all.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
 src/openvpn/forward.c | 6 +++++-
 src/openvpn/pf.c      | 4 +---
 2 files changed, 6 insertions(+), 4 deletions(-)

Comments

Gert Doering Aug. 10, 2020, 4:37 p.m. | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

I have no test rig for pf yet, but the change looks reasonable and
does not break client side testing.

Your patch has been applied to the master branch.

commit ce7ddaaf314553b6a4228f6bd4593b0a0a4badb4
Author: Arne Schwabe
Date:   Mon Aug 10 16:36:57 2020 +0200

     Split pf_check_reload check and check timer in process_coarse_timers

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20200810143707.5834-8-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20664.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 7ac878f9..27a40b0c 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -679,7 +679,11 @@  process_coarse_timers(struct context *c)
 #endif
 
 #ifdef PLUGIN_PF
-    pf_check_reload(c);
+    if (c->c2.pf.enabled
+        && event_timeout_trigger(&c->c2.pf.reload, &c->c2.timeval, ETT_DEFAULT))
+    {
+        pf_check_reload(c);
+    }
 #endif
 
     /* process --route options */
diff --git a/src/openvpn/pf.c b/src/openvpn/pf.c
index b8da26e4..f9bbfb50 100644
--- a/src/openvpn/pf.c
+++ b/src/openvpn/pf.c
@@ -547,9 +547,7 @@  pf_check_reload(struct context *c)
     const int wakeup_transition = 60;
     bool reloaded = false;
 
-    if (c->c2.pf.enabled
-        && c->c2.pf.filename
-        && event_timeout_trigger(&c->c2.pf.reload, &c->c2.timeval, ETT_DEFAULT))
+    if (c->c2.pf.filename)
     {
         platform_stat_t s;
         if (!platform_stat(c->c2.pf.filename, &s))