diff -ur zabbix-1.8.5.orig/src/libs/zbxcomms/comms.c zabbix-1.8.5/src/libs/zbxcomms/comms.c
--- zabbix-1.8.5.orig/src/libs/zbxcomms/comms.c	2011-04-15 13:17:29.000000000 -0600
+++ zabbix-1.8.5/src/libs/zbxcomms/comms.c	2011-06-18 12:44:57.447705225 -0600
@@ -1229,7 +1229,7 @@
 int	zbx_tcp_check_security(zbx_sock_t *s, const char *ip_list, int allow_if_empty)
 {
 #if defined(HAVE_IPV6)
-	struct addrinfo	hints, *ai = NULL;
+	struct addrinfo	hints, *ai = NULL, *orig_ai = NULL;
 	/* Network Byte Order is ensured */
 	unsigned char	ipv4_cmp_mask[12] = {0};				/* IPv4-Compatible, the first 96 bits are zeros */
 	unsigned char	ipv4_mpd_mask[12] = {0,0,0,0,0,0,0,0,0,0,255,255};	/* IPv4-Mapped, the first 80 bits are zeros, 16 next - ones */
@@ -1279,57 +1279,61 @@
 			hints.ai_family = PF_UNSPEC;
 			if(0 == getaddrinfo(start, NULL, &hints, &ai))
 			{
-				if(ai->ai_family == name.ss_family)
+				orig_ai = ai;
+				for(; ai != NULL; ai = ai->ai_next)
 				{
-					switch(ai->ai_family)
+					if(ai->ai_family == name.ss_family)
 					{
-						case AF_INET  :
-							if(((struct sockaddr_in*)&name)->sin_addr.s_addr == ((struct sockaddr_in*)ai->ai_addr)->sin_addr.s_addr)
-							{
-								freeaddrinfo(ai);
-								return SUCCEED;
-							}
-							break;
-						case AF_INET6 :
-							if(0 == memcmp(((struct sockaddr_in6*)&name)->sin6_addr.s6_addr,
-									((struct sockaddr_in6*)ai->ai_addr)->sin6_addr.s6_addr,
-									sizeof(struct in6_addr)))
-							{
-								freeaddrinfo(ai);
-								return SUCCEED;
-							}
-							break;
+						switch(ai->ai_family)
+						{
+							case AF_INET  :
+								if(((struct sockaddr_in*)&name)->sin_addr.s_addr == ((struct sockaddr_in*)ai->ai_addr)->sin_addr.s_addr)
+								{
+									freeaddrinfo(orig_ai);
+									return SUCCEED;
+								}
+								break;
+							case AF_INET6 :
+								if(0 == memcmp(((struct sockaddr_in6*)&name)->sin6_addr.s6_addr,
+										((struct sockaddr_in6*)ai->ai_addr)->sin6_addr.s6_addr,
+										sizeof(struct in6_addr)))
+								{
+									freeaddrinfo(orig_ai);
+									return SUCCEED;
+								}
+								break;
+						}
 					}
-				}
-				else
-				{
-					switch(ai->ai_family)
+					else
 					{
-						case AF_INET  :
-							/* incoming AF_INET6, must see whether it is comp or mapped */
-							if((0 == memcmp(((struct sockaddr_in6*)&name)->sin6_addr.s6_addr, ipv4_cmp_mask, 12) ||
-								0 == memcmp(((struct sockaddr_in6*)&name)->sin6_addr.s6_addr, ipv4_mpd_mask, 12)) && 
-								0 == memcmp(&((struct sockaddr_in6*)&name)->sin6_addr.s6_addr[12],
-									(unsigned char*)&((struct sockaddr_in*)ai->ai_addr)->sin_addr.s_addr, 4))
-							{
-								freeaddrinfo(ai);
-								return SUCCEED;
-							}
-							break;
-						case AF_INET6 :
-							/* incoming AF_INET, must see whether the given is comp or mapped */
-							if((0 == memcmp(((struct sockaddr_in6*)ai->ai_addr)->sin6_addr.s6_addr, ipv4_cmp_mask, 12) ||
-								0 == memcmp(((struct sockaddr_in6*)ai->ai_addr)->sin6_addr.s6_addr, ipv4_mpd_mask, 12)) &&
-								0 == memcmp(&((struct sockaddr_in6*)ai->ai_addr)->sin6_addr.s6_addr[12],
-									(unsigned char*)&((struct sockaddr_in*)&name)->sin_addr.s_addr, 4))
-							{
-								freeaddrinfo(ai);
-								return SUCCEED;
-							}
-							break;
+						switch(ai->ai_family)
+						{
+							case AF_INET  :
+								/* incoming AF_INET6, must see whether it is comp or mapped */
+								if((0 == memcmp(((struct sockaddr_in6*)&name)->sin6_addr.s6_addr, ipv4_cmp_mask, 12) ||
+									0 == memcmp(((struct sockaddr_in6*)&name)->sin6_addr.s6_addr, ipv4_mpd_mask, 12)) && 
+									0 == memcmp(&((struct sockaddr_in6*)&name)->sin6_addr.s6_addr[12],
+										(unsigned char*)&((struct sockaddr_in*)ai->ai_addr)->sin_addr.s_addr, 4))
+								{
+									freeaddrinfo(orig_ai);
+									return SUCCEED;
+								}
+								break;
+							case AF_INET6 :
+								/* incoming AF_INET, must see whether the given is comp or mapped */
+								if((0 == memcmp(((struct sockaddr_in6*)ai->ai_addr)->sin6_addr.s6_addr, ipv4_cmp_mask, 12) ||
+									0 == memcmp(((struct sockaddr_in6*)ai->ai_addr)->sin6_addr.s6_addr, ipv4_mpd_mask, 12)) &&
+									0 == memcmp(&((struct sockaddr_in6*)ai->ai_addr)->sin6_addr.s6_addr[12],
+										(unsigned char*)&((struct sockaddr_in*)&name)->sin_addr.s_addr, 4))
+								{
+									freeaddrinfo(orig_ai);
+									return SUCCEED;
+								}
+								break;
+						}
 					}
 				}
-				freeaddrinfo(ai);
+				freeaddrinfo(orig_ai);
 			}
 #else
 			if (0 != (hp = zbx_gethost(start)))

