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/).
2323 ([ #1921 ] ( https://github.com/nix-rust/nix/pull/1921 ) )
2424
2525### 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+
2629### Removed
2730
2831- Removed deprecated IoVec API.
Original file line number Diff line number Diff line change @@ -1182,8 +1182,8 @@ impl From<SockaddrIn6> for net::SocketAddrV6 {
11821182 net:: SocketAddrV6 :: new (
11831183 net:: Ipv6Addr :: from ( addr. 0 . sin6_addr . s6_addr ) ,
11841184 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 ,
11871187 )
11881188 }
11891189}
@@ -2525,6 +2525,18 @@ mod tests {
25252525 SockaddrIn6 :: size( ) as usize
25262526 ) ;
25272527 }
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+ }
25282540 }
25292541
25302542 mod sockaddr_storage {
You can’t perform that action at this time.
0 commit comments