From 033e789b48032deb5c17ea3fd86a2e73bec1bd3b Mon Sep 17 00:00:00 2001 From: Nelson Earle Date: Tue, 22 Oct 2024 22:22:40 -0500 Subject: [PATCH] fix(lan): panic due to too-long mdns-sd property (#486) Fixes #485. Limit iroh node direct addresses to only IPv4 in attempt to keep the total property length under 256 bytes. --- framework_crates/bones_framework/src/networking/lan.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework_crates/bones_framework/src/networking/lan.rs b/framework_crates/bones_framework/src/networking/lan.rs index c961b7f67d..f67039a380 100644 --- a/framework_crates/bones_framework/src/networking/lan.rs +++ b/framework_crates/bones_framework/src/networking/lan.rs @@ -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());