Skip to content

Using 0.0.0.0 as the IP address for server binding results in an extremely slow/broken connection #2823

@Frontear

Description

@Frontear

Problem:

Most of the s2n-quic examples in this repository bind their socket to 127.0.0.1:4433. If we instead use 0.0.0.0:<PORT>, the connection seems to either be extremely slow or does not work at all. Using the exact same port with 127.0.0.1 instead will make it work flawlessly.

Reproduction Steps

Running the provided code will fail with "MaxHandshakeDurationExceeded". Changing the server IP from 0.0.0.0 to 127.0.0.1 will immediately make the connection and cleanly terminate.

use std::error::Error;
use std::net::SocketAddr;

use s2n_quic::{ Client, Server };
use s2n_quic::client::Connect;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
  let server = Server::builder()
    .with_tls((CERT, KEY))? // FIXME: add this yourself
    .with_io("0.0.0.0:25575")? // WARN: change to `127.0.0.1`
    .start()?;

  let client = Client::builder()
    .with_tls(CERT)? // FIXME: add this yourself
    .with_io("0.0.0.0:0")?
    .start()?;

  let connect = Connect::new("0.0.0.0:25575".parse::<SocketAddr>()?) // WARN: change to `127.0.0.1`
    .with_server_name("localhost");
  let conn = client.connect(connect).await?;

  return Ok(());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions