From: Willy Tarreau Date: Wed, 17 Jul 2019 09:49:08 +0000 (+0200) Subject: MINOR: http/htx: use conn_get_dst() to retrieve the destination address X-Git-Tag: v2.1-dev2~321 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83b5890b4724bf297e414fb7258a5ed8f9bcc4e4;p=thirdparty%2Fhaproxy.git MINOR: http/htx: use conn_get_dst() to retrieve the destination address When adding the X-Original-To header, let's use conn_get_dst() and make sure it succeeds, since previous call to conn_get_to_addr() was unchecked. --- diff --git a/src/http_ana.c b/src/http_ana.c index ac3412bf00..2009180994 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -864,12 +864,10 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit) if ((sess->fe->options | s->be->options) & PR_O_ORGTO) { /* FIXME: don't know if IPv6 can handle that case too. */ - if (cli_conn && cli_conn->addr.from.ss_family == AF_INET) { + if (cli_conn && cli_conn->addr.from.ss_family == AF_INET && conn_get_dst(cli_conn)) { /* Add an X-Original-To header unless the destination IP is * in the 'except' network range. */ - conn_get_to_addr(cli_conn); - if (cli_conn->addr.to.ss_family == AF_INET && ((!sess->fe->except_mask_to.s_addr || (((struct sockaddr_in *)&cli_conn->addr.to)->sin_addr.s_addr & sess->fe->except_mask_to.s_addr)