webrtc-rs/ice

Connectivity checks even from an ICE-lite agent

Closed this issue · 7 comments

I believe that the ICE agent is performing connectivity checks even though I've set the lite flag to true in the AgentConfig used to create it. If I understand it correctly, ice-lite agents don't generate connectivity checks: https://datatracker.ietf.org/doc/html/rfc8445#section-2.5

Having a lite agent not generate connectivity checks is useful when using unsignalled WebRTC connections, because then one agent doesn't need to know the ICE password (or potentially even the username) of the peer that is connecting to it.

I tried to make a minimal example: https://github.com/evan-brass/webrtc-rs-ice-bug/blob/master/src/main.rs

Which gave me a network trace like this:
Screen Shot 2022-05-31 at 11 51 17 AM

The second Binding request is from Peer1 (the lite-client) to Peer2 (the full client).

I'm still not-very familiar with the webrtc-ice library's code, but I believe that perhaps a check is needed within the ControlledSelector implementation for AgentInternal?:

self.ping_candidate(local, remote).await;
I've also seen a browser send a USE_CANDIDATE attribute on the first binding request which resulted in a the ice-lite agent sending a binding request without sending a binding response:
self.ping_candidate(local, remote).await;

I'm still new to ICE and the protocol level of WebRTC so if I'm misunderstanding the protocol, just let me know.

Thank you,

Can you investigate what happens in Pion's ICE implementation since this is a port of that project.

I don't know Go very well, but I'll give it a try this weekend.

There should be a similar example in Pion that you can just run, so Go knowledge shouldn't be too important

Hmm, I guess Pion's ICE implementation behaves the same way when I port my example to Go+Pion.
Screen Shot 2022-06-12 at 9 50 53 PM

I must not be setting the lite parameter correctly, then? Do I need to set any other agent_config parameters to make it use lite selection?

Or maybe I have the wrong idea about what constitutes a connectivity check? Is the binding request not actually a connectivity check?
https://github.com/pion/ice/blob/2faac6229960d898132ecf8cc75c18166704470d/agent_config.go#L105-L106

There is however a lite selector implementation in Pion that I don't see in WebRTC-rs: https://github.com/pion/ice/blob/4669f6667393590d3e67fcc27379679d9f8f42d3/selection.go#L277-L292
I guess the code for that was merged into the controlling / controlled selector when it was ported to Rust.

I would need to re-read the RFC to recall what's supposed to happen here. If you think the selector might help with this could you send a PR? Alternatively if you believe we are violating the RFC can you send a PR with the changes and outline the relevant parts of the RFC that we aren't adhering to?

We have migrated this crate to the monorepo(webrtc-rs/webrtc) please re-open this issue over there.