Skip to content

Commit c028b1c

Browse files
committed
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
2 parents 0c424f9 + 88506ce commit c028b1c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/libstd/net/addr.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ impl SocketAddrV6 {
143143
sin6_family: c::AF_INET6 as c::sa_family_t,
144144
sin6_port: hton(port),
145145
sin6_addr: *ip.as_inner(),
146-
sin6_flowinfo: hton(flowinfo),
147-
sin6_scope_id: hton(scope_id),
146+
sin6_flowinfo: flowinfo,
147+
sin6_scope_id: scope_id,
148148
.. unsafe { mem::zeroed() }
149149
},
150150
}
@@ -173,23 +173,23 @@ impl SocketAddrV6 {
173173
/// Returns the flow information associated with this address,
174174
/// corresponding to the `sin6_flowinfo` field in C.
175175
#[stable(feature = "rust1", since = "1.0.0")]
176-
pub fn flowinfo(&self) -> u32 { ntoh(self.inner.sin6_flowinfo) }
176+
pub fn flowinfo(&self) -> u32 { self.inner.sin6_flowinfo }
177177

178178
/// Change the flow information associated with this socket address.
179179
#[unstable(feature = "sockaddr_setters", reason = "recent addition", issue = "31572")]
180180
pub fn set_flowinfo(&mut self, new_flowinfo: u32) {
181-
self.inner.sin6_flowinfo = hton(new_flowinfo)
181+
self.inner.sin6_flowinfo = new_flowinfo;
182182
}
183183

184184
/// Returns the scope ID associated with this address,
185185
/// corresponding to the `sin6_scope_id` field in C.
186186
#[stable(feature = "rust1", since = "1.0.0")]
187-
pub fn scope_id(&self) -> u32 { ntoh(self.inner.sin6_scope_id) }
187+
pub fn scope_id(&self) -> u32 { self.inner.sin6_scope_id }
188188

189189
/// Change the scope ID associated with this socket address.
190190
#[unstable(feature = "sockaddr_setters", reason = "recent addition", issue = "31572")]
191191
pub fn set_scope_id(&mut self, new_scope_id: u32) {
192-
self.inner.sin6_scope_id = hton(new_scope_id)
192+
self.inner.sin6_scope_id = new_scope_id;
193193
}
194194
}
195195

0 commit comments

Comments
 (0)