summaryrefslogtreecommitdiff
path: root/thirdparty/miniupnpc
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-03-24 12:53:43 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-03-24 12:53:43 +0100
commit8d5df826cb861eb1abc75fb7cea24ee4eaa2582d (patch)
treef8de70b3766ce12dfc69ad34fd6de791aa693797 /thirdparty/miniupnpc
parentfe566ee2a8363bcbe8c58e9d01a43c0fb90fd89b (diff)
[Net] Fix miniupnpc UWP build.
The patch has already been upstreamed, and custom patching won't be needed during next version update.
Diffstat (limited to 'thirdparty/miniupnpc')
-rw-r--r--thirdparty/miniupnpc/miniupnpc/minissdpc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/thirdparty/miniupnpc/miniupnpc/minissdpc.c b/thirdparty/miniupnpc/miniupnpc/minissdpc.c
index 0ef7e12cfb..5d3a0fd049 100644
--- a/thirdparty/miniupnpc/miniupnpc/minissdpc.c
+++ b/thirdparty/miniupnpc/miniupnpc/minissdpc.c
@@ -576,7 +576,17 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
* in order to give this ip to setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF) */
if(!ipv6) {
DWORD ifbestidx;
+#if _WIN32_WINNT >= 0x0600 // _WIN32_WINNT_VISTA
+ // While we don't need IPv6 support, the IPv4 only funciton is not available in UWP apps.
+ SOCKADDR_IN destAddr;
+ memset(&destAddr, 0, sizeof(destAddr));
+ destAddr.sin_family = AF_INET;
+ destAddr.sin_addr.s_addr = inet_addr("223.255.255.255");
+ destAddr.sin_port = 0;
+ if (GetBestInterfaceEx((struct sockaddr *)&destAddr, &ifbestidx) == NO_ERROR) {
+#else
if (GetBestInterface(inet_addr("223.255.255.255"), &ifbestidx) == NO_ERROR) {
+#endif
DWORD dwRetVal = NO_ERROR;
PIP_ADAPTER_ADDRESSES pAddresses = NULL;
ULONG outBufLen = 15360;