Skip to content
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

/dnsaddr is handled as /dns4 in libp2p-websocket and libp2p-websocket-websys #5601

Open
oblique opened this issue Sep 18, 2024 · 1 comment

Comments

@oblique
Copy link
Contributor

oblique commented Sep 18, 2024

Summary

/dnsaddr is handled as /dns4 in libp2p-websocket and libp2p-websocket-websys. This is incorrect because /dnsaddr is only for quering _dnsaddr.domain from DNS.

/dnsaddr support in WebSocket is tracked in #5529.

libp2p-websocket:

(Some(Protocol::Dns(h)), Some(Protocol::Tcp(port)))
| (Some(Protocol::Dns4(h)), Some(Protocol::Tcp(port)))
| (Some(Protocol::Dns6(h)), Some(Protocol::Tcp(port)))
| (Some(Protocol::Dnsaddr(h)), Some(Protocol::Tcp(port))) => {
break (format!("{h}:{port}"), tls::dns_name_ref(&h)?)
}

libp2p-websocket-websys:

(Some(Protocol::Dns(h)), Some(Protocol::Tcp(port)))
| (Some(Protocol::Dns4(h)), Some(Protocol::Tcp(port)))
| (Some(Protocol::Dns6(h)), Some(Protocol::Tcp(port)))
| (Some(Protocol::Dnsaddr(h)), Some(Protocol::Tcp(port))) => {
format!("{}:{}", &h, port)
}

Expected behavior

TransportError::MultiaddrNotSupported should be returned from dial.

Actual behavior

/dnsaddr multiaddress is dialed as if it was /dns4.

Relevant log output

No response

Possible Solution

No response

Version

0.54.1

Would you like to work on fixing this bug ?

Maybe

@dariusc93
Copy link
Member

Hey! Interesting find. I would have always assumed that using dnsaddr in this manner for websocket is fine but it does make sense that it would be meant to query the dns record itself.

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

No branches or pull requests

2 participants