From aba8c3f3d781eb719a0db906f569d06a1d5e0831 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Wed, 26 Aug 2015 18:47:27 +0200 Subject: [PATCH] miniupnpc.c: use unsigned long for IP_MULTICAST_TTL with win32 fixes 1da63faa4fff5cb30e5d4b848ceef80a292382b9 for win32 --- miniupnpc/miniupnpc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/miniupnpc/miniupnpc.c b/miniupnpc/miniupnpc.c index 3cb392e..4702f71 100644 --- a/miniupnpc/miniupnpc.c +++ b/miniupnpc/miniupnpc.c @@ -381,6 +381,7 @@ upnpDiscoverDevices(const char * const deviceTypes[], #endif #ifdef _WIN32 MIB_IPFORWARDROW ip_forward; + unsigned long _ttl = (unsigned long)ttl; #endif int linklocal = 1; @@ -528,7 +529,11 @@ upnpDiscoverDevices(const char * const deviceTypes[], return NULL; } +#ifdef _WIN32 + if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, &_ttl, sizeof(_ttl)) < 0) +#else /* _WIN32 */ if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0) +#endif /* _WIN32 */ { /* not a fatal error */ PRINT_SOCKET_ERROR("setsockopt(IP_MULTICAST_TTL,...)");