#21564·tailscale

net/dns/resolver: exit node PTR handling rejects uppercase names and accepts non-hex nibbles

Author: RaphaelFakhriCreated Sep 29, 2026Updated Sep 29, 2026
Labelsbugpod/network-features

What is the issue?

unARPA converts a reverse-lookup name to an IP address string when an exit node or app connector resolves a PTR query with the net package. It has two defects:

  1. The .in-addr.arpa. and .ip6.arpa. suffixes are matched case-sensitively. DNS names are case-insensitive and some resolvers randomize the case of the query name, so 4.4.8.8.IN-ADDR.ARPA. fails with bogus PTR name.
  2. The error from hex.Decode is ignored for IPv6 names. A name with a non-hex nibble, such as z.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.b.0.8.0.a.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa., returns the partly decoded address 2607:f8b0:400a:80b::2000, and the exit node looks up an unrelated IP.

Steps to reproduce

go
unARPA("4.4.8.8.IN-ADDR.ARPA.") // "", false; want "8.8.4.4", true
unARPA("z.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.b.0.8.0.a.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa.")
// "2607:f8b0:400a:80b::2000", true; want "", false

Expected behavior

Suffix matching ignores case, and a name with a non-hex nibble is rejected.

Version

Current main.