Skip to content

Normalize network hostname lookup#1810

Open
thromel wants to merge 1 commit into
apple:mainfrom
thromel:codex/normalize-network-hostname-lookup
Open

Normalize network hostname lookup#1810
thromel wants to merge 1 commit into
apple:mainfrom
thromel:codex/normalize-network-hostname-lookup

Conversation

@thromel

@thromel thromel commented Jun 25, 2026

Copy link
Copy Markdown

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Network attachments are allocated under the hostname supplied by the runtime, while DNS queries are canonical DNS names and may include a trailing dot. DNS hostnames are also case-insensitive. Because AttachmentAllocator keyed hostnames exactly as supplied, a container allocated as web could fail lookup when the embedded DNS path queried web..

This normalizes allocator keys by lowercasing hostnames and treating a single trailing dot as optional across allocate, lookup, and deallocate. The original hostname remains preserved in the returned attachment.

This is a narrow fix for the embedded DNS lookup path. First-class Compose-style bare service discovery from containers through the network gateway is a separate feature request: #1809. Related DNS discussion: #856.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

Checks run:

swift test --filter AttachmentAllocatorTest
swift test -c debug -Xswiftc -warnings-as-errors --filter AttachmentAllocatorTest

Additional manual validation:

  • On released container 1.0.0, created a custom network and container; direct dig @127.0.0.1 -p 2053 <container-name> A returned no A record.
  • With this patched debug build installed under a temporary /tmp install root, the same direct queries returned the allocated container IP for both <container-name> and <container-name>..

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