amazon-kinesis-video-streams-webrtc-sdk-c icon indicating copy to clipboard operation
amazon-kinesis-video-streams-webrtc-sdk-c copied to clipboard

[FEATURE] Add mDNS support for host candidates

Open thinkski opened this issue 2 years ago • 8 comments

Is your feature request related to a problem? Please describe.

Web browsers routinely use ephemeral mDNS host candidates (e.g. 0f612a90-ee2e-4785-b9b7-72f8434cba27.local) so as to not expose the local peer's IP address on its local area network. However, the SDK is not currently able to use these candidates:

ERROR iceAgentAddRemoteCandidate(): operation returned status code: 0x5a000003

Peer-reflexive candidate currently serve as a stop-gap in these cases. However, mDNS host candidates should really be supported, both for local and remote host candidates.

thinkski avatar Sep 28 '21 23:09 thinkski

@thinkski ,

As long as these candidates are UDP and are of IPv4 format, it should work. What are you noticing in terms of behaviour of the application?

disa6302 avatar Sep 29 '21 18:09 disa6302

@disa6302 When you say "as long as these candidates are UDP and are of IPv4 format", I take it you mean the address the mDNS hostname resolves to, correct?

I'm not seeing a remote host candidate logged -- the remote peer sends an mDNS host candidate, the C SDK prints the error above. From reading the code, I only see inet_pton() used, but don't see any code for mDNS domain name resolution (i.e. no getaddrinfo() or gethostbyname()), unless I'm missing something?

thinkski avatar Sep 30 '21 10:09 thinkski

The remote is supposed to send us the candidates as part of SDP. Do we know if the SDP contains the IP addresses?

disa6302 avatar Sep 30 '21 19:09 disa6302

The remote is supposed to send us the candidates as part of SDP. Do we know if the SDP contains the IP addresses?

The candidates are trickled. The host candidate is an mDNS hostname (e.g. 0f612a90-ee2e-4785-b9b7-72f8434cba27.local, not an IP address).

thinkski avatar Sep 30 '21 19:09 thinkski

Ok. Now I get it. We will look into this and update the thread with information if any. Adding the ticket as a suggested enhancement.

Adding for our reference: https://datatracker.ietf.org/doc/html/draft-ietf-rtcweb-mdns-ice-candidates

disa6302 avatar Sep 30 '21 21:09 disa6302

Thank you! I believe the fix is relatively straightforward -- if the candidate is of type host, use getaddrinfo() to resolve it to an IP address (which is a no-op if its already an IP address). Happy to provide a PR.

thinkski avatar Oct 01 '21 06:10 thinkski

Thank you @thinkski . We do welcome contributions! If you have some changes for this, please feel free to open a PR, and the team can review it.

disa6302 avatar Oct 01 '21 16:10 disa6302

This is a very old issue. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to open a new one.

github-actions[bot] avatar May 19 '22 00:05 github-actions[bot]

This is a very old issue. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to open a new one.

github-actions[bot] avatar Nov 20 '22 00:11 github-actions[bot]

+1. This would be a nice inclusion.

bneff avatar Dec 15 '22 16:12 bneff