Message ID | 20220422142953.3805364-11-arne@rfc2549.org |
---|---|
State | Accepted |
Headers | show |
Series | Stateless three-way handshake and control channel improvements | expand |
Acked-By: Frank Lichtenheld <frank@lichtenheld.com> Trivial change. Applies on top of 15/28 (probably sooner, but this is the one I tested). Only compile/UT tested. > Arne Schwabe <arne@rfc2549.org> hat am 22.04.2022 16:29 geschrieben: > > > 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. > --- > src/openvpn/reliable.c | 6 +++--- > src/openvpn/reliable.h | 7 +++---- > src/openvpn/ssl.c | 7 ++++--- > 3 files changed, 10 insertions(+), 10 deletions(-) Regards, -- Frank Lichtenheld
Stared a bit at the code, for good measure. Does what it says. S-O-B added. Your patch has been applied to the master branch. commit 32f13c1e8902bd44c26b54de45f12e0cab642156 Author: Arne Schwabe Date: Fri Apr 22 16:29:45 2022 +0200 Change reliable_get_buf_sequenced to reliable_get_entry_sequenced 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> -- kind regards, Gert Doering
> * 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. > */ As pointed out in the IRC by Gert, this comment is wrong. It should be message or packet id instead of key id. Arne
diff --git a/src/openvpn/reliable.c b/src/openvpn/reliable.c index 5c897b225..372444350 100644 --- a/src/openvpn/reliable.c +++ b/src/openvpn/reliable.c @@ -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; diff --git a/src/openvpn/reliable.h b/src/openvpn/reliable.h index b045410a7..0bc8ab913 100644 --- a/src/openvpn/reliable.h +++ b/src/openvpn/reliable.h @@ -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. diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index dca62a875..80440c411 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -2592,9 +2592,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) { @@ -2619,7 +2620,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;