systemd-resolved: serve uplink-names, writing the host names file (issue 960)

The verb checks each host name (root, wildcard, trailing dot, a label over
63 bytes, the mesh's own domain or under it, more than 8), writes
/var/lib/node-resolver/uplink-names whole through sudo -n install then
sudo -n mv -f, and answers the names with the link carrying the default
route (the lowest-metric kernel default route that is neither routed nor
the private network's interface) and when they were set.

Builds: design 08 sign-in-page §2, §5, §6
This commit is contained in:
jochen
2026-11-24 21:19:35 +01:00
parent 03bf70a22b
commit a40d7fb1c4
5 changed files with 394 additions and 5 deletions
@@ -93,5 +93,11 @@ func tools(r *Resolver, history string) []stdio.Tool {
"when the link has none. (a)",
map[string]any{"link": str("the network link, by name")},
func(a map[string]any) (any, error) { return r.Unroute(ctx, arg(a, "link")) }),
verb("uplink-names", "Give this machine's own resolver the network manager's own check's host names, so a "+
"working network it tests resolves through the network it tests: at most 8, each a host name of "+
"letters, digits, hyphens and dots; an empty list takes them away. Refused, naming the name and why: "+
"not a host name, the root, the mesh's own domain or under it, or more than 8. (a)",
map[string]any{"names": str("the host names, separated by spaces or commas; empty clears them")},
func(a map[string]any) (any, error) { return r.SetUplinkNames(ctx, Split(a["names"])) }),
}
}