aboutsummaryrefslogtreecommitdiffstats
path: root/nametoaddr.c
diff options
context:
space:
mode:
authoritojun <itojun>1999-11-25 08:25:35 +0000
committeritojun <itojun>1999-11-25 08:25:35 +0000
commit45ac9150b775ae43e62216794ba122dbac8b0407 (patch)
tree33efee2073c05df8211a0f639495871afe4349d8 /nametoaddr.c
parentbd8f1d4a95806e2fd5c38d299c9987f2e017e15f (diff)
restrict result from getaddrinfo() by specifying hints.ai_socktype.
otherwise, multiple answer may be returned for single numeric address (for SOCK_STREAM and SOCK_DGRAM, for example).
Diffstat (limited to 'nametoaddr.c')
-rw-r--r--nametoaddr.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/nametoaddr.c b/nametoaddr.c
index 056e777..8ec6ba9 100644
--- a/nametoaddr.c
+++ b/nametoaddr.c
@@ -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;