diff src/lmtp/lmtp-proxy.c @ 22545:425ee3581927

lmtp proxy: Avoid DNS lookup for "host" if passdb also returns "hostip"
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Fri, 08 Sep 2017 11:02:07 +0300
parents 2e2563132d5f
children cb108f786fb4
line wrap: on
line diff
--- a/src/lmtp/lmtp-proxy.c	Fri Sep 08 11:01:20 2017 +0300
+++ b/src/lmtp/lmtp-proxy.c	Fri Sep 08 11:02:07 2017 +0300
@@ -146,7 +146,10 @@
 
 	conn = p_new(proxy->pool, struct lmtp_proxy_connection, 1);
 	conn->proxy = proxy;
-	conn->set.host = p_strdup(proxy->pool, set->host);
+	if (set->hostip.family == 0)
+		conn->set.host = p_strdup(proxy->pool, set->host);
+	else
+		conn->set.host = p_strdup(proxy->pool, net_ip2addr(&set->hostip));
 	conn->set.port = set->port;
 	conn->set.timeout_msecs = set->timeout_msecs;
 	array_append(&proxy->connections, &conn, 1);