mirror of
https://github.com/ParrotXray/Mantis.git
synced 2026-08-24 19:00:27 +09:00
fix: catch subnet-directed broadcast in is_non_unicast guard
This commit is contained in:
parent
0973f61bfe
commit
4a417a94fd
@ -124,11 +124,12 @@ pub fn is_non_unicast(ip: &str) -> bool {
|
|||||||
};
|
};
|
||||||
match addr {
|
match addr {
|
||||||
IpAddr::V4(v4) => {
|
IpAddr::V4(v4) => {
|
||||||
v4.is_multicast() // 224.0.0.0/4
|
v4.is_multicast() // 224.0.0.0/4
|
||||||
|| v4.is_broadcast() // 255.255.255.255
|
|| v4.is_broadcast() // 255.255.255.255
|
||||||
|| v4.is_loopback() // 127.0.0.0/8
|
|| v4.is_loopback() // 127.0.0.0/8
|
||||||
|| v4.is_unspecified() // 0.0.0.0
|
|| v4.is_unspecified() // 0.0.0.0
|
||||||
|| v4.is_link_local() // 169.254.0.0/16
|
|| v4.is_link_local() // 169.254.0.0/16
|
||||||
|
|| v4.octets()[3] == 255 // subnet-directed broadcast (x.x.x.255)
|
||||||
}
|
}
|
||||||
IpAddr::V6(v6) => {
|
IpAddr::V6(v6) => {
|
||||||
v6.is_multicast() // ff00::/8
|
v6.is_multicast() // ff00::/8
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user