[master] 492d910bf mac: Add brackets around IPv6 endpoints

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue Nov 23 12:31:12 UTC 2021


commit 492d910bf98e17a1427bfe7dd194211a96e6b702
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 86c62683b..454b91d30 100644
--- a/bin/varnishd/mgt/mgt_acceptor.c
+++ b/bin/varnishd/mgt/mgt_acceptor.c
@@ -202,7 +202,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