mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
chore(connlib): treat Invalid Argument as unreachable hosts (#10037)
These appear to happen on systems that e.g. don't have IPv6 support or where the destination cannot be reached. It is a bit of a catch-all but all the ones I am seeing in Sentry are false-positives. To reduce the noise a bit, we log these on DEBUG now.
This commit is contained in:
@@ -147,11 +147,19 @@ impl Eventloop {
|
||||
.downcast_ref::<io::Error>()
|
||||
.is_some_and(is_unreachable)
|
||||
{
|
||||
// `NetworkUnreachable`, `HostUnreachable`, `AddrNotAvailable` most likely means we don't have IPv4 or IPv6 connectivity.
|
||||
tracing::debug!("{e:#}"); // Log these on DEBUG so they don't go completely unnoticed.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Invalid Input can be all sorts of things but we mostly see it with unreachable addresses.
|
||||
if e.root_cause()
|
||||
.downcast_ref::<io::Error>()
|
||||
.is_some_and(|e| e.kind() == io::ErrorKind::InvalidInput)
|
||||
{
|
||||
tracing::debug!("{e:#}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if e.root_cause()
|
||||
.is::<firezone_tunnel::UdpSocketThreadStopped>()
|
||||
{
|
||||
|
||||
@@ -98,16 +98,23 @@ impl Eventloop {
|
||||
continue;
|
||||
}
|
||||
Poll::Ready(Err(e)) => {
|
||||
if e.root_cause().downcast_ref::<io::Error>().is_some_and(|e| {
|
||||
e.kind() == io::ErrorKind::NetworkUnreachable
|
||||
|| e.kind() == io::ErrorKind::HostUnreachable
|
||||
|| e.kind() == io::ErrorKind::AddrNotAvailable
|
||||
}) {
|
||||
// `NetworkUnreachable`, `HostUnreachable`, `AddrNotAvailable` most likely means we don't have IPv4 or IPv6 connectivity.
|
||||
if e.root_cause()
|
||||
.downcast_ref::<io::Error>()
|
||||
.is_some_and(is_unreachable)
|
||||
{
|
||||
tracing::debug!("{e:#}"); // Log these on DEBUG so they don't go completely unnoticed.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Invalid Input can be all sorts of things but we mostly see it with unreachable addresses.
|
||||
if e.root_cause()
|
||||
.downcast_ref::<io::Error>()
|
||||
.is_some_and(|e| e.kind() == io::ErrorKind::InvalidInput)
|
||||
{
|
||||
tracing::debug!("{e:#}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if e.root_cause()
|
||||
.downcast_ref::<io::Error>()
|
||||
.is_some_and(|e| e.kind() == io::ErrorKind::PermissionDenied)
|
||||
@@ -663,3 +670,14 @@ fn resolve_address_family(addr: &str, family: i32) -> Result<AddrInfoIter, Looku
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
fn is_unreachable(e: &io::Error) -> bool {
|
||||
#[cfg(unix)]
|
||||
if e.raw_os_error().is_some_and(|e| e == libc::EHOSTDOWN) {
|
||||
return true;
|
||||
}
|
||||
|
||||
e.kind() == io::ErrorKind::NetworkUnreachable
|
||||
|| e.kind() == io::ErrorKind::HostUnreachable
|
||||
|| e.kind() == io::ErrorKind::AddrNotAvailable
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user