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

(validator) Allow RPC endpoint to bind IPv6 address #396

Open
grooviegermanikus opened this issue Jun 6, 2024 · 3 comments
Open

(validator) Allow RPC endpoint to bind IPv6 address #396

grooviegermanikus opened this issue Jun 6, 2024 · 3 comments

Comments

@grooviegermanikus
Copy link
Collaborator

grooviegermanikus commented Jun 6, 2024

--rpc-bind-address rejects IPv6 addresses: ::1, [::1], [::]

Custom { kind: Uncategorized, error: "failed to lookup address information: nodename nor servname provided, or not known" }

EmptyHost

Copy link

github-actions bot commented Jun 6, 2024

This repository is no longer in use. Please re-open this issue in the agave repo: https://github.com/anza-xyz/agave

@github-actions github-actions bot closed this as completed Jun 6, 2024
@grooviegermanikus
Copy link
Collaborator Author

Problem:
solana_net_utils::parse_host validates host by:

  1. parse it using Url crate
  2. run OS resolver
pub fn parse_host(host: &str) -> Result<IpAddr, String> {
    // First, check if the host syntax is valid. This check is needed because addresses
    // such as `("localhost:1234", 0)` will resolve to IPs on some networks.
    let parsed_url = Url::parse(&format!("http://{host}")).map_err(|e| e.to_string())?;
    if parsed_url.port().is_some() {
        return Err(format!("Expected port in URL: {host}"));
    }

    // Next, check to see if it resolves to an IP address
    let ips: Vec<_> = (host, 0)
        .to_socket_addrs()
        .map_err(|err| err.to_string())?
        .map(|socket_address| socket_address.ip())
        .collect();
    if ips.is_empty() {
        Err(format!("Unable to resolve host: {host}"))
    } else {
        Ok(ips[0])
    }
}

@grooviegermanikus grooviegermanikus changed the title Allow RPC endpoint to bind IPv6 endpoint (validator) Allow RPC endpoint to bind IPv6 address Jun 6, 2024
@grooviegermanikus grooviegermanikus transferred this issue from blockworks-foundation/solana Jun 6, 2024
@grooviegermanikus
Copy link
Collaborator Author

proposed solution I:

  • remove parsed_url check completely

proposed solution II:

  • call Url::parse with both "http://{host}" and "http://[{host}]"

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

1 participant