]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: backend: do not set sni on connection reuse
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 1 Jun 2021 15:04:10 +0000 (17:04 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 17 Jun 2021 16:01:57 +0000 (18:01 +0200)
When reusing a backend connection, do not reapply the SNI on the
connection. It should already be defined when the connection was
instantiated on a previous connect_server invocation. As the SNI is a
parameter used to select a connection, only connection with same value
can be reused.

The impact of this bug is unknown and may be null. No memory leak has
been reported by valgrind. So this is more a cleaning fix.

This commit relies on the SF_SRV_REUSED flag and thus depends on the
following fix :
  BUG/MINOR: backend: restore the SF_SRV_REUSED flag original purpose

This should be backported up to 2.4.

src/backend.c

index 6382805812c3044fe09c4a2fe041b42aa122c481..2ce34d1e1c1da393570aac91e74974b74bd2a761 100644 (file)
@@ -1625,8 +1625,10 @@ skip_reuse:
                return err;
 
 #ifdef USE_OPENSSL
-       if (smp_make_safe(sni_smp))
-               ssl_sock_set_servername(srv_conn, sni_smp->data.u.str.area);
+       if (!(s->flags & SF_SRV_REUSED)) {
+               if (smp_make_safe(sni_smp))
+                       ssl_sock_set_servername(srv_conn, sni_smp->data.u.str.area);
+       }
 #endif /* USE_OPENSSL */
 
        /* The CO_FL_SEND_PROXY flag may have been set by the connect method,