mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
CLEANUP: quic: Rename <buf> variable into quic_packet_read_long_header()
Make this function be more readable: there is no struct buffer variable passed as parameter to this function. Should be backported to 2.7.
This commit is contained in:
parent
81a02b59f5
commit
6ff52f9ce5
@ -5954,10 +5954,10 @@ static int quic_conn_init_idle_timer_task(struct quic_conn *qc)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse into <pkt> a long header located at <*buf> buffer, <end> begin a pointer to the end
|
/* Parse into <pkt> a long header located at <*pos> position, <end> begin a pointer to the end
|
||||||
* past one byte of this buffer.
|
* past one byte of this buffer.
|
||||||
*/
|
*/
|
||||||
static inline int quic_packet_read_long_header(unsigned char **buf, const unsigned char *end,
|
static inline int quic_packet_read_long_header(unsigned char **pos, const unsigned char *end,
|
||||||
struct quic_rx_packet *pkt)
|
struct quic_rx_packet *pkt)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -5965,15 +5965,15 @@ static inline int quic_packet_read_long_header(unsigned char **buf, const unsign
|
|||||||
|
|
||||||
TRACE_ENTER(QUIC_EV_CONN_RXPKT);
|
TRACE_ENTER(QUIC_EV_CONN_RXPKT);
|
||||||
|
|
||||||
if (end == *buf) {
|
if (end == *pos) {
|
||||||
TRACE_ERROR("buffer data consumed", QUIC_EV_CONN_RXPKT);
|
TRACE_ERROR("buffer data consumed", QUIC_EV_CONN_RXPKT);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destination Connection ID Length */
|
/* Destination Connection ID Length */
|
||||||
dcid_len = *(*buf)++;
|
dcid_len = *(*pos)++;
|
||||||
/* We want to be sure we can read <dcid_len> bytes and one more for <scid_len> value */
|
/* We want to be sure we can read <dcid_len> bytes and one more for <scid_len> value */
|
||||||
if (dcid_len > QUIC_CID_MAXLEN || end - *buf < dcid_len + 1) {
|
if (dcid_len > QUIC_CID_MAXLEN || end - *pos < dcid_len + 1) {
|
||||||
TRACE_ERROR("too long DCID", QUIC_EV_CONN_RXPKT);
|
TRACE_ERROR("too long DCID", QUIC_EV_CONN_RXPKT);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
@ -5990,23 +5990,23 @@ static inline int quic_packet_read_long_header(unsigned char **buf, const unsign
|
|||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(pkt->dcid.data, *buf, dcid_len);
|
memcpy(pkt->dcid.data, *pos, dcid_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
pkt->dcid.len = dcid_len;
|
pkt->dcid.len = dcid_len;
|
||||||
*buf += dcid_len;
|
*pos += dcid_len;
|
||||||
|
|
||||||
/* Source Connection ID Length */
|
/* Source Connection ID Length */
|
||||||
scid_len = *(*buf)++;
|
scid_len = *(*pos)++;
|
||||||
if (scid_len > QUIC_CID_MAXLEN || end - *buf < scid_len) {
|
if (scid_len > QUIC_CID_MAXLEN || end - *pos < scid_len) {
|
||||||
TRACE_ERROR("too long SCID", QUIC_EV_CONN_RXPKT);
|
TRACE_ERROR("too long SCID", QUIC_EV_CONN_RXPKT);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scid_len)
|
if (scid_len)
|
||||||
memcpy(pkt->scid.data, *buf, scid_len);
|
memcpy(pkt->scid.data, *pos, scid_len);
|
||||||
pkt->scid.len = scid_len;
|
pkt->scid.len = scid_len;
|
||||||
*buf += scid_len;
|
*pos += scid_len;
|
||||||
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
leave:
|
leave:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user