[master] f861ad2 Fail if multiple -a arguments return the same suckaddr.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Nov 2 12:48:08 CET 2015
commit f861ad2174ffc85700c591fda0aadffe843d2ecf
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Nov 2 11:47:44 2015 +0000
Fail if multiple -a arguments return the same suckaddr.
Fixes #1813
diff --git a/bin/varnishd/mgt/mgt_acceptor.c b/bin/varnishd/mgt/mgt_acceptor.c
index 658aca4..49cc0c8 100644
--- a/bin/varnishd/mgt/mgt_acceptor.c
+++ b/bin/varnishd/mgt/mgt_acceptor.c
@@ -128,6 +128,13 @@ mac_callback(void *priv, const struct suckaddr *sa)
CAST_OBJ_NOTNULL(mh, priv, MAC_HELP_MAGIC);
+ VTAILQ_FOREACH(ls, &heritage.socks, list) {
+ if (!VSA_Compare(sa, ls->addr)) {
+ ARGV_ERR("-a arguments %s and %s have same address\n",
+ ls->name, mh->name);
+ return (-1);
+ }
+ }
ALLOC_OBJ(ls, LISTEN_SOCK_MAGIC);
AN(ls);
ls->sock = -1;
diff --git a/bin/varnishtest/tests/r01813.vtc b/bin/varnishtest/tests/r01813.vtc
new file mode 100644
index 0000000..f37aa54
--- /dev/null
+++ b/bin/varnishtest/tests/r01813.vtc
@@ -0,0 +1,3 @@
+varnishtest "Duplicate -a arguments"
+
+err_shell {have same address} "${varnishd} -d -a 127.0.0.1:38484 -a 127.0.0.1:38484 -b localhost:80 2>&1"
More information about the varnish-commit
mailing list