[Openvpn-devel,11/17] Eliminate check_tls wrapper function

Message ID 20200810143707.5834-12-arne@rfc2549.org
State Accepted
Headers show
Series OpenVPN refactoring | expand

Commit Message

Arne Schwabe Aug. 10, 2020, 4:37 a.m. UTC
Move check into caller.

Remove two in function forward declarations that are not needed from
check_tls_errors.

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

Comments

Gert Doering Aug. 10, 2020, 8:32 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

Straightforward.  Client-side tested.

Your patch has been applied to the master branch.

commit cd88d947b100deb55bb8388fd2f1e95e0af4a658
Author: Arne Schwabe
Date:   Mon Aug 10 16:37:01 2020 +0200

     Eliminate check_tls wrapper function

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20200810143707.5834-12-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20670.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 0e05b08b..36e5c175 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -77,20 +77,6 @@  show_wait_status(struct context *c)
 
 #endif /* ifdef ENABLE_DEBUG */
 
-/*
- * Does TLS session need service?
- */
-static inline void
-check_tls(struct context *c)
-{
-    void check_tls_dowork(struct context *c);
-
-    if (c->c2.tls_multi)
-    {
-        check_tls_dowork(c);
-    }
-}
-
 /*
  * TLS errors are fatal in TCP mode.
  * Also check for --tls-exit trigger.
@@ -98,10 +84,6 @@  check_tls(struct context *c)
 static inline void
 check_tls_errors(struct context *c)
 {
-    void check_tls_errors_co(struct context *c);
-
-    void check_tls_errors_nco(struct context *c);
-
     if (c->c2.tls_multi && c->c2.tls_exit_signal)
     {
         if (link_socket_connection_oriented(c->c2.link_socket))
@@ -157,7 +139,7 @@  context_reschedule_sec(struct context *c, int sec)
  *
  */
 void
-check_tls_dowork(struct context *c)
+check_tls(struct context *c)
 {
     interval_t wakeup = BIG_TIMEOUT;
 
@@ -1852,8 +1834,11 @@  pre_select(struct context *c)
         return;
     }
 
-    /* Does TLS need service? */
-    check_tls(c);
+    /* If tls is enabled, do tls control channel packet processing. */
+    if (c->c2.tls_multi)
+    {
+        check_tls(c);
+    }
 
     /* In certain cases, TLS errors will require a restart */
     check_tls_errors(c);
diff --git a/src/openvpn/forward.h b/src/openvpn/forward.h
index 27e7fde7..a8b19f69 100644
--- a/src/openvpn/forward.h
+++ b/src/openvpn/forward.h
@@ -68,7 +68,7 @@  extern counter_type link_read_bytes_global;
 
 extern counter_type link_write_bytes_global;
 
-void check_tls_dowork(struct context *c);
+void check_tls(struct context *c);
 
 void check_tls_errors_co(struct context *c);