<div dir="ltr">Committed. Thank for the patch.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 6, 2015 at 10:40 AM, Rafael Zalamena <span dir="ltr"><<a href="mailto:rafaelfz@taghos.com.br" target="_blank">rafaelfz@taghos.com.br</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">After giving the proxy feature a try I noticed the client port collected<br>
in the vpx_proto1() function is wrong. I read the code and noticed it<br>
splits the proxy line in tokens and then when reading the client port it<br>
picks the wrong token.<br>
<br>
0 1 2 3 4<br>
PROXY PROTO_IPVX SRCADDR DSTADDR SRCPORT DSTPORT\r\n<br>
<br>
The code is partially working because when it resolves the address it uses<br>
the right token:<br>
cache_proxy_proto.c:line 110<br>
i = getaddrinfo(fld[1], fld[3], &hints, &res);<br>
<br>
The proxy version 2 part seems to be working correctly.<br>
<br>
The diff below fixes the problem I just reported.<br>
<br>
diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c<br>
index 604d796..6f64f3a 100644<br>
--- a/bin/varnishd/proxy/cache_proxy_proto.c<br>
+++ b/bin/varnishd/proxy/cache_proxy_proto.c<br>
@@ -125,7 +125,7 @@ vpx_proto1(const struct worker *wrk, struct req *req)<br>
SES_Reserve_client_addr(req->sp, &sa);<br>
AN(VSA_Build(sa, res->ai_addr, res->ai_addrlen));<br>
SES_Set_String_Attr(req->sp, SA_CLIENT_IP, fld[1]);<br>
- SES_Set_String_Attr(req->sp, SA_CLIENT_PORT, fld[2]);<br>
+ SES_Set_String_Attr(req->sp, SA_CLIENT_PORT, fld[3]);<br>
freeaddrinfo(res);<br>
<br>
i = getaddrinfo(fld[2], fld[4], &hints, &res);<br>
<br>
_______________________________________________<br>
varnish-dev mailing list<br>
<a href="mailto:varnish-dev@varnish-cache.org">varnish-dev@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev" rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev</a><br>
</blockquote></div><br></div>