fix: catch subnet-directed broadcast in is_non_unicast guard

This commit is contained in:
ParrotXray 2026-05-29 04:05:45 +00:00
parent 0973f61bfe
commit 4a417a94fd

View File

@ -124,11 +124,12 @@ pub fn is_non_unicast(ip: &str) -> bool {
};
match addr {
IpAddr::V4(v4) => {
v4.is_multicast() // 224.0.0.0/4
|| v4.is_broadcast() // 255.255.255.255
|| v4.is_loopback() // 127.0.0.0/8
|| v4.is_unspecified() // 0.0.0.0
|| v4.is_link_local() // 169.254.0.0/16
v4.is_multicast() // 224.0.0.0/4
|| v4.is_broadcast() // 255.255.255.255
|| v4.is_loopback() // 127.0.0.0/8
|| v4.is_unspecified() // 0.0.0.0
|| v4.is_link_local() // 169.254.0.0/16
|| v4.octets()[3] == 255 // subnet-directed broadcast (x.x.x.255)
}
IpAddr::V6(v6) => {
v6.is_multicast() // ff00::/8