Skip to content

Commit

Permalink
fix(lan): panic due to too-long mdns-sd property (#486)
Browse files Browse the repository at this point in the history
Fixes #485.

Limit iroh node direct addresses to only IPv4 in attempt to keep the
total property length under 256 bytes.
  • Loading branch information
nelson137 authored Oct 23, 2024
1 parent 965b000 commit 033e789
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion framework_crates/bones_framework/src/networking/lan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ pub async fn prepare_to_host<'a>(
let create_service_info = || async {
info!("New service hosting");
let ep = get_network_endpoint().await;
let my_addr = ep.node_addr().await.expect("network endpoint dead");
let mut my_addr = ep.node_addr().await.expect("network endpoint dead");
my_addr
.info
.direct_addresses
.retain(std::net::SocketAddr::is_ipv4);
let port = my_addr.info.direct_addresses.first().unwrap().port();
let mut props = std::collections::HashMap::default();
let addr_encoded = hex::encode(postcard::to_stdvec(&my_addr).unwrap());
Expand Down

0 comments on commit 033e789

Please sign in to comment.