[master] b7fada9 Log the named acceptors name in SessOpen instead of the endpoint.
Poul-Henning Kamp
phk at FreeBSD.org
Sun Aug 13 10:16:10 CEST 2017
commit b7fada92f9b73fb471679c5ec14b990c4d6e529d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sun Aug 13 08:14:57 2017 +0000
Log the named acceptors name in SessOpen instead of the endpoint.
diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index fc99491..f86f648 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -358,7 +358,10 @@ vca_make_session(struct worker *wrk, void *arg)
VSL(SLT_Begin, sp->vxid, "sess 0 %s",
wa->acceptlsock->transport->name);
VSL(SLT_SessOpen, sp->vxid, "%s %s %s %s %s %.6f %d",
- raddr, rport, wa->acceptlsock->endpoint, laddr, lport,
+ raddr, rport,
+ wa->acceptlsock->name != NULL ?
+ wa->acceptlsock->name : wa->acceptlsock->endpoint,
+ laddr, lport,
sp->t_open, sp->fd);
WS_Release(wrk->aws, 0);
diff --git a/bin/varnishd/mgt/mgt_acceptor.c b/bin/varnishd/mgt/mgt_acceptor.c
index a4e7e41..48e54a0 100644
--- a/bin/varnishd/mgt/mgt_acceptor.c
+++ b/bin/varnishd/mgt/mgt_acceptor.c
@@ -122,7 +122,7 @@ mac_callback(void *priv, const struct suckaddr *sa)
AN(ls->addr);
ls->endpoint = strdup(la->endpoint);
AN(ls->endpoint);
- la->name = ls->name;
+ ls->name = la->name;
ls->transport = la->transport;
VJ_master(JAIL_MASTER_PRIVPORT);
fail = mac_opensocket(ls);
diff --git a/bin/varnishtest/tests/r01804.vtc b/bin/varnishtest/tests/r01804.vtc
index c6705eb..983091d 100644
--- a/bin/varnishtest/tests/r01804.vtc
+++ b/bin/varnishtest/tests/r01804.vtc
@@ -6,14 +6,16 @@ server s1 {
} -start
-varnish v1 -proto "PROXY" -vcl+backend {
+varnish v1 -arg "-afoo=127.0.0.1:0,PROXY" -vcl+backend {
} -start
logexpect l1 -v v1 -d 0 -g session {
expect * * Begin {^sess .* PROXY$}
+ expect * = SessOpen {^.* foo .*}
expect * = Proxy {^1 }
expect * * Begin {^req}
expect * * Begin {^sess .* PROXY$}
+ expect * = SessOpen {^.* foo .*}
expect * = Proxy {^2 }
expect * * Begin {^req}
} -start
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 04e490c..30d8456 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -78,6 +78,7 @@ struct varnish {
struct vsm *vd; /* vsc use */
struct vsm *vdl; /* log use */
+ int has_a_arg;
struct vsm_fantom mgt_arg_i;
unsigned vsl_tag_count[256];
@@ -433,9 +434,11 @@ varnish_launch(struct varnish *v)
VSB_printf(vsb, " -p sigsegv_handler=on");
VSB_printf(vsb, " -p thread_pool_min=10");
VSB_printf(vsb, " -p debug=+vtc_mode");
- VSB_printf(vsb, " -a '%s'", "127.0.0.1:0");
- if (v->proto != NULL)
- VSB_printf(vsb, ",%s", v->proto);
+ if (!v->has_a_arg) {
+ VSB_printf(vsb, " -a '%s'", "127.0.0.1:0");
+ if (v->proto != NULL)
+ VSB_printf(vsb, ",%s", v->proto);
+ }
VSB_printf(vsb, " -M '%s %s'", abuf, pbuf);
VSB_printf(vsb, " -P %s/varnishd.pid", v->workdir);
if (vmod_path != NULL)
@@ -1105,6 +1108,8 @@ cmd_varnish(CMD_ARGS)
AZ(v->pid);
VSB_cat(v->args, " ");
VSB_cat(v->args, av[1]);
+ if (av[1][0] == '-' && av[1][1] == 'a')
+ v->has_a_arg = 1;
av++;
continue;
}
More information about the varnish-commit
mailing list