about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-03-13 16:53:09 -0700
committerbors <bors@rust-lang.org>2016-03-13 16:53:09 -0700
commit74b886ab14d48c1f043dde0102aeff365c2f991f (patch)
treef97ce0c7ee727ed5d7bb0a46b8471030ae1b75c6 /src/libstd
parentd5880fff990ced4815130582e68c9036d7cf7dcb (diff)
parent534bd19d25fd2211140d12540116eafd96aacc09 (diff)
downloadrust-74b886ab14d48c1f043dde0102aeff365c2f991f.tar.gz
rust-74b886ab14d48c1f043dde0102aeff365c2f991f.zip
Auto merge of #32211 - achanda:ipv6-global, r=alexcrichton
Reject unspecified IP from global

Also fixed the test
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/net/ip.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs
index 9c8ff44c704..bb688ab484a 100644
--- a/src/libstd/net/ip.rs
+++ b/src/libstd/net/ip.rs
@@ -371,10 +371,12 @@ impl Ipv6Addr {
     /// - the link-local addresses
     /// - the (deprecated) site-local addresses
     /// - unique local addresses
+    /// - the unspecified address
     pub fn is_unicast_global(&self) -> bool {
         !self.is_multicast()
             && !self.is_loopback() && !self.is_unicast_link_local()
             && !self.is_unicast_site_local() && !self.is_unique_local()
+            && !self.is_unspecified()
     }
 
     /// Returns the address's multicast scope if the address is multicast.
@@ -768,7 +770,7 @@ mod tests {
 
         //    unspec loopbk uniqlo global unill  unisl  uniglo mscope
         check("::",
-              true,  false, false, true,  false, false, true,  None);
+              true,  false, false, false,  false, false, false,  None);
         check("::1",
               false, true,  false, false, false, false, false, None);
         check("::0.0.0.2",