]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: ssl_sock: Set the QUIC application from ssl_sock_advertise_alpn_protos.
authorFrédéric Lécaille <flecaille@haproxy.com>
Tue, 14 Dec 2021 18:40:04 +0000 (19:40 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 17 Dec 2021 07:38:43 +0000 (08:38 +0100)
Make this function call quic_set_app_ops() if the protocol could be negotiated
by the TLS stack.

src/ssl_sock.c

index 158cb48ffcd25f2d947c3eeac72d9276d2663e18..2f030bab14379a13f25f5f4250fa2a82c2fe0343 100644 (file)
@@ -1974,17 +1974,26 @@ static int ssl_sock_advertise_alpn_protos(SSL *s, const unsigned char **out,
                                           unsigned int server_len, void *arg)
 {
        struct ssl_bind_conf *conf = arg;
+#ifdef USE_QUIC
+       struct connection *conn = SSL_get_ex_data(s, ssl_app_data_index);
+#endif
 
        if (SSL_select_next_proto((unsigned char**) out, outlen, (const unsigned char *)conf->alpn_str,
                                  conf->alpn_len, server, server_len) != OPENSSL_NPN_NEGOTIATED) {
 #ifdef USE_QUIC
-               struct connection *conn = SSL_get_ex_data(s, ssl_app_data_index);
-
                if (conn->qc)
                        quic_set_tls_alert(conn->qc, SSL_AD_NO_APPLICATION_PROTOCOL);
 #endif
                return SSL_TLSEXT_ERR_NOACK;
        }
+
+#ifdef USE_QUIC
+       if (conn->qc && !quic_set_app_ops(conn->qc, *out, *outlen)) {
+               quic_set_tls_alert(conn->qc, SSL_AD_NO_APPLICATION_PROTOCOL);
+               return SSL_TLSEXT_ERR_NOACK;
+       }
+#endif
+
        return SSL_TLSEXT_ERR_OK;
 }
 #endif