Drop link-local addresses from the status "not announced" list

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 <noreply@anthropic.com>
This commit is contained in:
UltradesuandClaude Opus 4.8 committed 2026-10-02 11:38:21 +01:00
1 parent 4d2f8a54ec
commit da7ce1dca1
1 file changed
+14
+14
View File
@@ -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);
}