Skip to content

Commit

Permalink
Remove automatic ignore of incoming/outgoing traffic for ports high p…
Browse files Browse the repository at this point in the history
…orts (#2598)

* Remove automatic ignore of incoming/outgoing traffic for ports 50000-60000

* ..
  • Loading branch information
aviramha authored Jul 14, 2024
1 parent 6d59418 commit 4fe9012
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.d/2597.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove automatic ignore of incoming/outgoing traffic for ports 50000-60000
6 changes: 2 additions & 4 deletions mirrord/layer/src/socket.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! We implement each hook function in a safe function as much as possible, having the unsafe do the
//! absolute minimum
use std::{
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, ToSocketAddrs},
net::{SocketAddr, ToSocketAddrs},
os::unix::io::RawFd,
str::FromStr,
sync::{Arc, LazyLock},
Expand Down Expand Up @@ -433,9 +433,7 @@ impl OutgoingFilterExt for OutgoingFilter {

#[inline]
fn is_ignored_port(addr: &SocketAddr) -> bool {
let (ip, port) = (addr.ip(), addr.port());
let ignored_ip = ip == IpAddr::V4(Ipv4Addr::LOCALHOST) || ip == IpAddr::V6(Ipv6Addr::LOCALHOST);
port == 0 || ignored_ip && (port > 50000 && port < 60000)
addr.port() == 0
}

/// Fill in the sockaddr structure for the given address.
Expand Down

0 comments on commit 4fe9012

Please sign in to comment.