Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions netwatch/src/interfaces/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ pub enum Error {
}

pub async fn default_route() -> Option<DefaultRouteDetails> {
let route = default_route_proc().await;
if let Ok(route) = route {
return route;
// /proc/net/route only contains IPv4 routes. If it finds one, return it.
// If it returns Ok(None) (no IPv4 default route) or Err (file unreadable),
// fall through to netlink which checks both IPv4 and IPv6.
if let Ok(Some(route)) = default_route_proc().await {
return Some(route);
}

#[cfg(target_os = "android")]
Expand Down
2 changes: 0 additions & 2 deletions netwatch/tests/patchbay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ async fn default_route_v4_only() -> TestResult {

/// Netwatch detects a default route on a v6-only network.
#[tokio::test]
#[ignore = "default_route() does not fall through to netlink when /proc/net/route has no IPv4 default"]
async fn default_route_v6_only() -> TestResult {
let state = state_for_routed_device(IpSupport::V6Only).await?;

Expand All @@ -75,7 +74,6 @@ async fn default_route_dual_stack() -> TestResult {
/// After replugging from a v4 router to a v6 router, netwatch detects the new
/// default route.
#[tokio::test]
#[ignore = "default_route() does not fall through to netlink when /proc/net/route has no IPv4 default"]
async fn default_route_after_replug_v4_to_v6() -> TestResult {
let lab = Lab::new().await?;
let v4_router = lab
Expand Down
Loading