about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2016-03-23 17:59:15 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2016-03-23 17:59:15 +0200
commitc028b1c02cf976b08e685a3716eee5db0322ff7c (patch)
tree955fd18c7b39ed203b8bcdd1ac685c0a6c30a658 /src/libstd
parent0c424f9825472d7b1ad6194a1e98e018f749be5f (diff)
parent88506ce5cdc7a5e3eeb9e121184f8a1c2e40819e (diff)
downloadrust-c028b1c02cf976b08e685a3716eee5db0322ff7c.tar.gz
rust-c028b1c02cf976b08e685a3716eee5db0322ff7c.zip
Rollup merge of #32429 - alexcrichton:scope-id-hton, r=aturon
std: Store flowinfo/scope_id in host byte order

Apparently these aren't supposed to be stored in network byte order, so doing so
ends up causing failures when it would otherwise succeed when stored in the host
byte order.

Closes #32424
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/net/addr.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs
index 78da9412212..649094a7493 100644
--- a/src/libstd/net/addr.rs
+++ b/src/libstd/net/addr.rs
@@ -143,8 +143,8 @@ impl SocketAddrV6 {
                 sin6_family: c::AF_INET6 as c::sa_family_t,
                 sin6_port: hton(port),
                 sin6_addr: *ip.as_inner(),
-                sin6_flowinfo: hton(flowinfo),
-                sin6_scope_id: hton(scope_id),
+                sin6_flowinfo: flowinfo,
+                sin6_scope_id: scope_id,
                 .. unsafe { mem::zeroed() }
             },
         }
@@ -173,23 +173,23 @@ impl SocketAddrV6 {
     /// Returns the flow information associated with this address,
     /// corresponding to the `sin6_flowinfo` field in C.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn flowinfo(&self) -> u32 { ntoh(self.inner.sin6_flowinfo) }
+    pub fn flowinfo(&self) -> u32 { self.inner.sin6_flowinfo }
 
     /// Change the flow information associated with this socket address.
     #[unstable(feature = "sockaddr_setters", reason = "recent addition", issue = "31572")]
     pub fn set_flowinfo(&mut self, new_flowinfo: u32) {
-        self.inner.sin6_flowinfo = hton(new_flowinfo)
+        self.inner.sin6_flowinfo = new_flowinfo;
     }
 
     /// Returns the scope ID associated with this address,
     /// corresponding to the `sin6_scope_id` field in C.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn scope_id(&self) -> u32 { ntoh(self.inner.sin6_scope_id) }
+    pub fn scope_id(&self) -> u32 { self.inner.sin6_scope_id }
 
     /// Change the scope ID associated with this socket address.
     #[unstable(feature = "sockaddr_setters", reason = "recent addition", issue = "31572")]
     pub fn set_scope_id(&mut self, new_scope_id: u32) {
-        self.inner.sin6_scope_id = hton(new_scope_id)
+        self.inner.sin6_scope_id = new_scope_id;
     }
 }