bug-tracker icon indicating copy to clipboard operation
bug-tracker copied to clipboard

Rainway doesn't appear to always present host ICE candidate leading to UDP connectivity problems

Open riverar opened this issue 5 years ago • 5 comments

Rainway app version 1.0.14.0 Windows 10 1903 18362.1

Repro steps:

Gather two test machines/devices. One must be a host running Rainway Dashboard software. Another can be another PC or Android device.

Machine 1:

  1. Install Rainway on PC one. Terminate Rainway after it starts up.
  2. Edit settings.json and under Network options set Upnp to false and WebRtcLower/WebRtcHigher to 22011 and 22020 respectively. Save changes.
  3. Restart Rainway. (This order is critical, as it will enable firewall rules at startup.)
  4. Open Windows Defender Firewall and ensure it's enabled. Find and disable the following rules:
  • Rainway RTC (TCP)
  • Rainway WSS Backup
  • Rainway WSS Common
  1. Machine 1 is now configured for UDP-only comms.

Machine 2:

  1. Open Chrome or Edge Insider (Chromium)
  2. Create a tab and navigate to: chrome://webrtc-internals
  3. Create a tab and navigate to: play.rainway.com
  4. Refresh play.rainway.com and repeat until it fails.

Log redactions:

  • WAN IP replaced with 1.2.3.4
  • Rainway Dashboard LAN IP replaced with 192.168.1.6
  • Client LAN IP replaced with 192.168.1.2
  • Keys/passwords replaced with [redacted]

Logs (on success):

8/3/2019, 2:07:00 PM	
createDataChannel
{"0":"Logic","1":{"ordered":true}}

8/3/2019, 2:07:00 PM	
createDataChannel
{"0":"Input","1":{"ordered":true}}

8/3/2019, 2:07:00 PM	
createDataChannel
{"0":"Video","1":{"ordered":true}}

8/3/2019, 2:07:00 PM	
createDataChannel
{"0":"Audio","1":{"ordered":true}}

8/3/2019, 2:07:00 PM	
createOffer
{}

8/3/2019, 2:07:00 PM	
onnegotiationneeded
{}

8/3/2019, 2:07:00 PM	
createOfferOnSuccess
type: offer, sdp:
v=0
o=- 4723158658717054202 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0
a=msid-semantic: WMS
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0
a=ice-ufrag:ectx
a=ice-pwd:[redacted]/
a=ice-options:trickle
a=fingerprint:sha-256 [redacted]
a=setup:actpass
a=mid:0
a=sctp-port:5000
a=max-message-size:262144

8/3/2019, 2:07:00 PM	
setLocalDescription
type: offer, sdp:
v=0
o=- 4723158658717054202 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0
a=msid-semantic: WMS
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0
a=ice-ufrag:ectx
a=ice-pwd:[redacted]/
a=ice-options:trickle
a=fingerprint:sha-256 [redacted]
a=setup:actpass
a=mid:0
a=sctp-port:5000
a=max-message-size:262144

8/3/2019, 2:07:00 PM	
onsignalingstatechange
have-local-offer

8/3/2019, 2:07:00 PM	
setLocalDescriptionOnSuccess
{}

8/3/2019, 2:07:00 PM	
onicegatheringstatechange
gathering

8/3/2019, 2:07:00 PM	
onicecandidate
{"candidate":"candidate:2671309437 1 udp 2113937151 192.168.1.2 62309 typ host generation 0 ufrag ectx network-cost 999","sdpMid":"0","sdpMLineIndex":0}

8/3/2019, 2:07:00 PM	
onicecandidate
{"candidate":"candidate:842163049 1 udp 1677729535 1.2.3.4 62309 typ srflx raddr 192.168.1.2 rport 62309 generation 0 ufrag ectx network-cost 999","sdpMid":"0","sdpMLineIndex":0}

8/3/2019, 2:07:00 PM	
onicegatheringstatechange
complete

8/3/2019, 2:07:00 PM	
onicecandidate
{}

8/3/2019, 2:07:01 PM	
setRemoteDescription
type: answer, sdp:
v=0
o=- 5900532286234452266 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0
a=msid-semantic: WMS
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0
b=AS:30
a=ice-ufrag:w0D/
a=ice-pwd:[redacted]
a=ice-options:trickle
a=fingerprint:sha-256 [redacted]
a=setup:active
a=mid:0
a=sctp-port:5000

8/3/2019, 2:07:01 PM	
addIceCandidate (host)
{"candidate":"candidate:1859086825 1 udp 2122260223 192.168.1.6 22011 typ host generation 0 ufrag w0D/ network-id 1 network-cost 50","sdpMid":"0","sdpMLineIndex":0}

8/3/2019, 2:07:01 PM	
addIceCandidate (srflx)
{"candidate":"candidate:4018630493 1 udp 1686052607 1.2.3.4 50545 typ srflx raddr 192.168.1.6 rport 22011 generation 0 ufrag w0D/ network-id 1 network-cost 50","sdpMid":"0","sdpMLineIndex":0}

8/3/2019, 2:07:01 PM	
addIceCandidate (srflx)
{"candidate":"candidate:4018630493 1 udp 1686052607 1.2.3.4 1920 typ srflx raddr 192.168.1.6 rport 22011 generation 0 ufrag w0D/ network-id 1 network-cost 50","sdpMid":"0","sdpMLineIndex":0}

8/3/2019, 2:07:01 PM	
onsignalingstatechange
stable

8/3/2019, 2:07:01 PM	
oniceconnectionstatechange
checking

8/3/2019, 2:07:01 PM	
addIceCandidateOnSuccess
{}

8/3/2019, 2:07:01 PM	
addIceCandidateOnSuccess
{}

8/3/2019, 2:07:01 PM	
addIceCandidateOnSuccess
{}

8/3/2019, 2:07:01 PM	
oniceconnectionstatechange
connected
8/3/2019, 2:07:01 PM	
setRemoteDescriptionOnSuccess
{}

Logs (on failure):

8/3/2019, 2:05:21 PM
createDataChannel
{"0":"Logic","1":{"ordered":true}}

8/3/2019, 2:05:21 PM	
createDataChannel
{"0":"Input","1":{"ordered":true}}

8/3/2019, 2:05:21 PM	
createDataChannel
{"0":"Video","1":{"ordered":true}}

8/3/2019, 2:05:21 PM	
createDataChannel
{"0":"Audio","1":{"ordered":true}}

8/3/2019, 2:05:21 PM	
createOffer
{}

8/3/2019, 2:05:21 PM	
onnegotiationneeded
{}

8/3/2019, 2:05:21 PM	
createOfferOnSuccess
type: offer, sdp:
v=0
o=- 1156469112662030421 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0
a=msid-semantic: WMS
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0
a=ice-ufrag:kJIh
a=ice-pwd:[redacted]
a=ice-options:trickle
a=fingerprint:sha-256 [redacted]
a=setup:actpass
a=mid:0
a=sctp-port:5000
a=max-message-size:262144

8/3/2019, 2:05:21 PM	
setLocalDescription
type: offer, sdp:
v=0
o=- 1156469112662030421 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0
a=msid-semantic: WMS
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0
a=ice-ufrag:kJIh
a=ice-pwd:[redacted]
a=ice-options:trickle
a=fingerprint:sha-256 [redacted]
a=setup:actpass
a=mid:0
a=sctp-port:5000
a=max-message-size:262144

8/3/2019, 2:05:21 PM	
onsignalingstatechange
have-local-offer

8/3/2019, 2:05:21 PM	
setLocalDescriptionOnSuccess
{}

8/3/2019, 2:05:21 PM	
onicegatheringstatechange
gathering

8/3/2019, 2:05:21 PM	
onicecandidate
{"candidate":"candidate:2671309437 1 udp 2113937151 192.168.1.2 64612 typ host generation 0 ufrag kJIh network-cost 999","sdpMid":"0","sdpMLineIndex":0}

8/3/2019, 2:05:21 PM	
onicecandidate
{"candidate":"candidate:842163049 1 udp 1677729535 1.2.3.4 64612 typ srflx raddr 192.168.1.2 rport 64612 generation 0 ufrag kJIh network-cost 999","sdpMid":"0","sdpMLineIndex":0}

8/3/2019, 2:05:21 PM	
onicegatheringstatechange
complete

8/3/2019, 2:05:21 PM	
onicecandidate
{}

8/3/2019, 2:05:21 PM	
setRemoteDescription
type: answer, sdp:
v=0
o=- 6141159648390038741 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0
a=msid-semantic: WMS
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0
b=AS:30
a=ice-ufrag:ZAiV
a=ice-pwd:[redacted]
a=ice-options:trickle
a=fingerprint:sha-256 [redacted]
a=setup:active
a=mid:0
a=sctp-port:5000

8/3/2019, 2:05:21 PM	
addIceCandidate (srflx)
{"candidate":"candidate:4018630493 1 udp 1686052607 1.2.3.4 48463 typ srflx raddr 192.168.1.6 rport 22011 generation 0 ufrag ZAiV network-id 1 network-cost 50","sdpMid":"0","sdpMLineIndex":0}

8/3/2019, 2:05:21 PM	
addIceCandidate (srflx)
{"candidate":"candidate:4018630493 1 udp 1686052607 1.2.3.4 43501 typ srflx raddr 192.168.1.6 rport 22011 generation 0 ufrag ZAiV network-id 1 network-cost 50","sdpMid":"0","sdpMLineIndex":0}

8/3/2019, 2:05:21 PM	
onsignalingstatechange
stable

8/3/2019, 2:05:21 PM	
oniceconnectionstatechange
checking

8/3/2019, 2:05:21 PM	
addIceCandidateOnSuccess
{}

8/3/2019, 2:05:21 PM	
addIceCandidateOnSuccess
{}

8/3/2019, 2:05:21 PM	
setRemoteDescriptionOnSuccess
{}

8/3/2019, 2:05:36 PM	
oniceconnectionstatechange
disconnected

riverar avatar Aug 03 '19 23:08 riverar

Thanks dude, we've been grappling with this strange issue for a while. This repro info should help us out.

FrobtheBuilder avatar Aug 03 '19 23:08 FrobtheBuilder

Anything else I can do to help here? I'm also seeing weirdness with IPv6 candidates being proposed, if the client has IPv6 visibility, despite the server not supporting it.

Is Spitfire master in sync with Rainway? I can try building a repro in Spitfire if so.

riverar avatar Aug 13 '19 22:08 riverar

Update on this: I built a copy of Spitfire and a test client. Interestingly, my test client generates a different set of ICE candidates than Rainway does. I even swapped out Rainway's Spitfire implementation with my own. Hm.

riverar avatar Sep 18 '19 05:09 riverar

Could you upload your example and I can take a look? That sounds concerning.

andrewmd5 avatar Sep 18 '19 05:09 andrewmd5

@Codeusa Sure thing.

Binaries: ice_candidates.zip Source: https://gist.github.com/riverar/7daff06a339b8b9777129f45c5f6291c

  • ICE candidates with type host are highlighted in green, while reflexive candidates are highlighted in gray.
  • Am running this on the same host as Rainway (v.latest).
  • Rainway somehow generates IPv6 and other candidates that never appear in the example tool.
  • Using Spitfire from GitHub repository with only very minor edits (e.g. boosted logging). Using branch-heads/63 of webrtc as per original.

Am available on Discord, if needed.

riverar avatar Sep 18 '19 21:09 riverar