]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Change FULL_SYNC macro to no_pending_reliable_packets function
authorArne Schwabe <arne@rfc2549.org>
Tue, 26 Apr 2022 13:23:23 +0000 (15:23 +0200)
committerGert Doering <gert@greenie.muc.de>
Tue, 26 Apr 2022 13:39:16 +0000 (15:39 +0200)
This changes this macro to a better named inline function. This
introduces a slight whitespace problem but the next refactoring will
move the incorrectly intended block to its own function anyway.

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220426132324.76517-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24213.html

Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/ssl.c

index bad59f2a1ca0c71dbdd29fab64187fdad5c65e6e..6c6648afa74a41eefbd2a3e54ac68f1cb90d2b64 100644 (file)
@@ -1774,8 +1774,11 @@ flush_payload_buffer(struct key_state *ks)
 }
 
 /* true if no in/out acknowledgements pending */
-#define FULL_SYNC \
-    (reliable_empty(ks->send_reliable) && reliable_ack_empty(ks->rec_ack))
+static bool
+no_pending_reliable_packets(struct key_state *ks)
+{
+    return (reliable_empty(ks->send_reliable) && reliable_ack_empty(ks->rec_ack));
+}
 
 /*
  * Move the active key to the lame duck key and reinitialize the
@@ -2518,7 +2521,7 @@ tls_process(struct tls_multi *multi,
         }
 
         /* Wait for Initial Handshake ACK */
-        if (ks->state == S_PRE_START && FULL_SYNC)
+        if (ks->state == S_PRE_START && no_pending_reliable_packets(ks))
         {
             ks->state = S_START;
             state_change = true;
@@ -2544,7 +2547,7 @@ tls_process(struct tls_multi *multi,
         if (((ks->state == S_GOT_KEY && !session->opt->server)
              || (ks->state == S_SENT_KEY && session->opt->server)))
         {
-            if (FULL_SYNC)
+            if (no_pending_reliable_packets(ks))
             {
                 ks->established = now;
                 dmsg(D_TLS_DEBUG_MED, "STATE S_ACTIVE");