Re: HAProxy 1.5-dev7 attempting to connect to real server port of twice virtual server port

From: Nick Chalk <nick#loadbalancer.org>
Date: Thu, 22 Sep 2011 23:16:10 +0100


Hello Willy.

On 22 September 2011 22:08, Willy Tarreau <w#1wt.eu> wrote:
> Wow, you've hit an amazing bug. I seem to remember we touched that
> area reacently when a server port was ignored. I'll have a look at
> this, because it's very likely that we fixed it wrong.

Thanks. I had another look at it today, but didn't make much progress.

Attempting to work around the problem, I experimented with not setting the SRV_MAPPORTS flag when there is no port specified in the server directive - simply commenting-out the else clause on lines 3933-3934 of cfgparse.c. I then added a test for

   ((struct sockaddr_in *)&s->req->cons->addr.s.to)->sin_port == 0 in assign_server_address(), and copying the port from

   s->req->prod->addr.c.to
to

   s->req->cons->addr.s.to

Interestingly, this works when HAProxy is run in debug mode, but not as a daemon. In the latter case, it seems that some of the structure elements are not set - in particular s->req->prod->addr.c.to.ss_family and &s->req->prod->addr.c.to->sin_port.

I'm not sure if that's expected behaviour when the session structure doesn't have SRV_MAPPORTS set, but it was certainly confusing!

Thanks for your help.
Nick.

-- 
Nick Chalk.

Loadbalancer.org Ltd.
Phone: +44 (0)870 443 8779
http://www.loadbalancer.org/
Received on 2011/09/23 00:16

This archive was generated by hypermail 2.2.0 : 2011/09/23 00:30 CEST