Skip to content

custom-domain: stop publishing an underscore-leading CNAME target - #123

Merged
Leechael merged 1 commit into
mainfrom
check-underscore-dns-android
Sep 12, 2026
Merged

custom-domain: stop publishing an underscore-leading CNAME target#123
Leechael merged 1 commit into
mainfrom
check-underscore-dns-android

Conversation

@h4x3rotab

@h4x3rotab h4x3rotab commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

GATEWAY_DOMAIN is published as the custom domain's CNAME target, and the examples used _.<gateway-domain>. That name is unresolvable on Android.

Android's resolver runs every name in an A/AAAA answer through res_hnok, including the CNAME RDATA (getaddrinfo.cpp), and res_hnok accepts _ only between two alphanumerics:

#define borderchar(c) (alphachar(c) || digitchar(c))
#define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c))

A label starting with _ sits in the border position, fails the check, and getanswer() drops the whole chain — so the hostname does not resolve on Android. glibc permits _ at any position and only rejects a leading -, which is why this never shows up in Linux or desktop-browser testing.

Note that _access would fail identically; the fix has to avoid a leading underscore, not just the bare _ label.

Change

Examples now use gateway.<gateway-domain>. The label is arbitrary: the gateway zone is a wildcard, the name never travels on the wire, and routing is driven by the client's SNI plus the app-address TXT record. Docs and default values only — no script logic changed, since dnsguide.py and dnsman.py already pass the value through verbatim.

_. keeps resolving, so this breaks no existing deployment — those are simply still broken on Android until they move.

Matching docs change: Phala-Network/phala-docs#177

🤖 Generated with Claude Code

GATEWAY_DOMAIN is published as the custom domain's CNAME target, and the
examples used `_.<gateway-domain>`. Android's resolver runs every name in an
A/AAAA answer through res_hnok, including the CNAME RDATA, and res_hnok
accepts `_` only between two alphanumerics. A label starting with `_` fails,
getanswer() drops the chain, and the hostname is unresolvable on Android --
while glibc, which permits `_` anywhere, resolves it fine, so the breakage
never shows up in Linux testing.

Switch the examples to `gateway.<gateway-domain>`. The label is arbitrary: the
gateway zone is a wildcard, the name never travels on the wire, and routing is
driven by the client's SNI plus the app-address TXT record. `_.` keeps
resolving, so existing deployments are unaffected by this change -- they are
simply still broken on Android until they move.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@Leechael Leechael left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Leechael
Leechael merged commit fd162b0 into main Sep 12, 2026
6 checks passed
@Leechael
Leechael deleted the check-underscore-dns-android branch September 12, 2026 03:56
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.

2 participants