From da7ce1dca19fe4b044664f26eeecba0cd64b4181 Mon Sep 17 00:00:00 2001 From: Ultradesu Date: Fri, 2 Oct 2026 11:38:21 +0100 Subject: [PATCH] Drop link-local addresses from the status "not announced" list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A host with several interfaces has a link-local (fe80::/10, and 169.254/16 on IPv4) on each, and none of them is ever a peer candidate. Listing them under "not announced" padded the section with one noise line per interface — most of the list on a machine with several VPN utuns. They are now filtered out; loopback and real unannounced addresses are unaffected. Checks: cargo fmt --all --check and cargo clippy -p tsunagi-cli --all-targets -D warnings pass; verified by eye against a live `tsunagi status`. Co-Authored-By: Claude Opus 4.8 --- crates/tsunagi-cli/src/main.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/tsunagi-cli/src/main.rs b/crates/tsunagi-cli/src/main.rs index 9f0dbd0..f926293 100644 --- a/crates/tsunagi-cli/src/main.rs +++ b/crates/tsunagi-cli/src/main.rs @@ -3033,6 +3033,16 @@ fn host_section() -> report::Section { host } +/// Whether an address is link-local — `fe80::/10` or `169.254.0.0/16` — which +/// the operating system assigns per interface and which is never a peer +/// candidate. +fn is_link_local(addr: std::net::IpAddr) -> bool { + match addr { + std::net::IpAddr::V4(v4) => v4.is_link_local(), + std::net::IpAddr::V6(v6) => (v6.segments()[0] & 0xffc0) == 0xfe80, + } +} + /// The addresses this host could reach a peer from. async fn addresses_section() -> report::Section { use report::{Health, Row, Section}; @@ -3087,6 +3097,10 @@ async fn addresses_section() -> report::Section { } if item.addr.is_loopback() { loopbacks.push(item); + } else if is_link_local(item.addr) { + // Link-local (fe80::/10, 169.254.0.0/16) is never a peer candidate, + // so one per interface is noise rather than information. + continue; } else { unannounced.push(item); }