]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Change reliable_get_buf_sequenced to reliable_get_entry_sequenced
authorArne Schwabe <arne@rfc2549.org>
Fri, 22 Apr 2022 14:29:45 +0000 (16:29 +0200)
committerGert Doering <gert@greenie.muc.de>
Wed, 27 Apr 2022 16:05:52 +0000 (18:05 +0200)
This returns not just the buffer of a reliable_entry but the whole
entry. This allows the caller to also inspect the original opcode
and packet id.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20220422142953.3805364-11-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24153.html

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

index 5c897b225a87ca50403aea72c369335269d334a9..3724443507c260a65af89a631d67e98b6ad0bffb 100644 (file)
@@ -533,8 +533,8 @@ reliable_get_buf_output_sequenced(struct reliable *rel)
 }
 
 /* get active buffer for next sequentially increasing key ID */
-struct buffer *
-reliable_get_buf_sequenced(struct reliable *rel)
+struct reliable_entry *
+reliable_get_entry_sequenced(struct reliable *rel)
 {
     int i;
     for (i = 0; i < rel->size; ++i)
@@ -542,7 +542,7 @@ reliable_get_buf_sequenced(struct reliable *rel)
         struct reliable_entry *e = &rel->array[i];
         if (e->active && e->packet_id == rel->packet_id)
         {
-            return &e->buf;
+            return e;
         }
     }
     return NULL;
index 1f3dc7088f012b28b0e8804e19a89d5f85451501..8da2c07290785e8fd84dbb02870ca3d1641fe4c7 100644 (file)
@@ -351,11 +351,10 @@ bool reliable_ack_acknowledge_packet_id(struct reliable_ack *ack, packet_id_type
  * @param rel The reliable structure from which to retrieve the
  *     buffer.
  *
- * @return A pointer to the buffer of the entry with the next
- *     sequential key ID.  If no such entry is present, this function
- *     returns NULL.
+ * @return A pointer to the entry with the next sequential key ID.
+ *     If no such entry is present, this function  returns NULL.
  */
-struct buffer *reliable_get_buf_sequenced(struct reliable *rel);
+struct reliable_entry *reliable_get_entry_sequenced(struct reliable *rel);
 
 /**
  * Remove an entry from a reliable structure.
index 65703eaac94a393edf0d5bb52ee9113da2468ac1..cb3382d6f767639cb7072ac532115d94f79b1bf7 100644 (file)
@@ -2557,9 +2557,10 @@ tls_process_state(struct tls_multi *multi,
     }
 
     /* Write incoming ciphertext to TLS object */
-    struct buffer *buf = reliable_get_buf_sequenced(ks->rec_reliable);
-    if (buf)
+    struct reliable_entry *entry = reliable_get_entry_sequenced(ks->rec_reliable);
+    if (entry)
     {
+        struct buffer *buf = &entry->buf;
         int status = 0;
         if (buf->len)
         {
@@ -2584,7 +2585,7 @@ tls_process_state(struct tls_multi *multi,
     }
 
     /* Read incoming plaintext from TLS object */
-    buf = &ks->plaintext_read_buf;
+    struct buffer *buf = &ks->plaintext_read_buf;
     if (!buf->len)
     {
         int status;