Fix UPNP on windows after #30205.
The problem could be related to different byte ordering when copying the interface address over the binding address.
This commit is contained in:
parent
f003b3efaa
commit
e85330231c
3 changed files with 17 additions and 4 deletions
1
thirdparty/README.md
vendored
1
thirdparty/README.md
vendored
|
@ -281,6 +281,7 @@ Files extracted from upstream source:
|
||||||
- All `*.c` and `*.h` files from `miniupnpc` to `thirdparty/miniupnpc/miniupnpc`
|
- All `*.c` and `*.h` files from `miniupnpc` to `thirdparty/miniupnpc/miniupnpc`
|
||||||
- Remove `test*`, `minihttptestserver.c` and `wingenminiupnpcstrings.c`
|
- Remove `test*`, `minihttptestserver.c` and `wingenminiupnpcstrings.c`
|
||||||
|
|
||||||
|
The patch `windows_fix.diff` is applied to `minissdpc.c` to fix an upstream issue.
|
||||||
The only modified file is miniupnpcstrings.h, which was created for Godot
|
The only modified file is miniupnpcstrings.h, which was created for Godot
|
||||||
(it is usually autogenerated by cmake).
|
(it is usually autogenerated by cmake).
|
||||||
|
|
||||||
|
|
4
thirdparty/miniupnpc/miniupnpc/minissdpc.c
vendored
4
thirdparty/miniupnpc/miniupnpc/minissdpc.c
vendored
|
@ -683,11 +683,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
struct in_addr mc_if;
|
struct in_addr mc_if;
|
||||||
#if defined(_WIN32) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
|
|
||||||
InetPtonA(AF_INET, multicastif, &mc_if);
|
|
||||||
#else
|
|
||||||
mc_if.s_addr = inet_addr(multicastif); /* ex: 192.168.x.x */
|
mc_if.s_addr = inet_addr(multicastif); /* ex: 192.168.x.x */
|
||||||
#endif
|
|
||||||
if(mc_if.s_addr != INADDR_NONE)
|
if(mc_if.s_addr != INADDR_NONE)
|
||||||
{
|
{
|
||||||
((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = mc_if.s_addr;
|
((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = mc_if.s_addr;
|
||||||
|
|
16
thirdparty/miniupnpc/windows_fix.diff
vendored
Normal file
16
thirdparty/miniupnpc/windows_fix.diff
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
diff --git a/thirdparty/miniupnpc/miniupnpc/minissdpc.c b/thirdparty/miniupnpc/miniupnpc/minissdpc.c
|
||||||
|
index 29f8110155..ea9af02e1f 100644
|
||||||
|
--- a/thirdparty/miniupnpc/miniupnpc/minissdpc.c
|
||||||
|
+++ b/thirdparty/miniupnpc/miniupnpc/minissdpc.c
|
||||||
|
@@ -683,11 +683,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
struct in_addr mc_if;
|
||||||
|
-#if defined(_WIN32) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
|
||||||
|
- InetPtonA(AF_INET, multicastif, &mc_if);
|
||||||
|
-#else
|
||||||
|
mc_if.s_addr = inet_addr(multicastif); /* ex: 192.168.x.x */
|
||||||
|
-#endif
|
||||||
|
if(mc_if.s_addr != INADDR_NONE)
|
||||||
|
{
|
||||||
|
((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = mc_if.s_addr;
|
Loading…
Reference in a new issue