[5.1] 581948c Log the remote address to make it easier to cross-ref to VSL

Poul-Henning Kamp phk at FreeBSD.org
Mon Apr 10 13:59:06 CEST 2017


commit 581948c49181751b935fff809d6a54cfcb4594b2
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Mar 28 07:28:02 2017 +0000

    Log the remote address to make it easier to cross-ref to VSL

diff --git a/bin/varnishtest/vtc_server.c b/bin/varnishtest/vtc_server.c
index 773e7fb..13dd336 100644
--- a/bin/varnishtest/vtc_server.c
+++ b/bin/varnishtest/vtc_server.c
@@ -152,6 +152,8 @@ server_thread(void *priv)
 	struct sockaddr_storage addr_s;
 	struct sockaddr *addr;
 	socklen_t l;
+	char abuf[VTCP_ADDRBUFSIZE];
+	char pbuf[VTCP_PORTBUFSIZE];
 
 	CAST_OBJ_NOTNULL(s, priv, SERVER_MAGIC);
 	assert(s->sock >= 0);
@@ -167,7 +169,8 @@ server_thread(void *priv)
 		fd = accept(s->sock, addr, &l);
 		if (fd < 0)
 			vtc_fatal(vl, "Accept failed: %s", strerror(errno));
-		vtc_log(vl, 3, "accepted fd %d", fd);
+		VTCP_hisname(fd, abuf, sizeof abuf, pbuf, sizeof pbuf);
+		vtc_log(vl, 3, "accepted fd %d %s %s", fd, abuf, pbuf);
 		fd = http_process(vl, s->spec, fd, &s->sock);
 		vtc_log(vl, 3, "shutting fd %d", fd);
 		j = shutdown(fd, SHUT_WR);



More information about the varnish-commit mailing list