<?xml version="1.0" encoding="utf-8"?>
<!-- name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.miek.nl" -->
<rfc version="3" ipr="trust200902" docName="draft-shuangli-dnsop-update-of-dns-cache-00" submissionType="IETF" category="std" xml:lang="en" xmlns:xi="http://www.w3.org/2001/XInclude" updates="1034" indexInclude="false" consensus="true">

<front>
<title>Active Update of DNS Cache</title><seriesInfo value="draft-shuangli-dnsop-update-of-dns-cache-01" stream="IETF" status="standard" name="Internet-Draft"></seriesInfo>
<author initials="X." surname="Zhang" fullname="Xinqing Zhang"><organization>Computer Network Information Center, Chinese Academy of Sciences</organization><address><postal><street></street>
</postal><email>zhangxinqing21@mails.ucas.ac.cn</email>
</address></author><author initials="S." surname="Wu" fullname="Shuangli Wu"><organization>Computer Network Information Center, Chinese Academy of Sciences</organization><address><postal><street></street>
</postal><email>wushuangli@cnic.cn</email>
</address></author><author initials="Y." surname="Qin" fullname="Yifang Qin"><organization>Computer Network Information Center, Chinese Academy of Sciences</organization><address><postal><street></street>
</postal><email>qinyf@cnic.cn</email>
</address></author><author initials="W." surname="Wang" fullname="Wei Wang"><organization>Computer Network Information Center, Chinese Academy of Sciences</organization><address><postal><street></street>
</postal><email>wangwei@cnic.cn</email>
</address></author><author initials="X." surname="Zhou" fullname="Xu Zhou"><organization>Computer Network Information Center, Chinese Academy of Sciences</organization><address><postal><street></street>
</postal><email>zhouxu@cnic.cn</email>
</address></author><date/>
<area>Operations</area>
<workgroup>DNSOP</workgroup>

<abstract>
<t>Under the caching mechanism in <xref target="RFC1035"></xref>, the local DNS 
   server cannot obtain the update status of the authoritative server in time, 
   making the data inconsistent. Shortening TTL increases server load. In the passive 
   query of the authoritative server, an active notification method is added 
   to update the DNS mapping cache of the local DNS server in order to improve the 
   efficiency of DNS resolution. Authoritative servers actively send DNS update 
   packets after updating resource records. This document designs the API for receiving 
   DNS update packets on the local DNS server.</t>
</abstract>

</front>

<middle>

<section anchor="introduction"><name>Introduction</name>
<t>The user invokes the resolver through the browser to initiate a domain name query,
   sends a DNS request to the local DNS server, first checks whether there is a cache record,
   and then iteratively queries the DNS servers at all levels. But the cached mapping between 
   hosts and hostnames and IP addresses is not permanent, and the DNS server will discard 
   the cached information after a time-to-live.<xref target="RFC1035"></xref>The local DNS server 
   cannot obtain the update status of the authoritative server in time. If the cached record is 
   within the lifetime, the record has been updated in the authoritative server, which will inevitably 
   cause the data to be out of sync. If the time-to-live is set too small in order to improve the 
   synchronization rate of data, the cache area will not have the effect of caching, and the name 
   server will be frequently queried, resulting in high load on the name server and low resolution efficiency.</t>
<t>The mapping cache is updated in a way that combines passive queries from local DNS servers 
   with active notifications from authoritative servers. This method improves the problem of 
   inconsistency between authoritative server records and local DNS server records caused by 
   record updates in authoritative servers. This method not only improves the parsing efficiency, 
   but also reduces the query load of the authoritative server.</t>
<t>Compared to using NOTIFY message<xref target="RFC1996"></xref> to notify remote triggering of 
   cache refresh, the active update cache mechanism provides a new API to receive and update specific data, 
   and relieves the recursive server's receiving and updating pressure.</t>
<t>This document designs the API on the local DNS server to receive DNS update packets. 
   If the resource record in the authoritative server is updated, the authoritative server 
   will push the record in the form of an update package to all local servers that have the original 
   record in the cache. The sending mechanism of the update package is resolved by other drafts.</t>

<section anchor="reserved-words"><name>Reserved Words</name>
<t>The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;,
   &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this
   document are to be interpreted as described in <xref target="RFC2119"></xref> . </t>
</section>
</section>

<section anchor="cache-update-message"><name>Cache Update Message</name>
<section anchor="cacheupdatemessageformat"><name>Cache Update Message Format</name>
<t>The DNS message format is defined by <xref target="RFC1035"></xref>, 
   refer to the domain name dynamic update message format <xref target="RFC2136"></xref>, 
   and make some necessary changes. Define new DNS opcodes CACHED UPDATE and new DNS request.</t>
<t>The overall format of an CACHED UPDATE message is, following:</t>

<artwork>   +---------------------+
   |        Header       |
   +---------------------+
   |         Zone        | specifies the zone to be updated
   +---------------------+
   |       Original      | Original RRs
   +---------------------+
   |        Update       | RRs to be updated
   +---------------------+
   |    Additional Data  |
   +---------------------+
</artwork>
<t>The Header section specifies that this message is a CACHED UPDATE, and describes 
   the size of the other sections. The Original section contains the original resource 
   record of the resource record to be updated. The Update section contains the resource 
   records to update. The Additional Data section contains data that may be required to 
   complete this update but is not part of this update. Using the DNSSEC mechanism for 
   security verification, the additional data packet contains the digital signature RRSIG. 
   CACHED UPDATE satisfies the prerequisites that the original RR must exist.</t>
</section>

<section anchor="transportissues"><name>Transport Issues</name>
<t>An update transaction may be carried in a UDP datagram or in a TCP connection.</t>
<t>The advantage of using UDP datagram is that the channel utilization rate is high, 
   and there is no need to establish a long-term connection between the client and the server. 
   But the disadvantage is low reliability. If the transmission fails, the synchronization of 
   the record will be greatly reduced. If the recursive server is missing, the database space 
   in the authoritative server will be wasted.</t>
<t>The advantage of using TCP connection is high reliability, but it has the disadvantages of 
   low channel utilization and high sending pressure on authoritative servers.</t>
</section>

<section anchor="authentication"><name>Authentication</name>
<t>Since update messages from authoritative servers are delivered through insecure channels, 
   anyone can change the cached RRs in the local DNS server. To keep records safe, 
   updating the DNS cache must be authenticated.</t>
<t>TSIG is a mechanism for securing DNS messages <xref target="RFC2845"></xref>. 
   Because TSIG RRs are only associated with a DNS request/response, once used to validate 
   DNS messages are discarded and cannot be cached. Moreover, TSIG belongs to symmetric encryption,
   which requires both parties to the transaction to be trusted. Therefore, TSIG is not suitable for 
   a mechanism where an authoritative server may send update messages multiple times within 
   a certain period of time.</t>
<t>The private signature key and public key system in the blockchain is used to ensure 
   the credibility of the source of the update record. Moreover, each update record is formed into 
   a chain data structure by calculating the Hash value of each block to ensure the traceability 
   of the update.</t>
<t>The DNSSEC mechanism provides data integrity and authentication to security-aware resolvers and 
   applications through the use of cryptographic digital signatures <xref target="RFC2535"></xref>. An authoritative 
   DNS server signs a resource record with a private key, and the local DNS server verifies it 
   with the corresponding public key. If validation fails, the update message may not have been 
   issued by an authoritative DNS server in this zone.</t>
<t>The local DNS server requests a query from the authoritative server, and the authoritative server 
   replies with a response record carrying the digital signature RRSIG. The local DNS server 
   obtains the public key DNSKEY resource record by sending a query message for the public key, 
   and stores the record in the database corresponding to the area to which it belongs. 
   When the authoritative DNS server sends an update message carrying a digital signature 
   to the local DNS server, the local DNS server searches the DNSKEY record according to the zone.</t>
</section>

<section anchor="RSreceivesthemessage"><name>The Recursive Server receives the Message from The Authoritative Server</name>
<t>After the recursive server receives cache updates, it updates specific data at the right time.</t>
<t>To confirm that the recursive server has received the updated data, the recursive server 
   replies to the source with a NOTIFY response message. <xref target="RFC1996"></xref> describes the characteristics 
   of the NOTIFY response.</t>
</section>

<section anchor="ASreceivestheresponse"><name>Tne Authoritative Server receives the Response from The Recursive Server</name>
<t>After the authoritative server receives a response from a set of recursive servers 
   corresponding to specific data, it deletes the record from the update queue. An active update 
   of the recursive server cache by the authoritative server completes.</t>
</section>

</section>

<section anchor="dns-update-cache-api"><name>DNS Update Cache API</name>
<section anchor="name"><name>Name</name>
<t>DNS_cached_update - Receive update packets sent by authoritative servers, 
   resolve update packets, and update cache.</t>
</section>

<section anchor="synopsis"><name>Synopsis</name>
<t>DNS_cached_update(int sockfd, void *buff, size_t nbytes, struct sockaddr *from, socklen_t *addrlen)</t>
</section>

<section anchor="description"><name>Description</name>
<t>The DNS_cached_update() function receives the message from the connectionless mode socket, 
   parses the update information from the message, and updates the cache. 
   It is often used with connectionless mode sockets because it allows applications 
   to retrieve the source address from which data is received.</t>
<artwork>sockfd - a descriptor that identifies a connected socket
buff - Receive data buffer
nbytes - Receive data buffer size
from - A socket address structure pointing to the protocol address 
of the datagram sender
addrlen - The length of the socket address structure of the protocol 
address of the datagram sender
</artwork>
</section>

<section anchor="returnvalue"><name>Return Value</name>
<t>Upon successful completion, DNS_cached_update() returns the length of the message in bytes. 
   Otherwise the function returns -1 and sets errno to indicate the error.</t>
</section>
</section>

<section anchor="cache-update"><name>Cache Update</name>
<t>Inside the name server, the data structure is mainly divided into directory data structure, 
   separate data structure for each zone, and data structure for cached data. 
   All data structures implement the same tree structure format <xref target="RFC1035"></xref>. 
   In cache data structures, data is stored in RR. Query processing will need to traverse the tree 
   using case-insensitive label comparisons. During cache updates, the directory structure is used to 
   store parameters used to control update activity.</t>
<t>The RR format is defined by <xref target="RFC1035"></xref>. Use the node name NAME in RR to query, 
   if the query is successful, update the value of RDATA according to TYPE and CLASS.</t>
</section>

<section anchor="Aggregation"><name>Aggregation of Many Update Records for The Same Destination</name>
<t>If the destination recursive server with a large number of update records in the update queue 
   of the authoritative server is the same, then the authoritative server directly sends 
   a cache refresh message to the destination recursive server.</t>
<t>After receiving the message, the destination recursive server sends a refresh request 
   to the authoritative server, advances the refresh time, and sends a response message 
   to the authoritative server.</t>
<t>After the authoritative server receives the response, it deletes all update records destined 
   for this recursive server in the queue, so as to improve the active update efficiency 
   of the authoritative server.</t>
</section>

<section anchor="security-considerations"><name>Security Considerations</name>
<t>This document clarifies correct DNS server behavior and does not introduce
   any changes or new security considerations.</t>
</section>

<section anchor="iana-considerations"><name>IANA Considerations</name>
<t>There are no actions for IANA.</t>
</section>

<section anchor="acknowledgements"><name>Acknowledgements</name>
<t>The authors wish to thank
   Shuangli Wu,
   YiFang Qin
   for their input.</t>
</section>
</middle>

<back>
<references><name>References</name>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.1035.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.1996.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2136.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2535.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2845.xml"/>
</references>
</back>

</rfc>
