<?xml version='1.0' encoding='utf-8'?>
<?xml-model href="rfc7991bis.rnc"?>
<?rfc toc="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes"?>
<?rfc subcompact="no" ?>
<?rfc linkmailto="no" ?>
<?rfc editing="no" ?>
<?rfc comments="yes" ?>
<?rfc inline="yes"?>
<?rfc rfcedstyle="yes"?>
<?rfc-ext allow-markup-in-artwork="yes" ?>
<?rfc-ext include-index="no" ?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:x="http://purl.org/net/xml2rfc/ext" ipr="trust200902" category="info" docName="draft-ietf-dnsop-zoneversion-01" tocInclude="true" symRefs="true" sortRefs="true" version="3" submissionType="IETF">
  <front>
    <title abbrev="The ZONEVERSION EDNS option">The "ZONEVERSION" EDNS option for the version token of a RR's zone</title>
    <author fullname="Hugo Salgado" initials="H." surname="Salgado">
      <organization>NIC Chile</organization>
      <address>
        <postal>
          <street>Miraflores 222, piso 14</street>
          <city>Santiago</city>
          <code>CP 8320198</code>
          <country>CL</country>
        </postal>
        <phone>+56 2 29407700</phone>
        <email>hsalgado@nic.cl</email>
      </address>
    </author>
    <author fullname="Mauricio Vergara Ereche" initials="M." surname="Vergara Ereche">
      <organization>ICANN</organization>
      <address>
        <email>mauricio.vergara@icann.org</email>
      </address>
    </author>
    <date year="2022"/>
    <area>General</area>
    <workgroup>Internet Engineering Task Force</workgroup>
    <keyword>zoneversion</keyword>
    <abstract>
      <t>The "ZONEVERSION" EDNS option allows a DNS querier to request a DNS authoritative server to
         add an EDNS option in the answer of such query with a token field
         representing the version of the zone which contains the answered Resource Record,
         such as the SOA serial field in zones when this number corresponds to the zone version.</t>
      <t>This "ZONEVERSION" data allows to debug and diagnose problems by helping to recognize the
         data source of an answer in an atomic single query,
         by associating the response with a respective zone version.</t>
    </abstract>
  </front>
  <middle>
    <section anchor="intro" title="Introduction">
      <t>The "ZONEVERSION" <xref target="RFC6891">EDNS option</xref>
       allows a DNS querier to request to a DNS authoritative server
       to add an EDNS option in the answer of such query
       with a token field representing the version of the zone associated to the answered Resource Record, such as the SOA serial field in zones when this number corresponds to the zone version.</t>
      <t>This "ZONEVERSION" data allows to help debug by recognizing the data source of an answer,
       associating this answer with a respective zone version.</t>
      <t>DNS data is of loose coherent nature,
       meaning that a record obtained by a response could be out-of-sync with other authoritative sources of the same data.
       This makes it difficult to debug responses,
       because you'd need to couple an answer with the same version of the zone used to obtain such data.
       Even when in zones where the SOA serial field have the meaning of zone version you could use a separate query to ask for the SOA RR of the zone and therefore know its SOA serial,
       such separate query is performed in a different time and could arrive from another authoritative source 
	   (for example, in the case the server is anycasted as described in <xref target="RFC4786" section="4.9"/>),
       so it's not directly correlated with the original query.</t>
      <t>This EDNS option is aimed to be used only on authoritative servers for a zone.
       It's intended for hop-to-hop communication (not transitive).
       Resolver and forwarder behavior is undefined.
      </t>
      <t>The ZONEVERSION EDNS extension can have different meaning depending on the semantics of the zone maintainer and implementation of nameservers. This document defines one possible value, when the zone version corresponds to the serial field of the SOA Resource Record of the zone, a classic behaviour defined in <xref target="RFC1034" section="4.3.5"/>. </t>

       <t>As the writing of this document, we recognize there are cases where nameservers use different backends for its data sources (like relational databases or by using a different off-DNS synchronicity among others) therefore,
       the SOA version field doesn't offer much relevance as a versioning to its content, and in those cases the ZONEVERSION EDNS extension SHOULD be extended with a different flag and have an opaque value for its data token.</t>
      <section title="Requirements Language">
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
        "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
        document are to be interpreted as described in <xref target="RFC2119"/>.</t>
      </section>
    </section>
    <section anchor="theoption" title="The ZONEVERSION Option">
    <t>The variable part of RDATA in the OPT RR <xref target="RFC6891" section="6.1.2"/> for ZONEVERSION is defined as follows:</t>
<ul>
      <li>The OPTION-CODE for the ZONEVERSION option is &lt;TBD&gt;.</li>
      <li>The OPTION-LENGTH for the ZONEVERSION option MUST have a value of 0 for queries, and MUST have the value of length in octects for the next OPTION-DATA for responses.</li>
      <li>The OPTION-DATA for the ZONEVERSION option is composed of the concatenation of an unsigned 1 byte Flag number (FLAG-NUMBER), an unsigned 2 bytes number with the Length of the next field in bytes (FLAG-LENGTH), and the final Data value of the ZONEVERSION field as an opaque bit value, with the previous specified length (FLAG-DATA).</li>
      </ul>
        <t>[RFC Editor: change &lt;TBD&gt; to the proper code when assigned by IANA.]</t>

        <section anchor="optionpresentation" title="The ZONEVERSION Option Presentation Format">
            <t>The presentation format of the RDATA portion is as follows:</t>
            <t>The OPTION-CODE field MUST be represented as the mnemonic value "ZONEVERSION".</t>
            <t>The OPTION-LENGTH field could be ommited in presentation format, but if is used, MUST be represented as an unsigned decimal integer.</t>
            <t>The OPTION-DATA field MUST be represented following its own format, as specified in the corresponding Flag's specification.</t>
        </section>
    </section>
    <section title="ZONEVERSION Processing">
      <section title="Initiator">
        <t>The EDNS ZONEVERSION option MAY be included on any QUERY,
         by adding a zero-length EDNS ZONEVERSION option to the options
         field of the OPT record when the query is made.</t>
      </section>
      <section title="Responder">
        <t>If an EDNS ZONEVERSION option is sent to a server that is Authoritative for
the zone, then a name server that understands the ZONEVERSION option and
chooses to honor a particular ZONEVERSION request, MUST put in the OPTION-DATA
a flag, length and value that corresponds to the properly semantic of such
flag number, and corresponds to a zone versioning value of the zone that holds
the original QNAME of the reply (as per <xref target="RFC8499" section="4"/>).</t>
        <t>Otherwise, the answer MUST NOT add an EDNS ZONEVERSION option to the response.</t>

      </section>
    </section>
    <section title="Flag Definition for SOA-SERIAL">
        <t>The first and only ZONEVERSION Flag defined in this document for the ZONEVERSION Option has the FLAG-NUMBER of 0, a FLAG-LENGTH field of value 4, and its corresponding FLAG-DATA MUST be a copy of the unsigned 32 bit version number as defined in the SERIAL field of the "SOA RDATA Format" in <xref target="RFC1035" section="3.3.13"/>.</t>
        <t>The FLAG-LENGTH for this ZONEVERSION Option MUST have a value of 7 for responses.</t>
        <t>The mnemonic of this flag is SOA-SERIAL.</t>
        <t>Note that in this case a NXDOMAIN RCODE already includes the complete SOA Resource Record in the AUTHORITY section, so the inclusion of a ZONEVERSION EDNS Option in the answer is superflous and can be omitted. In the case of a SERVFAIL RCODE the responder MAY include the ZONEVERSION EDNS Option if the QNAME still belongs to an authoritative zone of the server, 
         in which case that value MUST be the one included in the answer.</t>
        <t>Note that a NODATA response code as defined in <xref target="RFC8499" section="3"/>
         MUST also include the ZONEVERSION answer even when there's no ANSWER data for the QNAME,
         since the RCODE is NOERROR.</t>

        <section anchor="flagpresentation" title="Flag SOA-SERIAL Presentation Format">
            <t>The presentation format of this flag content is as follows:</t>
            <t>The FLAG-NUMBER field MUST be represented as the mnemonic value "SOA-SERIAL".</t>
            <t>The FLAG-LENGTH field could be ommited in presentation format, but if is used, MUST be represented as an unsigned decimal integer.</t>
            <t>The FLAG-DATA field MUST be represented as an unsigned decimal integer.</t>
        </section>
    </section>
    <section anchor="usage" title="Example usage">
    <t> A zone which utilizes the serial field of the SOA Resource Record as a number of the zone version release, should answer a ZONEVERSION request with an EDNS option code ZONEVERSION, an OPTION-DATA with a Flag byte with value 0, Length value 4 and a copy of the unsigned 32 bit version number of the SERIAL field of its SOA zone Resourse Record, and an OPTION-LENGTH with value 7.</t>
    <t>An example of a proper diagnostic tool that implements ZONEVERSION EDNS extension towards a compliant authoritative DNS server could be:</t>
      <figure>
        <artwork><![CDATA[

  $ dig @ns.example.com www.example.com AAAA +zoneversion +norec +cmd

  ; (1 server found)
  ;; global options: +cmd
  ;; Got answer:
  ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16429
  ;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

  ;; OPT PSEUDOSECTION:
  ; EDNS: version: 0, flags:; udp: 4096
  ; ZONEVERSION: 2019073001 (SOA-SERIAL)
  ;; QUESTION SECTION:
  ;www.example.com.                    IN      AAAA

  ;; ANSWER SECTION:
  www.example.com.             900     IN      AAAA

  ;; Query time: 53 msec
  ;; SERVER: ns.example.com#53(2001:DB8::53)
  ;; WHEN: Tue Aug 07 16:54:05 -04 2018
  ;; MSG SIZE  rcvd: 71

      ]]></artwork>
      </figure>
    </section>
    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>The authors thanks all the comments and support made in the DNSOPS mailing list, chats and discussions. In special for the suggestions to generalize the option using a registry of flags from <contact fullname="Petr Špaček" asciiFullname="Petr Spacek"/>, and suggestions for implementators from <contact fullname="Stéphane Bortzmeyer" asciiFullname="Stephane Bortzmeyer"/>.
      </t>
    </section>
    <section anchor="IANA" title="IANA Considerations">
      <section title="DNS EDNS0 Option Code Registration">
        <t>This document defines a new EDNS0 option, entitled "ZONEVERSION" (see <xref target="theoption"/>), and assigns a value of &lt;TBD&gt; from the DNS EDNS0 Option Codes (OPT) Option space:</t>
        <table>
          <thead>
            <tr><th>Value</th><th>Name</th><th>Status</th><th>Reference</th></tr>
          </thead>
          <tbody>
            <tr><th>&lt;TBD&gt;</th><th>ZONEVERSION</th><th>Standard</th><th>[this document]</th></tr>
          </tbody>
        </table>

        <t>[RFC Editor: change &lt;TBD&gt; to the proper code when assigned by IANA.]</t>
        <t>[RFC Editor: change "this document" with the proper RFC number for this document when assigned by IANA.]</t>
</section>
      <section title="ZONEVERSION Registry">
     <t>The ZONEVERSION option also defines a 8-bit Flag field, for which
     IANA is to create and maintain a new registry entitled
     "DNS EDNS0 ZONEVERSION Flags values" (abbreviation "ZONEVERSION") used by the ZONEVERSION option, inside the "Domain Name System (DNS) Parameters" group. Initial values for the
     DNS EDNS0 ZONEVERSION Flags values registry are given below; future assignments in the 1-245 values
     are to be made through Specification Required Review <xref target="BCP26"/>.  Assignments consist
     of a Flag value as an unsigned 8-bit integer recorded in decimal, a Mnemonic name as an uppercase ASCII string with maximum length of 15 characters, and the required document reference.</t>
     
        <table>
          <thead>
            <tr><th>ZONEVERSION Flag</th><th>Mnemonic</th><th>Reference</th></tr>
          </thead>
          <tbody>
            <tr><th>0</th><th>SOA-SERIAL</th><th>[this document]</th></tr>
            <tr><th>1-245</th><th>Unassigned</th><th></th></tr>
            <tr><th>246-254</th><th>Reserved for Local/Experimental Use</th><th>[this document]</th></tr>
            <tr><th>255</th><th>Reserved for future expansion</th><th>[this document]</th></tr>
          </tbody>
        </table>

        <t>[RFC Editor: change "this document" with the proper RFC number for this document when assigned by IANA.]</t>
        
        <t>The change control for this registry should be my means of an Standard action.</t>

      <section title="Expert Review Directives">
      <t>Allocation procedures for new code points in the ZONEVERSION Flag registry require Specification Required review, and so it requires Expert Reviews as stated in <xref target="BCP26"/>.</t>
   <t>The expert should consider the following points:</t>

   <ul>

      <li>Duplication of code point allocations should be avoided.</li>

      <li>A Presentation Format section should be provided, with a clear code point mnemonic.</li>

      <li>The referenced document and stated use of the new code point
         should be appropriate for the intended use of a ZONEVERSION
         Flag assignment. In particular the reference should state clear
         instructions for implementers about the syntax and semantic of
         the data. Also the Length of the Data must have proper limits.</li>
    </ul>

   <t>The expert reviewing the request MUST approve or disapprove the
   request within 10 business days from when he or she received the
   expert review request.</t>


      </section>
      </section>
    </section>
    <section anchor="Security" title="Security Considerations">
      <t>The EDNS extension data it's not covered by RRSIG records,
       so there's no way to verify its authenticity nor integrity using DNSSEC
       and could theoricatelly be tampered by a person-in-the-middle if the transport is made by unsecure means.
       Caution should be taken to use the EDNS ZONEVERSION data for any means besides troubleshooting and debugging.</t>

       <t>If there's a need to certify the ZONEVERSION trustwortiness, 
       it will be necessary to use an encrypted and authenticated DNS transport. </t>

       <t>If there's a need to authenticate data origin for the ZONEVERSION value, an answer with the SOA-SERIAL flag as defined above
       could be compared to a separate regular SOA query with DO flag, 
       whose answer shall be DNSSEC signed,
	   with the cautions about Anycast and others as already stated in <xref target="intro" format="title"/>.</t>
      <t>With the SOA-SERIAL flag defined above, there's no risk on disclosure of private information, 
       as the SERIAL of the SOA record is already publicly available.</t>
    </section>
  </middle>
  <back>
    <references title="Normative References">
      <reference anchor="RFC1034" target="https://www.rfc-editor.org/info/rfc1034" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.1034.xml">
        <front>
          <title>Domain names - concepts and facilities</title>
          <author initials="P.V." surname="Mockapetris" fullname="P.V. Mockapetris">
            <organization/>
          </author>
          <date year="1987" month="November"/>
          <abstract>
            <t>This RFC is the revised basic definition of The Domain Name System. It obsoletes RFC-882. This memo describes the domain style names and their used for host address look up and electronic mail forwarding. It discusses the clients and servers in the domain name system and the protocol used between them.</t>
          </abstract>
        </front>
        <seriesInfo name="STD" value="13"/>
        <seriesInfo name="RFC" value="1034"/>
        <seriesInfo name="DOI" value="10.17487/RFC1034"/>
      </reference>
      <reference anchor="RFC1035" target="https://www.rfc-editor.org/info/rfc1035" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.1035.xml">
        <front>
          <title>Domain names - implementation and specification</title>
          <author initials="P.V." surname="Mockapetris" fullname="P.V. Mockapetris">
            <organization/>
          </author>
          <date year="1987" month="November"/>
          <abstract>
            <t>This RFC is the revised specification of the protocol and format used in the implementation of the Domain Name System.  It obsoletes RFC-883. This memo documents the details of the domain name client - server communication.</t>
          </abstract>
        </front>
        <seriesInfo name="STD" value="13"/>
        <seriesInfo name="RFC" value="1035"/>
        <seriesInfo name="DOI" value="10.17487/RFC1035"/>
      </reference>
      <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author initials="S." surname="Bradner" fullname="S. Bradner">
            <organization/>
          </author>
          <date year="1997" month="March"/>
          <abstract>
            <t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized. This document defines these words as they should be interpreted in IETF documents.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
        <seriesInfo name="DOI" value="10.17487/RFC2119"/>
      </reference>
      <reference anchor="RFC6891" target="https://www.rfc-editor.org/info/rfc6891" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6891.xml">
        <front>
          <title>Extension Mechanisms for DNS (EDNS(0))</title>
          <author initials="J." surname="Damas" fullname="J. Damas">
            <organization/>
          </author>
          <author initials="M." surname="Graff" fullname="M. Graff">
            <organization/>
          </author>
          <author initials="P." surname="Vixie" fullname="P. Vixie">
            <organization/>
          </author>
          <date year="2013" month="April"/>
          <abstract>
            <t>The Domain Name System's wire protocol includes a number of fixed fields whose range has been or soon will be exhausted and does not allow requestors to advertise their capabilities to responders.  This document describes backward-compatible mechanisms for allowing the protocol to grow.</t>
            <t>This document updates the Extension Mechanisms for DNS (EDNS(0)) specification (and obsoletes RFC 2671) based on feedback from deployment experience in several implementations.  It also obsoletes RFC 2673 ("Binary Labels in the Domain Name System") and adds considerations on the use of extended labels in the DNS.</t>
          </abstract>
        </front>
        <seriesInfo name="STD" value="75"/>
        <seriesInfo name="RFC" value="6891"/>
        <seriesInfo name="DOI" value="10.17487/RFC6891"/>
      </reference>
    <reference anchor="BCP26" target="https://www.rfc-editor.org/info/rfc8126">
      <front>
        <title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
        <author initials="M." surname="Cotton" fullname="M. Cotton">
          <organization/>
        </author>
        <author initials="B." surname="Leiba" fullname="B. Leiba">
          <organization/>
        </author>
        <author initials="T." surname="Narten" fullname="T. Narten">
          <organization/>
        </author>
        <date year="2017" month="June"/>
        <abstract>
          <t>Many protocols make use of points of extensibility that use constants to identify various protocol parameters. To ensure that the values in these fields do not have conflicting uses and to promote interoperability, their allocations are often coordinated by a central record keeper. For IETF protocols, that role is filled by the Internet Assigned Numbers Authority (IANA).</t>
          <t>To make assignments in a given registry prudently, guidance describing the conditions under which new values should be assigned, as well as when and how modifications to existing values can be made, is needed. This document defines a framework for the documentation of these guidelines by specification authors, in order to assure that the provided guidance for the IANA Considerations is clear and addresses the various issues that are likely in the operation of a registry.</t>
          <t>This is the third edition of this document; it obsoletes RFC 5226.</t>
        </abstract>
      </front>
      <seriesInfo name="BCP" value="26"/>
      <seriesInfo name="RFC" value="8126"/>
      <seriesInfo name="DOI" value="10.17487/RFC8126"/>
    </reference>
    </references>
    <references title="Informative References">
      <reference anchor="RFC4786" target="https://www.rfc-editor.org/info/rfc4786" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.4786.xml">
        <front>
          <title>Operation of Anycast Services</title>
          <author initials="J." surname="Abley" fullname="J. Abley">
            <organization/>
          </author>
          <author initials="K." surname="Lindqvist" fullname="K. Lindqvist">
            <organization/>
          </author>
          <date year="2006" month="December"/>
          <abstract>
            <t>As the Internet has grown, and as systems and networked services within enterprises have become more pervasive, many services with high availability requirements have emerged.  These requirements have increased the demands on the reliability of the infrastructure on which those services rely.</t>
            <t>Various techniques have been employed to increase the availability of services deployed on the Internet.  This document presents commentary and recommendations for distribution of services using anycast.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="126"/>
        <seriesInfo name="RFC" value="4786"/>
        <seriesInfo name="DOI" value="10.17487/RFC4786"/>
      </reference>
      <reference anchor="RFC8499" target="https://www.rfc-editor.org/info/rfc8499" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8499.xml">
        <front>
          <title>DNS Terminology</title>
          <author initials="P." surname="Hoffman" fullname="P. Hoffman">
            <organization/>
          </author>
          <author initials="A." surname="Sullivan" fullname="A. Sullivan">
            <organization/>
          </author>
          <author initials="K." surname="Fujiwara" fullname="K. Fujiwara">
            <organization/>
          </author>
          <date year="2019" month="January"/>
          <abstract>
            <t>The Domain Name System (DNS) is defined in literally dozens of different RFCs.  The terminology used by implementers and developers of DNS protocols, and by operators of DNS systems, has sometimes changed in the decades since the DNS was first defined.  This document gives current definitions for many of the terms used in the DNS in a single document.</t>
            <t>This document obsoletes RFC 7719 and updates RFC 2308.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="219"/>
        <seriesInfo name="RFC" value="8499"/>
        <seriesInfo name="DOI" value="10.17487/RFC8499"/>
      </reference>
    </references>
    <section anchor="implementationcons" title="Implementation Considerations">
      <t>With very few
exceptions, EDNS options which elicit an EDNS option in the response
are independant of the QNAME. This is not the case of ZONEVERSION, so
its implementation may be more or less difficult depending on how EDNS
options are handled in the name server.
      </t>
    </section>
    <section anchor="implementation" title="Implementation References">
      <t>There's a patched NSD server version 4.3.7 with support for ZONEVERSION with the experimental opcode 65024 maintained in
       https://github.com/huguei/nsd/tree/rrserial with SOA-SERIAL flag support,
       and installed for live testing in 200.1.122.30 address with configured zones
       dateserial.example.com. and incserial.example.com.;
       with MX, TXT and AAAA apex records.</t>
    </section>
    <!-- Change Log

v02 2022-04-21  HS   Upgraded from RRSERIAL to ZONEVERSION, to be versioning-agnostic.
v01 2022-04-06  HS   No changes, just for revive it after it expired
v00 2021-06-11  HS   No changes, just new filename as requested by DNSOP chairs for WG adoption
v01 2021-06-01  HS   Substantial changes and enhancements from DNSOP discussion
v00 2021-05-07  HS   New filename as requested by WG chair, to call for adoption
v01 2020-01-27  HS   No changes, just to avoid expiration
v00 2017-04-27  HS   Initial version

-->

</back>
</rfc>
