From 8976de584ae7ab9d0900268b03f50d79fb816d04 Mon Sep 17 00:00:00 2001 From: keithmattix Date: Thu, 12 Sep 2024 12:36:16 -0500 Subject: [PATCH] Don't remove the linux ipv6 original_dst test Signed-off-by: keithmattix --- tests/socket.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/socket.rs b/tests/socket.rs index fc7d5497..91ab8882 100644 --- a/tests/socket.rs +++ b/tests/socket.rs @@ -1626,6 +1626,25 @@ fn original_dst() { } } +#[test] +#[cfg(all( + feature = "all", + any(target_os = "android", target_os = "fuchsia", target_os = "linux") +))]fn original_dst_ipv6() { + let socket = Socket::new(Domain::IPV6, Type::STREAM, None).unwrap(); + match socket.original_dst_ipv6() { + Ok(_) => panic!("original_dst_ipv6 on non-redirected socket should fail"), + Err(err) => assert_eq!(err.raw_os_error(), Some(libc::ENOENT)), + } + + // Not supported on IPv4 socket. + let socket = Socket::new(Domain::IPV4, Type::STREAM, None).unwrap(); + match socket.original_dst_ipv6() { + Ok(_) => panic!("original_dst_ipv6 on non-redirected socket should fail"), + Err(err) => assert_eq!(err.raw_os_error(), Some(libc::EOPNOTSUPP)), + } +} + #[test] #[cfg(all(feature = "all", target_os = "windows"))] fn original_dst_ipv6() {