[prev in list] [next in list] [prev in thread] [next in thread] 

List:       varnish-commit
Subject:    [master] 4334c501c varnishtest: Align tunnel's listen setup to server's
From:       Dridi Boukelmoune <dridi.boukelmoune () gmail ! com>
Date:       2021-05-28 10:17:05
Message-ID: 20210528101705.DBBF111810C () lists ! varnish-cache ! org
[Download RAW message or body]


commit 4334c501cadea312c305d420b010a44725e6ae24
Author: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
Date:   Fri May 28 12:14:55 2021 +0200

    varnishtest: Align tunnel's listen setup to server's

diff --git a/bin/varnishtest/vtc_tunnel.c b/bin/varnishtest/vtc_tunnel.c
index fc316fc35..418ce9195 100644
--- a/bin/varnishtest/vtc_tunnel.c
+++ b/bin/varnishtest/vtc_tunnel.c
@@ -43,6 +43,7 @@
 
 #include "vtc.h"
 
+#include "vsa.h"
 #include "vtcp.h"
 
 /* SECTION: tunnel tunnel
@@ -578,6 +579,8 @@ tunnel_delete(struct tunnel *t)
 static void
 tunnel_listen(struct tunnel *t)
 {
+	char buf[vsa_suckaddr_len];
+	struct suckaddr *sua;
 	const char *err;
 
 	if (t->lsock >= 0)
@@ -588,13 +591,20 @@ tunnel_listen(struct tunnel *t)
 		    "Tunnel listen address (%s) cannot be resolved: %s",
 		    t->listen, err);
 	assert(t->lsock > 0);
-	VTCP_myname(t->lsock, t->laddr, sizeof t->laddr,
+	sua = VSA_getsockname(t->lsock, buf, sizeof buf);
+	AN(sua);
+	VTCP_name(sua, t->laddr, sizeof t->laddr,
 	    t->lport, sizeof t->lport);
+
+	/* Record the actual port, and reuse it on subsequent starts */
+	if (VSA_Get_Proto(sua) == AF_INET)
+		bprintf(t->listen, "%s:%s", t->laddr, t->lport);
+	else
+		bprintf(t->listen, "[%s]:%s", t->laddr, t->lport);
+
 	macro_def(t->vl, t->name, "addr", "%s", t->laddr);
 	macro_def(t->vl, t->name, "port", "%s", t->lport);
 	macro_def(t->vl, t->name, "sock", "%s %s", t->laddr, t->lport);
-	/* Record the actual port, and reuse it on subsequent starts */
-	bprintf(t->listen, "%s %s", t->laddr, t->lport);
 }
 
 /**********************************************************************
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic