In a typical configuration, a Discovery Proxy is configured to be authoritative [
RFC 1034] [
RFC 1035] for four or more DNS subdomains, listed below. Authority for these subdomains is delegated from the parent domain to the Discovery Proxy in the usual way for DNS delegation, via NS records.
-
A DNS subdomain for DNS-based Service Discovery records.
-
This subdomain name may contain rich text, including spaces and other punctuation. This is because this subdomain name is used only in graphical user interfaces, where rich text is appropriate.
-
A DNS subdomain for host name records.
-
This subdomain name SHOULD be limited to letters, digits, and hyphens in order to facilitate the convenient use of host names in command-line interfaces.
-
One or more DNS subdomains for IPv4 Reverse Mapping records.
-
These subdomains will have names that end in "in-addr.arpa".
-
One or more DNS subdomains for IPv6 Reverse Mapping records.
-
These subdomains will have names that end in "ip6.arpa".
In an enterprise network, the naming and delegation of these subdomains is typically performed by conscious action of the network administrator. In a home network, naming and delegation would typically be performed using some automatic configuration mechanism such as Home Networking Control Protocol (HNCP) [
RFC 7788].
These three varieties of delegated subdomains (service discovery, host names, and reverse mapping) are described below in Sections [
5.1], [
5.3], and [
5.4].
How a client discovers where to issue its DNS-based Service Discovery queries is described in
Section 5.2.
In its simplest form, each link in an organization is assigned a unique Unicast DNS domain name such as "Building 1.example.com" or "2nd Floor.Building 3.example.com". Grouping multiple links under a single Unicast DNS domain name is to be specified in a future companion document, but for the purposes of this document, assume that each link has its own unique Unicast DNS domain name. In a graphical user interface these names are not displayed as strings with dots as shown above, but something more akin to a typical file browser graphical user interface (which is harder to illustrate in a text-only document) showing folders, subfolders, and files in a file system.
+---------------+--------------+-------------+-------------------+
| *example.com* | Building 1 | 1st Floor | Alice's printer |
| | Building 2 | *2nd Floor* | Bob's printer |
| | *Building 3* | 3rd Floor | Charlie's printer |
| | Building 4 | 4th Floor | |
| | Building 5 | | |
| | Building 6 | | |
+---------------+--------------+-------------+-------------------+
Each named link in an organization has one or more Discovery Proxies that serve it. This Discovery Proxy function could be performed by a device like a router or switch that is physically attached to that link. In the parent domain, NS records are used to delegate ownership of each defined link name (e.g., "Building 1.example.com") to one or more Discovery Proxies that serve the named link. In other words, the Discovery Proxies are the authoritative name servers for that subdomain. As in the rest of DNS-based Service Discovery, all names are represented as-is using plain UTF-8 encoding and, as described in
Section 5.5.4, no text-encoding translations are performed.
With appropriate VLAN configuration [
IEEE-1Q], a single Discovery Proxy device could have a logical presence on many links and serve as the Discovery Proxy for all those links. In such a configuration, the Discovery Proxy device would have a single physical Ethernet [
IEEE-3] port, configured as a VLAN trunk port, which would appear to software on that device as multiple virtual Ethernet interfaces, one connected to each of the VLAN links.
As an alternative to using VLAN technology, using a Multicast DNS Discovery Relay [
RELAY] is another way that a Discovery Proxy can have a "virtual" presence on a remote link.
When a DNS-SD client issues a Unicast DNS query to discover services in a particular Unicast DNS subdomain (e.g., "_ipp._tcp.Building 1.example.com. PTR ?"), the normal DNS delegation mechanism results in that query being forwarded until it reaches the delegated authoritative name server for that subdomain, namely, the Discovery Proxy on the link in question. Like a conventional Unicast DNS server, a Discovery Proxy implements the usual Unicast DNS protocol [
RFC 1034] [
RFC 1035] over UDP and TCP. However, unlike a conventional Unicast DNS server that generates answers from the data in its manually configured zone file, a Discovery Proxy learns answers using Multicast DNS. A Discovery Proxy does this by consulting its Multicast DNS cache and/or issuing Multicast DNS queries, as appropriate according to the usual protocol rules of Multicast DNS [
RFC 6762], for the corresponding Multicast DNS name, type, and class, with the delegated zone part of the name replaced with ".local" (e.g., in this case, "_ipp._tcp.local. PTR ?"). Then, from the received Multicast DNS data, the Discovery Proxy synthesizes the appropriate Unicast DNS response, with the ".local" top-level label of the owner name replaced with the name of the delegated zone. Further details of the name translation rules are described in
Section 5.5. Rules specifying how long the Discovery Proxy should wait to accumulate Multicast DNS responses before sending its unicast reply are described in
Section 5.6.
The existing Multicast DNS caching mechanism is used to minimize unnecessary Multicast DNS queries on the wire. The Discovery Proxy is acting as a client of the underlying Multicast DNS subsystem and benefits from the same caching and efficiency measures as any other client using that subsystem.
Note that the contents of the delegated zone, generated as it is by performing ".local" Multicast DNS queries, mirrors the records available on the local link via Multicast DNS very closely, but not precisely. There is not a full bidirectional equivalence between the two. Certain records that are available via Multicast DNS may not have equivalents in the delegated zone possibly because they are invalid or not relevant in the delegated zone or because they are being suppressed because they are unusable outside the local link (see
Section 5.5.2). Conversely, certain records that appear in the delegated zone may not have corresponding records available on the local link via Multicast DNS. In particular, there are certain administrative SRV records (see
Section 6) that logically fall within the delegated zone but semantically represent metadata
about the zone rather than records
within the zone. Consequently, these administrative records in the delegated zone do not have any corresponding counterparts in the Multicast DNS namespace of the local link.
A DNS-SD client performs Domain Enumeration [
RFC 6763] via certain PTR queries, using both unicast and multicast.
If a DNS-SD client receives a Domain Name configuration via DHCP then it issues unicast queries derived from this domain name. It also issues unicast queries using names derived from its IPv4 subnet address(es) and IPv6 prefix(es). These unicast Domain Enumeration queries are described in
Section 5.2.1. A DNS-SD client also issues multicast Domain Enumeration queries in the "local" domain [
RFC 6762], as described in
Section 5.2.2. The results of all the Domain Enumeration queries are combined for DNS-based Service Discovery purposes.
The (human or automated) administrator creates Unicast DNS Domain Enumeration PTR records [
RFC 6763] to inform clients of available service discovery domains. Two varieties of such Unicast DNS Domain Enumeration PTR records exist: those with names derived from the domain name communicated to the clients via [
RFC 2132], and those with names derived from either IPv4 subnet address(es) or IPv6 prefix(es) in use by the clients. Below is an example showing the name-based variety, where the DHCP server configured the client with the domain name "example.com":
b._dns-sd._udp.example.com. PTR Building 1.example.com.
PTR Building 2.example.com.
PTR Building 3.example.com.
PTR Building 4.example.com.
db._dns-sd._udp.example.com. PTR Building 1.example.com.
lb._dns-sd._udp.example.com. PTR Building 1.example.com.
The meaning of these records is defined in the [
RFC 6763] but, for convenience, is repeated here. The "b" ("browse") records tell the client device the list of browsing domains to display for the user to select from. The "db" ("default browse") record tells the client device which domain in that list should be selected by default. The "db" domain
MUST be one of the domains in the "b" list; if not, then no domain is selected by default. The "lb" ("legacy browse") record tells the client device which domain to automatically browse on behalf of applications that don't implement user interface for multi-domain browsing (which is most of them at the time of writing). The "lb" domain is often the same as the "db" domain, or sometimes the "db" domain plus one or more others that should be included in the list of automatic browsing domains for legacy clients.
Note that in the example above, for clarity, space characters in names are shown as actual spaces. If this data is manually entered into a textual zone file for authoritative server software such as BIND, care must be taken because the space character is used as a field separator, and other characters like dot ('.'), semicolon (';'), dollar ('$'), backslash ('\'), etc., also have special meaning. These characters have to be escaped when entered into a textual zone file, following the rules in
Section 5.1 of
RFC 1035. For example, a literal space in a name is represented in the textual zone file using '\032', so "Building 1.example.com" is entered as "Building\0321.example.com".
DNS responses are limited to a maximum size of 65535 bytes. This limits the maximum number of domains that can be returned for a Domain Enumeration query as follows:
A DNS response header is 12 bytes. That's typically followed by a single qname (up to 256 bytes) plus qtype (2 bytes) and qclass (2 bytes), leaving 65275 for the Answer Section.
An Answer Section Resource Record consists of:
-
Owner name, encoded as a compression pointer, 2 bytes
-
RRTYPE (type PTR), 2 bytes
-
RRCLASS (class IN), 2 bytes
-
TTL, 4 bytes
-
RDLENGTH, 2 bytes
-
RDATA (domain name), up to 256 bytes
This means that each Resource Record in the Answer Section can take up to 268 bytes total, which means that the Answer Section can contain, in the worst case, no more than 243 domains.
In a more typical scenario, where the domain names are not all maximum-sized names, and there is some similarity between names so that reasonable name compression is possible, each Answer Section Resource Record may average 140 bytes, which means that the Answer Section can contain up to 466 domains.
It is anticipated that this should be sufficient for even a large corporate network or university campus.
In the case where Discovery Proxy functionality is widely deployed within an enterprise (either by having a Discovery Proxy physically on each link, or by having a Discovery Proxy with a remote "virtual" presence on each link using VLANs or Multicast DNS Discovery Relays [
RELAY]), this offers an additional way to provide Domain Enumeration configuration data for clients.
Note that this function of the Discovery Proxy is supplementary to the primary purpose of the Discovery Proxy, which is to facilitate
remote clients discovering services on the Discovery Proxy's local link. This publication of Domain Enumeration configuration data via link-local multicast on the Discovery Proxy's local link is performed for the benefit of
local clients attached to that link, and typically directs those clients to contact other distant Discovery Proxies attached to other links. Generally, a client does not need to use the local Discovery Proxy on its own link, because a client is generally able to perform its own Multicast DNS queries on that link. (The exception to this is when the local Wi-Fi access point is blocking or filtering local multicast traffic, requiring even local clients to use their local Discovery Proxy to perform local discovery.)
A Discovery Proxy can be configured to generate Multicast DNS responses for the following Multicast DNS Domain Enumeration queries issued by clients:
b._dns-sd._udp.local. PTR ?
db._dns-sd._udp.local. PTR ?
lb._dns-sd._udp.local. PTR ?
This provides the ability for Discovery Proxies to indicate recommended browsing domains to DNS-SD clients on a per-link granularity. In some enterprises, it may be preferable to provide this per-link configuration information in the form of Discovery Proxy configuration data rather than by populating the Unicast DNS servers with the same data (in the "ip6.arpa" or "in-addr.arpa" domains).
Regardless of how the network operator chooses to provide this configuration data, clients will perform Domain Enumeration via both unicast and multicast queries and then combine the results of these queries.
DNS-SD service instance names and domains are allowed to contain arbitrary Net-Unicode text [
RFC 5198], encoded as precomposed UTF-8 [
RFC 3629].
Users typically interact with service discovery software by viewing a list of discovered service instance names on a display and selecting one of them by pointing, touching, or clicking. Similarly, in software that provides a multi-domain DNS-SD user interface, users view a list of offered domains on the display and select one of them by pointing, touching, or clicking. To use a service, users don't have to remember domain or instance names, or type them; users just have to be able to recognize what they see on the display and touch or click on the thing they want.
In contrast, host names are often remembered and typed. Also, host names have historically been used in command-line interfaces where spaces can be inconvenient. For this reason, host names have traditionally been restricted to letters, digits, and hyphens (LDH) with no spaces or other punctuation.
While we do want to allow rich text for DNS-SD service instance names and domains, it is advisable, for maximum compatibility with existing usage, to restrict host names to the traditional letter-digit-hyphen rules. This means that while the service name "My Printer._ipp._tcp.Building 1.example.com" is acceptable and desirable (it is displayed in a graphical user interface as an instance called "My Printer" in the domain "Building 1" at "example.com"), the host name "My-Printer.Building 1.example.com" is less desirable (because of the space in "Building 1").
To accommodate this difference in allowable characters, a Discovery Proxy
SHOULD support having two separate subdomains delegated to it for each link it serves: one whose name is allowed to contain arbitrary Net-Unicode text [
RFC 5198], and a second more constrained subdomain whose name is restricted to contain only letters, digits, and hyphens, to be used for host name records (names of 'A' and 'AAAA' address records). The restricted names may be any valid name consisting of only letters, digits, and hyphens, including Punycode-encoded names [
RFC 3492].
For example, a Discovery Proxy could have the two subdomains "Building 1.example.com" and "bldg-1.example.com" delegated to it. The Discovery Proxy would then translate these two Multicast DNS records:
My Printer._ipp._tcp.local. SRV 0 0 631 prnt.local.
prnt.local. A 203.0.113.2
into Unicast DNS records as follows:
My Printer._ipp._tcp.Building 1.example.com.
SRV 0 0 631 prnt.bldg-1.example.com.
prnt.bldg-1.example.com. A 203.0.113.2
Note that the SRV record name is translated using the rich-text domain name ("Building 1.example.com"), and the address record name is translated using the LDH domain ("bldg-1.example.com"). Further details of the name translation rules are described in
Section 5.5.
A Discovery Proxy
MAY support only a single rich-text Net-Unicode domain and use that domain for all records, including 'A' and 'AAAA' address records, but implementers choosing this option should be aware that this choice may produce host names that are awkward to use in command-line environments. Whether or not this is an issue depends on whether users in the target environment are expected to be using command-line interfaces.
A Discovery Proxy
MUST NOT be restricted to support only a letter-digit-hyphen subdomain, because that results in an unnecessarily poor user experience.
As described in
Section 5.2.1, for clarity, in examples here space characters in names are shown as actual spaces. If this dynamically discovered data were to be manually entered into a textual zone file (which it isn't), then spaces would need to be represented using '\032', so "My Printer._ipp._tcp.Building 1.example.com" would become "My\032Printer._ipp._tcp.Building\0321.example.com".
Note that the '\032' representation does not appear in DNS messages sent over the air. In the wire format of DNS messages, spaces are sent as spaces, not as '\032', and likewise, in a graphical user interface at the client device, spaces are shown as spaces, not as '\032'.
A Discovery Proxy can facilitate easier management of reverse mapping domains, particularly for IPv6 addresses where manual management may be more onerous than it is for IPv4 addresses.
To achieve this, in the parent domain, NS records are used to delegate ownership of the appropriate reverse mapping domain to the Discovery Proxy. In other words, the Discovery Proxy becomes the authoritative name server for the reverse mapping domain. For fault tolerance reasons, there may be more than one Discovery Proxy serving a given link.
If a given link is using the IPv4 subnet 203.0.113/24, then the domain "113.0.203.in-addr.arpa" is delegated to the Discovery Proxy for that link.
If a given link is using the IPv6 prefix 2001:0DB8:1234:5678::/64, then the domain "8.7.6.5.4.3.2.1.8.b.d.0.1.0.0.2.ip6.arpa" is delegated to the Discovery Proxy for that link.
When a reverse mapping query arrives at the Discovery Proxy, it issues the identical query on its local link, as a Multicast DNS query. The mechanism to force an apparently unicast name to be resolved using link-local Multicast DNS varies depending on the API set being used. For example, in the "dns_sd.h" APIs (available on macOS, iOS, Bonjour for Windows, Linux, and Android), using kDNSServiceFlagsForceMulticast indicates that the DNSServiceQueryRecord() call should perform the query using Multicast DNS. Other API sets have different ways of forcing multicast queries. When the host owning that IPv4 or IPv6 address responds with a name of the form "something.local", the Discovery Proxy rewrites it to use its configured LDH host name domain instead of ".local" and returns the response to the caller.
For example, a Discovery Proxy with the two subdomains "113.0.203.in-addr.arpa" and "bldg-1.example.com" delegated to it would translate this Multicast DNS record:
2.113.0.203.in-addr.arpa. PTR prnt.local.
into this Unicast DNS response:
2.113.0.203.in-addr.arpa. PTR prnt.bldg-1.example.com.
In this example the "prnt.local" host name is translated using the delegated LDH subdomain, as described in
Section 5.5.
Subsequent queries for the prnt.bldg-1.example.com address record, falling as it does within the bldg-1.example.com domain, which is delegated to this Discovery Proxy, will arrive at this Discovery Proxy where they are answered by issuing Multicast DNS queries and using the received Multicast DNS answers to synthesize Unicast DNS responses, as described above.
Note that this description assumes that all addresses on a given IPv4 subnet or IPv6 prefix are mapped to host names using the Discovery Proxy mechanism. It would be possible to implement a Discovery Proxy that can be configured so that some address-to-name mappings are performed using Multicast DNS on the local link, while other address-to-name mappings within the same IPv4 subnet or IPv6 prefix are configured manually.
For the delegated rich-text and LDH subdomains, generating appropriate Multicast DNS queries involves translating from the configured DNS domain (e.g., "Building 1.example.com") on the Unicast DNS side to ".local" on the Multicast DNS side.
For the delegated reverse-mapping subdomain, generating appropriate Multicast DNS queries involves using the appropriate API mechanism to indicate that a query should be performed using Multicast DNS, as described in
Section 5.4.
Generating appropriate Unicast DNS responses from the received Multicast DNS answers involves translating back from ".local" to the appropriate configured Unicast DNS domain as necessary, as described below.
In the examples below, the delegated subdomains are as follows:
Delegated subdomain for rich-text names Building 1.example.com.
Delegated subdomain for LDH names bldg-1.example.com.
Delegated subdomain for IPv4 reverse mapping 113.0.203.in-addr.arpa.
Names in Multicast DNS answers that do not end in ".local" do not require any translation.
Names in Multicast DNS answers that end in ".local" are only meaningful on the local link, and require translation to make them useable by clients outside the local link.
Names that end in ".local" may appear both as the owner names of received Multicast DNS answer records, and in the RDATA of received Multicast DNS answer records.
In a received Multicast DNS answer record, if the owner name ends with ".local", then the ".local" top-level label is replaced with the name of the delegated subdomain as was used in the originating query.
In a received Multicast DNS answer record, if a name in the RDATA ends with ".local", then the name is translated according to the delegated subdomain that was used in the originating query, as explained below.
For queries in subdomains delegated for LDH host names, ".local" names in RDATA are translated to that delegated LDH subdomain. For example, a query for "thing.bldg-1.example.com" will be translated to a Multicast DNS query for "thing.local". If that query returns this CNAME record:
thing.local. CNAME prnt.local.
then both the owner name and the name in the RDATA are translated from ".local" to the LDH subdomain "bldg-1.example.com":
thing.bldg-1.example.com. CNAME prnt.bldg-1.example.com.
For queries in subdomains delegated for reverse mapping names, ".local" names in RDATA are translated to the delegated LDH subdomain, if one is configured, or to the delegated rich-text subdomain otherwise. For example, consider a reverse mapping query that returns this PTR record:
2.113.0.203.in-addr.arpa. PTR prnt.local.
The owner name is not translated because it does not end in ".local". The name in the RDATA is translated from ".local" to the LDH subdomain "bldg-1.example.com":
2.113.0.203.in-addr.arpa. PTR prnt.bldg-1.example.com.
For queries in subdomains delegated for rich-text names, ".local" names in RDATA are translated according to whether or not they represent host names (i.e., RDATA names that are the owner names of A and AAAA DNS records). RDATA names ending in ".local" that represent host names are translated to the delegated LDH subdomain, if one is configured, or to the delegated rich-text subdomain otherwise. All other RDATA names ending in ".local" are translated to the delegated rich-text subdomain. For example, consider a DNS-SD service browsing PTR query that returns this PTR record for IPP printing:
_ipp._tcp.local. PTR My Printer._ipp._tcp.local.
Both the owner name and the name in the RDATA are translated from ".local" to the rich-text subdomain:
_ipp._tcp.Building 1.example.com.
PTR My Printer._ipp._tcp.Building 1.example.com.
In contrast, consider a query that returns this SRV record for a specific IPP printing instance:
My Printer._ipp._tcp.local. SRV 0 0 631 prnt.local.
As for all queries, the owner name is translated to the delegated subdomain of the originating query, the delegated rich-text subdomain "Building 1.example.com". However, the ".local" name in the RDATA is the target host name field of an SRV record, a field that is used exclusively for host names. Consequently it is translated to the LDH subdomain "bldg-1.example.com", if configured, instead of the rich-text subdomain:
My Printer._ipp._tcp.Building 1.example.com.
SRV 0 0 631 prnt.bldg-1.example.com.
Other beneficial translation and filtering operations are described below.
For efficiency, Multicast DNS typically uses moderately high DNS TTL values. For example, the typical TTL on DNS-SD service browsing PTR records is 75 minutes. What makes these moderately high TTLs acceptable is the cache coherency mechanisms built in to the Multicast DNS protocol, which protect against stale data persisting for too long. When a service shuts down gracefully, it sends goodbye packets to remove its service browsing PTR record(s) immediately from neighboring caches. If a service shuts down abruptly without sending goodbye packets, the Passive Observation Of Failures (POOF) mechanism described in
Section 10.5 of
RFC 6762 comes into play to purge the cache of stale data.
A traditional Unicast DNS client on a distant remote link does not get to participate in these Multicast DNS cache coherency mechanisms on the local link. For traditional Unicast DNS queries (those received without using Long-Lived Queries (LLQ) [
RFC 8764] or DNS Push Notification subscriptions [
RFC 8765]), the DNS TTLs reported in the resulting Unicast DNS response
MUST be capped to be no more than ten seconds.
Similarly, for negative responses, the negative caching TTL indicated in the SOA record [
RFC 2308] should also be ten seconds (see
Section 6.1).
This value of ten seconds is chosen based on user-experience considerations.
For negative caching, suppose a user is attempting to access a remote device (e.g., a printer), and they are unsuccessful because that device is powered off. Suppose they then place a telephone call and ask for the device to be powered on. We want the device to become available to the user within a reasonable time period. It is reasonable to expect it to take on the order of ten seconds for a simple device with a simple embedded operating system to power on. Once the device is powered on and has announced its presence on the network via Multicast DNS, we would like it to take no more than a further ten seconds for stale negative cache entries to expire from Unicast DNS caches, making the device available to the user desiring to access it.
Similar reasoning applies to capping positive TTLs at ten seconds. In the event of a device moving location, getting a new DHCP address, or other renumbering events, we would like the updated information to be available to remote clients in a relatively timely fashion.
However, network administrators should be aware that many recursive resolvers by default are configured to impose a minimum TTL of 30 seconds. If stale data appears to be persisting in the network to the extent that it adversely impacts user experience, network administrators are advised to check the configuration of their recursive resolvers.
For received Unicast DNS queries that use LLQ [
RFC 8764] or DNS Push Notifications [
RFC 8765], the Multicast DNS record's TTL
SHOULD be returned unmodified, because the notification channel exists to inform the remote client as records come and go. For further details about Long-Lived Queries and its newer replacement, DNS Push Notifications, see
Section 5.6.
A Discovery Proxy
SHOULD offer a configurable option, enabled by default, to suppress Unicast DNS answers for records that are not useful outside the local link. When the option to suppress unusable records is enabled:
-
For a Discovery Proxy that is serving only clients outside the local link, DNS A and AAAA records for IPv4 link-local addresses [RFC 3927] and IPv6 link-local addresses [RFC 4862] SHOULD be suppressed.
-
Similarly, for sites that have multiple private address realms [RFC 1918], in cases where the Discovery Proxy can determine that the querying client is in a different address realm, private addresses SHOULD NOT be communicated to that client.
-
IPv6 Unique Local Addresses [RFC 4193] SHOULD be suppressed in cases where the Discovery Proxy can determine that the querying client is in a different IPv6 address realm.
-
By the same logic, DNS SRV records that reference target host names that have no addresses usable by the requester should be suppressed, and likewise, DNS-SD service browsing PTR records that point to unusable SRV records should similarly be suppressed.
Multicast DNS devices do not routinely announce their records on the network. Generally, they remain silent until queried. This means that the complete set of Multicast DNS records in use on a link can only be discovered by active querying, not by passive listening. Because of this, a Discovery Proxy can only know what names exist on a link by issuing queries for them, and since it would be impractical to issue queries for every possible name just to find out which names exist and which do not, a Discovery Proxy cannot programmatically generate the traditional Unicast DNS NSEC [
RFC 4034] and NSEC3 [
RFC 5155] records that assert the nonexistence of a large range of names.
When queried for an NSEC or NSEC3 record type, the Discovery Proxy issues a qtype "ANY" query using Multicast DNS on the local link and then generates an NSEC or NSEC3 response with a Type Bit Map signifying which record types do and do not exist for just the specific name queried, and no other names.
Multicast DNS NSEC records received on the local link
MUST NOT be forwarded unmodified to a unicast querier, because there are slight differences in the NSEC record data. In particular, Multicast DNS NSEC records do not have the NSEC bit set in the Type Bit Map, whereas conventional Unicast DNS NSEC records do have the NSEC bit set.
A Discovery Proxy does no translation between text encodings. Specifically, a Discovery Proxy does no translation between Punycode encoding [
RFC 3492] and UTF-8 encoding [
RFC 3629], either in the owner name of DNS records or anywhere in the RDATA of DNS records (such as the RDATA of PTR records, SRV records, NS records, or other record types like TXT, where it is ambiguous whether the RDATA may contain DNS names). All bytes are treated as-is with no attempt at text-encoding translation. A client implementing DNS-based Service Discovery [
RFC 6763] will use UTF-8 encoding for its unicast DNS-based Service Discovery queries, which the Discovery Proxy passes through without any text-encoding translation to the Multicast DNS subsystem. Responses from the Multicast DNS subsystem are similarly returned, without any text-encoding translation, back to the requesting unicast client.
There may be cases where Application-Specific Data Translation is appropriate.
For example, AirPrint printers tend to advertise fairly verbose information about their capabilities in their DNS-SD TXT record. TXT record sizes in the range of 500-1000 bytes are not uncommon. This information is a legacy from lineprinter (LPR) printing, because LPR does not have in-band capability negotiation, so all of this information is conveyed using the DNS-SD TXT record instead. Internet Printing Protocol (IPP) printing does have in-band capability negotiation, but for convenience, printers tend to include the same capability information in their IPP DNS-SD TXT records as well. For local Multicast DNS (mDNS) use, this extra TXT record information is wasteful but not fatal. However, when a Discovery Proxy aggregates data from multiple printers on a link, and sends it via unicast (via UDP or TCP), this amount of unnecessary TXT record information can result in large responses. A DNS reply over TCP carrying information about 70 printers with an average of 700 bytes per printer adds up to about 50 kilobytes of data. Therefore, a Discovery Proxy that is aware of the specifics of an application-layer protocol such as AirPrint (which uses IPP) can elide unnecessary key/value pairs from the DNS-SD TXT record for better network efficiency.
Also, the DNS-SD TXT record for many printers contains an "adminurl" key (e.g., "adminurl=http://printername.local/status.html"). For this URL to be useful outside the local link, the embedded ".local" host name needs to be translated to an appropriate name with larger scope. It is easy to translate ".local" names when they appear in well-defined places: as a record's owner name, or in domain name fields in the RDATA of record types like PTR and SRV. In the printing case, some application-specific knowledge about the semantics of the "adminurl" key is needed for the Discovery Proxy to know that it contains a name that needs to be translated. This is somewhat analogous to the need for NAT gateways to contain ALGs (Application-Level Gateways) to facilitate the correct translation of protocols that embed addresses in unexpected places.
To avoid the need for application-specific knowledge about the semantics of particular TXT record keys, protocol designers are advised to avoid placing link-local names or link-local IP addresses in TXT record keys if translation of those names or addresses would be required for off-link operation. In the printing case, the consequence of failing to translate the "adminurl" key correctly would be that, when accessed from a different link, printing will still work, but clicking the "Admin" user interface button will fail to open the printer's administration page. Rather than duplicating the host name from the service's SRV record in its "adminurl" key, thereby having the same host name appear in two places, a better design might have been to omit the host name from the "adminurl" key and instead have the client implicitly substitute the target host name from the service's SRV record in place of a missing host name in the "adminurl" key. That way, the desired host name only appears once and is in a well-defined place where software like the Discovery Proxy is expecting to find it.
Note that this kind of Application-Specific Data Translation is expected to be very rare; it is the exception rather than the rule. This is an example of a common theme in computing. It is frequently the case that it is wise to start with a clean, layered design with clear boundaries. Then, in certain special cases, those layer boundaries may be violated where the performance and efficiency benefits outweigh the inelegance of the layer violation.
These layer violations are optional. They are done primarily for efficiency reasons and generally should not be required for correct operation. A Discovery Proxy
MAY operate solely at the mDNS layer without any knowledge of semantics at the DNS-SD layer or above.
In a simple analysis, simply gathering multicast answers and forwarding them in a unicast response seems adequate, but it raises the question of how long the Discovery Proxy should wait to be sure that it has received all the Multicast DNS answers it needs to form a complete Unicast DNS response. If it waits too little time, then it risks its Unicast DNS response being incomplete. If it waits too long, then it creates a poor user experience at the client end. In fact, there may be no time that is both short enough to produce a good user experience and at the same time long enough to reliably produce complete results.
Similarly, the Discovery Proxy (the authoritative name server for the subdomain in question) needs to decide what DNS TTL to report for these records. If the TTL is too long, then the recursive resolvers issuing queries on behalf of their clients risk caching stale data for too long. If the TTL is too short, then the amount of network traffic will be more than necessary. In fact, there may be no TTL that is both short enough to avoid undesirable stale data and, at the same time, long enough to be efficient on the network.
Both these dilemmas are solved by the use of DNS Long-Lived Queries (LLQ) [
RFC 8764] or its newer replacement, DNS Push Notifications [
RFC 8765].
Clients supporting unicast DNS-based Service Discovery
SHOULD implement DNS Push Notifications [
RFC 8765] for improved user experience.
Clients and Discovery Proxies
MAY support both LLQ and DNS Push Notifications, and when talking to a Discovery Proxy that supports both, the client may use either protocol, as it chooses, though it is expected that only DNS Push Notifications will continue to be supported in the long run.
When a Discovery Proxy receives a query using LLQ or DNS Push Notifications, it responds immediately using the Multicast DNS records it already has in its cache (if any). This provides a good client user experience by providing a near-instantaneous response. Simultaneously, the Discovery Proxy issues a Multicast DNS query on the local link to discover if there are any additional Multicast DNS records it did not already know about. Should additional Multicast DNS responses be received, these are then delivered to the client using additional LLQ or DNS Push Notification update messages. The timeliness of such update messages is limited only by the timeliness of the device responding to the Multicast DNS query. If the Multicast DNS device responds quickly, then the update message is delivered quickly. If the Multicast DNS device responds slowly, then the update message is delivered slowly. The benefit of using multiple update messages to deliver results as they become available is that the Discovery Proxy can respond promptly because it doesn't have to deliver all the results in a single response that needs to be delayed to allow for the expected worst-case delay for receiving all the Multicast DNS responses.
With a proxy that supported only standard DNS queries, even if it were to try to provide reliability by assuming an excessively pessimistic worst-case time (thereby giving a very poor user experience), there would still be the risk of a slow Multicast DNS device taking even longer than that worst-case time (e.g., a device that is not even powered on until ten seconds after the initial query is received), resulting in incomplete responses. Using update messages to deliver subsequent asynchronous replies solves this dilemma: even very late responses are not lost; they are delivered in subsequent update messages.
Note that while normal DNS queries are generally received via the client's configured recursive resolver, LLQ and DNS Push Notification subscriptions may be received directly from the client.
There are two factors that determine how unicast responses are generated:
The first factor is whether or not the Discovery Proxy already has at least one record in its cache that answers the question.
The second factor is whether the client used a normal DNS query, or established a subscription using LLQ or DNS Push Notifications. Normal DNS queries are typically used for one-shot operations like SRV or address record queries. LLQ and DNS Push Notification subscriptions are typically used for long-lived service browsing PTR queries. Normal DNS queries and LLQ each have different response timing depending on the cache state, yielding the first four cases listed below. DNS Push Notifications, the newer protocol, has uniform behavior regardless of cache state, yielding the fifth case listed below.
-
Standard DNS query; no answer in cache:
Issue an mDNS query on the local link, exactly as a local client would issue an mDNS query, for the desired record name, type, and class, including retransmissions, as appropriate, according to the established mDNS retransmission schedule [RFC 6762]. The Discovery Proxy awaits Multicast DNS responses.
As soon as any Multicast DNS response packet is received that contains one or more positive answers to that question (with or without the Cache Flush bit [RFC 6762] set) or a negative answer (signified via a Multicast DNS NSEC record [RFC 6762]), the Discovery Proxy generates a Unicast DNS response message containing the corresponding (filtered and translated) answers and sends it to the remote client.
If after six seconds no relevant Multicast DNS answers have been received, cancel the mDNS query and return a negative response to the remote client. Six seconds is enough time for the underlying Multicast DNS subsystem to transmit three mDNS queries and allow some time for responses to arrive.
(Reasoning: Queries not using LLQ or Push Notifications are generally queries that expect an answer from only one device, so the first response is also the only response.)
DNS TTLs in responses MUST be capped to at most ten seconds.
-
Standard DNS query; at least one answer in cache:
No local mDNS queries are performed.
The Discovery Proxy generates a Unicast DNS response message containing the answer(s) from the cache right away, to minimize delay.
(Reasoning: Queries not using LLQ or Push Notifications are generally queries that expect an answer from only one device. Given RRSet TTL harmonization, if the proxy has one Multicast DNS answer in its cache, it can reasonably assume that it has the whole set.)
DNS TTLs in responses MUST be capped to at most ten seconds.
-
Long-Lived Query (LLQ); no answer in cache:
As in the case above with no answer in the cache, plan to perform mDNS querying for six seconds, returning an LLQ response message to the remote client as soon as any relevant mDNS response is received.
If after six seconds no relevant mDNS answers have been received, and the client has not cancelled its Long-Lived Query, return a negative LLQ response message to the remote client.
(Reasoning: We don't need to rush to send an empty answer.)
Regardless of whether or not a relevant mDNS response is received within six seconds, the Long-Lived Query remains active for as long as the client maintains the LLQ state, and results in the ongoing transmission of mDNS queries until the Long-Lived Query is cancelled. If the set of mDNS answers changes, LLQ Event Response messages are sent.
DNS TTLs in responses are returned unmodified.
-
Long-Lived Query (LLQ); at least one answer in cache:
As in the case above with at least one answer in the cache, the Discovery Proxy generates a unicast LLQ response message containing the answer(s) from the cache right away, to minimize delay.
The Long-Lived Query remains active for as long as the client maintains the LLQ state, and results in the transmission of mDNS queries (with appropriate Known Answer lists) to determine if further answers are available. If the set of mDNS answers changes, LLQ Event Response messages are sent.
(Reasoning: We want a user interface that is displayed very rapidly yet continues to remain accurate even as the network environment changes.)
DNS TTLs in responses are returned unmodified.
-
Push Notification Subscription
The Discovery Proxy acknowledges the subscription request immediately.
If one or more answers are already available in the cache, those answers are then sent in an immediately following DNS PUSH message.
The Push Notification subscription remains active until the client cancels the subscription, and results in the transmission of mDNS queries (with appropriate Known Answer lists) to determine if further answers are available. If the set of mDNS answers changes, further DNS PUSH messages are sent.
(Reasoning: We want a user interface that is displayed very rapidly yet continues to remain accurate even as the network environment changes.)
DNS TTLs in responses are returned unmodified.
Where the text above refers to returning "a negative response to the remote client", it is describing returning a "no error no answer" negative response, not NXDOMAIN. This is because the Discovery Proxy cannot know all the Multicast DNS domain names that may exist on a link at any given time, so any name with no answers may have child names that do exist, making it an "empty non-terminal" name.
Note that certain aspects of the behavior described here do not have to be implemented overtly by the Discovery Proxy; they occur naturally as a result of using existing Multicast DNS APIs.
For example, in the first case above (standard DNS query and no answers in the cache), if a new Multicast DNS query is requested (either by a local client on the Discovery Proxy device, or by the Discovery Proxy software on that device on behalf of a remote client), and there is not already an identical Multicast DNS query active and there are no matching answers already in the Multicast DNS cache on the Discovery Proxy device, then this will cause a series of Multicast DNS query packets to be issued with exponential backoff. The exponential backoff sequence in some implementations starts at one second and then doubles for each retransmission (0, 1, 3, 7 seconds, etc.), and in others, it starts at one second and then triples for each retransmission (0, 1, 4, 13 seconds, etc.). In either case, if no response has been received after six seconds, that is long enough that the underlying Multicast DNS implementation will have sent three query packets without receiving any response. At that point, the Discovery Proxy cancels its Multicast DNS query (so no further Multicast DNS query packets will be sent for this query) and returns a negative response to the remote client via unicast.
The six-second delay is chosen to be long enough to give enough time for devices to respond, yet short enough not to be too onerous for a human user waiting for a response. For example, using the "dig" DNS debugging tool, the current default settings result in it waiting a total of 15 seconds for a reply (three transmissions of the DNS UDP query packet, with a wait of 5 seconds after each packet), which is ample time for it to have received a negative reply from a Discovery Proxy after six seconds.
The text above states that for a standard DNS query, if at least one answer is already available in the cache, then a Discovery Proxy should not issue additional mDNS query packets. This also occurs naturally as a result of using existing Multicast DNS APIs. If a new Multicast DNS query is requested (either locally, or by the Discovery Proxy on behalf of a remote client) for which there are relevant answers already in the Multicast DNS cache on the Discovery Proxy device, and after the answers are delivered the Multicast DNS query is immediately cancelled, then no Multicast DNS query packets will be generated for this query.