paullouisageneau / libjuice

JUICE is a UDP Interactive Connectivity Establishment library
Mozilla Public License 2.0
432 stars 82 forks source link

If socket allocations fails try again without IPv6 #245

Closed Sean-Der closed 6 months ago

Sean-Der commented 6 months ago

Resolves #244

paullouisageneau commented 6 months ago

Thank you for looking into the issue. While I'm open to a mitigation, this looks like a bug with NordVPN split tunnelling on Windows, because binding on IN6ADDR_ANY_INIT should always work provided the host supports IPv6 (when no interface has a valid IPv6 address it should effectively listen on localhost for IPv6).

The way you implemented the retry logic introduces unwanted behaviors. For instance, when IPv4 only is available, if it fails at a some point it will retry with prefer_ipv6 == false which will behave exactly the same, probably leading to twice the same error. Also, in introduces a flag which I'd prefer to avoid.

IMHO you should do the reverse, socket binding should simply be moved in the address family loop with socket creation. This way, if a failure happens, it will retry with the next address family. I pushed a suggestion, does it work for you?

Sean-Der commented 6 months ago

@paullouisageneau Just tested and it works great!

Any way you want to solve the problem I am in support of (you are the one who has to maintain the code)

Sean-Der commented 6 months ago

It is possible to get a new patch release of libdatachannel with this?

No worries if not, but would be nice to go into next major OBS release with a clean slate :) this is the last issue I am aware of

paullouisageneau commented 6 months ago

@Sean-Der Sure, I'll include it in a new patch release shortly!