Minor fixes
authorHugo Landau <hlandau@openssl.org>
Thu, 10 Aug 2023 18:29:27 +0000 (19:29 +0100)
committerHugo Landau <hlandau@openssl.org>
Fri, 1 Sep 2023 09:45:36 +0000 (10:45 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21715)

include/openssl/bio.h.in
ssl/quic/quic_impl.c
ssl/quic/quic_local.h

index e797769909e9705309233877aa28fe64e3edd3c5..e6af3470a5a485a249e3163ff0eaf66599042754 100644 (file)
@@ -188,9 +188,9 @@ extern "C" {
  * # define BIO_CTRL_SET_KTLS_TX_ZEROCOPY_SENDFILE 90
  */
 
-# define BIO_CTRL_GET_RPOLL_DESCRIPTOR          90
-# define BIO_CTRL_GET_WPOLL_DESCRIPTOR          91
-# define BIO_CTRL_DGRAM_DETECT_PEER_ADDR        92
+# define BIO_CTRL_GET_RPOLL_DESCRIPTOR          91
+# define BIO_CTRL_GET_WPOLL_DESCRIPTOR          92
+# define BIO_CTRL_DGRAM_DETECT_PEER_ADDR        93
 
 # define BIO_DGRAM_CAP_NONE                 0U
 # define BIO_DGRAM_CAP_HANDLES_SRC_ADDR     (1U << 0)
index 49133f0ca7e38cb8c81a60f3a0be79f264904477..839168040b9144ccbf5b155fda59ef1b6cf19211 100644 (file)
@@ -1565,15 +1565,13 @@ static int quic_do_handshake(QCTX *ctx)
     if (!qc->started && !qc->addressing_probe_done) {
         long rcaps = BIO_dgram_get_effective_caps(qc->net_rbio);
         long wcaps = BIO_dgram_get_effective_caps(qc->net_wbio);
-        int can_use_addressed =
-            (wcaps & BIO_DGRAM_CAP_HANDLES_DST_ADDR) != 0
-            && (rcaps & BIO_DGRAM_CAP_PROVIDES_SRC_ADDR) != 0;
 
-        qc->addressed_mode          = can_use_addressed;
-        qc->addressing_probe_done   = 1;
+        qc->addressed_mode_r = ((rcaps & BIO_DGRAM_CAP_PROVIDES_SRC_ADDR) != 0);
+        qc->addressed_mode_w = ((wcaps & BIO_DGRAM_CAP_HANDLES_DST_ADDR) != 0);
+        qc->addressing_probe_done = 1;
     }
 
-    if (!qc->started && qc->addressed_mode
+    if (!qc->started && qc->addressed_mode_w
         && BIO_ADDR_family(&qc->init_peer_addr) == AF_UNSPEC) {
         /*
          * We are trying to connect and are using addressed mode, which means we
@@ -1595,7 +1593,7 @@ static int quic_do_handshake(QCTX *ctx)
     }
 
     if (!qc->started
-        && qc->addressed_mode
+        && qc->addressed_mode_w
         && BIO_ADDR_family(&qc->init_peer_addr) == AF_UNSPEC) {
         /*
          * If we still don't have a peer address in addressed mode, we can't do
index aaaab128aa271e4d9e184f0c2b864dc1fd9c7317..f492dc656b902315c3ba6179ca470858666b3f69 100644 (file)
@@ -199,7 +199,8 @@ struct quic_conn_st {
     unsigned int                    addressing_probe_done   : 1;
 
     /* Are we using addressed mode (BIO_sendmmsg with non-NULL peer)? */
-    unsigned int                    addressed_mode          : 1;
+    unsigned int                    addressed_mode_w        : 1;
+    unsigned int                    addressed_mode_r        : 1;
 
     /* Default stream type. Defaults to SSL_DEFAULT_STREAM_MODE_AUTO_BIDI. */
     uint32_t                        default_stream_mode;