Hi Luke,

On Thu, Jan 17, 2019 at 02:35:38PM +0000, Luke Seelenbinder wrote:
> Hello all,
> 
> First, I wanted to say a huge thanks to the team for a producing a quality 
> piece of software. My company just moved all of our traffic over, and the 
> performance and nimbleness of haproxy is impressive. I'm testing 1.9.2 for 
> migration as soon as it's stable for our use-case.
> 
> I'm experiencing a segfault when running in mode http, option http-use-htx, 
> with h2 backends (alpn h2) and an assigned source address. A sanitized config 
> is as follows:
> 
> defaults
>    source [<ipv6 address>]
>    mode http
>    http-reuse always
>    option http-use-htx
> 
> listen test
>    bind :443 ssl crt <cert> alpn h2,http/1.1
>    server backend ipv6@<server addr:port> check ssl crt <crt-file> ca-file 
> <ca-file> verifyhost <sni-host> alpn h2,http/1.1 check-alpn http/1.1
> 
> If I disable h2 on the backend, it works correctly. If I disable the source 
> in defaults, it works correctly. I've attached the backtrace below.
> 
> Best,
> Luke
> 

I think I understand what's going on.
Does the attached patch fix it for you ?

Thanks a lot !

Olivier
>From 585bcc7f8ec84573d070d2d9d1e0b104fd18eb48 Mon Sep 17 00:00:00 2001
From: Olivier Houchard <ohouch...@haproxy.com>
Date: Thu, 17 Jan 2019 15:59:13 +0100
Subject: [PATCH] BUG/MEDIUM: servers: Make assign_tproxy_address work when
 ALPN is set.

If an ALPN is set on the server line, then when we reach assign_tproxy_address,
the stream_interface's endpoint will be a connection, not a conn_stream,
so make sure assign_tproxy_address() handles both cases.

This should be backported to 1.9.
---
 src/backend.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/backend.c b/src/backend.c
index ab5a629c..3e327975 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1021,7 +1021,12 @@ static void assign_tproxy_address(struct stream *s)
        struct server *srv = objt_server(s->target);
        struct conn_src *src;
        struct connection *cli_conn;
-       struct connection *srv_conn = cs_conn(objt_cs(s->si[1].end));
+       struct connection *srv_conn;
+
+       if (objt_cs(s->si[1].end))
+               srv_conn = cs_conn(__objt_cs(s->si[1].end));
+       else
+               srv_conn = objt_conn(s->si[1].end);
 
        if (srv && srv->conn_src.opts & CO_SRC_BIND)
                src = &srv->conn_src;
-- 
2.19.1

Reply via email to