<?xml version="1.0" encoding="US-ASCII"?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?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="3"?>
<!-- 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-eastlake-dnsop-expressing-qos-requirements-00"
     ipr="trust200902">

<front>
  <title abbrev="QoS Requirements in DNS Queries">
       Expressing Quality of Service Requirements (QoS) in Domain Name
       System (DNS) Queries</title>
      
  <author fullname="Donald Eastlake" initials="D." surname="Eastlake">
    <organization>Futurewei Technologies</organization>
    <address>
      <postal>
        <street>2386 Panoramic Circle</street>
        <city>Apopka</city>
        <region>FL</region>
        <code>32703</code>
        <country>United States of America</country>
      </postal>
      <phone>+1-508-333-2270</phone>
      <email>donald.eastlake@futurewei.com</email>
    </address>
  </author>

  <author fullname="Haoyu Song" initials="H." surname="Song">
    <organization>Futurewei Technologies</organization>
    <address>
      <postal>
        <street>2220 Central Expressway</street>
        <city>Santa Clara</city>
        <region>CA</region>
        <code>95050</code>
        <country>United States of America</country>
      </postal>
      <email>haoyu.song@futurewei.com</email>
    </address>
  </author>

  <date day="6" month="March" year="2022"/>

  <area></area>
  <workgroup>DNSOP</workgroup>
  
  <!---->

  <keyword>QoS</keyword>
  <keyword>DNS</keyword>

  <abstract>
    <t>A method of encoding communication service quality requirements
    in a Domain Name System (DNS) query is specified through inclusion
    of the requirements in one or more label of the name being
    queried. This enables DNS responses that are dependent on
    such requirements without changes in the format of DNS protocol
    messages or DNS application program interfaces (APIs).</t>
  </abstract>
 
</front>

<middle>

  <section anchor="Intro" title="Introduction">

    <t>The Domain Name System (DNS) is a distributed database that
    stores data under hierarchical domain names and supports redundant
    servers, data caching, and security features. The data is
    formatted into resource records (RRs) whose content type and
    structure are indicated by the RR Type field. A typical use of DNS
    is that, by running the DNS protocol, a host gets the IP addresses
    stored at a domain name from DNS servers through a DNS
    resolver. Many other types of data besides IP addresses can be
    stored in and returned by the DNS.</t>

    <t>There are instances where different DNS answers are desired
    depending on the type of destination service to be connected to
    and/or the communication protocol to be used for that
    communication. This can be signaled in a query through the use of
    designated initial labels beginning with the underscore codepoint
    ("_", 0x5F). This was initially specified for the SRV RR Type <xref
    target="RFC2782"/>. It has been extended with additional types of
    leading-underscore labels for use with the TLSA, URI, TXT, and
    other RR Types <xref target="RFC8552"/>.</t>

    <t>Similarly, there is a need to encode different communication
    service quality requirements in DNS queries. Then different DNS
    answers can be returned depending, for example, on whether high
    bandwidth or low delay is the most important factor in the
    communication. Different answers could cause packets to be
    differently handled, constructed, or addressed which in turn
    could affect the path taken and/or the behavior of network
    switches along the communications path so as to make the
    communications more likely to satisfy the desired communication
    service requirements.</t>

    <t>Such encoding into the name being queried ensures that
    requirements will be forwarded by any recursive DNS servers
    between the querying application and the responding authoritative
    server. It also avoids any change in DNS protocol messages or
    application program interfaces (APIs).</t>

    <t>This document specifies how service requirements may be encoded
    in DNS queries through inclusion of the requirements in one or
    more labels of the name being queried enabling an authoritative
    server to take such requirements into account in determining its
    answers. </t>

    <section title="Terminology and Acronyms">

    <t>The following terminology and acronyms are used in this
    document. General familiarity with DNS terminology <xref
    target="RFC8499"/> is assumed.</t>
      
    <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 BCP 14 <xref target="RFC2119"></xref><xref
    target="RFC8174"></xref> when, and only when, they appear in all
    capitals, as shown here.</t>

    <t><list style="hanging">
      <t hangText="ABNF -">Augmented Backus-Naur Form <xref
      target="RFC5234"/>.</t>

      <t hangText="API -">Application Program Interface</t>

      <t hangText="DNS -">Domain Name System</t>

      <t hangText="LDH -">Letters, Digits, and Hyphen (DNS label)
      <xref target="RFC5820"/></t>

      <t hangText="R-LDH -">Restricted LDH (DNS label) <xref
      target="RFC5820"/></t>

      <t hangText="RR -">Resource Record <xref target="RFC8499"/>. Ths
      unit of data stored in the DNS.</t>

      <t hangText="TLV -">Type, Length, Value.</t>
    </list></t>
    
    </section>

  </section>

  <section anchor="sec_2"
	   title="Including Service Requirements in DNS Queries">
   
<t>This section specifies how to encode communication services quality
requirements in one or more domain name labels and discusses why some
alternatives methods of including requirements in a DNS query were
rejected.</t>

<section title="Including Information in DNS Queries">
  
  <t>There exist methods to include information in a DNS
  request that are conveyed only from a resolver to a server, that is
  one hop. These are primarily through the inclusion of "meta-RRs" in
  the Additional Information section of a DNS request <xref
  target="RFC1035"/> including the OPT meta-RR <xref
  target="RFC6891"/> which can carry an extensible set of
  options. These methods are generally not suitable to use for the
  inclusion of QoS requirements for two reasons:</t>
  <t><list style="symbol">
    <t>Typical APIs do not provide for meta-RRs to be
    specified on a query or retrieved from a response.</t>
    
    <t>Because meta-RRs designate transient data associated with a
    particular DNS message. Thus, if a query is forwarded by a
    recursive DNS server, such requirements will be lost.</t>
  </list></t>

  <t>Other methods of including information in a DNS query that are
  preserved when a query is forwarded are the Name, Class, and RR
  Type.</t>

  <t>Class is an additional dimension of DNS data besides Name and RR
  Type.  However, only the "IN" or Internet Class has significant
  deployment or utilization and DNS messages specifying other Classes
  are frequently blocked by middle-boxes. Thus this dimension is not
  useful in practice.</t>

  <t>RR Type is only 16-bits and is already used to indicate the type
  of RRs being requests.</t>

  <t>This leaves only the name being queried for the encoding of
  service requirement as specified below.</t>
   
</section>

   <section title="Encoding Service Requirements in DNS Names">  

    <t>Domain names consist of a sequence of labels, with labels
    further to the right being a higher level in the name hierarchy
    and labels to the left of a particular label identifying nodes in
    the hierarchical tree of nodes below that particular label. Each
    label is limited to 63 octets in length and the zero length null
    label is reserved to identify the root node. In a complete valid
    domain name, the sum of the length of each label in the name plus
    one octet of overhead per label (including the terminating null
    label) may not exceed 255 octets. </t>

    <t>Communication service requirements are encoded into names being
    queried. This is done by including a service label, constructed as
    described below, in the name usually as the first label.  A
    service label consist of a special prefix followed by a sequence
    of one or more encoded TLVs indicating the service
    requirements. The use of such a special prefix which affects the
    interpretation of the remainder of the label is similar to the
    "xn--" prefix to indicate internationalized domain names <xref
    target="RFC5890" />.</t>
     
     <section title="Requirement TLV Encoding">
       
     <t>Each TLV expressing a service requirement can be thought of as
     being binarily encoded as shown in <xref target="TLV"/>.</t>

    <figure title="Service Requirement TLV Structure"
	    anchor="TLV">
      <artwork align="center"><![CDATA[
  0   1   2   3   4   5   6   7
+---+---+---+---+---+---+---+---+
|     Type      |    Length     |
+---+---+---+---+---+---+---+---+
|  Value,  Length Bytes Long    .
.                               .
.                               .
.................................
         ]]></artwork>
    </figure>
      
    <t><list style="none"><t><list style="hanging">
      <t hangText="Type:">4-bit unsigned integer indicating the type of
      service requirement.</t>
      <t hangText="Length:">4-bit unsigned integer indicating the
      length of the value associated with the service requirement in
      bytes. The presence of an explicit length makes it possible to
      skip unknown/unimplemented service requirements.</t>
      <t hangText="Value:">The value associated with the service
      requirement.</t>
    </list></t></list></t>

    <t>Although the DNS does not constraint the octet values within a
    label, for ease in use and due to user interface restrictions
    label octets are commonly limited to a subset of printing ASCII
    <xref target="RFC0020"/> character values. Furthermore, for name
    matching purposes, the DNS does not distinguish between octets
    having the upper case and lower case codes for an ASCII letter and
    in some cases the storage of a label in the DNS and/or its later
    retrieval may change the value of an octet in that label between
    the values for upper and lower case version of an ASCII letter
    <xref target="RFC4343"/>. To avoid possible problems with this DNS
    case insensitivity or possibly problematic byte values such as
    zero, the TLV or sequence of TLVs is included in the DNS name
    label in hexadecimal notation. There are more compact encoding
    that avoid these problems, such as a customization of Bootstring
    similar to Punycode <xref target="RFC3492"/> or Base32 <xref
    target="RFC4648"/> but for simplicity and to make the encoding into
    names more easily readable for debugging and other purpose
    hexdecimal was chosen.</t>
    
    </section><!--Requirements TLV Encoding-->

    <section title="Requirements Types and Value Encoding">

    <t>The following types of service requirement are initially
    defined:</t>
    <t><list style="hanging">
      <t hangText="Coarse:">A general indication of the most important
      service being sought encoded as a one byte integer patterned
      after the IPv4 ToS (Type of Service) value specified in <xref
      target="RFC1349"/>. (This is "coarse" in contrast with the more
      precise service requirements defined below.) The following
      values are defined:
      <list style="hanging">
	<t hangText="0x00">Normal service.</t>
	<t hangText="0x01">Minimize cost.</t>
	<t hangText="0x02">Maximize reliability.</t>
	<t hangText="0x04">Maximize throughput.</t>
	<t hangText="0x08">Minimize delay.</t>
	<t hangText="0x10">Minimize jitter.</t>
       </list></t>

      <t hangText="Bandwidth:"> The bandwidth requirement is encoded
      as a float32 (32-bit IEEE floating point format <xref
      target="ieee754"/> number). The unit is bits per second. If more
      than one TLV of this type occurs in a DNS name, all but the
      first (leftmost) are ignored.</t>

      <t hangText="Delay:"> The delay requirement is encoded in 24-bit
      integer format. The unit is microseconds. If more than one TLV
      of this type occurs in a DNS name, all but the first (leftmost)
      are ignored.</t>

      <t hangText="Jitter:"> The jitter (i.e., delay variation) is
      encoded in 24-bit integer format. The unit is microsecond. If
      more than one TLV of this type occurs in a DNS name, all but the
      first (leftmost) are ignored.</t>

      <t hangText="Loss Rate:"> This lost rate (i.e., the percentage
      of packet loss) is encoded in 24-bit integer format. The basic
      unit is 0.0000001% (i.e., one packet drop per 1 billion
      packets), where (2^24 - 2) = 1.6777214% is the largest possible
      loss rate defined, 2^24-1 means no loss rate requirement, and 0
      means the drop rate should be smaller than 0.0000001%. If more
      than one TLV of this type occurs in a DNS name, all but the
      first (leftmost) are ignored.</t>

    </list></t>    
      
     <t> Using IEEE 32-bit floating point for the values when appropriate
     provides a compact notation that can encode up to approximately
     10^38 and down to approximately 10^-38 with 6 to 9 significant
     digits of precision <xref target="ieee754"/>.</t>
 
     </section>

     <section title="Complete QoS DNS Names">

       <t>The on-the-wire encoding of a domain name beginning with a
       service requirement label would be as shown in <xref
       target="wire1"/> below. (In the DNS wire encoding, each label is
       preceded by a length.)</t>
       
     <t><figure anchor="wire1" title="Name Wire Encoding Style 1">
                      <artwork align="center"><![CDATA[

+-------+-------+-----+   +-----+--------------------------------+
|length |prefix |TLV1 |...|TLVn |Encoded Remainder of Domain Name|
+-------+-------+-----+   +-----+--------------------------------+
  ]]></artwork>
     </figure></t>
     
     <t>Alternatively, service requirements could split among a
     sequence of two or more labels in a DNS name to be queried, as
     shown in <xref target="wire2"/>.</t>

     <t><figure anchor="wire2" title="Name Encoding Style 2">
       <artwork align="center">
<![CDATA[

+-------+------+----+   +-------+------+----+-----------------+
|length |prefix|TLV1|...|length |prefix|TLVn|Remainder of Name|
+-------+------+----+   +-------+------+----+-----------------+
]]></artwork>
     </figure></t>

       <t>The display presentation of a DNS name requesting a coarse QoS
       requirement for minimum delay for communication with
       example.com would be as shown in <xref target="example"/></t>
     
     <t><figure anchor="example" title="Example DNS Name">
       <artwork align="center"><![CDATA[
                 qs--   Prefix
                    1   TLV Type
                    1   TLV Length
                   08   TLV Value
          example.com   Remainder of domain name

qs--1108.example.com.   Complete domain name
       ]]></artwork>
     </figure></t>

    </section><!-- Complete QoS DNS Names-->
  
    </section><!--Encoding Requirements in DNS Name-->
  </section><!--Including Service Requirements in DNS Queries-->

  <section anchor="Security" title="Security Considerations">
    <t>TBD</t>
  </section>

  <section anchor="IANA" title="IANA Considerations">
    <t>This section conforms to <xref target="RFC8126"/>.</t> 
   <t>IANA is requested to create the following registries.</t>

   <section title="Requirements Label Type Codes">
     <t>IANA is requested to create a registry on the Domain Name
     System (DNS) Parameters webpage as follows:</t>

     <figure><artwork>
       Name: DNS QoS Requirements Label Type Codes
       Registration Procedure: IETF review.
       Reference: [this document]

        Code     Description     Reference
       ------   -------------   -----------------
          0      reserved
          1      Coarse QoS      [this document]
          2      Bandwidth       [this document]
          3      Delay           [this document]
          4      Jitter          [this document]
          5      Loss Rate       [this document]
       6-14      unassigned
         15      extended
     </artwork></figure>

   </section>

   <section title="Restricted LDH Label Prefixes">
     
     <t>LDH labels are specified in <xref target="RFC5890"/> as
     consisting of letters, digits, and hyphen but not beginning or
     ending with a hyphen. That is, strings of length from 1 through
     63 that match the ABNF (Augmented Backus-Naur Form <xref
     target="RFC5234"/>) expression for LDH below.</t>
     
     <t><list style="none">
       <t>LD = ( a-z / 0-9 )  ;letter or digit (case
       insensitive)</t>
       <t>HYPH = %x2D         ;hyphen / minus</t>
       <t>LDH = LD / HYPH</t>
       <t>LDH-LABEL = LD / LD 0*61LDH LD</t>
     </list></t>
   
     <t>R-LDH (Restricted LDH) labels are specified in <xref
     target="RFC5890"/> as the subset of LDH-LABELs that begin with
     two letters/digits followed by two hyphens. That is, they are
     LDH-LABELs that match the ABNF regular expression <xref
     target="RFC5234"/> below.</t>
     
     <t><list style="none">
      <t>R-LDH-LABEL = 2LD HYPH HYPH 0*58LDH LD</t>
     </list></t>

     <section title="R-LDH Registry">

     <t>IANA is requested to create a registry on the Domain
     Name System (DNS) Parameters webpage as follows:</t>

     <figure><artwork>
       Name: DNS Restricted LDH (R-LDH) Label Prefixes
       Registration Procedure: Expert review.
       Reference: [this document]

       Prefix    Description             Reference
       ------   ---------------------   -----------
        qs--    QoS Requirements        [this document]
        xn--    Internationalization    [RFC5820]
     </artwork></figure>
     </section><!-- R-LDH REgistry-->

     <section title="R-LDH Expert Guidance">
       
       <t>In reviewing applications for the assignment of an R-LDH
       prefix, the Expert should keep in mind the following
       guidance:</t>
       
       <t><list style="symbols">
	 <t>The use of labels with the requested prefix must meet the
	 following criteria:
	 <list style="symbols">
	   <t>be documented in an Internet Draft,</t>
	   <t>not significantly duplicate the use of any other R-LDH
	   prefix, and</t>
	   <t>not require any changes to DNS protocol messages or DNS
	   mechanisms such as the handling of CNAME or DNAME RRs or
	   wildcards.</t>
	 </list></t>
	 
	 <t>Assignment of more than one R-LDH for a purpose is
	 prohibited. If it is necessary to distinguish sub-uses under
	 an R-LDH prefix, this should be done by encoding within the
	 R-LDH label after the prefix or by a further label or labels
	 before the R-LDH label, such as a label beginning with
	 underscore ("_").</t>
	 
	 <t>Prefixes where the first or second character is any of the
	 digits "0", "1", and "5"or the letters "O", "I", "L", and "S"
	 should not be assigned, due to the possibilities of
	 confusion, unless there are strong reasons to use these
	 characters.</t>
       </list></t>
       
     </section><!-- R-LDH Expert Guidance-->
   </section><!-- Restricted LDH Label Prefixes-->
            
 </section>

 <section anchor="Acknowledgments" title="Acknowledgments">
   <t>The suggestions of the following are gratefully acknowledged:</t>
   <t><list style="none"><t>TBD</t></list></t>
 </section>

 </middle>

 <back>

 <references title="Normative References">
   
    <?rfc include='reference.RFC.0020'?>
    <?rfc include='reference.RFC.2119'?>
    <?rfc include='reference.RFC.4343'?>
    <?rfc include='reference.RFC.5234'?>
    <?rfc include='reference.RFC.5820'?>
    <?rfc include='reference.RFC.5890'?>
    <?rfc include='reference.RFC.8126'?>
    <?rfc include='reference.RFC.8174'?>

    <reference anchor="ieee754"
	       target="https://standards.ieee.org/standard/754-2019.html">
    <front>
      <title>IEEE 754-2019 - IEEE Standard for Floating-Point
      Arithmetic</title> <author fullname="Institute for Electrical
      and Electronic Engineering" initials="IEEE" surname="IEEE 754
      WG"/> <date year="2019"/> </front> </reference>
 </references>
      
 <references title="Informative References">
   <?rfc include='reference.RFC.1035'?>
   <?rfc include='reference.RFC.1349'?>
   <?rfc include='reference.RFC.2782'?>
   <?rfc include='reference.RFC.3492'?>
   <?rfc include='reference.RFC.4648'?>
   <?rfc include='reference.RFC.6891'?>
   <?rfc include='reference.RFC.8499'?>
   <?rfc include='reference.RFC.8552'?>
 </references>

 </back>
</rfc>
