File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 33All notable changes to this project will be documented in this file.
44This project adheres to [ Semantic Versioning] ( https://semver.org/ ) .
55
6+ ## [ Unreleased] - ReleaseDate
7+ ### Added
8+ ### Changed
9+ ### Fixed
10+ - Fix ` SockaddrIn6 ` bug that was swapping flowinfo and scope_id byte ordering.
11+ ([ #1964 ] ( https://github.com/nix-rust/nix/pull/1964 ) )
12+
13+ ### Removed
14+
615## [ 0.26.1] - 2022-11-29
716### Added
817### Changed
Original file line number Diff line number Diff line change @@ -1476,8 +1476,8 @@ impl From<SockaddrIn6> for net::SocketAddrV6 {
14761476 net:: SocketAddrV6 :: new (
14771477 net:: Ipv6Addr :: from ( addr. 0 . sin6_addr . s6_addr ) ,
14781478 u16:: from_be ( addr. 0 . sin6_port ) ,
1479- u32 :: from_be ( addr. 0 . sin6_flowinfo ) ,
1480- u32 :: from_be ( addr. 0 . sin6_scope_id ) ,
1479+ addr. 0 . sin6_flowinfo ,
1480+ addr. 0 . sin6_scope_id ,
14811481 )
14821482 }
14831483}
@@ -3167,6 +3167,18 @@ mod tests {
31673167 SockaddrIn6 :: size( ) as usize
31683168 ) ;
31693169 }
3170+
3171+ #[ test]
3172+ // Ensure that we can convert to-and-from std::net variants without change.
3173+ fn to_and_from ( ) {
3174+ let s = "[1234:5678:90ab:cdef::1111:2222]:8080" ;
3175+ let mut nix_sin6 = SockaddrIn6 :: from_str ( s) . unwrap ( ) ;
3176+ nix_sin6. 0 . sin6_flowinfo = 0x12345678 ;
3177+ nix_sin6. 0 . sin6_scope_id = 0x9abcdef0 ;
3178+
3179+ let std_sin6 : std:: net:: SocketAddrV6 = nix_sin6. into ( ) ;
3180+ assert_eq ! ( nix_sin6, std_sin6. into( ) ) ;
3181+ }
31703182 }
31713183
31723184 mod sockaddr_storage {
You can’t perform that action at this time.
0 commit comments