--- linc2/src/linc-protocols.c.old	2008-04-14 10:48:56.930167000 +0800
+++ linc2/src/linc-protocols.c	2008-04-14 10:49:30.225271000 +0800
@@ -437,12 +437,17 @@
 		 */
 		if (proto->family == AF_INET) {
 			if (af == AF_INET) {
+				struct in_addr ipv4_def_addr;
+
 				struct sockaddr_in * localaddr;
 				struct sockaddr_in * incomingaddr;
+
+				inet_aton ("127.0.0.1", &ipv4_def_addr);
 				localaddr = (struct sockaddr_in *)result->ai_addr;
 				incomingaddr = (struct sockaddr_in *)saddr;
 				localaddr->sin_port = incomingaddr->sin_port;
-				if (!memcmp (localaddr, incomingaddr, result->ai_addrlen)) {
+				if (ipv4_def_addr.s_addr == incomingaddr->sin_addr.s_addr || 
+					!memcmp (localaddr, incomingaddr, result->ai_addrlen)) {
 #ifdef LOCAL_DEBUG
 					g_warning ("local ipv4 address");
 #endif
@@ -452,12 +457,16 @@
 		}
 		else {
 			if (af == AF_INET6) {
+				struct in6_addr ipv6_def_addr;
 				struct sockaddr_in6 * localaddr;
 				struct sockaddr_in6 * incomingaddr;
+
+				inet_pton (AF_INET6, "::1", (void *)&ipv6_def_addr);
 				localaddr = (struct sockaddr_in6 *)result->ai_addr;
 				incomingaddr = (struct sockaddr_in6 *)saddr;
 				localaddr->sin6_port = incomingaddr->sin6_port;
-				if (!memcmp (localaddr, incomingaddr, result->ai_addrlen)) {
+				if (!memcmp (&ipv6_def_addr, &incomingaddr->sin6_addr, sizeof(ipv6_def_addr))
+                                    || !memcmp (localaddr, incomingaddr, result->ai_addrlen)) {
 #ifdef LOCAL_DEBUG
 					g_warning ("local ipv6 address");
 #endif
