Skip to content

Conversation

@anigeo
Copy link

@anigeo anigeo commented Dec 18, 2025

Summary

Make Linux route listing reliably return IPv6 routes across kernel versions by dumping routes per address family (AF_INET + AF_INET6) and merging results.

Before (old behavior in this crate)

  • On Linux <= 6.9.5
    • list() could return IPv4 routes only
    • IPv6 routes missing (None)
  • On Linux >= 6.9.6
    • list() typically returns both IPv4 + IPv6 routes (works as expected)

After (this PR)

  • On Linux <= 6.9.5
    • list() returns IPv4 + IPv6 routes (fixed)
  • On Linux >= 6.9.6
    • list() continues to return IPv4 + IPv6 routes (no regression)

Expected behavior (all kernels)

  • RouteManager::list() / AsyncRouteManager::list() should return all current routes (IPv4 + IPv6 when enabled) consistently across kernel versions.

What changed

  • Update list_route_req() to accept an AddressFamily and set RouteMessage.header.address_family.
  • Update Linux sync + async list() to:
    • dump IPv4 (AddressFamily::Inet)
    • dump IPv6 (AddressFamily::Inet6)
    • merge results
    • return error only if both dumps fail (otherwise return partial results)

Test plan

  • Linux <= 6.9.5: confirm IPv6 routes appear in list().
  • Linux >= 6.9.6: confirm behavior unchanged.
  • Run both sync and async examples (e.g. examples/list.rs, examples/listen_async.rs).

Changes:
- Make route dump request accept an AddressFamily.
- List routes by querying IPv4 and IPv6 families separately.
- Apply the same logic to both sync and async route managers.

This ensures IPv6 routes are returned correctly on older kernels.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant