Skip to content

Commit

Permalink
Correct port mapping bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AgeManning committed Aug 11, 2023
1 parent 14b42c1 commit 8858f0e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion beacon_node/lighthouse_network/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ impl Config {
quic4_port: u16,
v6_addr: Ipv6Addr,
tcp6_port: u16,
quic6_port: u16,
disc6_port: u16,
quic6_port: u16,
) {
self.listen_addresses = ListenAddress::DualStack(
ListenAddr {
Expand Down
3 changes: 0 additions & 3 deletions beacon_node/lighthouse_network/src/listen_addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ pub struct ListenAddr<Ip> {
/// The UDP port that discovery will listen on.
pub disc_port: u16,
/// The UDP port that QUIC will listen on.
/// NB: Quic port is not yet supported with IPV6
/// See https://github.com/libp2p/rust-libp2p/issues/4165
/// It will therefore be disabled at the swarm level.
pub quic_port: u16,
/// The TCP port that libp2p will listen on.
pub tcp_port: u16,
Expand Down
10 changes: 2 additions & 8 deletions beacon_node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ pub fn get_config<E: EthSpec>(

let data_dir_ref = client_config.data_dir().clone();

println!("SET NETWORK CONFIG");
set_network_config(&mut client_config.network, cli_args, &data_dir_ref, log)?;

/*
Expand Down Expand Up @@ -965,9 +964,9 @@ pub fn set_network_config(
}

if cli_args.is_present("enr-match") {
// Match the Ip and UDP port in the enr.
// Match the IP and UDP port in the ENR.

// set the enr address to localhost if the address is unspecified
// Set the ENR address to localhost if the address is unspecified
if let Some(ipv4_addr) = config.listen_addrs().v4().cloned() {
let ipv4_enr_addr = if ipv4_addr.addr == Ipv4Addr::UNSPECIFIED {
Ipv4Addr::LOCALHOST
Expand Down Expand Up @@ -1149,7 +1148,6 @@ pub fn parse_listening_addresses(
cli_args: &ArgMatches,
log: &Logger,
) -> Result<ListenAddress, String> {
dbg!("PARSE");
let listen_addresses_str = cli_args
.values_of("listen-address")
.expect("--listen_addresses has a default value");
Expand Down Expand Up @@ -1233,8 +1231,6 @@ pub fn parse_listening_addresses(
format!("Failed to parse --quic6-port as an integer: {parse_error}")
})?;

println!("{:?}", maybe_disc6_port);
println!("{:?}", (maybe_ipv4, maybe_ipv6));
// Now put everything together
let listening_addresses = match (maybe_ipv4, maybe_ipv6) {
(None, None) => {
Expand Down Expand Up @@ -1333,13 +1329,11 @@ pub fn parse_listening_addresses(
.then(unused_port::unused_tcp6_port)
.transpose()?
.unwrap_or(port6);
println!("{:?}", maybe_disc6_port);
let ipv6_disc_port = use_zero_ports
.then(unused_port::unused_udp6_port)
.transpose()?
.or(maybe_disc6_port)
.unwrap_or(ipv6_tcp_port);
println!("{:?}", ipv6_disc_port);
let ipv6_quic_port = use_zero_ports
.then(unused_port::unused_udp6_port)
.transpose()?
Expand Down
1 change: 0 additions & 1 deletion lighthouse/tests/beacon_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,6 @@ fn network_port_and_discovery_port_flags_over_ipv4_and_ipv6() {
let disc4_port = unused_udp4_port().expect("Unable to find unused port.");
let tcp6_port = unused_tcp6_port().expect("Unable to find unused port.");
let disc6_port = unused_udp6_port().expect("Unable to find unused port.");
println!("Thing");
CommandLineTest::new()
.flag("listen-address", Some("::1"))
.flag("listen-address", Some("127.0.0.1"))
Expand Down

0 comments on commit 8858f0e

Please sign in to comment.