fix(#883): warn + bail on unparseable subnet instead of silently writing empty LOCAL_ADDRESS; doc /0 corner case

This commit is contained in:
damocles 2026-05-31 21:17:12 +02:00 committed by mara
commit 3c012efbea

View file

@ -101,6 +101,8 @@ pub fn agent_network_ip(name: &str, subnet_cidr: &str) -> Option<String> {
let prefix_len: u32 = prefix_str.parse().ok()?;
if prefix_len > 30 {
// /31 and /32 have no room for agents; /30 has 1 usable slot.
// /0 (the other extreme) is handled further down: host_count
// overflows checked_shl(32) → 0 → usable = 0 → None.
return None;
}
// Parse dotted-decimal IPv4.