[Openvpn-devel,08/17] Rename check_ping_restart_dowork to trigger_ping_timeout_signal

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

Commit Message

Arne Schwabe Aug. 10, 2020, 2:36 p.m.
Rename the function to better capture its actual function.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
 src/openvpn/ping.c |  6 +-----
 src/openvpn/ping.h | 13 +++++++------
 2 files changed, 8 insertions(+), 11 deletions(-)

Comments

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

(Why have local prototypes when the "real" prototype is just
a few lines further up in the same .h...??  And another
.._dowork() removal lurking :-) )

Basic client test.

Your patch has been applied to the master branch.

commit 76ea0859c5d0549f5d6193cbd5e43873e22d5906
Author: Arne Schwabe
Date:   Mon Aug 10 16:36:58 2020 +0200

     Rename check_ping_restart_dowork to trigger_ping_timeout_signal

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


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/ping.c b/src/openvpn/ping.c
index 358d54b0..aa176fdb 100644
--- a/src/openvpn/ping.c
+++ b/src/openvpn/ping.c
@@ -46,12 +46,8 @@  const uint8_t ping_string[] = {
     0x07, 0xed, 0x2d, 0x0a, 0x98, 0x1f, 0xc7, 0x48
 };
 
-/*
- * Should we exit or restart due to ping (or other authenticated packet)
- * not received in n seconds?
- */
 void
-check_ping_restart_dowork(struct context *c)
+trigger_ping_timeout_signal(struct context *c)
 {
     struct gc_arena gc = gc_new();
     switch (c->options.ping_rec_timeout_action)
diff --git a/src/openvpn/ping.h b/src/openvpn/ping.h
index b51f082a..6feaa878 100644
--- a/src/openvpn/ping.h
+++ b/src/openvpn/ping.h
@@ -43,7 +43,12 @@  is_ping_msg(const struct buffer *buf)
     return buf_string_match(buf, ping_string, PING_STRING_SIZE);
 }
 
-void check_ping_restart_dowork(struct context *c);
+/**
+ * Trigger the correct signal on a --ping timeout
+ * depending if --ping-exit is set (SIGTERM) or not
+ * (SIGUSR1)
+ */
+void trigger_ping_timeout_signal(struct context *c);
 
 void check_ping_send_dowork(struct context *c);
 
@@ -54,8 +59,6 @@  void check_ping_send_dowork(struct context *c);
 static inline void
 check_ping_restart(struct context *c)
 {
-    void check_ping_restart_dowork(struct context *c);
-
     if (c->options.ping_rec_timeout
         && event_timeout_trigger(&c->c2.ping_rec_interval,
                                  &c->c2.timeval,
@@ -63,7 +66,7 @@  check_ping_restart(struct context *c)
                                   || link_socket_actual_defined(&c->c1.link_socket_addr.actual))
                                  ? ETT_DEFAULT : 15))
     {
-        check_ping_restart_dowork(c);
+        trigger_ping_timeout_signal(c);
     }
 }
 
@@ -73,8 +76,6 @@  check_ping_restart(struct context *c)
 static inline void
 check_ping_send(struct context *c)
 {
-    void check_ping_send_dowork(struct context *c);
-
     if (c->options.ping_send_timeout
         && event_timeout_trigger(&c->c2.ping_send_interval,
                                  &c->c2.timeval,