diff -ur zabbix-2.0.5-orig/src/libs/zbxcomms/comms.c zabbix-2.0.5/src/libs/zbxcomms/comms.c
--- zabbix-2.0.5-orig/src/libs/zbxcomms/comms.c	2013-02-12 04:27:22.000000000 -0700
+++ zabbix-2.0.5/src/libs/zbxcomms/comms.c	2013-05-03 08:10:31.087101392 -0600
@@ -1118,7 +1118,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 */
@@ -1163,61 +1163,65 @@
 			hints.ai_family = PF_UNSPEC;
 			if (0 == getaddrinfo(start, NULL, &hints, &ai))
 			{
+				orig_ai = ai;
+				for(; ai != NULL; ai = ai->ai_next)
+ 				{
 #ifdef HAVE_SOCKADDR_STORAGE_SS_FAMILY
-				if (ai->ai_family == name.ss_family)
+					if (ai->ai_family == name.ss_family)
 #else
-				if (ai->ai_family == name.__ss_family)
+					if (ai->ai_family == name.__ss_family)
 #endif
-				{
-					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(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 (NULL != (hp = gethostbyname(start)))
