File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
23
23
([ #1921 ] ( https://github.com/nix-rust/nix/pull/1921 ) )
24
24
25
25
### Fixed
26
+ - Fix ` SockaddrIn6 ` bug that was swapping flowinfo and scope_id byte ordering.
27
+ ([ #1964 ] ( https://github.com/nix-rust/nix/pull/1964 ) )
28
+
26
29
### Removed
27
30
28
31
- Removed deprecated IoVec API.
Original file line number Diff line number Diff line change @@ -1182,8 +1182,8 @@ impl From<SockaddrIn6> for net::SocketAddrV6 {
1182
1182
net:: SocketAddrV6 :: new (
1183
1183
net:: Ipv6Addr :: from ( addr. 0 . sin6_addr . s6_addr ) ,
1184
1184
u16:: from_be ( addr. 0 . sin6_port ) ,
1185
- u32 :: from_be ( addr. 0 . sin6_flowinfo ) ,
1186
- u32 :: from_be ( addr. 0 . sin6_scope_id ) ,
1185
+ addr. 0 . sin6_flowinfo ,
1186
+ addr. 0 . sin6_scope_id ,
1187
1187
)
1188
1188
}
1189
1189
}
@@ -2525,6 +2525,18 @@ mod tests {
2525
2525
SockaddrIn6 :: size( ) as usize
2526
2526
) ;
2527
2527
}
2528
+
2529
+ #[ test]
2530
+ // Ensure that we can convert to-and-from std::net variants without change.
2531
+ fn to_and_from ( ) {
2532
+ let s = "[1234:5678:90ab:cdef::1111:2222]:8080" ;
2533
+ let mut nix_sin6 = SockaddrIn6 :: from_str ( s) . unwrap ( ) ;
2534
+ nix_sin6. 0 . sin6_flowinfo = 0x12345678 ;
2535
+ nix_sin6. 0 . sin6_scope_id = 0x9abcdef0 ;
2536
+
2537
+ let std_sin6 : std:: net:: SocketAddrV6 = nix_sin6. into ( ) ;
2538
+ assert_eq ! ( nix_sin6, std_sin6. into( ) ) ;
2539
+ }
2528
2540
}
2529
2541
2530
2542
mod sockaddr_storage {
You can’t perform that action at this time.
0 commit comments