[Openvpn-devel,09/17] Eliminate check_fragment function

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

Commit Message

Arne Schwabe Aug. 10, 2020, 4:36 a.m. UTC
This another of the small wrapper function where the check is
better move into the calling function.

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

Comments

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

"What the message says".

Passed the client-side test that excercises fragments.

Your patch has been applied to the master branch.

commit b7aebba25645e9e9c1359313fc35724f7e0e8529
Author: Arne Schwabe
Date:   Mon Aug 10 16:36:59 2020 +0200

     Eliminate check_fragment function

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20200810143707.5834-10-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20672.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 27a40b0c..866dd138 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -129,8 +129,6 @@  static inline void
 check_incoming_control_channel(struct context *c)
 {
 #if P2MP
-    void check_incoming_control_channel_dowork(struct context *c);
-
     if (tls_test_payload_len(c->c2.tls_multi) > 0)
     {
         check_incoming_control_channel_dowork(c);
@@ -138,22 +136,6 @@  check_incoming_control_channel(struct context *c)
 #endif
 }
 
-#ifdef ENABLE_FRAGMENT
-/*
- * Should we deliver a datagram fragment to remote?
- */
-static inline void
-check_fragment(struct context *c)
-{
-    void check_fragment_dowork(struct context *c);
-
-    if (c->c2.fragment)
-    {
-        check_fragment_dowork(c);
-    }
-}
-#endif
-
 /*
  * Set our wakeup to 0 seconds, so we will be rescheduled
  * immediately.
@@ -520,7 +502,7 @@  check_status_file(struct context *c)
  * Should we deliver a datagram fragment to remote?
  */
 void
-check_fragment_dowork(struct context *c)
+check_fragment(struct context *c)
 {
     struct link_socket_info *lsi = get_link_socket_info(c);
 
@@ -1903,7 +1885,10 @@  pre_select(struct context *c)
 
 #ifdef ENABLE_FRAGMENT
     /* Should we deliver a datagram fragment to remote? */
-    check_fragment(c);
+    if (c->c2.fragment)
+    {
+        check_fragment(c);
+    }
 #endif
 
     /* Update random component of timeout */
diff --git a/src/openvpn/forward.h b/src/openvpn/forward.h
index 114a24e7..e8b8900a 100644
--- a/src/openvpn/forward.h
+++ b/src/openvpn/forward.h
@@ -84,7 +84,7 @@  void check_push_request(struct context *c);
 #endif /* P2MP */
 
 #ifdef ENABLE_FRAGMENT
-void check_fragment_dowork(struct context *c);
+void check_fragment(struct context *c);
 
 #endif /* ENABLE_FRAGMENT */