A domain name resolution method and device, a storage medium and a computer program product

By employing an Adaptive Radix Tree (ART) structure in the DNS system for domain name resolution, the inefficiency of red-black trees in the domain name resolution process is solved, achieving efficient domain name resolution request processing and improving the performance and reliability of the DNS system.

CN118827611BActive Publication Date: 2025-12-12CHINA MOBILE COMM GRP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410746129.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-11
Publication Date
2025-12-12
Estimated Expiration
2044-06-11

Smart Images

  • Figure CN118827611B_ABST
    Figure CN118827611B_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses a domain name resolution method and device, a storage medium and a computer program product, and comprises the following steps: in the case that the domain name resolution device receives a domain name resolution request transmitted by a client, obtaining a domain name to be queried and a query type from the domain name resolution request; converting the domain name to be queried into a search key; searching for a target domain name in a target adaptive radix tree according to the search key and the query type; and transmitting the target domain name to the client.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer networks, and particularly relates to a domain name resolution method and device, a storage medium and a computer program product. BACKGROUND

[0002] Domain Name System (DNS) is one of the most basic network services of the Internet. A large number of Internet behaviors of users need to be processed through DNS in priority, and the efficiency, accuracy and security of DNS guidance directly affect the safe and stable operation of Internet services and user experience.

[0003] In the related art, a red-black tree is used as a data structure of DNS authoritative data, but the red-black tree is not well adapted to the properties of the DNS system, such as the DNS domain name taking a byte value as a basic unit and the maximum length being 255 bytes. The search time complexity of the red-black tree is O (logN), and the tree height in the worst case cannot be directly estimated according to the characteristics of the DNS system, range scan cannot be performed, and for a top-level domain area with a large number of glue records, it is difficult to apply the RCU (Read-Copy Update) mechanism during cache updating, and a lock mechanism is necessarily required. However, the existence of the lock will affect the performance of the cache server, thereby reducing the efficiency of processing domain name resolution requests by using the cache server. SUMMARY

[0004] To solve the above technical problems, the embodiments of the present application provide a domain name resolution method and device, a storage medium and a computer program product, which can improve the efficiency of processing domain name resolution requests.

[0005] The technical solution of the present application is implemented as follows:

[0006] The embodiments of the present application provide a domain name resolution method, which comprises the following steps:

[0007] In the case that a domain name resolution request transmitted by a client is received, a domain name to be queried and a query type are acquired from the domain name resolution request;

[0008] The domain name to be queried is converted into a search key;

[0009] According to the search key and the query type, a target domain name is searched in a target adaptive radix tree;

[0010] The target domain name is transmitted to the client.

[0011] The embodiments of the present application provide a domain name resolution device, which comprises the following steps:

[0012] The acquisition unit is configured to acquire a domain name to be queried and a query type from the domain name resolution request in a case where the domain name resolution request transmitted by the client is received.

[0013] The conversion unit is configured to convert the domain name to be queried into a search key.

[0014] The search unit is configured to search for a target domain name in a target adaptive radix tree according to the search key and the query type.

[0015] The transmission unit is configured to transmit the target domain name to the client.

[0016] Embodiments of the present application provide a domain name resolution device, and the device comprises:

[0017] The memory, the processor and the communication bus are in communication, the memory stores a domain name resolution program executable by the processor, and when the domain name resolution program is executed, the above-mentioned domain name resolution method is executed by the processor.

[0018] Embodiments of the present application provide a storage medium having a computer program stored thereon, and the computer program is applied to a domain name resolution device, and the computer program is executed by a processor to implement the above-mentioned domain name resolution method.

[0019] Embodiments of the present application further provide a computer program product comprising a computer program, and the computer program is executable by a processor in a domain name resolution device to complete the steps of the above-mentioned domain name resolution method.

[0020] Embodiments of the present application provide a domain name resolution method and device, a storage medium and a computer program product, and the domain name resolution method comprises the following steps: in a case where a domain name resolution request transmitted by a client is received, acquiring a domain name to be queried and a query type from the domain name resolution request; converting the domain name to be queried into a search key; searching for a target domain name in a target adaptive radix tree according to the search key and the query type; and transmitting the target domain name to the client. The above-mentioned method implementation scheme is adopted, the domain name resolution device, in a case where a domain name resolution request transmitted by a client is received, converts a domain name to be queried in the domain name resolution request into a search key, searches for a target domain name in a target adaptive radix tree according to the search key and a query type in the domain name resolution request, the target adaptive radix tree structure can solve the problem that a red-black tree cannot be applied to RCU, improves overall performance, implements top-level domain hotspot guarantee domain name resolution service, and thus improves the efficiency of processing domain name resolution requests. BRIEF DESCRIPTION OF DRAWINGS

[0021] Figure 1 A domain name resolution method flowchart is provided for embodiments of the present application.

[0022] Figure 2 An exemplary domain name conversion flowchart provided for the embodiments of the present application is shown in the following table.

[0023] Figure 3 An exemplary Node40 diagram provided for the embodiments of the present application is shown in the following table.

[0024] Figure 4 An exemplary component structure diagram of a domain name resolution device provided for the embodiments of the present application is shown in the following table.

[0025] Figure 5 An exemplary adaptive radix tree diagram provided for the embodiments of the present application is shown in the following table.

[0026] Figure 6 An exemplary component structure diagram of a domain name resolution device provided for the embodiments of the present application is shown in the following table. Figure 1 ;

[0027] Figure 7 An exemplary component structure diagram of a domain name resolution device provided for the embodiments of the present application is shown in the following table. Figure 2 . DETAILED DESCRIPTION

[0028] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.

[0029] The embodiments of the present application provide a domain name resolution method, and the domain name resolution method is applied to a domain name resolution device, Figure 1 A flowchart of a domain name resolution method provided for the embodiments of the present application is shown in the following table. Figure 1 The domain name resolution method can include the following steps.

[0030] S101, in the case of receiving a domain name resolution request transmitted by a client, obtaining a domain name to be queried and a query type from the domain name resolution request.

[0031] The domain name resolution method provided by the embodiments of the present application is applicable to the scenario of resolving a domain name resolution request.

[0032] In the embodiments of the present application, the domain name resolution device can be implemented in various forms. For example, the domain name resolution device described in the present application can include devices such as cameras, tablets, notebook computers, personal digital assistants (PDAs), and devices such as digital TVs, desktop computers, servers, etc.

[0033] In the embodiment of the present application, the domain name resolution device can be a new top-level domain data cache server between a recursive resolver and an authoritative domain name server.

[0034] In the embodiment of the present application, when the domain name resolution device receives a domain name resolution request transmitted by a client, the domain name resolution device can first perform basic processing on the domain name resolution request, such as packet format checking, User Datagram Protocol (UDP) packet validity detection, Access Control Lists (ACL) processing, and the like, and then obtain a domain name to be queried and a query type from the processed domain name resolution request.

[0035] It should be noted that the manner in which the domain name resolution device first performs basic processing (such as packet format checking, UDP packet validity detection, ACL processing, and the like) on the domain name resolution request can be determined according to actual conditions, and the embodiment of the present application does not limit this.

[0036] In the embodiment of the present application, the domain name resolution request can be a DNS request. The domain name resolution request carries a domain name to be queried and a query type.

[0037] It should be noted that the domain name to be queried can be a QNAME in the DNS request. The query type can be a QTYPE in the DNS request.

[0038] In the embodiment of the present application, the number of domain name resolution requests can be one, and the number of domain name resolution requests can also be multiple. The specific number of domain name query requests can be determined according to actual conditions, and the embodiment of the present application does not limit this.

[0039] In the embodiment of the present application, when the number of domain name resolution requests is one, one domain name to be queried and one query type can be obtained from one domain name resolution request, and one target domain name corresponding to one domain name resolution request can be determined according to one domain name to be queried and one query type. When the number of domain name resolution requests is multiple, multiple domain names to be queried and multiple query types can be obtained from multiple domain name resolution requests, and multiple target domain names corresponding to multiple domain name resolution requests can be determined according to multiple domain names to be queried and multiple query types.

[0040] In the embodiment of the present application, the domain name resolution request can be a resolution request for a hot domain name, or can be a resolution request for other domain names. The specific type can be determined according to actual conditions, and the embodiment of the present application does not limit this.

[0041] S102, convert the domain name to be queried into a search key.

[0042] In the embodiment of the present application, after the domain name resolution device obtains the domain name to be queried and the query type from the domain name resolution request, the domain name to be queried can be converted into a search key.

[0043] In the embodiment of the present application, the manner of converting the domain name to be queried into a search key can be adjusting the character format of the domain name to be queried according to a preset character writing format to obtain a third domain name, reversing the labels in the third domain name to obtain a fourth domain name, and adding a first character at the tail of the labels and the tail of the fourth domain name to obtain the search key.

[0044] It should be noted that the preset character writing format can be a format configured in the domain name resolution device, a format transmitted to the domain name resolution device by other equipment, or a format determined by the domain name resolution device in other manners. The manner in which the domain name resolution device obtains the preset character writing format can be determined according to actual conditions, and the embodiment of the present application does not limit this.

[0045] For example, the preset character writing format can be a writing format in which the character case is unified, or other writing formats. The specific preset character writing format can be determined according to actual conditions, and the embodiment of the present application does not limit this.

[0046] It should be noted that the first character can be a character configured in the domain name resolution device, a character transmitted to the domain name resolution device by other equipment, or a character obtained by the domain name resolution device in other manners. The manner in which the domain name resolution device obtains the first character can be determined according to actual conditions, and the embodiment of the present application does not limit this.

[0047] For example, the first character can be 0, the first character can also be 00, and the first character can also be other characters. The specific first character can be determined according to actual conditions, and the embodiment of the present application does not limit this.

[0048] For example, as shown in FIG. 1, Figure 2 The domain name to be queried can be www.baicu.com. The process of adjusting the character format of the domain name to be queried according to the preset character writing format to obtain the third domain name can be uniform case processing (e.g., converting all characters to lowercase) on the characters in the domain name to be queried to obtain www.baicu.com. The manner of reversing the labels in the third domain name to obtain the fourth domain name can be reversing all labels of the domain name from right to left to obtain com.baicu.www. If the byte value 0x00 is added as the label end and the domain name end, then the first character is added at the tail of the labels and the tail of the fourth domain name to obtain the converted domain name to be queried (i.e., the search key), which can be com0baicu0www00.

[0049] In the embodiments of the present application, the domain name resolution apparatus can also convert the domain name to be queried into a search key in other manners, and the specific implementation manners can be determined according to actual conditions, which are not limited in the embodiments of the present application.

[0050] S103, finding the target domain name in the target adaptive radix tree according to the search key and the query type.

[0051] In the embodiments of the present application, after the domain name resolution apparatus converts the domain name to be queried into a search key, the target domain name can be found in the target adaptive radix tree according to the search key and the query type.

[0052] In the embodiments of the present application, the process of finding the target domain name in the target adaptive radix tree according to the search key and the query type includes: finding the first parent domain of the search key in the target adaptive radix tree; in the case that the first parent domain exists in the target adaptive radix tree, matching the domain name to be queried with the plurality of nodes under the first parent domain in the target adaptive radix tree in turn; in the case that the first node matching the query type exists and the resource record type does not exist in the first node, adding the target resource record matching the query type in the first node to the response message; finding the first resource record related to the first node in the database; and determining the target domain name according to the first resource record and the response message.

[0053] It should be noted that the first node is part of the plurality of nodes.

[0054] In the embodiments of the present application, since the top-level domain hotspot service does not provide recursive resolution function, the RA bit (i.e. the flag bit field of the DNS header) in the response is not set. Then the ancestor region (ancestor) closest to the QNAME is found in the ART region tree (target adaptive radix tree) held by the hotspot service, i.e. the first parent domain of the search key is found in the target adaptive radix tree.

[0055] In the embodiment of the present application, in the case where the first parent domain exists in the target adaptive radix tree, the domain name to be queried is sequentially matched with the nodes under the first parent domain in the target adaptive radix tree (i.e., the domain name to be queried is sequentially matched with the nodes under the first parent domain in the target adaptive radix tree), in the case where the node matching the entire QNAME exists and the resource record type CNAME does not exist in the node (i.e., in the case where the first node matching the query type exists and the resource record type does not exist in the first node), all the QTYPE-compliant RR in the node are copied to the response part of the response (i.e., the target resource record matching the query type in the first node is added to the response message), and then the first resource record related to the first node is searched in the database (the resource record that can be useful is searched in the database); according to the first resource record and the response message, the target domain name (added to the additional part of the response) is determined.

[0056] It should be noted that the closest ancestor zone of the query name (qname) in the DNS tree refers to the closest parent domain related to the query name in the domain name resolution process. When a DNS server receives a query, it starts searching from the root domain and searches downward until the closest ancestor zone of the query name is found. The closest ancestor zone is usually the parent domain of the domain containing the query name. After the closest ancestor zone is found, the DNS server can continue to search downward until the zone matching the query name completely is found or a response that no record is found is returned.

[0057] In the embodiment of the present application, the database is a cache database of the target adaptive radix tree.

[0058] In the embodiment of the present application, after the domain name resolution device sequentially matches the domain name to be queried with the nodes under the first parent domain in the target adaptive radix tree, in the case where the first node matching the query type exists, the resource record type exists in the first node, and the resource record type does not match the query type, the resource record type is added to the response message; the query type is modified to the resource record type; the second parent domain corresponding to the resource record type is searched in the target adaptive radix tree; in the case where the second parent domain exists, the target domain name is determined according to the nodes under the second parent domain in the target adaptive radix tree.

[0059] In the embodiment of the present application, in the case where the first parent domain exists in the target adaptive radix tree, the labels are matched one by one downwards in the ART domain name tree (i.e. the domain name to be queried is matched with the nodes under the first parent domain in the target adaptive radix tree in turn), in the case where the node matching the entire QNAME exists, the resource record type CNAME exists in the node, but the request QTYPE does not match the CNAME (i.e. in the case where the first node matching the query type exists, the resource record type exists in the first node, and the resource record type does not match the query type), the CNAME record is copied to the response part of the response (i.e. the resource record type is added to the response message), the QNAME is changed to the canonical name in the CNAME record (i.e. the query type is modified to the resource record type), then the new QNAME is converted into a search key according to the rule, the closest ancestor region to the QNAME is found in the ART region tree held by the hot spot service, the target domain name is found based on the closest ancestor region (in the target adaptive radix tree, the second parent domain corresponding to the resource record type is found; in the case where the second parent domain exists, the target domain name is determined according to the nodes under the second parent domain in the target adaptive radix tree).

[0060] In the embodiment of the present application, after the domain name resolution device matches the domain name to be queried with the nodes under the first parent domain in the target adaptive radix tree in turn, in the case where the domain name server record exists in the first node, the domain name server record is added to the response message; the first resource record related to the first node is found in the database; and the target domain name is determined according to the first resource record and the response message.

[0061] In the embodiment of the present application, in the case where the first parent domain exists in the target adaptive radix tree, the labels are matched one by one downwards in the ART domain name tree (i.e. the domain name to be queried is matched with the nodes under the first parent domain in the target adaptive radix tree in turn), in the case where the node matching the entire QNAME exists, the resource record type CNAME exists in the node, but the request QTYPE does not match the CNAME (i.e. in the case where the first node matching the query type exists, the resource record type exists in the first node, and the resource record type does not match the query type), the CNAME record is copied to the response part of the response (i.e. the resource record type is added to the response message), the QNAME is changed to the canonical name in the CNAME record (i.e. the query type is modified to the resource record type), then the new QNAME is converted into a search key according to the rule, the closest ancestor region to the QNAME is found in the ART region tree held by the hot spot service, the target domain name is found based on the closest ancestor region (in the target adaptive radix tree, the second parent domain corresponding to the resource record type is found; in the case where the second parent domain exists, the target domain name is determined according to the nodes under the second parent domain in the target adaptive radix tree).

[0062] In the embodiment of the present application, after the domain name resolution device successively matches the domain name to be queried with the plurality of nodes under the first parent domain in the target adaptive radix tree, if there is a first label that does not match in the first node, it is determined whether there is a wildcard label corresponding to the first label in the first node; if there is no wildcard label and the query domain name is a low standard name in the alias record in the first node, a first resource record related to the first node is found in the database; and the target domain name is determined according to the first resource record.

[0063] In the embodiment of the present application, if there is a first parent domain in the target adaptive radix tree, the labels are successively matched in the ART domain name tree (i.e., the domain name to be queried is successively matched with the plurality of nodes under the first parent domain in the target adaptive radix tree), if a certain label cannot be matched, it is checked whether there is a wildcard label (if there is a first label that does not match in the first node, it is determined whether there is a wildcard label corresponding to the first label in the first node), and specifically, if there is no wildcard label and the QNAME is a low standard name in the alias record (i.e., there is no wildcard label and the query domain name is a low standard name in the alias record in the first node), a resource record that may be useful is found in the database and added to the additional part of the response (i.e., a first resource record related to the first node is found in the database; and the target domain name is determined according to the first resource record).

[0064] In the embodiment of the present application, after the domain name resolution device determines whether there is a wildcard label corresponding to the first label in the first node, if there is a wildcard label and there is a resource record matching the query type at the wildcard label node, the resource record is added to the response message; the owner name of the resource record is set as the domain name to be queried; a first resource record related to the first node is found in the database; and the target domain name is determined according to the first resource record and the response message.

[0065] In the embodiment of the present application, in the case where the first parent domain exists in the target adaptive radix tree, the labels are matched one by one downwards in the ART domain name tree (i.e. the domain name to be queried is sequentially matched with the nodes under the first parent domain in the target adaptive radix tree), if a certain label cannot be matched, it is checked whether there is a wildcard label (in the case where the first label does not match in the first node, it is determined whether there is a wildcard label corresponding to the first label in the first node), specifically, if there is a wildcard label, and there is a resource record matching the QTYPE at the wildcard label node (i.e. in the case where there is a wildcard label, and there is a resource record matching the query type at the wildcard label node), the resource record is copied to the response part of the response (i.e. the resource record is added to the response message), and the owner name of the resource record is set as the request QNAME (i.e. the owner name of the resource record is set as the domain name to be queried), then the possibly useful resource records are searched in the database, and added to the additional part of the response (i.e. the first resource record related to the first node is searched in the database; the target domain name is determined according to the first resource record and the response message).

[0066] In the embodiment of the present application, after the domain name resolution device determines whether there is a wildcard label corresponding to the first label in the first node, in the case where there is a wildcard label, and the type of the resource record at the wildcard label node does not match the query type, the type of the resource record is added to the response message; the owner name of the resource record is set as the domain name to be queried; the query type is modified as the type of the resource record; in the target adaptive radix tree, a second parent domain corresponding to the type of the resource record is searched; in the case where the second parent domain exists, in the target adaptive radix tree, the target domain name is determined according to the nodes under the second parent domain.

[0067] In the embodiment of the present application, in the case where the first parent domain exists in the target adaptive radix tree, the label is matched one by one downwards in the ART domain name tree (i.e. the domain name to be queried is matched with the plurality of nodes under the first parent domain in the target adaptive radix tree in turn), if a certain label cannot be matched, it is checked whether there is a wildcard label (in the case where the first label does not match in the first node, it is determined whether there is a wildcard label corresponding to the first label in the first node), specifically, if there is a wildcard label, it is queried whether there is a resource record type CNAME at the wildcard label node, but the request QTYPE does not match the CNAME (i.e. in the case where there is a wildcard label, and there is a resource record type at the wildcard label node which does not match the query type), the CNAME record is copied to the response part of the response (i.e. the resource record type is added to the response message), and the owner name of the resource record is set as the request QNAME (the owner name of the resource record is set as the domain name to be queried), the QNAME is changed to the canonical name in the CNAME record (the query type is modified to the resource record type), then the new QNAME is converted into a search key according to the rule, the closest ancestor region to the QNAME is found in the ART region tree held by the hot spot service, and the target domain name is found based on the closest ancestor region (in the target adaptive radix tree, the second parent domain corresponding to the resource record type is found; in the case where the second parent domain exists, in the target adaptive radix tree, the target domain name is determined according to the node under the second parent domain).

[0068] In the embodiment of the present application, in the case where the first parent domain does not exist in the target adaptive radix tree, the domain name resolution request is forwarded to the authoritative domain name server, so that the authoritative domain name server resolves the domain name resolution request to obtain the target domain name; or in the case where the wildcard label corresponding to the first label does not exist, and the domain name to be queried is the historical query domain name of the first node, the domain name resolution request is forwarded to the authoritative domain name server, so that the authoritative domain name server resolves the domain name resolution request to obtain the target domain name.

[0069] In the embodiment of the present application, after the first parent domain of the search key is found in the target adaptive radix tree, in the case where the first parent domain does not exist in the target adaptive radix tree, the domain name resolution request is pushed to the service forwarding module, and the domain name resolution request is forwarded to the authoritative domain name server by using the service forwarding module, so that the authoritative domain name server resolves the domain name resolution request to obtain the target domain name.

[0070] In the embodiment of the present application, in the case that the domain name resolution device determines that there is no wildcard label corresponding to the first label in the first node, and the domain name to be queried is the historical query domain name of the first node, the domain name resolution request is pushed to the service forwarding module, and the domain name resolution request is forwarded to the authoritative domain name server by using the service forwarding module, so that the authoritative domain name server resolves the domain name resolution request to obtain the target domain name.

[0071] In the embodiment of the present application, before searching the target adaptive radix tree according to the search key and the query type, in the case that the domain name resolution device obtains the domain name to be stored, the character format of the domain name to be stored is adjusted according to a preset character writing format to obtain a first domain name; the labels in the first domain name are reversed to obtain a second domain name; a first character is added at the tail of the labels of the second domain name and at the tail of the domain name to obtain a converted domain name to be stored; and the converted domain name to be stored is written into the tree node of the initial adaptive radix tree to obtain the target adaptive radix tree.

[0072] In the embodiment of the present application, the default structure of the adaptive radix tree cannot directly store the domain name. Since the hierarchical architecture of DNS is reflected in the label order of the domain name, the label on the right side of the domain name is higher than the label on the left side, which is contrary to the order of the keys of the adaptive radix tree. Therefore, the domain name as the key needs to be converted before being added to the tree node, and the labels of the domain name are reversed. The conversion process is as shown in FIG. 1: Figure 2

[0073] In the embodiment of the present application, the target adaptive radix tree includes a full pointer node Node 40.

[0074] It should be noted that the target adaptive radix tree can also include a full pointer node Node 4 or a pointer node Node 16, and the type of the full pointer node included in the target adaptive radix tree can be determined according to actual conditions, which is not limited in the embodiment of the present application.

[0075] ​It should be further explained that, in the process of searching the target domain name in the target adaptive radix tree, when a node of type node4 is encountered, the keys in the node are compared in turn; for a node of type node16, the keys in the node are compared using a single instruction stream multiple data (SIMD) instruction; and for a node of type node40, the current byte value is mapped to an index of a pointer array to obtain a corresponding child node.

[0076] In the embodiment of the present application, the adaptive radix tree (ART) is a new data structure. Compared with the traditional radix tree, the adaptive radix tree makes full use of modern instruction sets, can provide better performance and space efficiency, and has a search performance comparable to that of a hash table. The adaptive radix tree provides four node schemes: Node4, Node16, Node48, and Node255. The embodiment of the present application inherits the adaptive node size, path compression, and delayed expansion of the adaptive radix tree, and the internal nodes adopt the Node4 and Node16 schemes given in the original paper. The Node16 applies a 128-bit SIMD instruction to map the key value to the edge node, and fully utilizes the performance improvement of the modern instruction set. The domain name tree constructed by the adaptive radix tree has a space occupancy comparable to that of a red-black tree, and the query speed is faster than that of the traditional radix tree.

[0077] In the embodiment of the present application, for the characteristics of the top-level domain name, the embodiment of the present application discards the original Node48 and Node255, and supplements a full-pointer node Node40 adapted to the top-level domain name. An exemplary full-pointer node Node40 is shown in FIG. 4, and there are byte values of 0-39, i.e., 40 byte values. Although any byte of a DNS domain name can take any 8-bit byte value, since the domain names in the top-level domain basically comply with the preferred domain name specification in DNS given in RFC1034 section 3.5, i.e., only contain uppercase and lowercase English letters, numbers, and hyphen “-”, and the DNS system does not distinguish between the cases of letters, the uppercase and lowercase letters can be mapped to the same code value, and then compressed into 26 byte values. In addition to Arabic numerals and hyphen, the “0” byte value is used as a label terminator, and the wildcard “*” and the “_” occasionally seen in domain names are additionally added. The above 40 byte values form a full node Node40 similar to the Node255 in the original paper, which is specially used for the top-level domain. Figure 3

[0078] In the embodiment of the present application, the byte value code table of Node40 is shown in Table 1:

[0079] Table 1

[0080]

[0081]

[0082] In the embodiment of the present application, the domain name resolution device adopts SEDA (Stage Event Driver Architecture) architecture, and divides functions into several modules, and uses message queues to transfer between the modules. As shown in Figure 4 the service is divided into three aspects, a business aspect, a management aspect and a data analysis aspect (i.e. log / statistics). The business aspect includes a business thread pool, an ART cache structure and a receiving and sending thread pool. The management aspect includes an ART cache structure-area sub-tree, thread scheduling management, an update processing thread pool and an update management thread.

[0083] The business aspect is divided into two modules: a business module and a forwarding module. All the modules open thread management interfaces for the management module to call. The business module includes a business request sub-module, a business response sub-module and a thread management module. The business request sub-module includes a business request thread pool, which undertakes service business and listens to a service port. The business thread only reads a shared cache database based on a self-balancing radix tree structure (ART cache structure).

[0084] In the embodiment of the present application, when the business request thread in the domain name resolution device receives a client request, after basic processing (such as ACL, data packet format checking, etc.), the domain name of the request is converted into a search key, and a corresponding node and resource record are searched in an ART (target adaptive radix tree). The specific search process includes:

[0085] Step 1: Since the top-level domain hotspot service does not provide recursive resolution function, the RA bit in the response is not set.

[0086] Step 2: The QNAME is converted into a search key according to the rules, and the nearest ancestor area of the QNAME is searched in the ART area tree held by the hotspot service.

[0087] (1) If the ancestor area can be found, go to step 3;

[0088] (2) If the ancestor area cannot be found, go to step 5.

[0089] Step 3: Match one label at a time downwards in the ART domain name tree. The matching process is terminated under the following conditions:

[0090] (1) There is a node matching the entire QNAME.

[0091] a. If there is a resource record of type CNAME in the node, but the request QTYPE does not match the CNAME, copy the CNAME record into the answer section of the response and change the QNAME to the canonical name in the CNAME record. Go to step 2.

[0092] b. Otherwise, copy all the RR in the node that match the QTYPE into the answer section of the response, go to step 4.

[0093] (2) If there is an NS (domain name server) record in the node, it means there is a delegation / zone cut at this node. Copy the set of NS records at this node into the authority section of the response. Go to step 4.

[0094] (3) If a label cannot be matched, check if there is a wildcard label present.

[0095] a. If there is no wildcard label, and the QNAME at this point is the original QNAME of the query request, go to step 5.

[0096] b. If there is no wildcard label, and the QNAME at this point is the lower standard name in an alias record, go to step 4.

[0097] c. If there is a wildcard label, and there is a resource record of the QTYPE in the wildcard label node, copy the resource record into the answer section of the response and set the owner name of the resource record to the request QNAME, go to step 4.

[0098] d. If there is a wildcard label, and there is a resource record of type CNAME in the wildcard label node, but the request QTYPE does not match the CNAME, copy the CNAME record into the answer section of the response and set the owner name of the resource record to the request QNAME. Change the QNAME to the canonical name in the CNAME record. Go to step 2.

[0099] Step 4: Look for possible useful resource records in the database and add to the additional section of the response. Go to step 6.

[0100] Step 5: Push the request to the business forwarding module. End of flow.

[0101] Step 6: Push the response to the business answer module. End of flow.

[0102] Due to the nature of the top-level domain, 95% of the data in the zone is delegated, so most requests will end at step 3b of the algorithm above, i.e. return a referral response to the delegation point. For the less authoritative data within the top-level domain and the wildcard label node often used in IDN top-level domains, better adaptability and performance than traditional cache structures can also be achieved.

[0103] In the embodiments of the present application, the service response submodule includes a service response thread pool and a thread management module, and is only responsible for returning a response to a client.

[0104] The forwarding module includes a forwarding thread pool and a thread management module, and is responsible for sending a request to a suitable top-level domain server and receiving a response. The forwarding thread uses the algorithm described in RFC5452 to resist fake responses, uses a random transaction ID, a random port and a random server in the list of authoritative domain name servers when sending a request, and only receives a response when the problem part, the source address of the response, the target address and the port of the response are completely matched, and cleans up the resource records in the response that are irrelevant to the request. The following symbols are used for calculation:

[0105] I: the number of different IDs available (up to 65536);

[0106] P: the number of ports used (up to about 64000, because the ports below 1024 are not always available, but usually 1);

[0107] N: the number of authoritative domain name servers of the domain (about 2.5 on average);

[0108] F: the number of fake data packets sent by the attacker;

[0109] R: the number of data packets sent by the attacker per second;

[0110] W: the opportunity window, in seconds. Limited by the response time of the authoritative server (usually 0.1s);

[0111] D: the average number of identical outstanding queries of the resolver (usually 1)

[0112] A: the number of attempts, once per opportunity window

[0113] T: the duration of the attack

[0114] The probability of deceiving the resolver is equal to the number of fake data packets that arrive within the opportunity window divided by the size of the problem space. Then the probability of being deceived is shown in formula (1):

[0115]

[0116] After substituting the values, formula (2) is obtained:

[0117]

[0118] It should be noted that since the TTL value of the top-level domain data is generally large (more than 1200 seconds), it is almost impossible to implement a successful spoofing attack under the existing bandwidth conditions.

[0119] In the embodiments of the present application, each module and sub-module of the service side of the domain name resolution device opens a thread management interface for the management side to call, for adjusting the number of threads and other parameters.

[0120] In the embodiments of the present application, the management side of the domain name resolution device includes two modules: a service data management module and a service thread management module. Unlike the traditional cache service, the update and maintenance of the cache database of the embodiments of the present application are separated from the service side and managed and maintained by the service data management module of the management side.

[0121] In the embodiments of the present application, the service data management module includes an update management thread and an update processing module. The two are connected by a queue in which the update maintenance thread acts as a producer and the update processing module acts as a consumer, and a queue in which the update processing module acts as a producer and the update maintenance thread acts as a consumer.

[0122] In the embodiments of the present application, the update maintenance thread is responsible for the maintenance of the cache database and pushes the update request to the update processing module according to the remaining time of the life cycle of the resource record.

[0123] In the embodiments of the present application, the function of the update processing module is similar to that of the forwarding module of the service side, which is responsible for obtaining the latest resource record from the top-level domain authoritative server on the Internet and extracting the resource record set from the response and pushing it to the update maintenance module.

[0124] In the embodiments of the present application, after receiving the updated resource record set, the update maintenance module generates a discrete node or a sub-tree structure according to the data content. Since the delegation data of the top-level domain often contains a combination of NS record set and glue record, the update maintenance module generates an ART sub-tree for such a record set and replaces it into the ART domain tree cache structure using RCU.

[0125] For example:

[0126]

[0127] In the embodiments of the present application, the above example record set generates a sub-tree as shown in Figure 5 The sub-tree can be used to replace the sub-tree at the second-level domain name foo.bar. in the existing cache domain name tree using RCU, and the old sub-tree is released when the count of the old sub-tree is zero.

[0128] In the embodiment of the present application, the service thread management module in the domain name resolution device uses the thread management control module of each thread pool, and can adjust the number of working threads and parameters in the thread pool according to actual needs.

[0129] In the embodiment of the present application, as shown in Figure 4 The data analysis surface in the domain name resolution device reads the request log of the service request module and the response log of the service response module in real time, analyzes hot domain names in real time, sends the changes of the hot domain names to the update and maintenance module, and modifies the cached data.

[0130] S104, transmitting the target domain name to the client.

[0131] In the embodiment of the present application, after the domain name resolution device finds the target domain name in the target adaptive radix tree according to the search key and the query type, the target domain name can be transmitted to the client.

[0132] In the embodiment of the present application, the target domain name is the response of the domain name resolution request found by the domain name resolution device in the target adaptive radix tree according to the domain name resolution request.

[0133] In the embodiment of the present application, the domain name resolution request corresponds to the target domain name one by one, that is, one domain name resolution request corresponds to one target domain name.

[0134] In the embodiment of the present application, the domain name resolution device further includes a service response module, which is used to transmit the target domain name to the client when the target domain name is found in the target adaptive radix tree according to the search key and the query type.

[0135] It should be noted that the manner in which the service response module transmits the target domain name to the client can be determined according to the actual communication mode between the client and the client, and the embodiment of the present application does not limit it.

[0136] It can be understood that when the domain name resolution device receives the domain name resolution request transmitted by the client, the target domain name is found in the target adaptive radix tree according to the search key and the query type in the domain name resolution request by converting the domain name to be queried in the domain name resolution request into the search key, and the target adaptive radix tree structure can solve the problem that the red-black tree cannot be applied to RCU, improve the overall performance, realize the top-level domain hot spot guarantee domain name resolution service, and thus improve the efficiency of processing the domain name resolution request.

[0137] Based on the same inventive concept as the above domain name resolution method, the embodiment of the present application provides a domain name resolution device 1 corresponding to a domain name resolution method; Figure 6 The composition structure of a domain name resolution device provided in the embodiment of the present application is shown in Figure 1 The domain name resolution device 1 can include:

[0138] The acquisition unit 11 is configured to acquire a domain name to be queried and a query type from a domain name resolution request transmitted by a client in a case where the domain name resolution request is received.

[0139] The conversion unit 12 is configured to convert the domain name to be queried into a search key.

[0140] The search unit 13 is configured to search for a target domain name in a target adaptive radix tree according to the search key and the query type.

[0141] The transmission unit 14 is configured to transmit the target domain name to the client.

[0142] In some embodiments of the present application, the device further comprises a matching unit, an adding unit and a determination unit.

[0143] The search unit 13 is configured to search for a first parent domain of the search key in the target adaptive radix tree, and search for a first resource record related to the first node in a database.

[0144] The matching unit is configured to, in a case where the first parent domain exists in the target adaptive radix tree, sequentially match the domain name to be queried with a plurality of nodes under the first parent domain in the target adaptive radix tree.

[0145] The adding unit is configured to, in a case where a first node matching the query type exists and a resource record type does not exist in the first node, add a target resource record matching the query type in the first node to a response message; the first node is part of the plurality of nodes.

[0146] The determination unit is configured to determine the target domain name according to the first resource record and the response message.

[0147] In some embodiments of the present application, the device further comprises a modification unit.

[0148] The adding unit is configured to, in a case where a first node matching the query type exists, a resource record type exists in the first node, and the resource record type does not match the query type, add the resource record type to a response message.

[0149] The modification unit is configured to modify the query type to the resource record type.

[0150] The search unit 13 is configured to search for a second parent domain corresponding to the resource record type in the target adaptive radix tree.

[0151] The determining unit is configured to determine the target domain name according to a node under the second parent domain in the target adaptive radix tree if the second parent domain exists.

[0152] In some embodiments of the present application, the adding unit is configured to add the domain name server record into the response message if the domain name server record exists in the first node.

[0153] The finding unit 13 is configured to find a first resource record related to the first node in the database.

[0154] The determining unit is configured to determine the target domain name according to the first resource record and the response message.

[0155] In some embodiments of the present application, the determining unit is configured to determine whether a wildcard label corresponding to the first label exists in the first node if the first node contains a first label that does not match, and determine the target domain name according to the first resource record.

[0156] The finding unit 13 is configured to find a first resource record related to the first node in the database if no wildcard label exists and the query domain name is a low standard name in an alias record in the first node.

[0157] In some embodiments of the present application, the apparatus further includes a setting unit.

[0158] The adding unit is configured to add the resource record into the response message if the wildcard label exists and a resource record at the wildcard label node matches the query type.

[0159] The setting unit is configured to set a holder name of the resource record as a domain name to be queried.

[0160] The finding unit 13 is configured to find a first resource record related to the first node in the database.

[0161] The determining unit is configured to determine the target domain name according to the first resource record and the response message.

[0162] In some embodiments of the present application, the adding unit is configured to add the resource record type into the response message if the wildcard label exists and a resource record type at the wildcard label node does not match the query type.

[0163] The setting unit is configured to set a holder name of the resource record as a domain name to be queried.

[0164] The modification unit is configured to modify the query type to the resource record type.

[0165] The lookup unit 13 is configured to look up, in the target adaptive radix tree, a second parent domain corresponding to the resource record type.

[0166] The determination unit is configured to determine, in the case where the second parent domain exists, the target domain name according to a node under the second parent domain in the target adaptive radix tree.

[0167] In some embodiments of the present application, the device further includes a forwarding unit.

[0168] The forwarding unit is configured to, in the case where the first parent domain does not exist in the target adaptive radix tree, forward the domain name resolution request to an authoritative domain name server, so that the authoritative domain name server resolves the domain name resolution request to obtain the target domain name; or, in the case where a wildcard label corresponding to the first label does not exist and the domain name to be queried is a historical query domain name of the first node, forward the domain name resolution request to an authoritative domain name server, so that the authoritative domain name server resolves the domain name resolution request to obtain the target domain name.

[0169] In some embodiments of the present application, the target adaptive radix tree includes a full-pointer node Node 40.

[0170] In some embodiments of the present application, the device further includes an adjustment unit, a reversal unit and a writing unit.

[0171] The adjustment unit is configured to, in the case where a domain name to be stored is obtained, adjust a character format of the domain name to be stored according to a preset character writing format to obtain a first domain name.

[0172] The reversal unit is configured to reverse a label in the first domain name to obtain a second domain name.

[0173] The adding unit is configured to add a first character at the end of the label and the end of the domain name of the second domain name to obtain a converted domain name to be stored.

[0174] The writing unit is configured to write the converted domain name to be stored into a tree node of an initial adaptive radix tree to obtain a target adaptive radix tree.

[0175] It should be noted that in actual application, the above-mentioned acquisition unit 11, conversion unit 12, searching unit 13 and transmission unit 14 can be realized by a processor 15 on the domain name resolution device 1, specifically, a CPU (Central Processing Unit), MPU (Microprocessor Unit), DSP (Digital Signal Processing) or FPGA (Field Programmable Gate Array) and the like; and the above-mentioned data storage can be realized by a memory 16 on the domain name resolution device 1.

[0176] The embodiment of the present application further provides a domain name resolution device 1, as shown in the figure, the domain name resolution device 1 comprises a processor 15, a memory 16 and a communication bus 17, the memory 16 communicates with the processor 15 through the communication bus 17, and the memory 16 stores programs executable by the processor 15, when the programs are executed, the processor 15 executes the domain name resolution method as described above. Figure 7

[0177] In actual application, the above-mentioned memory 16 can be a volatile memory such as a RAM (Random-Access Memory), or a non-volatile memory such as a ROM (Read-Only Memory), a flash memory, a HDD (Hard Disk Drive) or a SSD (Solid-State Drive), or a combination of the above-mentioned memories, and provides instructions and data to the processor 15.

[0178] The embodiment of the present application provides a computer readable storage medium, which has a computer program, when the program is executed by the processor 15, the domain name resolution method as described above is realized.

[0179] The embodiment of the present application further provides a computer program product, which comprises a computer program, the computer program can be executed by the processor 15 in the domain name resolution device to complete the steps of the aforementioned domain name resolution method.

[0180] ​It can be understood that, in the case that the domain name resolution device receives the domain name resolution request transmitted by the client, the target domain name is found in the target adaptive radix tree according to the search key and the query type in the domain name resolution request by converting the to-be-queried domain name in the domain name resolution request into the search key, and the target adaptive radix tree structure can solve the problem that the red-black tree cannot apply RCU, improve overall performance, implement top-level domain hotspot guarantee domain name resolution service, and thus improve the efficiency of processing the domain name resolution request.

[0181] Those skilled in the art will understand that embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.

[0182] The present application is described with reference to flowcharts and / or block diagrams according to the methods, devices (systems), and computer program products of embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that carries out the functions specified in one or more flows and / or blocks.

[0183] These computer program instructions can also be stored in a computer-readable memory that can direct the computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including instruction apparatus, which implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that carries out the functions specified in one or more flows and / or blocks.

[0184] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are performed on the computer or other programmable data processing apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable data processing apparatus provide a process for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that carries out the functions specified in one or more flows and / or blocks.

[0185] The above descriptions are merely some example embodiments of the present application, not intended to limit the protective scope of the present application.

Claims

1. A domain name resolution method, characterized by, The method comprises: In the case of receiving a domain name resolution request transmitted by a client, obtaining a domain name to be queried and a query type from the domain name resolution request; Converting the domain name to be queried into a search key; According to the search key and the query type, finding a target domain name in a target adaptive radix tree; Transmitting the target domain name to the client; Wherein, according to the search key and the query type, finding a target domain name in a target adaptive radix tree, comprising: In the target adaptive radix tree, find the first parent domain of the search key; In the case that the first parent domain exists in the target adaptive radix tree, match the domain name to be queried with a plurality of nodes under the first parent domain in the target adaptive radix tree in turn; In the case that there is a first node matching the query type, and there is no resource record type in the first node, add a target resource record matching the query type in the first node to a response message; The first node is part of the plurality of nodes; Find a first resource record related to the first node in the database; According to the first resource record and the response message, determine the target domain name.

2. The method of claim 1, wherein, After the method further comprises: In the case that there is a first node matching the query type, and there is a resource record type in the first node, and the resource record type does not match the query type, add the resource record type to the response message; Modify the query type to the resource record type; In the target adaptive radix tree, find a second parent domain corresponding to the resource record type; In the case that the second parent domain exists, determine the target domain name according to the nodes under the second parent domain in the target adaptive radix tree.

3. The method of claim 1, wherein, After the method further comprises: In the case that there is a domain name server record in the first node, add the domain name server record to the response message; Find a first resource record related to the first node in the database; According to the first resource record and the response message, determine the target domain name.

4. The method of claim 1, wherein, After the method further comprises: In the case that there is a first label that does not match in the first node, determine whether there is a wildcard label corresponding to the first label in the first node; In the case that there is no wildcard label, and the query domain name is a low standard name in the alias record in the first node, find a first resource record related to the first node in the database; According to the first resource record, determine the target domain name.

5. The method of claim 4, wherein, After the method further comprises: add the resource record to the response message in the case that the wildcard label exists and the resource record type at the wildcard label node matches the query type; set the owner name of the resource record as the domain name to be queried; find a first resource record related to the first node in the database; determine the target domain name according to the first resource record and the response message.

6. The method of claim 4, wherein, After the determination of whether the wildcard label corresponding to the first label exists in the first node, the method further comprises: add the resource record type to the response message in the case that the wildcard label exists and the resource record type at the wildcard label node does not match the query type; set the owner name of the resource record as the domain name to be queried; modify the query type as the resource record type; find a second parent domain corresponding to the resource record type in the target adaptive radix tree; in the case that the second parent domain exists, determine the target domain name according to the node under the second parent domain in the target adaptive radix tree.

7. The method according to claim 1 or 4, characterized in that, The method further comprises: in the case that the first parent domain does not exist in the target adaptive radix tree, forward the domain name resolution request to an authoritative domain name server for resolution of the domain name resolution request by the authoritative domain name server to obtain the target domain name; or, in the case that the wildcard label corresponding to the first label does not exist and the domain name to be queried is a historical query domain name of the first node, forward the domain name resolution request to an authoritative domain name server for resolution of the domain name resolution request by the authoritative domain name server to obtain the target domain name.

8. The method of claim 1, wherein, The target adaptive radix tree comprises a full pointer node Node40.

9. The method of claim 1, wherein, Before the finding of the target domain name in the target adaptive radix tree according to the search key and the query type, the method further comprises: in the case that the domain name to be stored is obtained, adjust the character format of the domain name to be stored according to a preset character writing format to obtain a first domain name; reverse the label in the first domain name to obtain a second domain name; add a first character at the tail of the label and the tail of the domain name of the second domain name to obtain a converted domain name to be stored; write the converted domain name to be stored in a tree node of an initial adaptive radix tree to obtain a target adaptive radix tree.

10. A domain name resolution apparatus characterized by comprising: The device comprises: an acquisition unit configured to acquire a domain name to be queried and a query type from a domain name resolution request transmitted by a client in the case that the domain name resolution request is received; a conversion unit configured to convert the domain name to be queried into a search key; a finding unit configured to find a target domain name in a target adaptive radix tree according to the search key and the query type; a transmission unit configured to transmit the target domain name to the client; wherein the device further comprises a matching unit, an adding unit and a determining unit; the finding unit is configured to find a first parent domain of the search key in the target adaptive radix tree and find a first resource record related to a first node in a database. The matching unit is configured to, in a case where the first parent domain exists in the target adaptive radix tree, sequentially match the domain name to be queried with a plurality of nodes under the first parent domain in the target adaptive radix tree; The adding unit is configured to, in a case where the first node matching the query type exists and a resource record type does not exist in the first node, add a target resource record matching the query type in the first node to a response message; the first node is part of the plurality of nodes; The determining unit is configured to determine the target domain name according to the first resource record and the response message.

11. A domain name resolution apparatus characterized by comprising: The apparatus comprises: A memory, a processor and a communication bus, the memory being in communication with the processor via the communication bus, the memory storing a domain name resolution program executable by the processor, when the domain name resolution program is executed, performing the method of any one of claims 1 to 9 by the processor.

12. A storage medium storing a computer program thereon for use in a domain name resolution device, characterized in that, The computer program is executed by the processor to implement the method of any one of claims 1 to 9.

13. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the method of any one of claims 1 to 9. The computer program is executed by the processor to implement the method of any one of claims 1 to 9.

Citation Information

Patent Citations

  • Method and device for domain name search

    CN106776657A

  • Method and system for determining domain name and parent domain name thereof and medium

    CN112380324A