Browse Source

Merge pull request #55117 from akien-mga/miniupnpc-2.2.3

miniupnpc: Update to version 2.2.3
Fabio Alessandrelli 3 năm trước cách đây
mục cha
commit
1db8cf0d81
41 tập tin đã thay đổi với 50 bổ sung37 xóa
  1. 1 1
      COPYRIGHT.txt
  2. 2 2
      modules/upnp/SCsub
  3. 2 2
      modules/upnp/upnp.cpp
  4. 1 1
      modules/upnp/upnp.h
  5. 1 1
      modules/upnp/upnp_device.cpp
  6. 6 9
      thirdparty/README.md
  7. 1 2
      thirdparty/miniupnpc/LICENSE
  8. 0 0
      thirdparty/miniupnpc/include/igd_desc_parse.h
  9. 2 2
      thirdparty/miniupnpc/include/miniupnpc.h
  10. 0 0
      thirdparty/miniupnpc/include/miniupnpc_declspec.h
  11. 4 2
      thirdparty/miniupnpc/include/miniupnpctypes.h
  12. 0 0
      thirdparty/miniupnpc/include/miniwget.h
  13. 0 0
      thirdparty/miniupnpc/include/portlistingparse.h
  14. 0 0
      thirdparty/miniupnpc/include/upnpcommands.h
  15. 3 3
      thirdparty/miniupnpc/include/upnpdev.h
  16. 0 0
      thirdparty/miniupnpc/include/upnpreplyparse.h
  17. 1 1
      thirdparty/miniupnpc/src/addr_is_reserved.c
  18. 0 0
      thirdparty/miniupnpc/src/addr_is_reserved.h
  19. 0 0
      thirdparty/miniupnpc/src/codelength.h
  20. 0 0
      thirdparty/miniupnpc/src/connecthostport.c
  21. 0 0
      thirdparty/miniupnpc/src/connecthostport.h
  22. 0 0
      thirdparty/miniupnpc/src/igd_desc_parse.c
  23. 0 0
      thirdparty/miniupnpc/src/minisoap.c
  24. 0 0
      thirdparty/miniupnpc/src/minisoap.h
  25. 25 10
      thirdparty/miniupnpc/src/minissdpc.c
  26. 0 0
      thirdparty/miniupnpc/src/minissdpc.h
  27. 0 0
      thirdparty/miniupnpc/src/miniupnpc.c
  28. 0 0
      thirdparty/miniupnpc/src/miniupnpc_socketdef.h
  29. 1 1
      thirdparty/miniupnpc/src/miniupnpcstrings.h
  30. 0 0
      thirdparty/miniupnpc/src/miniwget.c
  31. 0 0
      thirdparty/miniupnpc/src/miniwget_private.h
  32. 0 0
      thirdparty/miniupnpc/src/minixml.c
  33. 0 0
      thirdparty/miniupnpc/src/minixml.h
  34. 0 0
      thirdparty/miniupnpc/src/minixmlvalid.c
  35. 0 0
      thirdparty/miniupnpc/src/portlistingparse.c
  36. 0 0
      thirdparty/miniupnpc/src/receivedata.c
  37. 0 0
      thirdparty/miniupnpc/src/receivedata.h
  38. 0 0
      thirdparty/miniupnpc/src/upnpcommands.c
  39. 0 0
      thirdparty/miniupnpc/src/upnpdev.c
  40. 0 0
      thirdparty/miniupnpc/src/upnpreplyparse.c
  41. 0 0
      thirdparty/miniupnpc/src/win32_snprintf.h

+ 1 - 1
COPYRIGHT.txt

@@ -266,7 +266,7 @@ Copyright: lieff
 License: CC0-1.0
 License: CC0-1.0
 
 
 Files: ./thirdparty/miniupnpc/
 Files: ./thirdparty/miniupnpc/
-Comment: MiniUPnPc
+Comment: MiniUPnP Project
 Copyright: 2005-2021, Thomas Bernard
 Copyright: 2005-2021, Thomas Bernard
 License: BSD-3-clause
 License: BSD-3-clause
 
 

+ 2 - 2
modules/upnp/SCsub

@@ -26,9 +26,9 @@ if env["builtin_miniupnpc"]:
         "receivedata.c",
         "receivedata.c",
         "addr_is_reserved.c",
         "addr_is_reserved.c",
     ]
     ]
-    thirdparty_sources = [thirdparty_dir + "miniupnpc/" + file for file in thirdparty_sources]
+    thirdparty_sources = [thirdparty_dir + "src/" + file for file in thirdparty_sources]
 
 
-    env_upnp.Prepend(CPPPATH=[thirdparty_dir])
+    env_upnp.Prepend(CPPPATH=[thirdparty_dir + "include"])
     env_upnp.Append(CPPDEFINES=["MINIUPNP_STATICLIB"])
     env_upnp.Append(CPPDEFINES=["MINIUPNP_STATICLIB"])
     env_upnp.Append(CPPDEFINES=["MINIUPNPC_SET_SOCKET_TIMEOUT"])
     env_upnp.Append(CPPDEFINES=["MINIUPNPC_SET_SOCKET_TIMEOUT"])
 
 

+ 2 - 2
modules/upnp/upnp.cpp

@@ -30,8 +30,8 @@
 
 
 #include "upnp.h"
 #include "upnp.h"
 
 
-#include <miniupnpc/miniwget.h>
-#include <miniupnpc/upnpcommands.h>
+#include <miniwget.h>
+#include <upnpcommands.h>
 
 
 #include <stdlib.h>
 #include <stdlib.h>
 
 

+ 1 - 1
modules/upnp/upnp.h

@@ -35,7 +35,7 @@
 
 
 #include "upnp_device.h"
 #include "upnp_device.h"
 
 
-#include <miniupnpc/miniupnpc.h>
+#include <miniupnpc.h>
 
 
 class UPNP : public RefCounted {
 class UPNP : public RefCounted {
 	GDCLASS(UPNP, RefCounted);
 	GDCLASS(UPNP, RefCounted);

+ 1 - 1
modules/upnp/upnp_device.cpp

@@ -32,7 +32,7 @@
 
 
 #include "upnp.h"
 #include "upnp.h"
 
 
-#include <miniupnpc/upnpcommands.h>
+#include <upnpcommands.h>
 
 
 String UPNPDevice::query_external_address() const {
 String UPNPDevice::query_external_address() const {
 	ERR_FAIL_COND_V_MSG(!is_valid_gateway(), "", "The Internet Gateway Device must be valid.");
 	ERR_FAIL_COND_V_MSG(!is_valid_gateway(), "", "The Internet Gateway Device must be valid.");

+ 6 - 9
thirdparty/README.md

@@ -350,22 +350,19 @@ found in the `patches` directory.
 ## miniupnpc
 ## miniupnpc
 
 
 - Upstream: https://github.com/miniupnp/miniupnp
 - Upstream: https://github.com/miniupnp/miniupnp
-- Version: 2.2.2 (81029a860baf1f727903e5b85307903b3f40cbc8, 2021)
+- Version: 2.2.3 (2df8120326ed4246e049a7a6de707539604cd514, 2021)
 - License: BSD-3-Clause
 - License: BSD-3-Clause
 
 
 Files extracted from upstream source:
 Files extracted from upstream source:
 
 
-- All `*.c` and `*.h` files from `miniupnpc` to `thirdparty/miniupnpc/miniupnpc`
+- Copy `miniupnpc/src` and `miniupnpc/include` to `thirdparty/miniupnpc`
 - Remove the following test or sample files:
 - Remove the following test or sample files:
-  `listdevices.c minihttptestserver.c miniupnpcmodule.c upnpc.c upnperrors.* test* wingenminiupnpcstrings.c`
+  `listdevices.c minihttptestserver.c miniupnpcmodule.c upnpc.c upnperrors.* test*`
 - `LICENSE`
 - `LICENSE`
 
 
-The only modified file is `miniupnpcstrings.h`, which was created for Godot
-(it is usually autogenerated by cmake). Bump the version number for miniupnpc in that
-file when upgrading.
-
-Note: The following upstream patch has been applied, remove this notice on next update.
-https://github.com/miniupnp/miniupnp/commit/3a08dd4b89af2e9effa22a136bac86f2f306fd79
+The only modified file is `src/miniupnpcstrings.h`, which was created for Godot
+(it is usually autogenerated by cmake). Bump the version number for miniupnpc in
+that file when upgrading.
 
 
 
 
 ## minizip
 ## minizip

+ 1 - 2
thirdparty/miniupnpc/LICENSE

@@ -1,4 +1,4 @@
-MiniUPnPc
+MiniUPnP Project
 Copyright (c) 2005-2020, Thomas BERNARD
 Copyright (c) 2005-2020, Thomas BERNARD
 All rights reserved.
 All rights reserved.
 
 
@@ -24,4 +24,3 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.
 POSSIBILITY OF SUCH DAMAGE.
-

+ 0 - 0
thirdparty/miniupnpc/miniupnpc/igd_desc_parse.h → thirdparty/miniupnpc/include/igd_desc_parse.h


+ 2 - 2
thirdparty/miniupnpc/miniupnpc/miniupnpc.h → thirdparty/miniupnpc/include/miniupnpc.h

@@ -1,4 +1,4 @@
-/* $Id: miniupnpc.h,v 1.58 2021/03/02 23:49:52 nanard Exp $ */
+/* $Id: miniupnpc.h,v 1.59 2021/09/28 21:39:17 nanard Exp $ */
 /* vim: tabstop=4 shiftwidth=4 noexpandtab
 /* vim: tabstop=4 shiftwidth=4 noexpandtab
  * Project: miniupnp
  * Project: miniupnp
  * http://miniupnp.free.fr/
  * http://miniupnp.free.fr/
@@ -20,7 +20,7 @@
 #define UPNPDISCOVER_MEMORY_ERROR (-102)
 #define UPNPDISCOVER_MEMORY_ERROR (-102)
 
 
 /* versions : */
 /* versions : */
-#define MINIUPNPC_VERSION	"2.2.2"
+#define MINIUPNPC_VERSION	"2.2.3"
 #define MINIUPNPC_API_VERSION	17
 #define MINIUPNPC_API_VERSION	17
 
 
 /* Source port:
 /* Source port:

+ 0 - 0
thirdparty/miniupnpc/miniupnpc/miniupnpc_declspec.h → thirdparty/miniupnpc/include/miniupnpc_declspec.h


+ 4 - 2
thirdparty/miniupnpc/miniupnpc/miniupnpctypes.h → thirdparty/miniupnpc/include/miniupnpctypes.h

@@ -1,13 +1,15 @@
 /* $Id: miniupnpctypes.h,v 1.1 2011/02/15 11:10:40 nanard Exp $ */
 /* $Id: miniupnpctypes.h,v 1.1 2011/02/15 11:10:40 nanard Exp $ */
 /* Miniupnp project : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org
 /* Miniupnp project : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org
  * Author : Thomas Bernard
  * Author : Thomas Bernard
- * Copyright (c) 2011 Thomas Bernard
+ * Copyright (c) 2021 Thomas Bernard
  * This software is subject to the conditions detailed in the
  * This software is subject to the conditions detailed in the
  * LICENCE file provided within this distribution */
  * LICENCE file provided within this distribution */
 #ifndef MINIUPNPCTYPES_H_INCLUDED
 #ifndef MINIUPNPCTYPES_H_INCLUDED
 #define MINIUPNPCTYPES_H_INCLUDED
 #define MINIUPNPCTYPES_H_INCLUDED
 
 
-#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
+/* Use unsigned long long when available :
+ * strtoull is C99 */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 #define UNSIGNED_INTEGER unsigned long long
 #define UNSIGNED_INTEGER unsigned long long
 #define STRTOUI	strtoull
 #define STRTOUI	strtoull
 #else
 #else

+ 0 - 0
thirdparty/miniupnpc/miniupnpc/miniwget.h → thirdparty/miniupnpc/include/miniwget.h


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/portlistingparse.h → thirdparty/miniupnpc/include/portlistingparse.h


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/upnpcommands.h → thirdparty/miniupnpc/include/upnpcommands.h


+ 3 - 3
thirdparty/miniupnpc/miniupnpc/upnpdev.h → thirdparty/miniupnpc/include/upnpdev.h

@@ -1,8 +1,8 @@
-/* $Id: upnpdev.h,v 1.3 2020/05/29 15:57:42 nanard Exp $ */
+/* $Id: upnpdev.h,v 1.4 2021/08/21 09:45:01 nanard Exp $ */
 /* Project : miniupnp
 /* Project : miniupnp
  * Web : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
  * Web : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
  * Author : Thomas BERNARD
  * Author : Thomas BERNARD
- * copyright (c) 2005-2020 Thomas Bernard
+ * copyright (c) 2005-2021 Thomas Bernard
  * This software is subjet to the conditions detailed in the
  * This software is subjet to the conditions detailed in the
  * provided LICENSE file. */
  * provided LICENSE file. */
 #ifndef UPNPDEV_H_INCLUDED
 #ifndef UPNPDEV_H_INCLUDED
@@ -20,7 +20,7 @@ struct UPNPDev {
 	char * st;
 	char * st;
 	char * usn;
 	char * usn;
 	unsigned int scope_id;
 	unsigned int scope_id;
-#if defined(__STDC_VERSION) && __STDC_VERSION__ >= 199901L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 	/* C99 flexible array member */
 	/* C99 flexible array member */
 	char buffer[];
 	char buffer[];
 #elif defined(__GNUC__)
 #elif defined(__GNUC__)

+ 0 - 0
thirdparty/miniupnpc/miniupnpc/upnpreplyparse.h → thirdparty/miniupnpc/include/upnpreplyparse.h


+ 1 - 1
thirdparty/miniupnpc/miniupnpc/addr_is_reserved.c → thirdparty/miniupnpc/src/addr_is_reserved.c

@@ -56,7 +56,7 @@ int addr_is_reserved(const char * addr_str)
 	uint32_t addr_n, address;
 	uint32_t addr_n, address;
 	size_t i;
 	size_t i;
 
 
-#if defined(_WIN32) && (!defined(_WIN32_WINNT_VISTA) || (_WIN32_WINNT < _WIN32_WINNT_VISTA))
+#if defined(_WIN32) && _WIN32_WINNT < 0x0600 // _WIN32_WINNT_VISTA
 	addr_n = inet_addr(addr_str);
 	addr_n = inet_addr(addr_str);
 	if (addr_n == INADDR_NONE)
 	if (addr_n == INADDR_NONE)
 		return 1;
 		return 1;

+ 0 - 0
thirdparty/miniupnpc/miniupnpc/addr_is_reserved.h → thirdparty/miniupnpc/src/addr_is_reserved.h


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/codelength.h → thirdparty/miniupnpc/src/codelength.h


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/connecthostport.c → thirdparty/miniupnpc/src/connecthostport.c


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/connecthostport.h → thirdparty/miniupnpc/src/connecthostport.h


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/igd_desc_parse.c → thirdparty/miniupnpc/src/igd_desc_parse.c


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/minisoap.c → thirdparty/miniupnpc/src/minisoap.c


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/minisoap.h → thirdparty/miniupnpc/src/minisoap.h


+ 25 - 10
thirdparty/miniupnpc/miniupnpc/minissdpc.c → thirdparty/miniupnpc/src/minissdpc.c

@@ -1,4 +1,4 @@
-/* $Id: minissdpc.c,v 1.47 2021/03/02 23:38:30 nanard Exp $ */
+/* $Id: minissdpc.c,v 1.49 2021/05/13 11:00:36 nanard Exp $ */
 /* vim: tabstop=4 shiftwidth=4 noexpandtab
 /* vim: tabstop=4 shiftwidth=4 noexpandtab
  * Project : miniupnp
  * Project : miniupnp
  * Web : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
  * Web : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
@@ -460,7 +460,7 @@ parseMSEARCHReply(const char * reply, int size,
 static int upnp_gettimeofday(struct timeval * tv)
 static int upnp_gettimeofday(struct timeval * tv)
 {
 {
 #if defined(_WIN32)
 #if defined(_WIN32)
-#if defined(_WIN32_WINNT_VISTA) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+#if _WIN32_WINNT >= 0x0600 // _WIN32_WINNT_VISTA
 	ULONGLONG ts = GetTickCount64();
 	ULONGLONG ts = GetTickCount64();
 #else
 #else
 	DWORD ts = GetTickCount();
 	DWORD ts = GetTickCount();
@@ -469,14 +469,29 @@ static int upnp_gettimeofday(struct timeval * tv)
 	tv->tv_usec = (ts % 1000) * 1000;
 	tv->tv_usec = (ts % 1000) * 1000;
 	return 0; /* success */
 	return 0; /* success */
 #elif defined(CLOCK_MONOTONIC_FAST) || defined(CLOCK_MONOTONIC)
 #elif defined(CLOCK_MONOTONIC_FAST) || defined(CLOCK_MONOTONIC)
-	struct timespec ts;
-	int ret_code = clock_gettime(UPNP_CLOCKID, &ts);
-	if (ret_code == 0)
+#if defined(__APPLE__)
+#if defined(__clang__)
+	if (__builtin_available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)) {
+#else /* !defined(__clang__) */
+	if (clock_gettime != NULL) {
+#endif /* defined(__clang__) */
+#endif /* defined(__APPLE__) */
+		struct timespec ts;
+		int ret_code = clock_gettime(UPNP_CLOCKID, &ts);
+		if (ret_code == 0)
+		{
+			tv->tv_sec = ts.tv_sec;
+			tv->tv_usec = ts.tv_nsec / 1000;
+		}
+		return ret_code;
+#if defined(__APPLE__)
+	}
+	else
 	{
 	{
-		tv->tv_sec = ts.tv_sec;
-		tv->tv_usec = ts.tv_nsec / 1000;
+		/* fall-back for earlier Apple platforms */
+		return gettimeofday(tv, NULL);
 	}
 	}
-	return ret_code;
+#endif /* defined(__APPLE__) */
 #else
 #else
 	return gettimeofday(tv, NULL);
 	return gettimeofday(tv, NULL);
 #endif
 #endif
@@ -705,7 +720,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
 		}
 		}
 	}
 	}
 
 
-	if(multicastif)
+	if(multicastif && multicastif[0] != '\0')
 	{
 	{
 		if(ipv6) {
 		if(ipv6) {
 #if !defined(_WIN32)
 #if !defined(_WIN32)
@@ -732,7 +747,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
 		} else {
 		} else {
 			struct in_addr mc_if;
 			struct in_addr mc_if;
 #if defined(_WIN32)
 #if defined(_WIN32)
-#if defined(_WIN32_WINNT_VISTA) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+#if _WIN32_WINNT >= 0x0600 // _WIN32_WINNT_VISTA
 			InetPtonA(AF_INET, multicastif, &mc_if);
 			InetPtonA(AF_INET, multicastif, &mc_if);
 #else
 #else
 			mc_if.s_addr = inet_addr(multicastif); /* old Windows SDK do not support InetPtoA() */
 			mc_if.s_addr = inet_addr(multicastif); /* old Windows SDK do not support InetPtoA() */

+ 0 - 0
thirdparty/miniupnpc/miniupnpc/minissdpc.h → thirdparty/miniupnpc/src/minissdpc.h


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/miniupnpc.c → thirdparty/miniupnpc/src/miniupnpc.c


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/miniupnpc_socketdef.h → thirdparty/miniupnpc/src/miniupnpc_socketdef.h


+ 1 - 1
thirdparty/miniupnpc/miniupnpc/miniupnpcstrings.h → thirdparty/miniupnpc/src/miniupnpcstrings.h

@@ -4,7 +4,7 @@
 #include "core/version.h"
 #include "core/version.h"
 
 
 #define OS_STRING VERSION_NAME "/1.0"
 #define OS_STRING VERSION_NAME "/1.0"
-#define MINIUPNPC_VERSION_STRING "2.2.2"
+#define MINIUPNPC_VERSION_STRING "2.2.3"
 
 
 #if 0
 #if 0
 /* according to "UPnP Device Architecture 1.0" */
 /* according to "UPnP Device Architecture 1.0" */

+ 0 - 0
thirdparty/miniupnpc/miniupnpc/miniwget.c → thirdparty/miniupnpc/src/miniwget.c


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/miniwget_private.h → thirdparty/miniupnpc/src/miniwget_private.h


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/minixml.c → thirdparty/miniupnpc/src/minixml.c


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/minixml.h → thirdparty/miniupnpc/src/minixml.h


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/minixmlvalid.c → thirdparty/miniupnpc/src/minixmlvalid.c


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/portlistingparse.c → thirdparty/miniupnpc/src/portlistingparse.c


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/receivedata.c → thirdparty/miniupnpc/src/receivedata.c


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/receivedata.h → thirdparty/miniupnpc/src/receivedata.h


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/upnpcommands.c → thirdparty/miniupnpc/src/upnpcommands.c


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/upnpdev.c → thirdparty/miniupnpc/src/upnpdev.c


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/upnpreplyparse.c → thirdparty/miniupnpc/src/upnpreplyparse.c


+ 0 - 0
thirdparty/miniupnpc/miniupnpc/win32_snprintf.h → thirdparty/miniupnpc/src/win32_snprintf.h