rock88 / moonlight-nx

Moonlight port for Horizon OS
GNU General Public License v3.0
399 stars 46 forks source link

CURL SSL error results in Inactive Host #52

Open windraver opened 3 years ago

windraver commented 3 years ago

Getting an "Inactive Host" error. Digging through the logs it looks to be an SSL error but non-ssl seems to get a response but still won't connect.

Heres the log:

2021-00-02 00:09:58 [INFO][CURL] Request: https://192.168.86.152:47984/serverinfo?uniqueid=0123456789ABCDEF 2021-00-02 00:10:11 [ERROR][CURL] error: Timeout was reached 2021-00-02 00:10:11 [INFO][CURL] Request: http://(null):47989/serverinfo?uniqueid=0123456789ABCDEF 2021-00-02 00:10:12 [ERROR][CURL] error: Couldn't resolve host name 2021-00-02 00:10:12 [INFO][CURL] Request: https://192.168.86.152:47984/serverinfo?uniqueid=0123456789ABCDEF 2021-00-02 00:10:24 [ERROR][CURL] error: Timeout was reached 2021-00-02 00:10:24 [INFO][CURL] Request: http://(null):47989/serverinfo?uniqueid=0123456789ABCDEF 2021-00-02 00:10:25 [ERROR][CURL] error: Couldn't resolve host name 2021-00-02 00:13:06 [INFO][MOONLIGHT] Starting... 2021-00-02 00:13:06 [INFO][CURL] libcurl/7.69.1 mbedTLS/2.16.6 zlib/1.2.11 2021-00-02 00:13:06 [INFO][CURL] Request: https://192.168.86.152:47984/serverinfo?uniqueid=0123456789ABCDEF 2021-00-02 00:13:18 [ERROR][CURL] error: Timeout was reached 2021-00-02 00:13:18 [INFO][CURL] Request: http://(null):47989/serverinfo?uniqueid=0123456789ABCDEF 2021-00-02 00:13:18 [ERROR][CURL] error: Couldn't resolve host name 2021-00-02 00:13:19 [INFO][CURL] Request: https://192.168.86.152:47984/serverinfo?uniqueid=0123456789ABCDEF 2021-00-02 00:13:23 [INFO][CURL] Response: <?xml version="1.0" encoding="UTF-16"?> 2021-00-02 00:13:23 [INFO][CURL] Request: http://192.168.86.152:47989/serverinfo?uniqueid=0123456789ABCDEF 2021-00-02 00:13:23 [INFO][CURL] Response: response here removed due to mac and unique ids

A few interesting items to note

System details: Switch Firmware: 10.2.0 Moonlight-NX: 1.1.0 Atmosphere: 0.15.0 Video Card: RTX 2080

Let me know if there is anything else you need or any advice you have.

masagrator commented 3 years ago

Are you using release or compiled yourself?

windraver commented 3 years ago

Are you using release or compiled yourself?

I'm using the release.

windraver commented 3 years ago

Trying again from scratch. Deleted the NRO file and folder. Copy pasted moonlight folder with NRO file.

Enabled logs. closed app. opened moonlight app.

entered IP. the loading wheel really is frozen unless I tap the screen. doing so apparently gets progress as the IP is added but it still doesn't work. Tried connecting again and I get inactive host.

Logs are as follows:

2021-00-02 16:28:15 [INFO][MOONLIGHT] Starting...
2021-00-02 16:28:23 [INFO][CLIENT] No certs, generate new...
2021-00-02 16:28:36 [INFO][CURL] libcurl/7.69.1 mbedTLS/2.16.6 zlib/1.2.11
2021-00-02 16:28:36 [INFO][CURL] Request:
https://192.168.86.152:47984/serverinfo?uniqueid=0123456789ABCDEF
2021-00-02 16:28:36 [INFO][CURL] Response:
<?xml version="1.0" encoding="UTF-16"?><root protocol_version="0.1" query="serverinfo" status_code="401" status_message="The client is not authorized. Certificate verification failed." />
2021-00-02 16:28:36 [INFO][CURL] Request:
http://192.168.86.152:47989/serverinfo?uniqueid=0123456789ABCDEF
2021-00-02 16:28:36 [INFO][CURL] Response:
<?xml version="1.0" encoding="UTF-8"?>
<root protocol_version="0.1" query="serverinfo" status_code="200" status_message="OK">
   <AuthenticationType>1</AuthenticationType>
   <ConnectionState />
   <CurrentClient>0</CurrentClient>
   <GfeVersion>3.20.5.70</GfeVersion>
   <GsVersion>gs_04_24_28968357</GsVersion>
   <HttpsPort>47984</HttpsPort>
   <LocalIP>192.168.86.152</LocalIP>
   <LocalIPs>
      <Address>192.168.86.152</Address>
   </LocalIPs>
   <LoginState>2</LoginState>
   <MaxLumaPixelsH264>1721324928</MaxLumaPixelsH264>
   <MaxLumaPixelsHEVC>1869449984</MaxLumaPixelsHEVC>
   <Mode>0</Mode>
   <PairStatus>0</PairStatus>
   <ServerCapability>3895</ServerCapability>
   <ServerCodecModeSupport>3843</ServerCodecModeSupport>
   <ServerColorSpaceSupport>2</ServerColorSpaceSupport>
   <SupportedDisplayMode>
      <DisplayMode>
         <Height>2160</Height>
         <RefreshRate>60</RefreshRate>
         <Width>3840</Width>
      </DisplayMode>
      <DisplayMode>
         <Height>2160</Height>
         <RefreshRate>30</RefreshRate>
         <Width>3840</Width>
      </DisplayMode>
      <DisplayMode>
         <Height>1080</Height>
         <RefreshRate>60</RefreshRate>
         <Width>1920</Width>
      </DisplayMode>
      <DisplayMode>
         <Height>1080</Height>
         <RefreshRate>30</RefreshRate>
         <Width>1920</Width>
      </DisplayMode>
      <DisplayMode>
         <Height>720</Height>
         <RefreshRate>60</RefreshRate>
         <Width>1280</Width>
      </DisplayMode>
      <DisplayMode>
         <Height>720</Height>
         <RefreshRate>30</RefreshRate>
         <Width>1280</Width>
      </DisplayMode>
   </SupportedDisplayMode>
   <accountId>FF4DB7...</accountId>
   <appversion>7.1.424.0</appversion>
   <currentgame>0</currentgame>
   <gamelistid>82ba6...</gamelistid>
   <gputype>GeForce RTX 2080</gputype>
   <hostname>HACHI-ROKU</hostname>
   <mac>2C:...</mac>
   <numofapps>0</numofapps>
   <resyncSuccessful>0</resyncSuccessful>
   <state>MJOLNIR_STATE_SERVER_AVAILABLE</state>
   <uniqueid>3c2b9d...</uniqueid>
</root>2021-00-02 16:28:37 [INFO][CURL] Request:
https://192.168.86.152:47984/serverinfo?uniqueid=0123456789ABCDEF
2021-00-02 16:29:44 [ERROR][CURL] error: SSL connect error
2021-00-02 16:29:44 [INFO][CURL] Request:
http://(null):47989/serverinfo?uniqueid=0123456789ABCDEF
2021-00-02 16:29:44 [ERROR][CURL] error: Couldn't resolve host name
2021-00-02 16:29:44 [INFO][CURL] Request:
https://192.168.86.152:47984/serverinfo?uniqueid=0123456789ABCDEF
2021-00-02 16:30:06 [ERROR][CURL] error: Timeout was reached
2021-00-02 16:30:06 [INFO][CURL] Request:
http://(null):47989/serverinfo?uniqueid=0123456789ABCDEF
2021-00-02 16:30:07 [ERROR][CURL] error: Couldn't resolve host name

I can see that the certificate was self-generated. I see there is code for that and the keys folder created. What is interesting is the unique id and IP. I find myself wondering if it is supposed to appear as it does...

any pointers? Maybe I can try to compile it myself and just inject my own unique ID. I'm not really good with SSL though so would need help there..

windraver commented 3 years ago

compiled it myself off the latest code and it still fails the same way. still trying to figure out why.

<?xml version="1.0" encoding="UTF-8"?>
<root protocol_version="0.1" query="serverinfo" status_code="200" status_message="OK">
   <AuthenticationType>1</AuthenticationType>
   <ConnectionState />
   <CurrentClient>0</CurrentClient>
   <GfeVersion>3.20.5.70</GfeVersion>
   <GsVersion>gs_04_24_28968357</GsVersion>
   <HttpsPort>47984</HttpsPort>
   <LocalIP>192.168.86.152</LocalIP>
   <LocalIPs>
      <Address>192.168.86.152</Address>
   </LocalIPs>
   <LocalIPs>
      <Address>192.168.18.17</Address>
   </LocalIPs>
   <LocalIPs>
      <Address>172....</Address>
   </LocalIPs>
   <LocalIPs>
      <Address>172....</Address>
   </LocalIPs>
   <LoginState>2</LoginState>
   <MaxLumaPixelsH264>1721324928</MaxLumaPixelsH264>
   <MaxLumaPixelsHEVC>1869449984</MaxLumaPixelsHEVC>
   <Mode>0</Mode>
   <PairStatus>0</PairStatus>
   <ServerCapability>3895</ServerCapability>
   <ServerCodecModeSupport>3843</ServerCodecModeSupport>
   <ServerColorSpaceSupport>2</ServerColorSpaceSupport>
   <SupportedDisplayMode>
      <DisplayMode>
         <Height>2160</Height>
         <RefreshRate>60</RefreshRate>
         <Width>3840</Width>
      </DisplayMode>
      <DisplayMode>
         <Height>2160</Height>
         <RefreshRate>30</RefreshRate>
         <Width>3840</Width>
      </DisplayMode>
      <DisplayMode>
         <Height>1080</Height>
         <RefreshRate>60</RefreshRate>
         <Width>1920</Width>
      </DisplayMode>
      <DisplayMode>
         <Height>1080</Height>
         <RefreshRate>30</RefreshRate>
         <Width>1920</Width>
      </DisplayMode>
      <DisplayMode>
         <Height>720</Height>
         <RefreshRate>60</RefreshRate>
         <Width>1280</Width>
      </DisplayMode>
      <DisplayMode>
         <Height>720</Height>
         <RefreshRate>30</RefreshRate>
         <Width>1280</Width>
      </DisplayMode>
   </SupportedDisplayMode>
   <accountId>FF4DB7EF601...</accountId>
   <appversion>7.1.424.0</appversion>
   <currentgame>0</currentgame>
   <gamelistid>db07a6ca...</gamelistid>
   <gputype>GeForce RTX 2080</gputype>
   <hostname>HACHI-ROKU</hostname>
   <mac>2C:FD...</mac>
   <numofapps>0</numofapps>
   <resyncSuccessful>0</resyncSuccessful>
   <state>MJOLNIR_STATE_SERVER_AVAILABLE</state>
   <uniqueid>3c2b9dc9-...</uniqueid>
</root>
windraver commented 3 years ago

@rock88 , I found a way to get to force this to work for me and bypassed the inactive host error. Not sure if you want me to submit a pull request for it or not. I'm not sure if this is only affecting me.

Essentially, I added two buttons and copy pasted your code to force pairing and a separate button to force a connection.

Given I had a "response" and I knew my host was not inactive, this worked for me. The proper fix likely would be to drill through the is_active() function and debug where it fails but I don't have the right experience. I've only been able to verify that bypassing the is_active() check does allow me to force the connection to work.

image

I'm also not sure what you or others are building the nro file with as my docker handles differently on Windows X so I had to remove dkp-pacman -S --noconfirm devkitpro-pkgbuild-helpers from the dockerfile build and instead enter it in manually once I've run and loaded the docker container. could just be a weird glitch that only affects my computer.

Thoughts? I'll create a PR if you want but my changes might just be trash code as it doesn't actually solve the root problem.

In case it matters.. System details: Switch Firmware: 10.2.0 Moonlight-NX: 1.1.0 Atmosphere: 0.17.1 Video Card: RTX 2080