Skip to content

Loopback addresses published by mDNS lead to dial failures #5995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MatthiasvB opened this issue Apr 19, 2025 · 0 comments · May be fixed by #6003
Open

Loopback addresses published by mDNS lead to dial failures #5995

MatthiasvB opened this issue Apr 19, 2025 · 0 comments · May be fixed by #6003

Comments

@MatthiasvB
Copy link

Summary

For simplicity, I like to have my nodes listen on all network interfaces. Also, I'm building a local file sharing app that relies on mDNS and request_response.

request_response automatically initiates dialling, without any intervention from the user's side (possible, afaik)

Since mDNS wildly publishes all listening addresses on all interfaces as already mentioned here, there are loopback addresses among the dialing candidates that request_response ends up using.

This means that the node ends up dialing itself.

It does not ignore contacting itself silently, instead, the entire dial fails with a libp2p::swarm::DialError::WrongPeerId

In order to make my node work nonetheless I had to fork the repository and add this hotfix

I see it as non-negotiable that mDNS should, on each interface, only broadcast its listening address on that interface to avoid bugs like this.

As a side note, finding the cause of this has been an ordeal. I'm trying to make this work on Android (and weirdly I encounter this issue only there), and changing the log level and inspecting the logs is not very straightforward there. I added up modifying the libp2p code to add print statements and had to discover that the very very useless request_response::OutboundFailure::DialFailure could easily be enhanced by wrapping the aforementioned libp2p::swarm::DialError here.

Error handling via trace-logging should not be a thing, particularly in Rust

Expected behavior

mDNS should only publish addresses that make sense

Actual behavior

it publishes all addresses on all interfaces

Relevant log output

Possible Solution

No response

Version

0.55.1

Would you like to work on fixing this bug?

No

@elenaf9 elenaf9 linked a pull request Apr 22, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant