SaltDns. Proxy. Families
(Salt v1.0.0)
Which address families Salt's own host can probe, and what that means for a node's probe signal. Pure: no network, no database.
A probe of one address ends in one of three outcomes (classify/2):
:ok: the TLS handshake completed;:failed: the address did not answer;:local: the probe never left this host, because the local system has no route to, or no address of, that family.
The rule
The :inet error atoms are POSIX codes from the local connect(2):
:eafnosupport(address family not supported) and:eaddrnotavail(no local address of that family to use as the source) can only come from this host's own network stack, never from the far end. Always:local.:enetunreach(network unreachable) is what a host without a route for the family answers at once, in microseconds. A router somewhere on the way can send the same code by ICMP, but only after a round trip. So it is:localonly when it came back within 1000 ms.:ehostunreach(no route to host) is ambiguous in the same way, and a router also sends it for one dead host: a single address that gives:ehostunreach, or gives it after a delay, is a:failedprobe, an honest verdict on that node. Quick:ehostunreachcounts as:localonly as evidence for a whole family (below).- Everything else (
:timeout,:econnrefused,:econnreset, a failed handshake,:no_certificate,:eaccesfrom a firewall) is:failed. A refused or timed-out connection proves the packet left this host.
A family is not checkable from here when, across every address of that
family probed for the group in one round (all nodes), there is at least one
and every one of them is :local, and the evidence is either an error that
is local by nature (:eafnosupport, :eaddrnotavail, a quick
:enetunreach) or at least two different addresses all giving the quick
:ehostunreach. One address alone failing is a failure; the same local
error for all of them is the host's own limit. A single :ok among them
makes the family checkable, and the :local ones then count as failures.
A node's probe signal (verdict/2)
The addresses of families that are not checkable are neither a failure nor
a proof. Of the others: :failed when any failed, :ok when all are ok and
there is at least one, :not_checkable when none could be checked at all.
A group for which every probed node is :not_checkable is the "prober
cannot judge" case and changes nothing.
Summary
Functions
Classifies one probe result given the milliseconds it took.
The family of an address in text; nil when it is not an IP address.
The probe milliseconds under which :enetunreach/:ehostunreach look local.
The families that cannot be checked, from the classified results of every address probed for a group in one round (the nodes together).
A node's probe verdict from its classified addresses and the families that are not checkable.
Types
@type classified() :: :ok | :failed | {:local, atom()}
@type entry() :: {String.t(), classified()}
@type family() :: :ipv4 | :ipv6
@type outcome() :: :ok | {:error, atom()}
Functions
@spec classify(outcome(), non_neg_integer()) :: classified()
Classifies one probe result given the milliseconds it took.
The family of an address in text; nil when it is not an IP address.
@spec quick_ms() :: pos_integer()
The probe milliseconds under which :enetunreach/:ehostunreach look local.
The families that cannot be checked, from the classified results of every address probed for a group in one round (the nodes together).
A node's probe verdict from its classified addresses and the families that are not checkable.