]> The Tcpdump Group git mirrors - libpcap/commitdiff
restrict result from getaddrinfo() by specifying hints.ai_socktype.
authoritojun <itojun>
Thu, 25 Nov 1999 08:25:35 +0000 (08:25 +0000)
committeritojun <itojun>
Thu, 25 Nov 1999 08:25:35 +0000 (08:25 +0000)
otherwise, multiple answer may be returned for single numeric address
(for SOCK_STREAM and SOCK_DGRAM, for example).

nametoaddr.c

index 056e777cfa3e2c6e8e785b4501dfc7687163e4dc..8ec6ba964f19dd015f95e0e3725ffc8b75a4353f 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.50 1999-10-19 15:18:30 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.51 1999-11-25 08:25:35 itojun Exp $ (LBL)";
 #endif
 
 #include <sys/param.h>
@@ -107,6 +107,7 @@ pcap_nametoaddr(const char *name)
 
        memset(&hints, 0, sizeof(hints));
        hints.ai_family = PF_UNSPEC;
+       hints.ai_socktype = SOCK_STREAM;        /*not really*/
        error = getaddrinfo(name, NULL, &hints, &res);
        if (error)
                return NULL;