Warn about a zone name only when it collides with something

"`.pidar` is not a delegated top-level domain today, but it could become
one" fired on every private name anybody has ever picked, which is every
network without a dot in its name. A warning that is always there is a
warning about nothing, and it teaches people to skim past the ones that
mean something — there were two of them in one report, side by side with
the real checks.

What is left is the collision that exists: a name that really is a public
top-level domain, which does make every public name under it unreachable
from that host, and `.local`, which belongs to multicast DNS. A name that
shadows nothing is said nothing about.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
tsunagi
2026-09-22 02:09:17 +01:00
co-authored by Claude Opus 5
parent 83d3445b7e
commit 458051f47d
2 changed files with 19 additions and 19 deletions
+6 -5
View File
@@ -251,11 +251,12 @@ for the host running the agent, and binding an overlay address would put
them in front of the whole mesh — an agent in two networks would then answer them in front of the whole mesh — an agent in two networks would then answer
one network's questions about the other's names. one network's questions about the other's names.
The zone is the network name unless `--dns-zone` says otherwise. It is The zone is the network name, and it is yours to choose. A name that
yours to choose, so a name that shadows a real public domain is reported and shadows a real public domain is reported and then used: a network called
then used: `--dns-zone ru` warns that every public `.ru` name becomes `ru` warns that every public `.ru` name becomes unreachable from this host,
unreachable from this host, and then does it. `.internal` is reserved for and then does it. Anything that collides with nothing — which is most names
exactly this and is never mentioned. — is said nothing about, because a warning that fires on every private name
anybody picks is how people learn to ignore warnings.
On Linux the agent tells systemd-resolved to send questions for that suffix On Linux the agent tells systemd-resolved to send questions for that suffix
here, over D-Bus, scoped to the overlay interface and as a *routing* domain here, over D-Bus, scoped to the overlay interface and as a *routing* domain
+13 -14
View File
@@ -128,17 +128,14 @@ impl ZoneName {
.to_string(), .to_string(),
); );
} }
if tld::exist_case_insensitive(top) { // A real top-level domain is the whole of it. A name that is not
return Some(format!( // delegated today might be one day — and saying so fires on every
// private name anybody ever picks, which is a warning about
// nothing that teaches people to ignore warnings.
tld::exist_case_insensitive(top).then(|| {
format!(
"`.{top}` is a real top-level domain, so every public name under it \ "`.{top}` is a real top-level domain, so every public name under it \
becomes unreachable from this host while the overlay is up" becomes unreachable from this host while the overlay is up"
));
}
// Not delegated today is not a promise about tomorrow.
(!self.0.contains('.')).then(|| {
format!(
"`.{top}` is not a delegated top-level domain today, but it could \
become one; `.internal` is reserved for private use and never will"
) )
}) })
} }
@@ -516,11 +513,13 @@ mod tests {
let local = ZoneName::new("local").unwrap().collision().unwrap(); let local = ZoneName::new("local").unwrap().collision().unwrap();
assert!(local.contains("multicast DNS"), "{local}"); assert!(local.contains("multicast DNS"), "{local}");
// An undelegated single label is a maybe, not a yes. // A name that collides with nothing is said nothing about. It
let lab = ZoneName::new("lab").unwrap().collision().unwrap(); // might be delegated one day, and warning about that fires on
assert!(lab.contains("could"), "{lab}"); // every private name anybody picks — a warning about nothing,
// A multi-label name under something undelegated is not worth a word. // which is how people learn to ignore warnings.
assert_eq!(ZoneName::new("a.lab").unwrap().collision(), None); for quiet in ["lab", "a.lab", "pidar", "twar", "kitchen-table"] {
assert_eq!(ZoneName::new(quiet).unwrap().collision(), None, "{quiet}");
}
} }
#[test] #[test]