Exclude 0.0.0.0 from the list of globally routable addresses
This commit is contained in:
@@ -131,7 +131,7 @@ impl Ipv4Addr {
|
|||||||
/// - test addresses used for documentation (192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24)
|
/// - test addresses used for documentation (192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24)
|
||||||
pub fn is_global(&self) -> bool {
|
pub fn is_global(&self) -> bool {
|
||||||
!self.is_private() && !self.is_loopback() && !self.is_link_local() &&
|
!self.is_private() && !self.is_loopback() && !self.is_link_local() &&
|
||||||
!self.is_broadcast() && !self.is_documentation()
|
!self.is_broadcast() && !self.is_documentation() && !self.is_unspecified()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if this is a multicast address.
|
/// Returns true if this is a multicast address.
|
||||||
@@ -725,7 +725,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// address unspec loopbk privt linloc global multicast brdcast doc
|
// address unspec loopbk privt linloc global multicast brdcast doc
|
||||||
check(&[0, 0, 0, 0], true, false, false, false, true, false, false, false);
|
check(&[0, 0, 0, 0], true, false, false, false, false, false, false, false);
|
||||||
check(&[0, 0, 0, 1], false, false, false, false, true, false, false, false);
|
check(&[0, 0, 0, 1], false, false, false, false, true, false, false, false);
|
||||||
check(&[1, 0, 0, 0], false, false, false, false, true, false, false, false);
|
check(&[1, 0, 0, 0], false, false, false, false, true, false, false, false);
|
||||||
check(&[10, 9, 8, 7], false, false, true, false, false, false, false, false);
|
check(&[10, 9, 8, 7], false, false, true, false, false, false, false, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user