[master] 4bec43af4 mac: Add brackets around IPv6 endpoints

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Nov 15 11:46:07 UTC 2021


commit 4bec43af4e59ec71ef59538e08235f11f0bc9e3a
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Nov 15 12:44:59 2021 +0100

    mac: Add brackets around IPv6 endpoints

diff --git a/bin/varnishd/mgt/mgt_acceptor.c b/bin/varnishd/mgt/mgt_acceptor.c
index 5204d259c..612198672 100644
--- a/bin/varnishd/mgt/mgt_acceptor.c
+++ b/bin/varnishd/mgt/mgt_acceptor.c
@@ -201,7 +201,10 @@ mac_tcp(void *priv, const struct suckaddr *sa)
 		ls->addr = VTCP_my_suckaddr(ls->sock);
 		VTCP_myname(ls->sock, abuf, sizeof abuf,
 		    pbuf, sizeof pbuf);
-		bprintf(nbuf, "%s:%s", abuf, pbuf);
+		if (VSA_Get_Proto(sa) == AF_INET6)
+			bprintf(nbuf, "[%s]:%s", abuf, pbuf);
+		else
+			bprintf(nbuf, "%s:%s", abuf, pbuf);
 		REPLACE(ls->endpoint, nbuf);
 	}
 	VTAILQ_INSERT_TAIL(&la->socks, ls, arglist);


More information about the varnish-commit mailing list