MINOR: quic: Get rid of a struct buffer in quic_lstnr_dgram_read()
This is to be sure xprt functions do not manipulate the buffer struct
passed as parameter to quic_lstnr_dgram_read() from low level datagram
I/O callback in quic_sock.c (quic_sock_fd_iocb()).
diff --git a/include/haproxy/xprt_quic.h b/include/haproxy/xprt_quic.h
index ab52808..a24df74 100644
--- a/include/haproxy/xprt_quic.h
+++ b/include/haproxy/xprt_quic.h
@@ -1184,7 +1184,7 @@
void quic_set_tls_alert(struct quic_conn *qc, int alert);
int quic_set_app_ops(struct quic_conn *qc, const unsigned char *alpn, size_t alpn_len);
-ssize_t quic_lstnr_dgram_read(struct buffer *buf, size_t len, void *owner,
+ssize_t quic_lstnr_dgram_read(unsigned char *buf, size_t len, void *owner,
struct sockaddr_storage *saddr);
#endif /* USE_QUIC */
diff --git a/src/quic_sock.c b/src/quic_sock.c
index ee6a2fa..ef94acb 100644
--- a/src/quic_sock.c
+++ b/src/quic_sock.c
@@ -212,7 +212,7 @@
} while (0);
b_add(buf, ret);
- quic_lstnr_dgram_read(buf, ret, l, &saddr);
+ quic_lstnr_dgram_read((unsigned char *)b_head(buf), ret, l, &saddr);
b_del(buf, ret);
out:
MT_LIST_APPEND(&l->rx.rxbuf_list, &rxbuf->mt_list);
diff --git a/src/xprt_quic.c b/src/xprt_quic.c
index 8a9b4f2..e08a1a4 100644
--- a/src/xprt_quic.c
+++ b/src/xprt_quic.c
@@ -5527,7 +5527,7 @@
* as owner calling <func> function.
* Return the number of bytes read if succeeded, -1 if not.
*/
-static ssize_t quic_dgram_read(struct buffer *buf, size_t len, void *owner,
+static ssize_t quic_dgram_read(unsigned char *buf, size_t len, void *owner,
struct sockaddr_storage *saddr, qpkt_read_func *func)
{
unsigned char *pos;
@@ -5538,7 +5538,7 @@
.owner = owner,
};
- pos = (unsigned char *)b_head(buf);
+ pos = buf;
end = pos + len;
do {
int ret;
@@ -5563,13 +5563,13 @@
if (dgram_ctx.qc)
dgram_ctx.qc->rx.bytes += len;
- return pos - (unsigned char *)b_head(buf);
+ return pos - buf;
err:
return -1;
}
-ssize_t quic_lstnr_dgram_read(struct buffer *buf, size_t len, void *owner,
+ssize_t quic_lstnr_dgram_read(unsigned char *buf, size_t len, void *owner,
struct sockaddr_storage *saddr)
{
return quic_dgram_read(buf, len, owner, saddr, qc_lstnr_pkt_rcv);