Skip to content

transport: Ensure that numeric IP literals use correct family - #546

Closed
dch wants to merge 1 commit into
elixir-mint:mainfrom
skunkwerks:fix/ip-literals
Closed

dch wants to merge 1 commit into
elixir-mint:mainfrom
skunkwerks:fix/ip-literals

Conversation

@dch

@dch dch commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

When the address was an IP literal, gen_tcp got the wrong family and treated it as a hostname. Mint then returned :nxdomain from the IPv4 fallback instead of the real error, after an unneeded DNS lookup and timeouts.

  • connect to IPv6 literals over inet6 and IPv4 literals over inet, ignoring :inet6 and :inet4
  • keep the inet6-then-inet4 fallback for hostnames
  • apply the same change to TCP and SSL

When the address was an IP literal, gen_tcp got the wrong family and
treated it as a hostname. Mint then returned :nxdomain from the IPv4
fallback instead of the real error, after an unneeded DNS lookup and
timeouts.

- connect to IPv6 literals over inet6 and IPv4 literals over inet,
  ignoring :inet6 and :inet4
- keep the inet6-then-inet4 fallback for hostnames
- apply the same change to TCP and SSL
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 0

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.05%) to 90.527%

Details

  • Coverage increased (+0.05%) from the base build.
  • Patch coverage: 2 uncovered changes across 2 files (21 of 23 lines covered, 91.3%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
lib/mint/core/transport/ssl.ex 8 7 87.5%
lib/mint/core/transport/tcp.ex 8 7 87.5%
Total (3 files) 23 21 91.3%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 2048
Covered Lines: 1854
Line Coverage: 90.53%
Coverage Strength: 755.02 hits per line

💛 - Coveralls

@ericmj

ericmj commented Nov 17, 2026

Copy link
Copy Markdown
Member

Thanks for the PR. Reopening as #552 so I can push commits to it.

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.

3 participants