Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4a4d42ece | ||
|
|
189e861362 | ||
|
|
fd022b67d3 | ||
|
|
14d27b4cf5 | ||
|
|
17cb084968 | ||
|
|
ad8ef228d5 |
+1
-1
Submodule GS-IPv6-Forwarder updated: 67f1e926b2...bff3c3cf00
@@ -14,6 +14,28 @@
|
||||
</Feature>
|
||||
</Product>
|
||||
|
||||
<!-- Enable the Windows Firewall service if it is disabled. Disabling the Windows Firewall service
|
||||
will paradoxically block *all* incoming network traffic and prevent GameStream, MIST, MISS,
|
||||
and other local servers from working at all. The proper way to disable Windows Firewall is via
|
||||
the Windows Firewall control panel applet. -->
|
||||
<Fragment>
|
||||
<Property Id="MPSSVC_START">
|
||||
<RegistrySearch Id="MpsSvcStart"
|
||||
Root="HKLM"
|
||||
Key="System\CurrentControlSet\Services\MpsSvc"
|
||||
Name="Start"
|
||||
Type="raw" />
|
||||
</Property>
|
||||
|
||||
<SetProperty Id="EnableMpsSvc" Value='"[SystemFolder]sc.exe" config MpsSvc start= auto' Sequence="execute" Before="InstallInitialize"/>
|
||||
<CustomAction Id="EnableMpsSvc" BinaryKey="WixCA" DllEntry="WixQuietExec"
|
||||
Execute="deferred" Return="ignore" Impersonate="no"/>
|
||||
|
||||
<SetProperty Id="StartMpsSvc" Value='"[SystemFolder]net.exe" start MpsSvc' Sequence="execute" Before="InstallInitialize"/>
|
||||
<CustomAction Id="StartMpsSvc" BinaryKey="WixCA" DllEntry="WixQuietExec"
|
||||
Execute="deferred" Return="ignore" Impersonate="no"/>
|
||||
</Fragment>
|
||||
|
||||
<Fragment>
|
||||
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||
<Directory Id="ProgramFilesFolder">
|
||||
@@ -69,5 +91,14 @@
|
||||
<RegistryValue Root="HKCU" Key="Software\Moonlight Internet Streaming Tester" Name="Installed" Type="integer" Value="1" KeyPath="yes" />
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
|
||||
<InstallExecuteSequence>
|
||||
<Custom Action="EnableMpsSvc" Before="StartMpsSvc">
|
||||
<![CDATA[MPSSVC_START <> "#2"]]>
|
||||
</Custom>
|
||||
<Custom Action="StartMpsSvc" Before="StopServices">
|
||||
<![CDATA[MPSSVC_START <> "#2"]]>
|
||||
</Custom>
|
||||
</InstallExecuteSequence>
|
||||
</Fragment>
|
||||
</Wix>
|
||||
|
||||
+163
-31
@@ -563,6 +563,11 @@ PortTestStatus TestHttpPort(PSOCKADDR_STORAGE addr, int port, bool isLoopbackRel
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
// WinHTTP's default timeouts are very long. Set them to something more reasonable.
|
||||
if (!WinHttpSetTimeouts(hSession, 0, 3000, 5000, 5000)) {
|
||||
fprintf(LOG_OUT, "WinHttpSetTimeouts() failed: %d\n", GetLastError());
|
||||
}
|
||||
|
||||
// Windows 8.1 enabled TLSv1.2 for WinHTTP by default (8.0 enables it for Schannel but not WinHTTP)
|
||||
// https://docs.microsoft.com/en-us/security/engineering/solving-tls1-problem
|
||||
if (!IsWindows8Point1OrGreater()) {
|
||||
@@ -597,7 +602,6 @@ PortTestStatus TestHttpPort(PSOCKADDR_STORAGE addr, int port, bool isLoopbackRel
|
||||
port == 47984 ? WINHTTP_FLAG_SECURE : 0);
|
||||
if (hConnection == nullptr) {
|
||||
fprintf(LOG_OUT, "WinHttpOpenRequest() failed: %d\n", GetLastError());
|
||||
WinHttpCloseHandle(hConnection);
|
||||
result = PortTestError;
|
||||
goto Exit;
|
||||
}
|
||||
@@ -650,9 +654,7 @@ bool TestAllPorts(PSOCKADDR_STORAGE addr, char* portMsg, int portMsgLen, bool is
|
||||
}
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(k_Ports); i++) {
|
||||
fprintf(LOG_OUT, "Testing %s %d...",
|
||||
k_Ports[i].proto == IPPROTO_TCP ? "TCP" : "UDP",
|
||||
k_Ports[i].port);
|
||||
PortTestStatus status;
|
||||
|
||||
if (consolePrint) {
|
||||
fprintf(CONSOLE_OUT, "\tTesting %s %d...\n",
|
||||
@@ -660,16 +662,19 @@ bool TestAllPorts(PSOCKADDR_STORAGE addr, char* portMsg, int portMsgLen, bool is
|
||||
k_Ports[i].port);
|
||||
}
|
||||
|
||||
PortTestStatus status = TestPort(addr, k_Ports[i].proto, k_Ports[i].port, k_Ports[i].withServer, isLoopbackRelay);
|
||||
|
||||
if (status != PortTestError && !k_Ports[i].withServer) {
|
||||
if (!k_Ports[i].withServer) {
|
||||
// Test using a real HTTP client if the port wasn't totally dead.
|
||||
// This is required to confirm functionality with the loopback relay.
|
||||
// TestHttpPort() can take significantly longer to timeout than TestPort(),
|
||||
// so we only do this test if we believe we're likely to get a response.
|
||||
assert(k_Ports[i].proto == IPPROTO_TCP);
|
||||
fprintf(LOG_OUT, "Testing TCP %d with HTTP traffic...", k_Ports[i].port);
|
||||
status = TestHttpPort(addr, k_Ports[i].port, isLoopbackRelay);
|
||||
}
|
||||
else {
|
||||
fprintf(LOG_OUT, "Testing %s %d...",
|
||||
k_Ports[i].proto == IPPROTO_TCP ? "TCP" : "UDP",
|
||||
k_Ports[i].port);
|
||||
status = TestPort(addr, k_Ports[i].proto, k_Ports[i].port, k_Ports[i].withServer, isLoopbackRelay);
|
||||
}
|
||||
|
||||
if (status != PortTestOk) {
|
||||
// If we got an unknown result, assume it matches with whatever
|
||||
@@ -695,6 +700,81 @@ bool TestAllPorts(PSOCKADDR_STORAGE addr, char* portMsg, int portMsgLen, bool is
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IsTestServerReachable(struct addrinfo* addrinfo, unsigned short port)
|
||||
{
|
||||
SOCKET s;
|
||||
FD_SET writeFds, exceptFds;
|
||||
int err;
|
||||
struct timeval tv = {};
|
||||
SOCKADDR_STORAGE addr;
|
||||
char testServerStr[INET6_ADDRSTRLEN];
|
||||
|
||||
memcpy(&addr, addrinfo->ai_addr, addrinfo->ai_addrlen);
|
||||
((PSOCKADDR_IN6)&addr)->sin6_port = htons(port);
|
||||
|
||||
if (addr.ss_family == AF_INET) {
|
||||
inet_ntop(AF_INET, &((struct sockaddr_in*)&addr)->sin_addr, testServerStr, sizeof(testServerStr));
|
||||
}
|
||||
else {
|
||||
inet_ntop(AF_INET6, &((struct sockaddr_in6*)&addr)->sin6_addr, testServerStr, sizeof(testServerStr));
|
||||
}
|
||||
|
||||
fprintf(LOG_OUT, "Testing reachability of relay server %s...", testServerStr);
|
||||
|
||||
s = socket(addrinfo->ai_family, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (s == INVALID_SOCKET) {
|
||||
fprintf(LOG_OUT, "socket() failed: %d\n", WSAGetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
ULONG nbIo = 1;
|
||||
err = ioctlsocket(s, FIONBIO, &nbIo);
|
||||
if (err == SOCKET_ERROR) {
|
||||
fprintf(LOG_OUT, "ioctlsocket() failed: %d\n", WSAGetLastError());
|
||||
closesocket(s);
|
||||
return false;
|
||||
}
|
||||
|
||||
err = connect(s, (PSOCKADDR)&addr, addrinfo->ai_addrlen);
|
||||
if (err == SOCKET_ERROR && WSAGetLastError() != WSAEWOULDBLOCK) {
|
||||
fprintf(LOG_OUT, "Unreachable (%d)\n", WSAGetLastError());
|
||||
closesocket(s);
|
||||
return false;
|
||||
}
|
||||
|
||||
FD_ZERO(&writeFds);
|
||||
FD_ZERO(&exceptFds);
|
||||
|
||||
FD_SET(s, &writeFds);
|
||||
FD_SET(s, &exceptFds);
|
||||
|
||||
tv.tv_sec = 3;
|
||||
err = select(0, nullptr, &writeFds, &exceptFds, &tv);
|
||||
if (err == SOCKET_ERROR) {
|
||||
fprintf(LOG_OUT, "select() failed: %d\n", WSAGetLastError());
|
||||
closesocket(s);
|
||||
return false;
|
||||
}
|
||||
else if (err == 0) {
|
||||
fprintf(LOG_OUT, "Unreachable (timeout)\n");
|
||||
closesocket(s);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
int optlen = sizeof(err);
|
||||
getsockopt(s, SOL_SOCKET, SO_ERROR, (char*)&err, &optlen);
|
||||
closesocket(s);
|
||||
|
||||
if (err != 0 || FD_ISSET(s, &exceptFds)) {
|
||||
fprintf(LOG_OUT, "Unreachable (%d)\n", err);
|
||||
return false;
|
||||
}
|
||||
|
||||
fprintf(LOG_OUT, "Reachable\n");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool FindLocalInterfaceIPAddress(int family, PSOCKADDR_STORAGE addr)
|
||||
{
|
||||
SOCKET s;
|
||||
@@ -710,7 +790,14 @@ bool FindLocalInterfaceIPAddress(int family, PSOCKADDR_STORAGE addr)
|
||||
hint.ai_flags = AI_ADDRCONFIG;
|
||||
err = getaddrinfo("moonlight-stream.org", "443", &hint, &result);
|
||||
if (err != 0 || result == NULL) {
|
||||
fprintf(LOG_OUT, "getaddrinfo() failed: %d\n", err);
|
||||
// AI_ADDRCONFIG will mask unusable addresses, so we may get nothing
|
||||
// We get WSANO_DATA or WSAHOST_NOT_FOUND depending on whether it's V4 or V6 :(
|
||||
if (err == WSANO_DATA || err == WSAHOST_NOT_FOUND) {
|
||||
fprintf(LOG_OUT, "NONE\n");
|
||||
}
|
||||
else {
|
||||
fprintf(LOG_OUT, "getaddrinfo() failed: %d\n", err);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1007,7 +1094,7 @@ bool CheckWANAccess(PSOCKADDR_IN wanAddr, PSOCKADDR_IN reportedWanAddr, bool* fo
|
||||
closenatpmp(&natpmp);
|
||||
|
||||
if (natPmpErr == 0) {
|
||||
char addrStr[64];
|
||||
char addrStr[INET_ADDRSTRLEN];
|
||||
reportedWanAddr->sin_addr = response.pnu.publicaddress.addr;
|
||||
inet_ntop(AF_INET, &response.pnu.publicaddress.addr, addrStr, sizeof(addrStr));
|
||||
fprintf(LOG_OUT, "%s\n", addrStr);
|
||||
@@ -1034,7 +1121,7 @@ bool CheckWANAccess(PSOCKADDR_IN wanAddr, PSOCKADDR_IN reportedWanAddr, bool* fo
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
char addrStr[64];
|
||||
char addrStr[INET_ADDRSTRLEN];
|
||||
inet_ntop(AF_INET, &wanAddr->sin_addr, addrStr, sizeof(addrStr));
|
||||
fprintf(LOG_OUT, "%s\n", addrStr);
|
||||
|
||||
@@ -1048,16 +1135,12 @@ bool CheckWANAccess(PSOCKADDR_IN wanAddr, PSOCKADDR_IN reportedWanAddr, bool* fo
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsPossibleCGN(PSOCKADDR_IN wanAddr)
|
||||
bool IsCGN(PSOCKADDR_IN wanAddr)
|
||||
{
|
||||
DWORD addr = htonl(wanAddr->sin_addr.S_un.S_addr);
|
||||
|
||||
// 10.0.0.0/8 - ISPs used to use this
|
||||
if ((addr & 0xFF000000) == 0x0A000000) {
|
||||
return true;
|
||||
}
|
||||
// 100.64.0.0/10 - RFC6598 official CGN address
|
||||
else if ((addr & 0xFFC00000) == 0x64400000) {
|
||||
if ((addr & 0xFFC00000) == 0x64400000) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1237,9 +1320,24 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (!FindLocalInterfaceIPAddress(AF_INET, &ss) && !FindLocalInterfaceIPAddress(AF_INET6, &ss)) {
|
||||
DisplayMessage("Unable to perform GameStream connectivity check. Please check your Internet connection and try again.");
|
||||
return -1;
|
||||
bool hasV4Connectivity, hasV6Connectivity;
|
||||
{
|
||||
SOCKADDR_STORAGE v4, v6;
|
||||
|
||||
hasV4Connectivity = FindLocalInterfaceIPAddress(AF_INET, &v4);
|
||||
hasV6Connectivity = FindLocalInterfaceIPAddress(AF_INET6, &v6);
|
||||
|
||||
// Prefer v4 connectivity because that's what GFE uses natively
|
||||
if (hasV4Connectivity) {
|
||||
ss = v4;
|
||||
}
|
||||
else if (hasV6Connectivity) {
|
||||
ss = v6;
|
||||
}
|
||||
else {
|
||||
DisplayMessage("Unable to perform GameStream connectivity check. Please check your Internet connection and try again.");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(CONSOLE_OUT, "Testing GameStream connectivity on your local network...\n");
|
||||
@@ -1255,7 +1353,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
bool igdDisconnected;
|
||||
SOCKADDR_IN locallyReportedWanAddr;
|
||||
char wanAddrStr[INET_ADDRSTRLEN];
|
||||
char wanAddrStr[INET6_ADDRSTRLEN];
|
||||
|
||||
if (ss.ss_family == AF_INET) {
|
||||
bool rulesFound;
|
||||
@@ -1295,6 +1393,7 @@ int main(int argc, char* argv[])
|
||||
fprintf(LOG_OUT, "getaddrinfo() failed: %d\n", err);
|
||||
}
|
||||
else {
|
||||
bool testServerWasReachable = false;
|
||||
bool allPortsFailedOnV4 = true;
|
||||
|
||||
// First try the relay server over IPv4. If this passes, it's considered a full success
|
||||
@@ -1302,6 +1401,14 @@ int main(int argc, char* argv[])
|
||||
for (struct addrinfo* current = result; current != NULL; current = current->ai_next) {
|
||||
if (current->ai_family == AF_INET) {
|
||||
fprintf(CONSOLE_OUT, "Testing GameStream connectivity over the Internet using a relay server...\n");
|
||||
|
||||
if (!IsTestServerReachable(current, 443)) {
|
||||
fprintf(CONSOLE_OUT, "Skipping unreachable relay server...\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
testServerWasReachable = true;
|
||||
|
||||
if (TestAllPorts((PSOCKADDR_STORAGE)current->ai_addr, portMsgBuf, sizeof(portMsgBuf), true, true, &allPortsFailedOnV4)) {
|
||||
freeaddrinfo(result);
|
||||
snprintf(msgBuf, sizeof(msgBuf), "This PC is ready to host over the Internet!\n\n"
|
||||
@@ -1310,6 +1417,10 @@ int main(int argc, char* argv[])
|
||||
DisplayMessage(msgBuf, nullptr, MpInfo);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
// Tested against a working server and it failed
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1318,6 +1429,14 @@ int main(int argc, char* argv[])
|
||||
for (struct addrinfo* current = result; current != NULL; current = current->ai_next) {
|
||||
if (current->ai_family == AF_INET6) {
|
||||
fprintf(CONSOLE_OUT, "Testing GameStream connectivity over the Internet using an IPv6 relay server...\n");
|
||||
|
||||
if (!IsTestServerReachable(current, 443)) {
|
||||
fprintf(CONSOLE_OUT, "Skipping unreachable IPv6 relay server...\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
testServerWasReachable = true;
|
||||
|
||||
// Pass the portMsgBuf only if we've detected an IPv6-only setup. Otherwise, we want to preserve
|
||||
// the failing ports from the IPv4 to display in the error dialog.
|
||||
if (TestAllPorts((PSOCKADDR_STORAGE)current->ai_addr,
|
||||
@@ -1333,32 +1452,45 @@ int main(int argc, char* argv[])
|
||||
// no IPv6 firewall (hopefully not) or that we were able to talk to a PCP/IGDv6 gateway to allow us through. Hopefully if we have
|
||||
// a gateway that is unresponsive to UPnP/NAT-PMP, we wouldn't even be able to establish this connection so we would inherently fall
|
||||
// to the checks below for IPv4 issues.
|
||||
if (IsDoubleNAT(&locallyReportedWanAddr) || igdDisconnected || IsPossibleCGN(&locallyReportedWanAddr) || ss.ss_family == AF_INET6 || allPortsFailedOnV4) {
|
||||
if (IsDoubleNAT(&locallyReportedWanAddr) || igdDisconnected || IsCGN(&locallyReportedWanAddr) || ss.ss_family == AF_INET6 || allPortsFailedOnV4) {
|
||||
snprintf(msgBuf, sizeof(msgBuf), "This PC has limited connectivity for Internet hosting. It will work only for clients on certain networks.\n\n"
|
||||
"If you want to try streaming with this configuration, you must pair Moonlight to your gaming PC from your home network before trying to stream over the Internet.\n\n"
|
||||
"To get full connectivity, please contact your ISP and ask for a \"public IP address\" which they may offer for free upon request. For more information and workarounds, click the Help button.");
|
||||
"To get full connectivity, please contact your ISP and ask for a \"public IPv4 address\" which they may offer for free upon request. For more information and workarounds, click the Help button.");
|
||||
DisplayMessage(msgBuf, "https://github.com/moonlight-stream/moonlight-docs/wiki/Internet-Streaming-Errors#limited-connectivity-for-hosting-error", MpWarn);
|
||||
freeaddrinfo(result);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Tested against a working server and it failed
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
freeaddrinfo(result);
|
||||
}
|
||||
|
||||
if (!testServerWasReachable) {
|
||||
snprintf(msgBuf, sizeof(msgBuf), "None of Moonlight's connection testing servers were reachable from your PC. Check your Internet connection and try again later.");
|
||||
DisplayMessage(msgBuf);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// Many UPnP devices report IGD disconnected when double-NATed. If it was really offline,
|
||||
// we probably would not have even gotten past STUN.
|
||||
if (IsDoubleNAT(&locallyReportedWanAddr) || igdDisconnected) {
|
||||
//
|
||||
// We try to tell double-NAT from CGN by checking if IPv6 connectivity is available. If it
|
||||
// is, we assume we're in a DS-Lite or similar configuration. If not, we'll assume it's a
|
||||
// real double-NAT setup.
|
||||
if (IsCGN(&locallyReportedWanAddr) || ((IsDoubleNAT(&locallyReportedWanAddr) || igdDisconnected) && hasV6Connectivity)) {
|
||||
snprintf(msgBuf, sizeof(msgBuf), "Your ISP is running a Carrier-Grade NAT that is preventing you from hosting services like Moonlight on the Internet.\n\n"
|
||||
"Ask your ISP for a \"public IPv4 address\" which they may offer for free upon request. For more information and workarounds, click the Help button.");
|
||||
DisplayMessage(msgBuf, "https://github.com/moonlight-stream/moonlight-docs/wiki/Internet-Streaming-Errors#carrier-grade-nat-error");
|
||||
}
|
||||
else if ((IsDoubleNAT(&locallyReportedWanAddr) || igdDisconnected) /* && !hasV6Connectivity */) {
|
||||
snprintf(msgBuf, sizeof(msgBuf), "Your router appears be connected to the Internet through another router. Click the Help button for guidance on fixing this issue.");
|
||||
DisplayMessage(msgBuf, "https://github.com/moonlight-stream/moonlight-docs/wiki/Internet-Streaming-Errors#connected-through-another-router-error");
|
||||
}
|
||||
else if (IsPossibleCGN(&locallyReportedWanAddr)) {
|
||||
snprintf(msgBuf, sizeof(msgBuf), "Your ISP is running a Carrier-Grade NAT that is preventing you from hosting services like Moonlight on the Internet.\n\n"
|
||||
"Ask your ISP for a \"public IP address\" which they may offer for free upon request. For more information and workarounds, click the Help button.");
|
||||
DisplayMessage(msgBuf, "https://github.com/moonlight-stream/moonlight-docs/wiki/Internet-Streaming-Errors#carrier-grade-nat-error");
|
||||
}
|
||||
else {
|
||||
snprintf(msgBuf, sizeof(msgBuf), "Internet GameStream connectivity check failed.\n\n"
|
||||
"First, try restarting your router. If that fails, check that UPnP is enabled in your router settings. For more information and workarounds, click the Help button.\n\n"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#define VER_VERSION 5,0,0,0
|
||||
#define VER_VERSION_STR "5.0.0.0"
|
||||
#define VER_VERSION 5,1,0,0
|
||||
#define VER_VERSION_STR "5.1.0.0"
|
||||
|
||||
#define VER_COMPANYNAME_STR "Moonlight Game Streaming Project"
|
||||
#define VER_PRODUCTNAME_STR "Moonlight Internet Hosting Tool"
|
||||
|
||||
Reference in New Issue
Block a user