File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -1681,8 +1681,8 @@ impl Socket {
1681
1681
target_os = "windows" ,
1682
1682
)
1683
1683
) ) ]
1684
- pub fn original_dst ( & self ) -> io:: Result < SockAddr > {
1685
- sys:: original_dst ( self . as_raw ( ) )
1684
+ pub fn original_dst_v4 ( & self ) -> io:: Result < SockAddr > {
1685
+ sys:: original_dst_v4 ( self . as_raw ( ) )
1686
1686
}
1687
1687
}
1688
1688
Original file line number Diff line number Diff line change @@ -1380,7 +1380,7 @@ pub(crate) const fn to_mreqn(
1380
1380
feature = "all" ,
1381
1381
any( target_os = "android" , target_os = "fuchsia" , target_os = "linux" )
1382
1382
) ) ]
1383
- pub ( crate ) fn original_dst ( fd : Socket ) -> io:: Result < SockAddr > {
1383
+ pub ( crate ) fn original_dst_v4 ( fd : Socket ) -> io:: Result < SockAddr > {
1384
1384
// Safety: `getsockopt` initialises the `SockAddr` for us.
1385
1385
unsafe {
1386
1386
SockAddr :: try_init ( |storage, len| {
@@ -1401,7 +1401,7 @@ pub(crate) fn original_dst(fd: Socket) -> io::Result<SockAddr> {
1401
1401
/// This value contains the original destination IPv6 address of the connection
1402
1402
/// redirected using `ip6tables` `REDIRECT` or `TPROXY`.
1403
1403
#[ cfg( all( feature = "all" , any( target_os = "android" , target_os = "linux" ) ) ) ]
1404
- pub ( crate ) fn original_dst_ipv6 ( fd : Socket ) -> io:: Result < SockAddr > {
1404
+ pub ( crate ) fn original_dst_v6 ( fd : Socket ) -> io:: Result < SockAddr > {
1405
1405
// Safety: `getsockopt` initialises the `SockAddr` for us.
1406
1406
unsafe {
1407
1407
SockAddr :: try_init ( |storage, len| {
Original file line number Diff line number Diff line change @@ -883,7 +883,7 @@ pub(crate) fn to_mreqn(
883
883
}
884
884
885
885
#[ cfg( feature = "all" ) ]
886
- pub ( crate ) fn original_dst ( socket : Socket ) -> io:: Result < SockAddr > {
886
+ pub ( crate ) fn original_dst_v4 ( socket : Socket ) -> io:: Result < SockAddr > {
887
887
unsafe {
888
888
SockAddr :: try_init ( |storage, len| {
889
889
syscall ! (
@@ -903,7 +903,7 @@ pub(crate) fn original_dst(socket: Socket) -> io::Result<SockAddr> {
903
903
}
904
904
905
905
#[ cfg( feature = "all" ) ]
906
- pub ( crate ) fn original_dst_ipv6 ( socket : Socket ) -> io:: Result < SockAddr > {
906
+ pub ( crate ) fn original_dst_v6 ( socket : Socket ) -> io:: Result < SockAddr > {
907
907
unsafe {
908
908
SockAddr :: try_init ( |storage, len| {
909
909
syscall ! (
Original file line number Diff line number Diff line change @@ -1654,21 +1654,21 @@ fn header_included_ipv6() {
1654
1654
target_os = "windows"
1655
1655
)
1656
1656
) ) ]
1657
- fn original_dst ( ) {
1657
+ fn original_dst_v4 ( ) {
1658
1658
let socket = Socket :: new ( Domain :: IPV4 , Type :: STREAM , None ) . unwrap ( ) ;
1659
1659
#[ cfg( not( target_os = "windows" ) ) ]
1660
1660
let expected = Some ( libc:: ENOENT ) ;
1661
1661
#[ cfg( target_os = "windows" ) ]
1662
1662
let expected = Some ( windows_sys:: Win32 :: Networking :: WinSock :: WSAEINVAL ) ;
1663
1663
1664
- match socket. original_dst ( ) {
1665
- Ok ( _) => panic ! ( "original_dst on non-redirected socket should fail" ) ,
1664
+ match socket. original_dst_v4 ( ) {
1665
+ Ok ( _) => panic ! ( "original_dst_v4 on non-redirected socket should fail" ) ,
1666
1666
Err ( err) => assert_eq ! ( err. raw_os_error( ) , expected) ,
1667
1667
}
1668
1668
1669
1669
let socket = Socket :: new ( Domain :: IPV6 , Type :: STREAM , None ) . unwrap ( ) ;
1670
- match socket. original_dst ( ) {
1671
- Ok ( _) => panic ! ( "original_dst on non-redirected socket should fail" ) ,
1670
+ match socket. original_dst_v4 ( ) {
1671
+ Ok ( _) => panic ! ( "original_dst_v4 on non-redirected socket should fail" ) ,
1672
1672
Err ( err) => assert_eq ! ( err. raw_os_error( ) , expected) ,
1673
1673
}
1674
1674
}
You can’t perform that action at this time.
0 commit comments