[master] aa1b15b Fix proxy protocol v1 client port
Federico G. Schwindt
fgsch at lodoss.net
Sat Nov 7 19:47:23 CET 2015
commit aa1b15b1caeda73910b72a2b11d5edf09e75782b
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date: Sat Nov 7 18:03:55 2015 +0000
Fix proxy protocol v1 client port
Most likely missed when #1727 was addressed.
Submitted by: Rafael Zalamena on varnish-dev
diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c
index 604d796..6f64f3a 100644
--- a/bin/varnishd/proxy/cache_proxy_proto.c
+++ b/bin/varnishd/proxy/cache_proxy_proto.c
@@ -125,7 +125,7 @@ vpx_proto1(const struct worker *wrk, struct req *req)
SES_Reserve_client_addr(req->sp, &sa);
AN(VSA_Build(sa, res->ai_addr, res->ai_addrlen));
SES_Set_String_Attr(req->sp, SA_CLIENT_IP, fld[1]);
- SES_Set_String_Attr(req->sp, SA_CLIENT_PORT, fld[2]);
+ SES_Set_String_Attr(req->sp, SA_CLIENT_PORT, fld[3]);
freeaddrinfo(res);
i = getaddrinfo(fld[2], fld[4], &hints, &res);
diff --git a/bin/varnishtest/tests/o00000.vtc b/bin/varnishtest/tests/o00000.vtc
index 0cb518a..7cebb63 100644
--- a/bin/varnishtest/tests/o00000.vtc
+++ b/bin/varnishtest/tests/o00000.vtc
@@ -134,6 +134,11 @@ client c1 {
} -run
delay .1
+logexpect l1 -v v1 {
+ expect * * ReqStart "1.2.3.4 1234"
+ expect * * ReqStart "1:f::2 1234"
+} -start
+
# Finally try something which works...
client c1 {
send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678\r\n"
@@ -167,6 +172,8 @@ client c1 {
} -run
delay .1
+logexpect l1 -wait
+
# Try with appended request (See also: #1728)
client c1 {
send "PROXY TCP6 1:f::3 5:a::8 1234 5678\r\nGET /3 HTTP/1.1\r\nHdr1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n\r\n"
More information about the varnish-commit
mailing list