aboutsummaryrefslogtreecommitdiff
path: root/nametoaddr.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-09-23 13:52:40 -0700
committerGuy Harris <guy@alum.mit.edu>2015-09-23 13:52:40 -0700
commite7a19f82a59fe1f41a7435ddead69b90f6833c2c (patch)
tree6f18e7312dfd3c7ca47fbd9aa8482a083d71226e /nametoaddr.c
parent224c3435669574b71892e18188949991f92450e9 (diff)
Don't use our own getaddrinfo() on Windows.
Include <Wspiapi.h> to make sure we get access to getaddrinfo() on Windows. Get rid of Win32/Src/getaddrinfo.c (we weren't building with it anyway).
Diffstat (limited to 'nametoaddr.c')
-rw-r--r--nametoaddr.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/nametoaddr.c b/nametoaddr.c
index eb123615..b4bb4b45 100644
--- a/nametoaddr.c
+++ b/nametoaddr.c
@@ -34,6 +34,32 @@
#ifdef _WIN32
#include <pcap-stdinc.h>
+#ifdef INET6
+/*
+ * To quote the MSDN page for getaddrinfo() at
+ *
+ * https://msdn.microsoft.com/en-us/library/windows/desktop/ms738520(v=vs.85).aspx
+ *
+ * "Support for getaddrinfo on Windows 2000 and older versions
+ * The getaddrinfo function was added to the Ws2_32.dll on Windows XP and
+ * later. To execute an application that uses this function on earlier
+ * versions of Windows, then you need to include the Ws2tcpip.h and
+ * Wspiapi.h files. When the Wspiapi.h include file is added, the
+ * getaddrinfo function is defined to the WspiapiGetAddrInfo inline
+ * function in the Wspiapi.h file. At runtime, the WspiapiGetAddrInfo
+ * function is implemented in such a way that if the Ws2_32.dll or the
+ * Wship6.dll (the file containing getaddrinfo in the IPv6 Technology
+ * Preview for Windows 2000) does not include getaddrinfo, then a
+ * version of getaddrinfo is implemented inline based on code in the
+ * Wspiapi.h header file. This inline code will be used on older Windows
+ * platforms that do not natively support the getaddrinfo function."
+ *
+ * We use getaddrinfo(), so we include Wspiapi.h here. pcap-stdinc.h
+ * includes Ws2tcpip.h, so we don't need to include it ourselves.
+ */
+#include <Wspiapi.h>
+#endif
+
#else /* _WIN32 */
#include <sys/param.h>