mDNS registrars that support the TSR option MUST check incoming messages for the presence of an EDNS(0) option containing
TSR options. mDNS registrars that do not support TSR will not do this check, and will behave as if no TSR options are present.
For non-proxy use cases, this should make no difference, since in such cases if multiple devices advertise records
on the same owner name, these are actually in conflict. However, for the proxy use case, what this means is that two
proxies that are proxying the same data cannot interoperate if one supports TSR and the other doesn't.¶
It is important to note that mDNS messages, particularly in the case of proxies, can contain combined information
answering multiple queries that may be outstanding, and as such, it's entirely possible for a mDNS message sent by an
mDNS registrar that supports TSR to contain some answers for which there is TSR data, and some answers for which there
is not. It's equally possible that such a registrar will send mDNS packets containing no TSR options at all.¶
When an mDNS message contains TSR options, for each TSR option in an mDNS message, the mDNS registrar first determines
the owner name of the TSR option by assigning
an index to each non-question resource record in the mDNS message. The 'RR index' of each TSR option is then matched to the
index of a resource record, and the owner name for that resource record is applied to the TSR option. The time on the TSR
option is then computed by taking the current local clock time and subtracting from it the 'Time Offset' value in
the TSR option.¶
If there is a TSR option in an mDNS message for which there is no matching resource record in the mDNS message, the mDNS
registrar MUST ignore that TSR option. The mDNS registrar MUST NOT use the 'RR Index' value in the TSR option to search across the
mDNS packet since such an index can easily be out of bounds.¶
Now, for each record in the mDNS message, the mDNS registrar first determines whether the record is an OPT record, is in
the question section, or is a known answer (QD bit = 0 and it's a record in the answer section). For all such records, no
special processing is done for TSRs, since no TSR should exist in the mDNS message.¶
For each remaining resource record in the mDNS message, the mDNS registrar MUST check to see if there is a TSR option in
the mDNS message for that owner name. If there is not, the mDNS registrar MUST check to see if there is TSR data with that
owner name locally. If there is not, the record is processed normally.¶
If there is local TSR data for the record's owner name, but no TSR data for that owner name in the mDNS message,
the mDNS registrar checks to see if there are any resource records
in the local registration database on that name. If there are, all such records are treated as in
conflict. This conflict exists even if the locally registered records are all shared records. In cases where there are
records on the name in the cache, those records are all discarded, because they are in conflict with the new data.¶
In the case that there is TSR data for the record in the mDNS message, and there are local records on the same owner name
for which there is no local TSR data, this always means that any
data is in conflict. How that conflict is addressed depends on the data. First, note that resource records in the answer
section of an mDNS Query (QR bit in the header is 0) are "known answers" and therefore are not relevant when adding data
to the cache. Such records can never have TSR options associated with them. However, resource records in
the authority and additional sections of a query do need to be processed (but in the case of authority records, are not
added to the cache).¶
In cases where the TSR data for a particular name is present both locally and in the mDNS message, the mDNS registrar
MUST compare the key checksums. If these are different, then the records are always in conflict, and are handled according
to the context of the conflict, as described in Section 9 of [RFC6762].¶
In cases where the key checksums match, the mDNS registrar MUST compare the times. When the TSR time from the mDNS message
is more recent than the local TSR time, the local data in the cache is flushed.
Stale data in the local registration database is removed, and the mDNS registrant is informed that this data is stale.¶
When the TSR times are the same, any resource records on that name in the answer section and additional section are added
to the cache.¶
When the local TSR time is more recent, the data in the message is not added to the cache, and no action is taken with
respect to any locally-registered data.¶