<?xml version="1.0" encoding="UTF-8"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
    which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
    There has to be one entity for each item to be referenced.
    An alternate method (rfc include) is described in the references. -->

<!ENTITY RFC0768 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.0768.xml">
<!ENTITY RFC0793 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.0793.xml">
<!ENTITY RFC1034 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.1034.xml">
<!ENTITY RFC1035 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.1035.xml">
<!ENTITY RFC1123 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.1123.xml">
<!ENTITY RFC2119 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC2136 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2136.xml">
<!ENTITY RFC2308 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2308.xml">
<!ENTITY RFC2782 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2782.xml">
<!ENTITY RFC4287 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4287.xml">
<!ENTITY RFC4953 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4953.xml">
<!ENTITY RFC5077 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5077.xml">
<!ENTITY RFC5246 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5246.xml">
<!ENTITY RFC6066 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6066.xml">
<!ENTITY RFC6281 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6281.xml">
<!ENTITY RFC6762 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6762.xml">
<!ENTITY RFC6763 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6763.xml">
<!ENTITY RFC6824 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6824.xml">
<!ENTITY RFC6895 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6895.xml">
<!ENTITY RFC7413 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7413.xml">
<!ENTITY RFC7525 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7525.xml">
<!ENTITY RFC7673 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7673.xml">
<!ENTITY RFC7719 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7719.xml">
<!ENTITY RFC7766 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7766.xml">
<!ENTITY RFC7858 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7858.xml">
<!ENTITY RFC8010 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8010.xml">
<!ENTITY RFC8011 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8011.xml">
<!ENTITY RFC8174 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC8310 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8310.xml">
<!ENTITY RFC8446 SYSTEM  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8446.xml">
<!ENTITY I-D.dukkipati-tcpm-tcp-loss-probe SYSTEM  "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.dukkipati-tcpm-tcp-loss-probe.xml">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs),
    please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
    (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space
    (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="std" docName="draft-ietf-dnssd-push-15" ipr="trust200902">
 <!-- category values: std, bcp, info, exp, and historic
    ipr values: trust200902, noModificationTrust200902, noDerivativesTrust200902,
       or pre5378Trust200902
    you can add the attributes updates="NNNN" and obsoletes="NNNN"
    they will automatically be output with "(if approved)" -->

 <!-- ***** FRONT MATTER ***** -->

 <front>
   <!-- The abbreviated title is used in the page header - it is only necessary if the
        full title is longer than 39 characters -->

   <title abbrev="DNS Push Notifications">DNS Push Notifications</title>

   <!-- add 'role="editor"' below for the editors if appropriate -->

   <!-- Another author who claims to be an editor -->

   <author fullname="Tom Pusateri" initials="T.J." surname="Pusateri">
     <organization>Unaffiliated</organization>
     <?v3xml2rfc silence=".*[Pp]ostal address" ?>
     <address>
       <postal>
         <street></street>
         <!-- Reorder these if your country does things differently -->
         <city>Raleigh</city>
         <region>NC</region>
         <code>27608</code>
         <country>USA</country>
       </postal>
       <phone>+1 919 867 1330</phone>
       <email>pusateri@bangj.com</email>
       <!-- uri and facsimile elements may also be added -->
     </address>
   </author>
   <author fullname="Stuart Cheshire" initials="S." surname="Cheshire">
     <organization>Apple Inc.</organization>

     <address>
       <postal>
         <street>1 Infinite Loop</street>
         <!-- Reorder these if your country does things differently -->
         <city>Cupertino</city>
         <region>CA</region>
         <code>95014</code>
         <country>USA</country>
       </postal>
       <phone>+1 408 974 3207</phone>
       <email>cheshire@apple.com</email>
       <!-- uri and facsimile elements may also be added -->
     </address>
   </author>

   <?v3xml2rfc silence="The document date .*? is more than 3 days away from today's date" ?>
   <date year='2018' month='September' day='17'/>

   <!-- If the month and year are both specified and are the current ones, xml2rfc will fill
        in the current day for you. If only the current year is specified, xml2rfc will fill
        in the current day and month for you. If the year is not the current one, it is
        necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the
        purpose of calculating the expiry date).  With drafts it is normally sufficient to
        specify just the year. -->

   <!-- Meta-data Declarations -->

   <area>DNSSD</area>

   <workgroup>Internet Engineering Task Force</workgroup>

   <!-- WG name at the upper left corner of the doc,
        IETF is fine for individual submissions.
        If this element is not present, the default is "Network Working Group",
        which is used by the RFC Editor as a nod to the history of the IETF. -->

   <keyword>dns update push notification</keyword>

   <!-- Keywords will be incorporated into HTML output
        files in a meta tag but they have no effect on text or nroff
        output. If you submit your draft to the RFC Editor, the
        keywords will be used for the search engine. -->

   <abstract>
     <t>The Domain Name System (DNS) was designed to return matching records
     efficiently for queries for data that are relatively static.
     When those records change frequently, DNS is still efficient at returning
     the updated results when polled, as long as the polling rate is not too high.
     But there exists no mechanism
     for a client to be asynchronously notified when these changes occur.
     This document defines a mechanism for a client to be notified
     of such changes to DNS records, called DNS Push Notifications.</t>
   </abstract>
 </front>

 <middle>
<?rfc needLines="12" ?>
   <section title="Introduction">

     <t>Domain Name System (DNS) records may be updated using <xref target="RFC2136">DNS Update</xref>.
     Other mechanisms such as a <xref target="DisProx">Discovery Proxy</xref> can also generate changes to a DNS zone.
     This document specifies a protocol for DNS clients to subscribe to receive asynchronous notifications of changes to RRSets of interest. It is immediately relevant in the case of <xref target="RFC6763">DNS Service Discovery</xref> but is not limited to that use case, and provides a general DNS mechanism for DNS record change notifications. Familiarity with the DNS protocol and DNS packet formats is assumed <xref target="RFC1034"/> <xref target="RFC1035"/> <xref target="RFC6895"/>.</t>

<?rfc needLines="7" ?>
     <section title="Requirements Language">
       <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
       "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY",
       and "OPTIONAL" in this document are to be interpreted as described
       in "Key words for use in RFCs to Indicate Requirement Levels",
       when, and only when, they appear in all capitals, as shown here
       <xref target="RFC2119"/> <xref target="RFC8174"/>.</t>
<?rfc needLines="40" ?>
     </section>
   </section>

   <section title="Motivation">
     <t>As the domain name system continues to adapt to new uses and changes in deployment, polling has the potential to burden DNS servers at many levels throughout the network. Other network protocols have successfully deployed a publish/subscribe model following the <xref target="obs">Observer design pattern</xref>.
     <xref target="XEP0060">XMPP Publish-Subscribe</xref> and <xref target="RFC4287">Atom</xref> are examples. While DNS servers are generally highly tuned and capable of a high rate of query/response traffic, adding a publish/subscribe model for tracking changes to DNS records can deliver more timely notification of changes with reduced CPU usage and lower network traffic.</t>

     <t><xref target="RFC6762">Multicast DNS</xref> implementations always listen on a well known link-local IP multicast group, and record changes are sent to that multicast group address for all group members to receive. Therefore, Multicast DNS already has asynchronous change notification capability. However, when <xref target="RFC6763">DNS Service Discovery</xref> is used across a wide area network using Unicast DNS (possibly facilitated via a <xref target="DisProx">Discovery Proxy</xref>) it would be beneficial to have an equivalent capability for Unicast DNS, to allow clients to learn about DNS record changes in a timely manner without polling.</t>

     <t>The <xref target="LLQ">DNS Long-Lived Queries (LLQ) mechanism</xref> is an existing deployed solution to provide asynchronous change notifications, used by Apple's <xref target="RFC6281">Back to My Mac Service</xref>
     introduced in Mac OS X 10.5 Leopard in 2007.
     Back to My Mac was designed in an era when the data center operations staff asserted that it was impossible for a server to handle large numbers of mostly-idle TCP connections, so LLQ was defined as a UDP-based protocol, effectively replicating much of TCP's connection state management logic in user space, and creating its own poor imitations of existing TCP features like the three-way handshake, flow control, and reliability.</t>

     <t>This document builds on experience gained with the LLQ protocol, with an improved design.
     Instead of using UDP, this specification uses
     <xref target="DSO">DNS Stateful Operations (DSO)</xref>
     running over TLS over TCP,
     and therefore doesn't need to reinvent existing TCP functionality.
     Using TCP also gives long-lived low-traffic connections better longevity through NAT gateways
     without resorting to excessive keepalive traffic.
     Instead of inventing a new vocabulary of messages to communicate DNS zone changes as LLQ did, this specification borrows the established syntax and semantics of <xref target="RFC2136">DNS Update messages</xref>.</t>

<?rfc needLines="9" ?>
   </section>

   <section title="Overview">
     <t>The existing <xref target="RFC2136">DNS Update protocol</xref> provides a mechanism for clients to add or delete individual resource records (RRs) or entire resource record sets (RRSets) on the zone's server.</t>

     <t>This specification adopts a simplified subset of these existing syntax and semantics, and uses them for DNS Push Notification messages going in the opposite direction, from server to client, to communicate changes to a zone. The client subscribes for Push Notifications by connecting to the server and sending DNS message(s) indicating the RRSet(s) of interest. When the client loses interest in receiving further updates to these records, it unsubscribes.</t>

     <t>The DNS Push Notification server for a zone is any server capable
     of generating the correct change notifications for a name.
     It may be a primary, secondary, or stealth name server <xref target="RFC7719"/>.
     Consequently, the <spanx style="verb">_dns&nbhy;push&nbhy;tls._tcp.&lt;zone&gt;</spanx> SRV record for a
     zone MAY reference the same target host and port as that zone's
     <spanx style="verb">_dns&nbhy;update&nbhy;tls._tcp.&lt;zone&gt;</spanx> SRV record. When the same target host and port is offered for both DNS Updates and DNS Push Notifications, a client MAY use a single TCP connection to that server for both DNS Updates and DNS Push Notification Subscriptions.</t>

     <t>Supporting DNS Updates and DNS Push Notifications on the same server is OPTIONAL. A DNS Push Notification server does NOT also have to support DNS Update.</t>

     <t>DNS Updates and DNS Push Notifications may be handled on different ports on the same target host, in which case they are not considered to be the "same server" for the purposes of this specification, and communications with these two ports are handled independently.</t>

     <t>Standard DNS Queries MAY be sent over a DNS Push Notification connection, provided that these are queries for names falling within the server's zone (the &lt;zone&gt; in the <spanx style="verb">_dns&nbhy;push&nbhy;tls._tcp.&lt;zone&gt;</spanx> SRV record). The RD (Recursion Desired) bit MUST be zero. If a query is received with the RD bit set, matching records for names falling within the server's zones should be returned with the RA (Recursion Available) bit clear. If the query is for a name not in the server's zone, an error with RCODE NOTAUTH (Not Authoritative) should be returned.</t>

     <t>DNS Push Notification clients are NOT required to implement DNS Update Prerequisite processing. Prerequisites are used to perform tentative atomic test-and-set type operations when a client updates records on a server, and that concept has no applicability when it comes to an authoritative server unilaterally informing a client of changes to DNS records.</t>

     <t>This DNS Push Notification specification includes support for DNS classes, for completeness. However, in practice, it is anticipated that for the foreseeable future the only DNS class in use will be DNS class "IN", as is the reality today with existing DNS servers and clients. A DNS Push Notification server MAY choose to implement only DNS class "IN". If messages are received for a class other than "IN", and that class is not supported, an error with RCODE NOTIMPL (Not Implemented) should be returned.</t>

     <t>DNS Push Notifications impose less load on the responding server than rapid polling would, but Push Notifications do still have a cost, so DNS Push Notification clients must not recklessly create an excessive number of Push Notification subscriptions. Specifically:</t>

     <t>(a) A subscription should only be active when there is a valid reason to need live data (for example, an on-screen display is currently showing the results to the user) and the subscription SHOULD be cancelled as soon as the need for that data ends (for example, when the user dismisses that display). Implementations MAY want to implement idle timeouts, so that if the user ceases interacting with the device, the display showing the result of the DNS Push Notification subscription is automatically dismissed after a certain period of inactivity. For example, if a user presses the "Print" button on their smartphone, and then leaves the phone showing the printer discovery screen until the phone goes to sleep, then the printer discovery screen should be automatically dismissed as the device goes to sleep. If the user does still intend to print, this will require them to press the "Print" button again when they wake their phone up.</t>

     <t>(b) A DNS Push Notification client SHOULD NOT routinely keep a DNS Push Notification subscription active 24 hours a day, 7 days a week, just to keep a list in memory up to date so that if the user does choose to bring up an on-screen display of that data, it can be displayed really fast. DNS Push Notifications are designed to be fast enough that there is no need to pre-load a "warm" list in memory just in case it might be needed later.</t>

     <t>Generally, as described in the <xref target="DSO">DNS Stateful Operations specification</xref>, a client must not keep a session to a server open indefinitely if it has no subscriptions (or other operations) active on that session. A client MAY close a session as soon as it becomes idle, and then if needed in the future, open a new session when required. Alternatively, a client MAY speculatively keep an idle session open for some time, subject to the constraint that it MUST NOT keep a session open that has been idle for more than the session's idle timeout (15 seconds by default).</t>
<?rfc needLines="9" ?>
   </section>

   <section title="Transport">
     <t>Other DNS operations like <xref target="RFC2136">DNS Update</xref> MAY use either User Datagram Protocol <xref target="RFC0768">(UDP)</xref> or Transmission Control Protocol <xref target="RFC0793">(TCP)</xref> as the transport protocol, in keeping with the historical precedent that DNS queries must first be sent over UDP <xref target="RFC1123"/>. This requirement to use UDP has subsequently been relaxed <xref target="RFC7766"/>.</t>

     <t>In keeping with the more recent precedent, DNS Push Notification is defined only for TCP.
     DNS Push Notification clients MUST use
     <xref target="DSO">DNS Stateful Operations (DSO)</xref>
     running over TLS over TCP <xref target="RFC7858"/>.</t>

     <t>Connection setup over TCP ensures return reachability and alleviates concerns of state overload at the server through anonymous subscriptions. All subscribers are guaranteed to be reachable by the server by virtue of the TCP three-way handshake.
     Flooding attacks are possible with any protocol, and a benefit of TCP is that there are already established industry best practices to guard against SYN flooding and similar attacks <xref target="SYN"/> <xref target="RFC4953"/>.</t>

     <t>Use of TCP also allows DNS Push Notifications to take advantage of current and future developments in TCP, such as
     <xref target="RFC6824">Multipath TCP (MPTCP)</xref>,
     <xref target="RFC7413">TCP Fast Open (TFO)</xref>,
     <xref target="I-D.dukkipati-tcpm-tcp-loss-probe">Tail Loss Probe (TLP)</xref>, and so on.</t>

     <t>Transport Layer Security <xref target="RFC5246">(TLS)</xref> is well understood and deployed across many protocols running over TCP. It is designed to prevent eavesdropping, tampering, and message forgery. TLS is REQUIRED for every connection between a client subscriber and server in this protocol specification. Additional security measures such as client authentication during TLS negotiation MAY also be employed to increase the trust relationship between client and server.</t>

<?rfc needLines="25" ?>
   </section>

   <section title="State Considerations">
     <t>Each DNS Push Notification server is capable of handling some finite number of Push Notification subscriptions. This number will vary from server to server and is based on physical machine characteristics, network bandwidth, and operating system resource allocation. After a client establishes a session to a DNS server, each subscription is individually accepted or rejected. Servers may employ various techniques to limit subscriptions to a manageable level. Correspondingly, the client is free to establish simultaneous sessions to alternate DNS servers that support DNS Push Notifications for the zone and distribute subscriptions at the client's discretion. In this way, both clients and servers can react to resource constraints. Token bucket rate limiting schemes are also effective in providing fairness by a server across numerous client requests.</t>
<?rfc needLines="35" ?>
   </section>

   <section title="Protocol Operation">
     <t>The DNS Push Notification protocol is a session-oriented protocol, and makes use of
     <xref target="DSO">DNS Stateful Operations (DSO)</xref>.</t>

     <t>For details of the DSO message format refer to the
     <xref target="DSO">DNS Stateful Operations specification</xref>.
     Those details are not repeated here.</t>

     <t>DNS Push Notification clients and servers MUST support DSO,
     but (as stated in the <xref target="DSO">DSO specification</xref>)
     the server SHOULD NOT issue any DSO
     messages until after the client has first initiated an acknowledged DSO message of its own.
     A single server can support DNS Queries, DNS Updates, and DNS Push
     Notifications (using DSO) on the same TCP port, and
     until the client has sent at least one DSO message,
     the server does not know what kind of client has connected to it.
     Once the client has indicated willingness to use DSO
     by sending one of its own, either side of the session may
     then initiate further DSO messages at any time.</t>

     <t>A DNS Push Notification exchange begins with the client discovering the appropriate server,
     using the procedure described in <xref target="discovery"/>, and then making a TLS/TCP connection to it.</t>

     <t>A typical DNS Push Notification client will immediately issue a DSO
     Keepalive operation to request a session timeout or keepalive interval
     longer than the the 15-second default, but this is not required.
     A DNS Push Notification client MAY issue other requests on the
     session first, and only issue a DSO Keepalive
     operation later if it determines that to be necessary. However,
     Push Notification subscriptions can also be used to establish the
     DSO session.</t>

     <t>In accordance with the current set of active subscriptions,
     the server sends relevant asynchronous Push Notifications to
     the client. Note that a client MUST be prepared to receive
     (and silently ignore) Push Notifications for subscriptions it
     has previously removed, since there is no way to prevent the
     situation where a Push Notification is in flight from server
     to client while the client's UNSUBSCRIBE message cancelling
     that subscription is simultaneously in flight from client to
     server.</t>

<?rfc needLines="30" ?>
      <section title="Discovery" anchor="discovery">
        <t>The first step in DNS Push Notification subscription is to discover an appropriate DNS server that supports DNS Push Notifications for the desired zone.</t>

        <t>The client begins by opening a DSO Session to its normal configured DNS recursive resolver and requesting a Push
        Notification subscription. If this is successful, then the recursive resolver will make appropriate
        Push Notification subscriptions on the client's behalf, and the client will receive appropriate results.
        If the recursive resolver does not support Push Notification subscriptions, then it will return an error code,
        and the client should proceed to discover the appropriate server for direct communication.
        The client MUST also determine which TCP port on the server is listening for connections, which need not be (and often is not) the typical TCP port 53 used for conventional DNS, or TCP port 853 used for <xref target="RFC7858">DNS over TLS</xref>.</t>

        <t>The algorithm described here is an iterative algorithm,
        which starts with the full name of the record to which the
        client wishes to subscribe. Successive SOA queries are then
        issued, trimming one label each time, until
        the closest enclosing authoritative server is discovered.
        There is also an optimization to enable the client to
        take a "short cut" directly to the SOA record of
        the closest enclosing authoritative server in many cases.</t>

        <t>
          <list style="numbers">
            <t>The client begins the discovery by sending a DNS query to its  local resolver, with record type <xref target="RFC1035">SOA</xref> for the record name to which it wishes to subscribe. As an example, suppose the client wishes to subscribe to PTR records with the name _ipp._tcp.foo.example.com (to discover Internet Printing Protocol (IPP) printers <xref target="RFC8010"/> <xref target="RFC8011"/> being advertised at "foo.example.com"). The client begins by sending an SOA query for _ipp._tcp.foo.example.com to the local recursive resolver. The goal is to determine the server authoritative for the name _ipp._tcp.foo.example.com. The DNS zone containing the name _ipp._tcp.foo.example.com could be example.com, or foo.example.com, or _tcp.foo.example.com, or even _ipp._tcp.foo.example.com. The client does not know in advance where the closest enclosing zone cut occurs, which is why it uses the procedure described here to discover this information.</t>

            <t>If the requested SOA record exists, it will be returned in the Answer section with a NOERROR response code, and
            the client has succeeded in discovering the information it needs.
            (This text is not placing any new requirements on DNS recursive resolvers.
            It is merely describing the existing operation of the DNS protocol
            <xref target="RFC1034"/> <xref target="RFC1035"/>.)</t>

            <t>If the requested SOA record does not exist, the client will get back a NOERROR/NODATA response or an NXDOMAIN/Name Error response.
            In either case, the local resolver SHOULD include the SOA record for the zone of the requested name in the Authority Section.
            If the SOA record is received in the Authority Section, then
            the client has succeeded in discovering the information it needs.
            (This text is not placing any new requirements on DNS recursive resolvers.
            It is merely describing the existing operation of the DNS protocol regarding negative responses <xref target="RFC2308"/>.)</t>

            <t>If the client receives a response containing no SOA record,
            then it proceeds with the iterative approach.
            The client strips the leading label from the current query name and if the resulting name has at least one label in it, the client sends a new SOA query, and processing continues at step 2 above, repeating the iterative search until either an SOA is received, or the query name is empty. In the case of an empty name, this is a network configuration error which should not happen and the client gives up. The client may retry the operation at a later time, of the client's choosing, such after a change in network attachment.</t>

            <t>Once the SOA is known (either by virtue of being seen in the Answer Section, or in the Authority Section), the client sends a DNS query with type <xref target="RFC2782">SRV</xref> for the record name
            <spanx style="verb">_dns&nbhy;push&nbhy;tls._tcp.&lt;zone&gt;</spanx>, where &lt;zone&gt; is the owner name of the discovered SOA record.</t>

            <t>If the zone in question is set up to offer DNS Push Notifications then this SRV record MUST exist.
            (If this SRV record does not exist then the zone is not correctly
            configured for DNS Push Notifications as specified in this document.)
            The SRV <spanx style="verb">target</spanx> contains the name of the server providing DNS Push Notifications for the zone. The port number on which to contact the server is in the SRV record <spanx style="verb">port</spanx> field. The address(es) of the target host MAY be included in the Additional Section, however, the address records SHOULD be authenticated before use as described below in <xref target="tls_name_auth"/> and in
            <xref target="RFC7673">the specification for using DANE TLSA Records with SRV Records</xref>, if applicable.</t>

            <t>More than one SRV record may be returned. In this case, the <spanx style="verb">priority</spanx> and <spanx style="verb">weight</spanx> values in the returned SRV records are used to determine the order in which to contact the servers for subscription requests. As described in <xref target="RFC2782">the SRV specification</xref>, the server with the lowest <spanx style="verb">priority</spanx> is first contacted. If more than one server has the same <spanx style="verb">priority</spanx>, the <spanx style="verb">weight</spanx> indicates the weighted probability that the client should contact that server. Higher weights have higher probabilities of being selected.
            If a server is not willing to accept a subscription request,
            or is not reachable within a reasonable time, as determined by the client,
            then a subsequent server is to be contacted.</t>

          </list>
        </t>

        <t>Each time a client makes a new DNS Push Notification subscription session, it SHOULD repeat the discovery process in order to determine the preferred DNS server for subscriptions at that time. However, the client device MUST respect the DNS TTL values on records it receives, and store them in its local cache with this lifetime. This means that, as long as the DNS TTL values on the authoritative records were set to reasonable values, repeated application of this discovery process can be completed nearly instantaneously by the client, using only locally-stored cached data.</t>

<?rfc needLines="48" ?>
     </section>

     <section title="DNS Push Notification SUBSCRIBE" anchor="subscribe">
       <t>After connecting, and requesting a longer idle timeout and/or keepalive interval if necessary, a DNS Push Notification client then indicates its desire to receive DNS Push Notifications for a given domain name by sending a SUBSCRIBE request over the established DSO session to the server. A SUBSCRIBE request is encoded in a <xref target="DSO">DSO</xref> message. This specification defines a DSO TLV for DNS Push Notification SUBSCRIBE Requests/Responses (tentatively DSO Type Code 0x40).</t>

       <t>The entity that initiates a SUBSCRIBE request is by definition the client. A server MUST NOT send a SUBSCRIBE request over an existing session from a client. If a server does send a SUBSCRIBE request over a DSO session initiated by a client, this is a fatal error and the client should immediately abort the connection with a TCP RST (or equivalent for other protocols).</t>

       <section title="SUBSCRIBE Request">
         <t>A SUBSCRIBE request begins with the standard
         <xref target="DSO">DSO 12-byte header</xref>, followed by the SUBSCRIBE TLV.
         A SUBSCRIBE request message is illustrated in <xref target="subscribe_req"/>.</t>

         <t>The MESSAGE ID field MUST be set to a unique value, that the client is not using for any other active operation on this session. For the purposes here, a MESSAGE ID is in use on this session if the client has used it in a request for which it has not yet received a response, or if the client has used it for a subscription which it has not yet cancelled using UNSUBSCRIBE. In the SUBSCRIBE response the server MUST echo back the MESSAGE ID value unchanged.</t>

         <t>The other header fields MUST be set as described in the
         <xref target="DSO">DSO specification</xref>.
         The DNS Opcode is the DSO Opcode.
         The four count fields MUST be zero, and the corresponding four sections MUST be empty (i.e., absent).</t>

         <t>The DSO-TYPE is SUBSCRIBE.
         The DSO-LENGTH is the length of the DSO-DATA that follows, which specifies
         the name, type, and class of the record(s) being sought.</t>

         <figure align="center" anchor="subscribe_req" title="SUBSCRIBE Request"><artwork align="center"><![CDATA[
                                1  1  1  1  1  1
  0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  \
|                  MESSAGE ID                   |   \
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|QR|  Opcode   |         Z          |   RCODE   |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|             QDCOUNT (MUST BE ZERO)            |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+     > HEADER
|             ANCOUNT (MUST BE ZERO)            |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|             NSCOUNT (MUST BE ZERO)            |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|             ARCOUNT (MUST BE ZERO)            |   /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  /
|              DSO-TYPE = SUBSCRIBE             |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|   DSO-LENGTH (number of octets in DSO-DATA)   |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  \
|                                               |   \
\                     NAME                      \    |
\                                               \    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+     > DSO-DATA
|                     TYPE                      |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|                     CLASS                     |   /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  /]]></artwork></figure>

         <t>The DSO-DATA for a SUBSCRIBE request MUST contain exactly one NAME, Type, and CLASS.
         Since SUBSCRIBE requests are sent over TCP, multiple SUBSCRIBE request messages
         can be concatenated in a single TCP stream and packed efficiently into TCP segments.</t>

         <t>If accepted, the subscription will stay in effect until the client cancels the subscription using UNSUBSCRIBE or until the DSO session between the client and the server is closed.</t>

         <t>SUBSCRIBE requests on a given session MUST be unique. A client MUST NOT send a SUBSCRIBE message that duplicates the NAME, TYPE and CLASS of an existing active subscription on that DSO session. For the purpose of this matching, the established DNS case-insensitivity for US-ASCII letters applies (e.g., "example.com" and "Example.com" are the same). If a server receives such a duplicate SUBSCRIBE message this is an error and the server MUST immediately terminate the connection with a TCP RST (or equivalent for other protocols).</t>

         <t>DNS wildcarding is not supported. That is, a wildcard ("*") in a SUBSCRIBE message matches only a literal wildcard character ("*") in the zone, and nothing else.</t>

         <t>Aliasing is not supported. That is, a CNAME in a SUBSCRIBE message matches only a literal CNAME record in the zone, and nothing else.</t>

         <t>A client may SUBSCRIBE to records that are unknown to the server at the time of the request (providing that the name falls within one of the zone(s) the server is responsible for) and this is not an error. The server MUST accept these requests and send Push Notifications if and when matching records are found in the future.</t>

         <t>If neither TYPE nor CLASS are ANY (255) then this is a specific subscription to changes for the given NAME, TYPE and CLASS. If one or both of TYPE or CLASS are ANY (255) then this subscription matches any type and/or any class, as appropriate.</t>

<?rfc needLines="14" ?>
         <t>NOTE: A little-known quirk of DNS is that in DNS QUERY requests, QTYPE and QCLASS 255 mean "ANY" not "ALL". They indicate that the server should respond with ANY matching records of its choosing, not necessarily ALL matching records. This can lead to some surprising and unexpected results, where a query returns some valid answers but not all of them, and makes QTYPE=ANY queries less useful than people sometimes imagine.</t>

         <t>When used in conjunction with SUBSCRIBE, TYPE and CLASS 255 should be interpreted to mean "ALL", not "ANY". After accepting a subscription where one or both of TYPE or CLASS are 255, the server MUST send Push Notification Updates for ALL record changes that match the subscription, not just some of them.</t>
<?rfc needLines="48" ?>
       </section>

       <section title="SUBSCRIBE Response" anchor="subresp">

         <t>Each SUBSCRIBE request generates exactly one SUBSCRIBE response from the server.</t>

         <t>A SUBSCRIBE response message begins with the standard
         <xref target="DSO">DSO 12-byte header</xref>,
         possibly followed by one or more optional TLVs, such as a Retry Delay TLV.</t>

         <t>The MESSAGE ID field MUST echo the value given in the ID field of the SUBSCRIBE request.
         This is how the client knows which request is being responded to.</t>

         <t>A SUBSCRIBE response message MUST NOT include a SUBSCRIBE TLV.
         If a client receives a SUBSCRIBE response message containing a SUBSCRIBE TLV
         then the response message is processed but the SUBSCRIBE TLV MUST be silently ignored.</t>

<?rfc needLines="20" ?>
         <t>In the SUBSCRIBE response the RCODE indicates whether or not the subscription was accepted. Supported RCODEs are as follows:</t>
         <texttable title="SUBSCRIBE Response codes">
         <ttcol align="left">Mnemonic</ttcol>
         <ttcol align="center">Value</ttcol>
         <ttcol align="left">Description</ttcol>
         <c>NOERROR</c><c>0</c><c>SUBSCRIBE successful.</c>
         <c>FORMERR</c><c>1</c><c>Server failed to process request due to a malformed request.</c>
         <c>SERVFAIL</c><c>2</c><c>Server failed to process request due to a problem with the server.</c>
         <c>NXDOMAIN</c><c>3</c><c>NOT APPLICABLE. DNS Push Notification servers MUST NOT return NXDOMAIN errors in response to SUBSCRIBE requests.</c>
         <c>NOTIMP</c><c>4</c><c>Server does not implement DSO.</c>
         <c>REFUSED</c><c>5</c><c>Server refuses to process request for policy or security reasons.</c>
         <c>NOTAUTH</c><c>9</c><c>Server is not authoritative for the requested name.</c>
         <c>DSOTYPENI</c><c>11</c><c>SUBSCRIBE operation not supported.</c>
         </texttable>

         <t>This document specifies only these RCODE values for SUBSCRIBE Responses. Servers sending SUBSCRIBE Responses SHOULD use one of these values. However, future circumstances may create situations where other RCODE values are appropriate in SUBSCRIBE Responses, so clients MUST be prepared to accept SUBSCRIBE Responses with any RCODE value.</t>

<?rfc needLines="30" ?>
         <t>If the server sends a nonzero RCODE in the SUBSCRIBE response, that means
         (a) the client is (at least partially) misconfigured,
         (b) the server resources are exhausted, or
         (c) there is some other unknown failure on the server.
         In any case, the client shouldn't retry the subscription right away. Either end can terminate the session, but the client may want to try this subscription again, or it may have other successful subscriptions that it doesn't want to abandon. If the server sends a nonzero RCODE then it SHOULD append a Retry Delay TLV <xref target="DSO"/> to the response specifying a delay before the client attempts this operation again. Recommended values for the delay for different RCODE values are given below. These recommended values apply both to the default values a server should place in the Retry Delay TLV, and the default values a client should assume if the server provides no Retry Delay TLV.
           <list style="bullets">
             <t>For RCODE = 1 (FORMERR) the delay may be any value selected by the implementer. A value of five minutes is RECOMMENDED, to reduce the risk of high load from defective clients.</t>

             <t>For RCODE = 2 (SERVFAIL) the delay should be chosen according to the level of server overload and the anticipated duration of that overload. By default, a value of one minute is RECOMMENDED. If a more serious server failure occurs, the delay may be longer in accordance with the specific problem encountered.</t>

             <t>For RCODE = 4 (NOTIMP), which occurs on a server that doesn't implement
             <xref target="DSO">DSO</xref>,
             it is unlikely that the server will begin supporting DSO
             in the next few minutes, so the retry delay SHOULD be one hour.
             Note that in such a case, a server that doesn't implement DSO
             is unlikely to place a Retry Delay TLV in its response, so this
             recommended value in particular applies to what a client should assume by default.</t>

             <t>For RCODE = 5 (REFUSED), which occurs on a server that implements DNS Push Notifications, but is currently configured to disallow DNS Push Notifications, the retry delay may be any value selected by the implementer and/or configured by the operator.</t>
             <t>This is a misconfiguration, since this server is listed in a <spanx style="verb">_dns&nbhy;push&nbhy;tls._tcp.&lt;zone&gt;</spanx> SRV record, but the server itself is not currently configured to support DNS Push Notifications. Since it is possible that the misconfiguration may be repaired at any time, the retry delay should not be set too high. By default, a value of 5 minutes is RECOMMENDED.</t>

             <t>For RCODE = 9 (NOTAUTH), which occurs on a server that implements DNS Push Notifications, but is not configured to be authoritative for the requested name, the retry delay may be any value selected by the implementer and/or configured by the operator.</t>
             <t>This is a misconfiguration, since this server is listed in a <spanx style="verb">_dns&nbhy;push&nbhy;tls._tcp.&lt;zone&gt;</spanx> SRV record, but the server itself is not currently configured to support DNS Push Notifications for that zone. Since it is possible that the misconfiguration may be repaired at any time, the retry delay should not be set too high. By default, a value of 5 minutes is RECOMMENDED.</t>

             <t>For RCODE = 11 (DSOTYPENI),
             which occurs on a server that doesn't implement DNS Push Notifications,
             it is unlikely that the server will begin supporting DNS Push Notifications
             in the next few minutes, so the retry delay SHOULD be one hour.</t>

             <t>For other RCODE values, the retry delay should be set by the server as appropriate for that error condition. By default, a value of 5 minutes is RECOMMENDED.</t>
           </list>
         </t>
         <t>For RCODE = 9 (NOTAUTH), the time delay applies to requests for other names falling within the same zone. Requests for names falling within other zones are not subject to the delay. For all other RCODEs the time delay applies to all subsequent requests to this server.</t>

         <t>After sending an error response the server MAY allow the session to remain open,
         or MAY send a DNS Push Notification Retry Delay Operation TLV instructing the client to close the session,
         as described in the <xref target="DSO">DSO specification</xref>.
         Clients MUST correctly handle both cases.</t>

<?rfc needLines="48" ?>
       </section>
     </section>

     <section title="DNS Push Notification Updates">
       <t>Once a subscription has been successfully established, the server generates PUSH messages to send to the client as appropriate. In the case that the answer set was non-empty at the moment the subscription was established, an initial PUSH message will be sent immediately following the SUBSCRIBE Response. Subsequent changes to the answer set are then communicated to the client in subsequent PUSH messages.</t>

       <section title="PUSH Message" anchor="push">

         <t>A PUSH message begins with the standard
         <xref target="DSO">DSO 12-byte header</xref>, followed by the PUSH TLV.
         A PUSH message is illustrated in <xref target="push_msg"/>.</t>

         <t>In accordance with the definition of DSO unidirectional
         messages, the MESSAGE ID field MUST be zero. There is no client
         response to a PUSH message.</t>

         <t>The other header fields MUST also be set as described in the
         <xref target="DSO">DSO specification</xref>.
         The DNS Opcode is the DSO Opcode.
         The four count fields MUST be zero, and the corresponding four sections MUST be empty (i.e., absent).</t>

         <t>The DSO-TYPE is PUSH (tentatively 0x41).
         The DSO-LENGTH is the length of the DSO-DATA that follows, which specifies
         the changes being communicated.</t>

         <t>The DSO-DATA contains one or more Update records.
         A PUSH Message MUST contain at least one Update record.
         If a PUSH Message is received that contains zero Update records,
         this is a fatal error, and the receiver MUST immediately terminate
         the connection with a TCP RST (or equivalent for other protocols).
         The Update records are formatted in the customary way for Resource
         Records in DNS messages.
         Update records in a PUSH Message are interpreted according to the same
         rules as for <xref target="RFC2136">DNS Update</xref> messages, namely:

           <list style="bullets">
             <t>Delete all RRsets from a name:<vspace />
             TTL=0, CLASS=ANY, RDLENGTH=0, TYPE=ANY.</t>
             <t>Delete an RRset from a name:<vspace />
             TTL=0, CLASS=ANY, RDLENGTH=0;<vspace />
             TYPE specifies the RRset being deleted.</t>
             <t>Delete an individual RR from a name:<vspace />
             TTL=0, CLASS=NONE;<vspace />
             TYPE, RDLENGTH and RDATA specifies the RR being deleted.</t>
             <t>Add to an RRset:<vspace />
             TTL, CLASS, TYPE, RDLENGTH and RDATA specifies the RR being added.</t>
           </list>
         </t>
  
         <figure align="center" anchor="push_msg" title="PUSH Message"><artwork align="center"><![CDATA[
                                1  1  1  1  1  1
  0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  \
|           MESSAGE ID (MUST BE ZERO)           |   \
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|QR|  Opcode   |         Z          |   RCODE   |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|             QDCOUNT (MUST BE ZERO)            |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+     > HEADER
|             ANCOUNT (MUST BE ZERO)            |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|             NSCOUNT (MUST BE ZERO)            |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|             ARCOUNT (MUST BE ZERO)            |   /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  /
|                DSO-TYPE = PUSH                |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|   DSO-LENGTH (number of octets in DSO-DATA)   |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  \
\                     NAME                      \   \
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|                     TYPE                      |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|                     CLASS                     |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|                      TTL                      |    |
|                   (32 bits)                   |     > DSO-DATA
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|                     RDLEN                     |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
\                     RDATA                     \    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
:     NAME, TYPE, CLASS, TTL, RDLEN, RDATA      :    |
:             Repeated As Necessary             :   /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  /]]></artwork></figure>

         <t>When processing the records received in a PUSH Message, the receiving client MUST validate that the records being added or deleted correspond with at least one currently active subscription on that session. Specifically, the record name MUST match the name given in the SUBSCRIBE request, subject to the usual established DNS case-insensitivity for US-ASCII letters.
         If the TYPE in the SUBSCRIBE request was not ANY (255) then the TYPE of the record must match the TYPE given in the SUBSCRIBE request.
         If the CLASS in the SUBSCRIBE request was not ANY (255) then the CLASS of the record must match the CLASS given in the SUBSCRIBE request.
         If a matching active subscription on that session is not found, then that individual record addition/deletion is silently ignored. Processing of other additions and deletions in this message is not affected. The DSO session is not closed. This is to allow for the unavoidable race condition where a client sends an outbound UNSUBSCRIBE while inbound PUSH messages for that subscription from the server are still in flight.</t>
  
         <t>In the case where a single change affects more than one active subscription, only one PUSH message is sent. For example, a PUSH message adding a given record may match both a SUBSCRIBE request with the same TYPE and a different SUBSCRIBE request with TYPE=ANY. It is not the case that two PUSH messages are sent because the new record matches two active subscriptions.</t>
  
         <t>The server SHOULD encode change notifications in the most efficient manner possible. For example, when three AAAA records are deleted from a given name, and no other AAAA records exist for that name, the server SHOULD send a "delete an RRset from a name" PUSH message, not three separate "delete an individual RR from a name" PUSH messages. Similarly, when both an SRV and a TXT record are deleted from a given name, and no other records of any kind exist for that name, the server SHOULD send a "delete all RRsets from a name" PUSH message, not two separate "delete an RRset from a name" PUSH messages.</t>
  
         <t>A server SHOULD combine multiple change notifications in a single PUSH message when possible, even if those change notifications apply to different subscriptions. Conceptually, a PUSH message is a session-level mechanism, not a subscription-level mechanism.</t>
  
         <t>The TTL of an added record is stored by the client and decremented as time passes, with the caveat that for as long as a relevant subscription is active, the TTL does not decrement below 1 second. For as long as a relevant subscription remains active, the client SHOULD assume that when a record goes away the server will notify it of that fact. Consequently, a client does not have to poll to verify that the record is still there. Once a subscription is cancelled (individually, or as a result of the DSO session being closed) record aging resumes and records are removed from the local cache when their TTL reaches zero.</t>
<?rfc needLines="48" ?>
       </section>
     </section>

     <section title="DNS Push Notification UNSUBSCRIBE" anchor="unsubscribe">
       <t>To cancel an individual subscription without closing the entire DSO session, the client sends an UNSUBSCRIBE message over the established DSO session to the server. The UNSUBSCRIBE message is encoded as a
       <xref target="DSO">DSO</xref> unidirectional message. This specification defines a DSO TLV for DNS Push Notification UNSUBSCRIBE Requests/Responses (tentatively DSO Type Code 0x42).</t>

       <t>A server MUST NOT initiate an UNSUBSCRIBE request. If a server does send an UNSUBSCRIBE request over a DSO session initiated by a client, this is a fatal error and the client should immediately abort the connection with a TCP RST (or equivalent for other protocols).</t>

       <section title="UNSUBSCRIBE Request">

         <t>An UNSUBSCRIBE request begins with the standard
         <xref target="DSO">DSO 12-byte header</xref>, followed by the UNSUBSCRIBE TLV.
         An UNSUBSCRIBE request message is illustrated in <xref target="unsubscribe_req"/>.</t>         

         <t>The MESSAGE ID field MUST be zero. There is no server response to a UNSUBSCRIBE message.</t>

         <t>The other header fields MUST be set as described in the
         <xref target="DSO">DSO specification</xref>.
         The DNS Opcode is the DSO Opcode.
         The four count fields MUST be zero, and the corresponding four sections MUST be empty (i.e., absent).</t>

         <t>In the UNSUBSCRIBE TLV the DSO-TYPE is UNSUBSCRIBE.
         The DSO-LENGTH is 2 octets.</t>

         <t>The DSO-DATA contains the MESSAGE ID field of the value given in the ID field of an active SUBSCRIBE request.
         This is how the server knows which SUBSCRIBE request is being cancelled.
         After receipt of the UNSUBSCRIBE request, the SUBSCRIBE request is no longer active.</t>

         <t>It is allowable for the client to issue an UNSUBSCRIBE request for a previous SUBSCRIBE request
         for which the client has not yet received a SUBSCRIBE response.
         This is to allow for the case where a client starts and stops a subscription in less than the
         round-trip time to the server.
         The client is NOT required to wait for the SUBSCRIBE response before issuing the UNSUBSCRIBE request.</t>

         <figure align="center" anchor="unsubscribe_req" title="UNSUBSCRIBE Request"><artwork align="center"><![CDATA[
                                1  1  1  1  1  1
  0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  \
|           MESSAGE ID (MUST BE ZERO)           |   \
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|QR|  Opcode   |         Z          |   RCODE   |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|             QDCOUNT (MUST BE ZERO)            |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+     > HEADER
|             ANCOUNT (MUST BE ZERO)            |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|             NSCOUNT (MUST BE ZERO)            |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|             ARCOUNT (MUST BE ZERO)            |   /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  /
|             DSO-TYPE = UNSUBSCRIBE            |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|              DSO-LENGTH (2 octets)            |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  \
|              SUBSCRIBE MESSAGE ID             |   > DSO-DATA
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  /]]></artwork></figure>

<?rfc needLines="48" ?>
       </section>
     </section>

     <section title="DNS Push Notification RECONFIRM">
       <t>Sometimes, particularly when used with a <xref target="DisProx">Discovery Proxy</xref>, a DNS Zone may contain stale data. When a client encounters data that it believe may be stale (e.g., an SRV record referencing a target host+port that is not responding to connection requests) the client can send a RECONFIRM request to ask the server to re-verify that the data is still valid. For a Discovery Proxy, this causes it to issue new Multicast DNS requests to ascertain whether the target device is still present. For other types of DNS server, the RECONFIRM operation is currently undefined, and SHOULD result in a NOERROR response, but otherwise need not cause any action to occur. Frequent RECONFIRM operations may be a sign of network unreliability, or some kind of misconfiguration, so RECONFIRM operations MAY be logged or otherwise communicated to a human administrator to assist in detecting, and remedying, such network problems.</t>

       <t>If, after receiving a valid RECONFIRM request, the server determines that the disputed records are in fact no longer valid, then subsequent DNS PUSH Messages will be generated to inform interested clients. Thus, one client discovering that a previously-advertised device (like a network printer) is no longer present has the side effect of informing all other interested clients that the device in question is now gone.</t>

       <section title="RECONFIRM Request" anchor="reconfirm">

         <t>A RECONFIRM request begins with the standard
         <xref target="DSO">DSO 12-byte header</xref>, followed by the RECONFIRM TLV.
         A RECONFIRM request message is illustrated in <xref target="reconfirm_req"/>.</t>

         <t>The MESSAGE ID field MUST be set to a unique value, that the client is not using for any other active operation on this DSO session. For the purposes here, a MESSAGE ID is in use on this session if the client has used it in a request for which it has not yet received a response, or if the client has used it for a subscription which it has not yet cancelled using UNSUBSCRIBE. In the RECONFIRM response the server MUST echo back the MESSAGE ID value unchanged.</t>

         <t>The other header fields MUST be set as described in the
         <xref target="DSO">DSO specification</xref>.
         The DNS Opcode is the DSO Opcode.
         The four count fields MUST be zero, and the corresponding four sections MUST be empty (i.e., absent).</t>

         <t>The DSO-TYPE is RECONFIRM (tentatively 0x43).
         The DSO-LENGTH is the length of the data that follows, which specifies
         the name, type, class, and content of the record being disputed.</t>

         <figure align="center" anchor="reconfirm_req" title="RECONFIRM Request"><artwork align="center"><![CDATA[
                                1  1  1  1  1  1
  0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  \
|                  MESSAGE ID                   |   \
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|QR|  Opcode   |         Z          |   RCODE   |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|             QDCOUNT (MUST BE ZERO)            |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+     > HEADER
|             ANCOUNT (MUST BE ZERO)            |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|             NSCOUNT (MUST BE ZERO)            |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|             ARCOUNT (MUST BE ZERO)            |   /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  /
|              DSO-TYPE = RECONFIRM             |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|   DSO-LENGTH (number of octets in DSO-DATA)   |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  \
\                     NAME                      \   \
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
|                     TYPE                      |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+     > DSO-DATA
|                     CLASS                     |    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+    |
\                     RDATA                     \   /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+  /]]></artwork></figure>

         <t>The DSO-DATA for a RECONFIRM request MUST contain exactly one record.
         The DSO-DATA for a RECONFIRM request has no count field to specify more than one record.
         Since RECONFIRM requests are sent over TCP, multiple RECONFIRM request messages
         can be concatenated in a single TCP stream and packed efficiently into TCP segments.</t>

         <t>TYPE MUST NOT be the value ANY (255) and CLASS MUST NOT be the value ANY (255).</t>

         <t>DNS wildcarding is not supported. That is, a wildcard ("*") in a RECONFIRM message matches only a literal wildcard character ("*") in the zone, and nothing else.</t>

         <t>Aliasing is not supported. That is, a CNAME in a RECONFIRM message matches only a literal CNAME record in the zone, and nothing else.</t>

<?rfc needLines="48" ?>
       </section>

       <section title="RECONFIRM Response">

         <t>Each RECONFIRM request generates exactly one RECONFIRM response from the server.</t>

         <t>A RECONFIRM response message begins with the standard
         <xref target="DSO">DSO 12-byte header</xref>,
         possibly followed by one or more optional TLVs, such as a Retry Delay TLV.
         For suggested values for the Retry Delay TLV, see <xref target="subresp"/>.</t>

         <t>The MESSAGE ID field MUST echo the value given in the ID field of the RECONFIRM request.
         This is how the client knows which request is being responded to.</t>

         <t>A RECONFIRM response message MUST NOT include a DSO RECONFIRM TLV.
         If a client receives a RECONFIRM response message containing a RECONFIRM TLV
         then the response message is processed but the RECONFIRM TLV MUST be silently ignored.</t>

         <t>In the RECONFIRM response the RCODE confirms receipt of the reconfirmation request. Supported RCODEs are as follows:</t>
         <texttable title="RECONFIRM Response codes">
         <ttcol align="left">Mnemonic</ttcol>
         <ttcol align="center">Value</ttcol>
         <ttcol align="left">Description</ttcol>
         <c>NOERROR</c><c>0</c><c>RECONFIRM accepted.</c>
         <c>FORMERR</c><c>1</c><c>Server failed to process request due to a malformed request.</c>
         <c>SERVFAIL</c><c>2</c><c>Server failed to process request due to a problem with the server.</c>
         <c>NXDOMAIN</c><c>3</c><c>NOT APPLICABLE. DNS Push Notification servers MUST NOT return NXDOMAIN errors in response to RECONFIRM requests.</c>
         <c>NOTIMP</c><c>4</c><c>Server does not implement DSO.</c>
         <c>REFUSED</c><c>5</c><c>Server refuses to process request for policy or security reasons.</c>
         <c>NOTAUTH</c><c>9</c><c>Server is not authoritative for the requested name.</c>
         <c>DSOTYPENI</c><c>11</c><c>RECONFIRM operation not supported.</c>
         </texttable>

         <t>This document specifies only these RCODE values for RECONFIRM Responses. Servers sending RECONFIRM Responses SHOULD use one of these values. However, future circumstances may create situations where other RCODE values are appropriate in RECONFIRM Responses, so clients MUST be prepared to accept RECONFIRM Responses with any RCODE value.</t>

         <t>Nonzero RCODE values signal some kind of error.</t>

         <t>RCODE value FORMERR indicates a message format error, for example TYPE or CLASS being ANY (255).</t>

         <t>RCODE value SERVFAIL indicates that the server has exhausted its resources or other serious problem occurred.</t>

         <t>RCODE values NOTIMP indicates that the server does not support DSO, and DSO is required for RECONFIRM requests.</t>

         <t>RCODE value REFUSED indicates that the server supports RECONFIRM requests but is currently not configured to accept them from this client.</t>

         <t>RCODE value NOTAUTH indicates that the server is not authoritative for the requested name, and can do nothing to remedy the apparent error. Note that there may be future cases in which a server is able to pass on the RECONFIRM request to the ultimate source of the information, and in these cases the server should return NOERROR.</t>

         <t>RCODE value DSOTYPENI indicates that the server does not support RECONFIRM requests.</t>

         <t>Nonzero RCODE values SERVFAIL, REFUSED and DSOTYPENI are benign from the client's point of view. The client may log them to aid in debugging, but otherwise they require no special action.</t>
         
         <t>Nonzero RCODE values other than these three indicate a serious problem with the client. After sending an error response other than one of these three, the server SHOULD send a DSO Retry Delay TLV to end the DSO session, as described in the <xref target="DSO">DSO specification</xref>.</t>

<?rfc needLines="48" ?>
       </section>
     </section>

     <section title="Client-Initiated Termination">

       <t>An individual subscription is terminated by sending an UNSUBSCRIBE TLV for that specific subscription, or all subscriptions can be cancelled at once by the client closing the DSO session. When a client terminates an individual subscription (via UNSUBSCRIBE) or all subscriptions on that DSO session (by ending the session) it is signaling to the server that it is longer interested in receiving those particular updates. It is informing the server that the server may release any state information it has been keeping with regards to these particular subscriptions.</t>

       <t>After terminating its last subscription on a session via UNSUBSCRIBE, a client MAY close the session immediately, or it may keep it open if it anticipates performing further operations on that session in the future. If a client wishes to keep an idle session open, it MUST respect the maximum idle time required by the server <xref target="DSO"/>.</t>

       <t>If a client plans to terminate one or more subscriptions on a session and doesn't intend to keep that session open, then as an efficiency optimization it MAY instead choose to simply close the session, which implicitly terminates all subscriptions on that session. This may occur because the client computer is being shut down, is going to sleep, the application requiring the subscriptions has terminated, or simply because the last active subscription on that session has been cancelled.</t>

       <t>When closing a session, a client will generally do an abortive disconnect, sending a TCP RST. This immediately discards all remaining inbound and outbound data, which is appropriate if the client no longer has any interest in this data. In the BSD Sockets API, sending a TCP RST is achieved by setting the SO_LINGER option with a time of 0 seconds and then closing the socket.</t>

       <t>If a client has performed operations on this session that it
       would not want lost (like DNS updates) then the client SHOULD do an
       orderly disconnect, sending a TLS close_notify followed by a TCP FIN.
       (In the BSD Sockets API, sending a TCP FIN is achieved by calling "shutdown(s,SHUT_WR)"
       and keeping the socket open until all remaining data has been read from it.)</t>
<?rfc needLines="9" ?>
     </section>
   </section>

   <section title="Security Considerations" anchor="Security">
     <t>The Strict Privacy Usage Profile for DNS over TLS is strongly recommended for DNS Push Notifications as defined in <xref target="RFC8310">"Usage Profiles for DNS over TLS and DNS over DTLS"</xref>. The Opportunistic Privacy Usage Profile is permissible as a way to support incremental deployment of security capabilities. Cleartext connections for DNS Push Notifications are not permissible.</t>

     <t>DNSSEC is RECOMMENDED for the authentication of DNS Push Notification servers. TLS alone does not provide complete security. TLS certificate verification can provide reasonable assurance that the client is really talking to the server associated with the desired host name, but since the desired host name is learned via a DNS SRV query, if the SRV query is subverted then the client may have a secure connection to a rogue server. DNSSEC can provided added confidence that the SRV query has not been subverted.</t>

     <section title="Security Services">
       <t>It is the goal of using TLS to provide the following security services:
         <list style="hanging">
           <t hangText="Confidentiality:">All application-layer communication is encrypted with the goal that no party should be able to decrypt it except the intended receiver.</t>
           <t hangText="Data integrity protection:">Any changes made to the communication in transit are detectable by the receiver.</t>
           <t hangText="Authentication:">An end-point of the TLS communication is authenticated as the intended entity to communicate with.</t>
         </list>
       </t>
       <t>Deployment recommendations on the appropriate key lengths and cypher suites are beyond the scope of this document. Please refer to <xref target="RFC7525">TLS Recommendations</xref> for the best current practices. Keep in mind that best practices only exist for a snapshot in time and recommendations will continue to change. Updated versions or errata may exist for these recommendations.</t>
     </section>

     <section title="TLS Name Authentication" anchor="tls_name_auth">
       <t>As described in <xref target="discovery"/>, the client discovers the DNS Push Notification server using an SRV lookup for the record name <spanx style="verb">_dns&nbhy;push&nbhy;tls._tcp.&lt;zone&gt;</spanx>. The server connection endpoint SHOULD then be authenticated using DANE TLSA records for the associated SRV record. This associates the target's name and port number with a trusted TLS certificate <xref target="RFC7673"/>. This procedure uses the TLS Sever Name Indication (SNI) extension <xref target="RFC6066"/> to inform the server of the name the client has authenticated through the use of TLSA records. Therefore, if the SRV record passes DNSSEC validation and a TLSA record matching the target name is useable, an SNI extension must be used for the target name to ensure the client is connecting to the server it has authenticated. If the target name does not have a usable TLSA record, then the use of the SNI extension is optional.</t>
       <t>See <xref target="RFC8310">Usage Profiles for DNS over TLS and DNS over DTLS</xref> for more information on authenticating domain names. Also note that a DNS Push server is an authoritative server and a DNS Push client is a standard DNS client. While the terminology in <xref target="RFC8310">Usage Profiles for DNS over TLS and DNS over DTLS</xref> explicitly states it does not apply to authoritative servers, it does in this case apply to DNS Push Notification clients and servers.</t>
     </section>

     <section title="TLS Compression">
       <t>In order to reduce the chances of compression-related attacks, TLS-level compression SHOULD be disabled when using TLS versions 1.2 and earlier. In <xref target="RFC8446">TLS 1.3</xref>, TLS-level compression has been removed completely.</t>
     </section>

     <section title="TLS Session Resumption">
       <t>TLS Session Resumption is permissible on DNS Push Notification servers. The server may keep TLS state with Session IDs <xref target="RFC5246"/> or operate in stateless mode by sending a Session Ticket <xref target="RFC5077"/> to the client for it to store. However, once the DSO session is closed, any existing subscriptions will be dropped. When the TLS session is resumed, the DNS Push Notification server will not have any subscription state and will proceed as with any other new DSO session. Use of TLS Session Resumption allows a new TLS connection to be set up more quickly, but the client will still have to recreate any desired subscriptions.</t>
<?rfc needLines="9" ?>
     </section>
   </section>

   <section title="IANA Considerations" anchor="IANA">
     <t>This document defines a new service name to be published in the IANA Registry Service Types <xref target="RFC6335"/><xref target="ST"/> that is only applicable for the TCP protocol.</t>
     <t>This document also defines four new DNS Stateful Operation TLV types to be recorded in the IANA DSO Type Code Registry.</t>
     <texttable title="IANA Assignments" anchor="iana_table">
       <ttcol align="left">Name</ttcol>
       <ttcol align="center">Value</ttcol>
       <ttcol align="left">Definition</ttcol>
       <c>DNS Push Notifcation Service Type</c>
       <c><spanx style="verb">_dns&nbhy;push&nbhy;tls._tcp</spanx></c>
       <c><xref target="discovery"/></c>
       <c>SUBSCRIBE</c>
       <c>TBA (tentatively 0x40)</c>
       <c><xref target="subscribe"/></c>
       <c>PUSH</c>
       <c>TBA (tentatively 0x41)</c>
       <c><xref target="push"/></c>
       <c>UNSUBSCRIBE</c>
       <c>TBA (tentatively 0x42)</c>
       <c><xref target="unsubscribe"/></c>
       <c>RECONFIRM</c>
       <c>TBA (tentatively 0x43)</c>
       <c><xref target="reconfirm"/></c>
     </texttable>
   </section>

   <section title="Acknowledgements" anchor="Acknowledgements">
     <t>The authors would like to thank Kiren Sekar and Marc Krochmal for previous work completed in this field.</t>

     <t>This draft has been improved due to comments from Ran Atkinson, Tim Chown, Mark Delany, Ralph Droms, Bernie Volz, Jan Komissar, Manju Shankar Rao, Markus Stenberg, Dave Thaler, Soraia Zlatkovic, Sara Dickinson, and Andrew Sullivan.</t>
<?rfc needLines="15" ?>
   </section>
 </middle>

 <!--  *****BACK MATTER ***** -->

 <back>
   <!-- References split into informative and normative -->

   <!-- There are 2 ways to insert reference entries from the citation libraries:
    1. define an ENTITY at the top, and use "ampersand character"RFC2629; here (as shown)
    2. simply use a PI "less than character"?rfc include="reference.RFC.2119.xml"?> here
       (for I-Ds: include="reference.I-D.narten-iana-considerations-rfc2434bis.xml")

    Both are cited textually in the same manner: by using xref elements.
    If you use the PI option, xml2rfc will, by default, try to find included files in the same
    directory as the including file. You can also define the XML_LIBRARY environment variable
    with a value containing a set of directories to search.  These can be either in the local
    filing system or remote ones accessed by http (http://domain/dir/... ).-->

   <references title="Normative References">
     &RFC0768;
     &RFC0793;
     &RFC1034;
     &RFC1035;
     &RFC1123;
     &RFC2119;
     &RFC2136;
     &RFC2782;
     &RFC5246;
     &RFC6066;
     <?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.6335.xml" ?>
     &RFC6895;
     &RFC7673;
     &RFC7766;
     &RFC8174;
     &RFC8446;

     <reference anchor='DSO'>
     <front>
     <title>DNS Stateful Operations</title>
     <author initials='R' surname='Bellis' fullname='Ray Bellis'><organization /></author>
     <author initials='S' surname='Cheshire' fullname='Stuart Cheshire'><organization /></author>
     <author initials='J' surname='Dickinson' fullname='John Dickinson'><organization /></author>
     <author initials='S' surname='Dickinson' fullname='Sara Dickinson'><organization /></author>
     <author initials='T' surname='Lemon' fullname='Ted Lemon'><organization /></author>
     <author initials='T' surname='Pusateri' fullname='Tom Pusateri'><organization /></author>
     <date month='August' day='2' year='2018' />
     <abstract><t>TThis document defines a new DNS OPCODE for DNS Stateful Operations
   (DSO).  DSO messages communicate operations within persistent
   stateful sessions, using type-length-value (TLV) syntax.  Three TLVs
   are defined that manage session timeouts, termination, and encryption
   padding, and a framework is defined for extensions to enable new
   stateful operations.  This document updates RFC 1035 by adding a new
   DNS header opcode and result code which has different message
   semantics.  This document updates RFC 7766 by redefining a session,
   providing new guidance on connection re-use, and providing a new
   mechanism for handling session idle timeouts.</t></abstract>
     </front>
     <seriesInfo name='Internet-Draft' value='draft-ietf-dnsop-session-signal-14' />
     <format type='TXT' target='http://www.ietf.org/internet-drafts/draft-ietf-dnsop-session-signal-14.txt' />
     </reference>

     <reference anchor="ST"
     target="http://www.iana.org/assignments/service-names-port-numbers/">
       <front>
         <title>Service Name and Transport Protocol Port Number Registry</title>
         <author/>
         <date/>
       </front>
     </reference>

   </references>

<!-- Use needLines to make sure "Authors' Addresses" line doesn't appear as the last line on the page -->
<?rfc needLines="9" ?>

   <references title="Informative References">
     &RFC2308;
     &RFC4287;
     &RFC4953;
     &RFC5077;
     &RFC6281;
     &RFC6762;
     &RFC6763;
     &RFC6824;
     &RFC7413;
     &RFC7525;
     &RFC7719;
     &RFC7858;
     &RFC8010;
     &RFC8011;

     &I-D.dukkipati-tcpm-tcp-loss-probe;

<reference anchor='LLQ'>
<front>
<title>DNS Long-Lived Queries</title>

<author initials='K' surname='Sekar' fullname='Kiren Sekar'>
    <organization />
</author>

<date month='August' day='28' year='2006' />

<abstract><t>This document proposes a method of extending unicast DNS to support long-lived queries, thus allowing clients to learn about changes to DNS data without polling the server.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-sekar-dns-llq-01' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-sekar-dns-llq-01.txt' />
</reference>

     &RFC8310;

     <reference anchor='DisProx'>
     <front>
     <title>Discovery Proxy for Multicast DNS-Based Service Discovery</title>
     <author initials='S' surname='Cheshire' fullname='Stuart Cheshire'><organization /></author>
     <date year='2018' month='March' day='18'/>
     <abstract><t>This document specifies a mechanism that uses Multicast DNS to
   automatically populate the wide-area unicast Domain Name System
   namespace with records describing devices and services found on the
   local link.</t></abstract>
     </front>
     <seriesInfo name='Internet-Draft' value='draft-ietf-dnssd-hybrid-08' />
     <format type='TXT' target='http://www.ietf.org/internet-drafts/draft-ietf-dnssd-hybrid-08.txt' />
     </reference>

     <reference anchor='SYN'>
       <front>
         <title>Defenses Against TCP SYN Flooding Attacks</title>
         <author initials='W.' surname='Eddy' fullname='Wesley Eddy'>
           <organization>Verizon Federal Network Systems</organization>
           <address>
             <email>weddy@grc.nasa.gov</email>
           </address>
         </author>
         <date year='2006' month='December' />
         <keyword>TCP</keyword>
       </front>
       <seriesInfo name="The Internet Protocol Journal," value='Cisco Systems' />
       <seriesInfo name='Volume' value='9' />
       <seriesInfo name='Number' value='4' />
       <format type='PDF' octets='882020' target="http://www.cisco.com/web/about/ac123/ac147/archived_issues/ipj_9-4/ipj_9-4.pdf" />
       <format type='HTML' octets='65566' target="http://www.cisco.com/web/about/ac123/ac147/archived_issues/ipj_9-4/syn_flooding_attacks.html" />
     </reference>

     <reference anchor='obs' target="https://en.wikipedia.org/wiki/Observer_pattern">
       <front>
         <title>Observer Pattern</title>
          <author/>
          <date/>
       </front>
     </reference>

     <reference anchor="XEP0060">
       <front>
         <title>Publish-Subscribe</title>
         <author initials="P." surname="Millard" fullname="Peter Millard">
           <organization/>
           <address>
             <email/>
           </address>
         </author>
         <author initials="P." surname="Saint-Andre" fullname="Peter Saint-Andre">
           <organization/>
           <address>
             <email>peter@andyet.net</email>
           </address>
         </author>
         <author initials="R." surname="Meijer" fullname="Ralph Meijer">
           <organization/>
           <address>
             <email>ralphm@ik.nu</email>
           </address>
         </author>
         <date day="01" month="July" year="2010"/>
       </front>
       <seriesInfo name="XSF XEP" value="0060"/>
       <format type="HTML" target="http://xmpp.org/extensions/xep-0060.html"/>
     </reference>

   </references>
 </back>
</rfc>
