[6.0] f7715a8dc mac: Add brackets around IPv6 endpoints
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Fri Nov 19 10:33:09 UTC 2021
commit f7715a8dc70bda38548c54c24d4aefc65fd96b8b
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 2d04e6089..bb8c29484 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