about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorAbhishek Chanda <abhishek.becs@gmail.com>2016-03-01 10:58:56 -0800
committerAbhishek Chanda <abhishek.becs@gmail.com>2016-03-04 11:01:06 -0800
commit27b2201c7caae284414d7d49d596ff1519c46763 (patch)
tree710ff5463aaec0dcee333d40b2ddc570bb60bd8d /src/libstd
parentdb837d011afee8a868f41c40ab4c3535a1d40b82 (diff)
downloadrust-27b2201c7caae284414d7d49d596ff1519c46763.tar.gz
rust-27b2201c7caae284414d7d49d596ff1519c46763.zip
Reject the reserved block as not global
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/net/ip.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs
index 89e32619f47..55930e06e0e 100644
--- a/src/libstd/net/ip.rs
+++ b/src/libstd/net/ip.rs
@@ -121,6 +121,8 @@ impl Ipv4Addr {
     }
 
     /// 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 @@ impl Ipv4Addr {
     /// - 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.