Fix MingW version issue
diff --git a/include/polarssl/config.h b/include/polarssl/config.h
index 7bbef55..d98bdb3 100644
--- a/include/polarssl/config.h
+++ b/include/polarssl/config.h
@@ -108,6 +108,8 @@
  * System supports the basic socket interface for IPv6 (RFC 3493),
  * specifically getaddrinfo(), freeaddrinfo() and struct sockaddr_storage.
  *
+ * Note: on Windows/MingW, XP or higher is required.
+ *
  * Comment if your system does not support the IPv6 socket interface
  */
 #define POLARSSL_HAVE_IPV6
diff --git a/library/net.c b/library/net.c
index e666fad..fd5fd12 100644
--- a/library/net.c
+++ b/library/net.c
@@ -32,13 +32,14 @@
 #if (defined(_WIN32) || defined(_WIN32_WCE)) && !defined(EFIX64) && \
     !defined(EFI32)
 
-#include <winsock2.h>
-#include <windows.h>
-
 #if defined(POLARSSL_HAVE_IPV6)
+#define _WIN32_WINNT 0x0501
 #include <ws2tcpip.h>
 #endif
 
+#include <winsock2.h>
+#include <windows.h>
+
 #if defined(_WIN32_WCE)
 #pragma comment( lib, "ws2.lib" )
 #else