[experimental-ims] a9e5d35 Increase the id field in VSM to 128 bytes to make space for 64 backend VCL name + IPv4, IPv6 and portnumber.

Poul-Henning Kamp phk at FreeBSD.org
Thu Dec 18 10:27:47 CET 2014


commit a9e5d3503f8fea332c01cdf6576a980947b39b07
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jun 4 11:38:01 2012 +0000

    Increase the id field in VSM to 128 bytes to make space for
    64 backend VCL name + IPv4, IPv6 and portnumber.
    
    Fixes	#1144

diff --git a/bin/varnishtest/tests/r01144.vtc b/bin/varnishtest/tests/r01144.vtc
new file mode 100644
index 0000000..b08060d
--- /dev/null
+++ b/bin/varnishtest/tests/r01144.vtc
@@ -0,0 +1,38 @@
+varnishtest "very long backend names"
+
+server s1 {
+	rxreq
+	txresp
+} -start
+
+varnish v1 -vcl+backend {
+	backend fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210
+	{
+		.host = "127.0.0.1";
+		.port = "54321";
+	}
+	sub vcl_recv {
+		if (req.url == "never") {
+			set req.backend = fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210;
+		}
+	}
+} -start
+
+client c1 {
+	txreq
+	rxresp
+	expect resp.status == 200
+} -run
+
+varnish v1 -badvcl {
+	backend 0fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210
+	{
+		.host = "127.0.0.1";
+		.port = "54321";
+	}
+	sub vcl_recv {
+		if (req.url == "never") {
+			set req.backend = fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210;
+		}
+	}
+}
diff --git a/include/vapi/vsm_int.h b/include/vapi/vsm_int.h
index 4272aef..7e44604 100644
--- a/include/vapi/vsm_int.h
+++ b/include/vapi/vsm_int.h
@@ -104,7 +104,7 @@ struct VSM_chunk {
 	ssize_t			next;		/* Offset in shmem */
 	char			class[8];
 	char			type[8];
-	char			ident[64];
+	char			ident[128];
 };
 
 struct VSM_head {
diff --git a/lib/libvcl/vcc_backend.c b/lib/libvcl/vcc_backend.c
index fb160e7..76ef874 100644
--- a/lib/libvcl/vcc_backend.c
+++ b/lib/libvcl/vcc_backend.c
@@ -706,6 +706,13 @@ vcc_ParseDirector(struct vcc *tl)
 
 	vcc_ExpectCid(tl);		/* ID: name */
 	ERRCHK(tl);
+	if (tl->t->e - tl->t->b > 64) {
+		VSB_printf(tl->sb,
+		    "Name of %.*s too long (max 64, is %zd):\n",
+		    PF(t_first), (tl->t->e - tl->t->b));
+		vcc_ErrWhere(tl, tl->t);
+		return;
+	}
 	tl->t_dir = tl->t;
 	vcc_NextToken(tl);
 



More information about the varnish-commit mailing list