diff --git a/beacon_node/src/cli.rs b/beacon_node/src/cli.rs index 1339c158258..aa95c3fcae0 100644 --- a/beacon_node/src/cli.rs +++ b/beacon_node/src/cli.rs @@ -185,8 +185,7 @@ pub fn cli_app() -> Command { .long("port6") .value_name("PORT") .help("The TCP/UDP ports to listen on over IPv6 when listening over both IPv4 and \ - IPv6. Defaults to 9090 when required. The Quic UDP port will be set to this value + 1.") - .default_value("9090") + IPv6. Defaults to --port. The Quic UDP port will be set to this value + 1.") .action(ArgAction::Set) .display_order(0) ) diff --git a/beacon_node/src/config.rs b/beacon_node/src/config.rs index 6d3c18d363a..0f8f3a8012a 100644 --- a/beacon_node/src/config.rs +++ b/beacon_node/src/config.rs @@ -936,12 +936,11 @@ pub fn parse_listening_addresses( .expect("--port has a default value") .parse::() .map_err(|parse_error| format!("Failed to parse --port as an integer: {parse_error}"))?; - let port6 = cli_args + let maybe_port6 = cli_args .get_one::("port6") .map(|s| str::parse::(s)) .transpose() - .map_err(|parse_error| format!("Failed to parse --port6 as an integer: {parse_error}"))? - .unwrap_or(9090); + .map_err(|parse_error| format!("Failed to parse --port6 as an integer: {parse_error}"))?; // parse the possible discovery ports. let maybe_disc_port = cli_args @@ -989,6 +988,10 @@ pub fn parse_listening_addresses( warn!(log, "When listening only over IPv6, use the --port flag. The value of --port6 will be ignored."); } + // If we are only listening on ipv6 and the user has specified --port6, lets just use + // that. + let port = maybe_port6.unwrap_or(port); + // use zero ports if required. If not, use the given port. let tcp_port = use_zero_ports .then(unused_port::unused_tcp6_port) @@ -1055,6 +1058,9 @@ pub fn parse_listening_addresses( }) } (Some(ipv4), Some(ipv6)) => { + // If --port6 is not set, we use --port + let port6 = maybe_port6.unwrap_or(port); + let ipv4_tcp_port = use_zero_ports .then(unused_port::unused_tcp4_port) .transpose()? @@ -1074,7 +1080,7 @@ pub fn parse_listening_addresses( ipv4_tcp_port + 1 }); - // Defaults to 9090 when required + // Defaults to 9000 when required let ipv6_tcp_port = use_zero_ports .then(unused_port::unused_tcp6_port) .transpose()? diff --git a/book/src/advanced_networking.md b/book/src/advanced_networking.md index c0f6b5485ef..0dc1000aa04 100644 --- a/book/src/advanced_networking.md +++ b/book/src/advanced_networking.md @@ -162,8 +162,8 @@ To listen over both IPv4 and IPv6: > > **IPv6**: > -> It listens on the default value of --port6 (`9090`) for both UDP and TCP. -> QUIC will use port `9091` for UDP, which is the default `--port6` value (`9090`) + 1. +> It listens on the default value of --port6 (`9000`) for both UDP and TCP. +> QUIC will use port `9001` for UDP, which is the default `--port6` value (`9000`) + 1. > When using `--listen-address :: --listen-address --port 9909 --discovery-port6 9999`, listening will be set up as follows: > @@ -174,8 +174,8 @@ To listen over both IPv4 and IPv6: > > **IPv6**: > -> It listens on the default value of `--port6` (`9090`) for TCP, and port `9999` for UDP. -> QUIC will use port `9091` for UDP, which is the default `--port6` value (`9090`) + 1. +> It listens on the default value of `--port6` (`9000`) for TCP, and port `9999` for UDP. +> QUIC will use port `9001` for UDP, which is the default `--port6` value (`9000`) + 1. ### Configuring Lighthouse to advertise IPv6 reachable addresses diff --git a/book/src/help_bn.md b/book/src/help_bn.md index 2d12010094c..3bc8a2c2750 100644 --- a/book/src/help_bn.md +++ b/book/src/help_bn.md @@ -301,8 +301,8 @@ Options: [default: 9000] --port6 The TCP/UDP ports to listen on over IPv6 when listening over both IPv4 - and IPv6. Defaults to 9090 when required. The Quic UDP port will be - set to this value + 1. [default: 9090] + and IPv6. Defaults to --port. The Quic UDP port will be set to this + value + 1. --prepare-payload-lookahead The time before the start of a proposal slot at which payload attributes should be sent. Low values are useful for execution nodes