Skip to content

Commit 4eefabe

Browse files
committed
MINOR: quic: convert ALPN to char *
1 parent f41e684 commit 4eefabe

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

include/haproxy/quic_conn.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void qc_check_close_on_released_mux(struct quic_conn *qc);
8484
int quic_stateless_reset_token_cpy(unsigned char *pos, size_t len,
8585
const unsigned char *salt, size_t saltlen);
8686
int quic_reuse_srv_params(struct quic_conn *qc,
87-
const unsigned char *alpn,
87+
const char *alpn,
8888
const struct quic_early_transport_params *etps);
8989

9090
/* Returns true if <qc> is used on the backed side (as a client). */
@@ -204,7 +204,7 @@ static inline void *qc_counters(enum obj_type *o, const struct stats_module *m)
204204
void chunk_frm_appendf(struct buffer *buf, const struct quic_frame *frm);
205205
void quic_set_connection_close(struct quic_conn *qc, const struct quic_err err);
206206
void quic_set_tls_alert(struct quic_conn *qc, int alert);
207-
int quic_set_app_ops(struct quic_conn *qc, const unsigned char *alpn, size_t alpn_len);
207+
int quic_set_app_ops(struct quic_conn *qc, const char *alpn, int alpn_len);
208208
int qc_check_dcid(struct quic_conn *qc, unsigned char *dcid, size_t dcid_len);
209209

210210
void qc_notify_err(struct quic_conn *qc);

src/quic_conn.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ void quic_set_tls_alert(struct quic_conn *qc, int alert)
272272
/* Set the application for <qc> QUIC connection.
273273
* Return 1 if succeeded, 0 if not.
274274
*/
275-
int quic_set_app_ops(struct quic_conn *qc, const unsigned char *alpn, size_t alpn_len)
275+
int quic_set_app_ops(struct quic_conn *qc, const char *alpn, int alpn_len)
276276
{
277277
if (alpn_len >= 2 && memcmp(alpn, "h3", 2) == 0)
278278
qc->app_ops = &h3_ops;
@@ -290,14 +290,14 @@ int quic_set_app_ops(struct quic_conn *qc, const unsigned char *alpn, size_t alp
290290
* Return 1 if succeeded, 0 if not.
291291
*/
292292
int quic_reuse_srv_params(struct quic_conn *qc,
293-
const unsigned char *alpn,
293+
const char *alpn,
294294
const struct quic_early_transport_params *etps)
295295
{
296296
int ret = 0;
297297

298298
TRACE_ENTER(QUIC_EV_CONN_NEW, qc);
299299

300-
if (!alpn || !quic_set_app_ops(qc, alpn, strlen((char *)alpn)))
300+
if (!alpn || !quic_set_app_ops(qc, alpn, strlen(alpn)))
301301
goto err;
302302

303303
qc_early_transport_params_reuse(qc, &qc->tx.params, etps);

src/quic_ssl.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,11 +1011,11 @@ int qc_ssl_do_hanshake(struct quic_conn *qc, struct ssl_sock_ctx *ctx)
10111011
}
10121012
}
10131013
else if (qc->conn) {
1014-
const unsigned char *alpn;
1015-
size_t alpn_len;
1014+
const char *alpn;
1015+
int alpn_len;
10161016

10171017
qc->conn->flags &= ~(CO_FL_SSL_WAIT_HS | CO_FL_WAIT_L6_CONN);
1018-
if (!ssl_sock_get_alpn(qc->conn, ctx, (const char **)&alpn, (int *)&alpn_len) ||
1018+
if (!ssl_sock_get_alpn(qc->conn, ctx, &alpn, &alpn_len) ||
10191019
!quic_set_app_ops(qc, alpn, alpn_len)) {
10201020
TRACE_ERROR("No negotiated ALPN", QUIC_EV_CONN_IO_CB, qc, &state);
10211021
quic_set_tls_alert(qc, SSL_AD_NO_APPLICATION_PROTOCOL);
@@ -1358,7 +1358,7 @@ int qc_alloc_ssl_sock_ctx(struct quic_conn *qc, void *target)
13581358
#if (HA_OPENSSL_VERSION_NUMBER >= 0x10101000L) && defined(HAVE_SSL_0RTT_QUIC)
13591359
if ((srv->ssl_ctx.options & SRV_SSL_O_EARLY_DATA)) {
13601360
int ret;
1361-
unsigned char *alpn;
1361+
char *alpn;
13621362
struct quic_early_transport_params *etps;
13631363
/* This code is called by connect_server() by way of
13641364
* conn_prepare().
@@ -1374,7 +1374,7 @@ int qc_alloc_ssl_sock_ctx(struct quic_conn *qc, void *target)
13741374
* able to send data at early-data level.
13751375
*/
13761376
HA_RWLOCK_RDLOCK(SERVER_LOCK, &srv->path_params.param_lock);
1377-
alpn = (unsigned char *)srv->path_params.nego_alpn;
1377+
alpn = srv->path_params.nego_alpn;
13781378
etps = &srv->path_params.tps;
13791379
ret = quic_reuse_srv_params(qc, alpn, etps);
13801380
HA_RWLOCK_RDUNLOCK(SERVER_LOCK, &srv->path_params.param_lock);

src/ssl_sock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2242,7 +2242,7 @@ static int ssl_sock_advertise_alpn_protos(SSL *s, const unsigned char **out,
22422242
}
22432243

22442244
#ifdef USE_QUIC
2245-
if (qc && !quic_set_app_ops(qc, *out, *outlen)) {
2245+
if (qc && !quic_set_app_ops(qc, (const char *)*out, *outlen)) {
22462246
quic_set_tls_alert(qc, SSL_AD_NO_APPLICATION_PROTOCOL);
22472247
return SSL_TLSEXT_ERR_NOACK;
22482248
}

0 commit comments

Comments
 (0)