Skip to content

feat: add prefer_ipv4 option to force IPv4 for DNS resolution and connections#357

Open
guessi wants to merge 1 commit into
aws:masterfrom
guessi:feat/prefer-ipv4-option
Open

feat: add prefer_ipv4 option to force IPv4 for DNS resolution and connections#357
guessi wants to merge 1 commit into
aws:masterfrom
guessi:feat/prefer-ipv4-option

Conversation

@guessi

@guessi guessi commented Jun 17, 2026

Copy link
Copy Markdown

Closes #356

Problem

On dual-stack or NAT64 hosts, DNS returns IPv6 addresses before IPv4. efs-utils uses AF_UNSPEC, so the OS selects the IPv6 address, which times out on NFS port 2049 because the EFS mount target is only reachable over IPv4.

Change

Adds prefer_ipv4 = false (off by default) to efs-utils.conf and s3files-utils.conf. When set to true:

  • DNS name resolution uses AF_INET instead of AF_UNSPEC (Python layer)
  • CNAME resolution in match_device uses AF_INET
  • Fallback via DescribeMountTargets rejects IPv6-only addresses with a clear error
  • efs-proxy resolves the mount target hostname to IPv4 before connecting (Rust layer)

Default is false so existing behaviour is unchanged.

Testing

  • Existing cargo test suite passes
  • New Rust tests: test_resolve_addr_returns_ipv4, test_resolve_addr_no_ipv4_returns_error, test_plain_text_finder_prefer_ipv4_connects
  • New Python test: test_get_fallback_mount_target_ip_address_helper_ipv6_only_prefer_ipv4

…nections

Add a new prefer_ipv4 = false config option (efs-utils.conf and
s3files-utils.conf) that, when set to true, forces IPv4 throughout
the mount path:

- DNS name resolution uses AF_INET instead of AF_UNSPEC
- CNAME resolution in match_device uses AF_INET
- Fallback to IPv6-only mount target raises FallbackException
- efs-proxy resolves mount target hostname to IPv4 before connecting
- efs-proxy config receives prefer_ipv4 = true when enabled

Default is false so existing behaviour is unchanged.
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.

EFS mount fails on dual-stack/NAT64 hosts: IPv6 address selected over IPv4, causing NFS timeout

1 participant