]> git.lizzy.rs Git - rust.git/commitdiff
Reject the reserved block as not global
authorAbhishek Chanda <abhishek.becs@gmail.com>
Tue, 1 Mar 2016 18:58:56 +0000 (10:58 -0800)
committerAbhishek Chanda <abhishek.becs@gmail.com>
Fri, 4 Mar 2016 19:01:06 +0000 (11:01 -0800)
src/libstd/net/ip.rs

index 89e32619f4729fe1e1dc75f95e046c787ea794f7..55930e06e0e2a90127e036ced6ffdaf771f80b51 100644 (file)
@@ -121,6 +121,8 @@ pub fn is_link_local(&self) -> bool {
     }
 
     /// Returns true if the address appears to be globally routable.
+    /// See [iana-ipv4-special-registry][ipv4-sr].
+    /// [ipv4-sr]: http://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
     ///
     /// The following return false:
     ///
@@ -131,7 +133,8 @@ pub fn is_link_local(&self) -> bool {
     /// - 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 {
         !self.is_private() && !self.is_loopback() && !self.is_link_local() &&
-        !self.is_broadcast() && !self.is_documentation() && !self.is_unspecified()
+        !self.is_broadcast() && !self.is_documentation() && !self.is_unspecified() &&
+        !self.is_this_network()
     }
 
     /// Returns true if this is a multicast address.