]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC QSM: Allow QSM to know if we are in the server role
authorHugo Landau <hlandau@openssl.org>
Fri, 28 Apr 2023 15:56:34 +0000 (16:56 +0100)
committerHugo Landau <hlandau@openssl.org>
Wed, 24 May 2023 09:34:47 +0000 (10:34 +0100)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20856)

include/internal/quic_stream_map.h
ssl/quic/quic_channel.c
ssl/quic/quic_stream_map.c
test/quic_txp_test.c

index 1af0c57d1eec01686168ccd17ab68d3de525d227..7d2356c22d7ea6e3454d0d91918c2364c0c1521a 100644 (file)
@@ -255,6 +255,7 @@ typedef struct quic_stream_map_st {
     void                    *get_stream_limit_cb_arg;
     QUIC_RXFC               *max_streams_bidi_rxfc;
     QUIC_RXFC               *max_streams_uni_rxfc;
+    int                     is_server;
 } QUIC_STREAM_MAP;
 
 /*
@@ -274,7 +275,8 @@ int ossl_quic_stream_map_init(QUIC_STREAM_MAP *qsm,
                               uint64_t (*get_stream_limit_cb)(int uni, void *arg),
                               void *get_stream_limit_cb_arg,
                               QUIC_RXFC *max_streams_bidi_rxfc,
-                              QUIC_RXFC *max_streams_uni_rxfc);
+                              QUIC_RXFC *max_streams_uni_rxfc,
+                              int is_server);
 
 /*
  * Any streams still in the map will be released as though
index 6e0af8676066cba7be0f9e882df5ae6172c3787b..4325434c4fe6359322060f8f7988dce9112e0317 100644 (file)
@@ -186,7 +186,8 @@ static int ch_init(QUIC_CHANNEL *ch)
 
     if (!ossl_quic_stream_map_init(&ch->qsm, get_stream_limit, ch,
                                    &ch->max_streams_bidi_rxfc,
-                                   &ch->max_streams_uni_rxfc))
+                                   &ch->max_streams_uni_rxfc,
+                                   ch->is_server))
         goto err;
 
     ch->have_qsm = 1;
@@ -2426,7 +2427,6 @@ QUIC_STREAM *ossl_quic_channel_new_stream_local(QUIC_CHANNEL *ch, int is_uni)
     if (!ch_init_new_stream(ch, qs, /*can_send=*/1, /*can_recv=*/!is_uni))
         goto err;
 
-
     ++*p_next_ordinal;
     return qs;
 
index 680fe48ad9945a8892a329bb4188ef8c6f253604..138a063bf62095a18550ab0b1e9a467b6c45843c 100644 (file)
@@ -89,7 +89,8 @@ int ossl_quic_stream_map_init(QUIC_STREAM_MAP *qsm,
                               uint64_t (*get_stream_limit_cb)(int uni, void *arg),
                               void *get_stream_limit_cb_arg,
                               QUIC_RXFC *max_streams_bidi_rxfc,
-                              QUIC_RXFC *max_streams_uni_rxfc)
+                              QUIC_RXFC *max_streams_uni_rxfc,
+                              int is_server)
 {
     qsm->map = lh_QUIC_STREAM_new(hash_stream, cmp_stream);
     qsm->active_list.prev = qsm->active_list.next = &qsm->active_list;
@@ -105,6 +106,7 @@ int ossl_quic_stream_map_init(QUIC_STREAM_MAP *qsm,
     qsm->get_stream_limit_cb_arg    = get_stream_limit_cb_arg;
     qsm->max_streams_bidi_rxfc      = max_streams_bidi_rxfc;
     qsm->max_streams_uni_rxfc       = max_streams_uni_rxfc;
+    qsm->is_server                  = is_server;
     return 1;
 }
 
index 3c9804d2ab347ab1f243ebf8d1a6c97d22526275..7e5e0edc7a748df268af581f40a18818c71147fb 100644 (file)
@@ -176,7 +176,8 @@ static int helper_init(struct helper *h)
 
     if (!TEST_true(ossl_quic_stream_map_init(&h->qsm, NULL, NULL,
                                              &h->max_streams_bidi_rxfc,
-                                             &h->max_streams_uni_rxfc)))
+                                             &h->max_streams_uni_rxfc,
+                                             /*is_server=*/0)))
         goto err;
 
     h->have_qsm = 1;