Skip to content

Commit

Permalink
Allow using IPv6 sockets with mirrord (#2808)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviramha authored Oct 9, 2024
1 parent 8b83694 commit 4f82caa
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 11 deletions.
1 change: 1 addition & 0 deletions changelog.d/2807.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow using IPv6 sockets with mirrord
7 changes: 0 additions & 7 deletions mirrord/layer/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ pub(crate) enum HookError {
#[error("mirrord-layer: SIP patch failed with error `{0}`!")]
FailedSipPatch(#[from] SipError),

#[error("mirrord-layer: IPv6 can't be used with mirrord")]
SocketUnsuportedIpv6,

// `From` implemented below, not with `#[from]` so that when new variants of
// `SerializationError` are added, they are mapped into different variants of
// `LayerError`.
Expand Down Expand Up @@ -221,9 +218,6 @@ impl From<HookError> for i64 {
HookError::FileNotFound => {
info!("mirrord file not found triggered")
}
HookError::SocketUnsuportedIpv6 => {
info!("{fail}")
}
HookError::ProxyError(ref err) => {
graceful_exit!(
r"Proxy error, connectivity issue or a bug.
Expand Down Expand Up @@ -292,7 +286,6 @@ impl From<HookError> for i64 {
HookError::LocalFileCreation(_) => libc::EINVAL,
#[cfg(target_os = "macos")]
HookError::FailedSipPatch(_) => libc::EACCES,
HookError::SocketUnsuportedIpv6 => libc::EAFNOSUPPORT,
HookError::UnsupportedSocketType => libc::EAFNOSUPPORT,
HookError::BadPointer => libc::EFAULT,
HookError::AddressAlreadyBound(_) => libc::EADDRINUSE,
Expand Down
4 changes: 0 additions & 4 deletions mirrord/layer/src/socket/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ pub(super) fn socket(domain: c_int, type_: c_int, protocol: c_int) -> Detour<Raw
Ok(())
}?;

if domain == libc::AF_INET6 {
return Detour::Error(HookError::SocketUnsuportedIpv6);
}

let socket_result = unsafe { FN_SOCKET(domain, type_, protocol) };

let socket_fd = if socket_result == -1 {
Expand Down

0 comments on commit 4f82caa

Please sign in to comment.