net/dns,ipn/ipnlocal: add nodecap to resolve subdomains (#18258)

This adds a new node capability 'dns-subdomain-resolve' that signals
that all of hosts' subdomains should resolve to the same IP address.
It allows wildcard matching on any node marked with this capability.

This change also includes an util/dnsname utility function that lets
us access the parent of a full qualified domain name. MagicDNS takes
this function and recursively searchs for a matching real node name.

One important thing to observe is that, in this context, a subdomain
can have multiple sub labels. This means that for a given node named
machine, both my.machine and be.my.machine will be a positive match.

Updates #1196

Signed-off-by: Fernando Serboncini <fserb@tailscale.com>
This commit is contained in:
Fernando Serboncini
2026-01-30 13:32:34 -05:00
committed by GitHub
parent 214b70cc1a
commit f48cd46662
11 changed files with 186 additions and 4 deletions
+7
View File
@@ -2707,6 +2707,13 @@ const (
// server to answer AAAA queries about its peers. See tailscale/tailscale#1152.
NodeAttrMagicDNSPeerAAAA NodeCapability = "magicdns-aaaa"
// NodeAttrDNSSubdomainResolve, when set on Self or a Peer node, indicates
// that the subdomains of that node's MagicDNS name should resolve to the
// same IP addresses as the node itself.
// For example, if node "myserver.tailnet.ts.net" has this capability,
// then "anything.myserver.tailnet.ts.net" will resolve to myserver's IPs.
NodeAttrDNSSubdomainResolve NodeCapability = "dns-subdomain-resolve"
// NodeAttrTrafficSteering configures the node to use the traffic
// steering subsystem for via routes. See tailscale/corp#29966.
NodeAttrTrafficSteering NodeCapability = "traffic-steering"