A DNS access request processing method, device, equipment and storage medium

By querying the cache results of the target DNS data packet in the DNS cache structure and determining whether the domain name is compressed based on the resource record cache list, directly copying and sending the compressed or original domain name and resource record results, the problem of repeated compression in the prior art is solved, and the efficiency and performance of DNS access request processing is improved.

CN117749762BActive Publication Date: 2025-03-04CHINA TELECOM NETWORK SECURITY TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311362950.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-19
Publication Date
2025-03-04
Estimated Expiration
2043-10-19

AI Technical Summary

Technical Problem

The cache storage method configured in the existing DNS cache server causes repeated compression of domain names and parsing records every time the cache hits, which seriously slows down processing performance, especially when there are many parsing records, reducing query processing efficiency and increasing delay.

Method used

In the DNS cache structure, query the cache results of the target DNS data packet, and determine whether the target domain name is compressed based on the target resource record cache list. If it is compressed, copy the compressed domain name and resource record results. If it is not compressed, copy the original domain name and resource record results, and send a response directly to the terminal.

Benefits of technology

Reduces DNS access request response delay, improves the efficiency of DNS access request processing, meets high performance requirements, and avoids repeated compression operations every time the cache hits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117749762B_ABST
    Figure CN117749762B_ABST
Patent Text Reader

Abstract

The present application discloses a DNS access request processing method, device, equipment and storage medium, and relates to the field of computer network technology. The method includes: receiving a DNS access request from a terminal, and determining the type of the target DNS data packet according to the target DNS data packet carried in the DNS access request; if the type is a request type, querying in the DNS cache structure; when a cache result of the target DNS data packet is queried in the DNS cache structure, obtaining a target resource record cache list of the target DNS data packet, and determining whether the target domain name of the target DNS data packet is compressed according to the target resource record cache list; if so, copying the compressed first target domain name and the first resource record result corresponding to the target domain name; if not, copying the target domain name and the original resource record result of the target domain name; sending a DNS access request response to the terminal to improve processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer network technology, and in particular to a DNS access request processing method, device, equipment and storage medium. Background Art

[0002] The Domain Name System (DNS) is a service of the Internet. As a distributed database that maps domain names and IP addresses, it enables people to access the Internet more conveniently. In DNS, the roles of DNS servers can be divided into DNS cache servers, DNS recursive servers, DNS authoritative servers, DNS root servers, etc. Among them, the DNS cache server is a server that stores frequently accessed content and is a device directly facing users. Therefore, there are very high requirements for the performance of DNS cache servers.

[0003] The cache storage method configured in the DNS cache server will directly affect the query efficiency, and thus affect the overall DNS access request processing process. At present, the cache storage method configured in the cache server is to completely decompress the domain name and the resolution record results, and then store them; during the query process, when the DNS access request from the terminal is received and the cache hits in the DNS cache server, the domain name and / or resolution record results will be recompressed, and then the corresponding DNS access request response will be fed back to the terminal. However, this storage method will be repeated once for each cache hit during the query process, which greatly slows down the overall processing performance, especially when there are many resolution record results for the domain name, which will reduce the processing efficiency of the query process and increase the latency of the DNS access request. Summary of the invention

[0004] The present application provides a DNS access request processing method to improve the processing efficiency of the access request process.

[0005] In a first aspect, a DNS access request processing method is provided, comprising:

[0006] Receiving a DNS access request from a terminal, and determining the type of the target DNS data packet according to the target DNS data packet carried in the DNS access request;

[0007] If the type is a request type, query is performed in the DNS cache structure;

[0008] When a cache result of the target DNS data packet is found in the DNS cache structure, a target resource record cache list of the target DNS data packet is obtained, and whether the target domain name of the target DNS data packet is compressed is determined according to the target resource record cache list;

[0009] If yes, copy the compressed first target domain name and the first resource record result corresponding to the target domain name;

[0010] If not, copying the target domain name and the original resource record result of the target domain name;

[0011] Sending a DNS access request response to the terminal; wherein the DNS access request response carries the encapsulated first target domain name and the first resource record result, or the encapsulated target domain name and the original resource record result.

[0012] In the embodiments of the present application, the beneficial effects are as follows:

[0013] For the target DNS data packet of the request type, when the cache hits in the DNS cache server, the target resource record cache list of the target DNS data packet can be directly obtained in the DNS cache structure; according to the content recorded in the target resource record cache list, it is determined whether the target domain name of the target DNS data packet is compressed. If so, the compressed first target domain name and the first resource record result corresponding to the target domain name can be copied; if not, the target domain name and the original resource record result of the target domain name are copied; finally, the DNS access request response can be sent to the terminal. Therefore, when the DNS cache structure hits the cache, it is only necessary to copy the compressed domain name and feedback the DNS access request response to the terminal. There is no need to compress the domain name every time, which reduces the DNS access request response delay, thereby improving the efficiency of DNS access request processing and meeting high performance requirements.

[0014] In a possible implementation, the cache storage format of the DNS cache structure is a first storage structure, a second storage structure, a third storage structure, and a fourth storage structure nested in sequence;

[0015] The first storage structure represents the storage of cache results of at least one DNS data packet; wherein each cache result includes at least a domain name, a type, a domain name length, and a response result;

[0016] The second storage structure stores the effective TTL, the number of record results, and the record result array of each of the M resource records in each response result, wherein the record result array includes the M resource records, and M is an integer greater than 0;

[0017] The third storage structure represents a resource record cache list corresponding to each resource record in the record result array;

[0018] The fourth storage structure represents a list of parsing record results corresponding to each resource record.

[0019] By adopting the DNS cache structure of the above-mentioned cache storage format, for the DNS data packet of the request type, in the subsequent DNS access request process, when the cache hits, the corresponding DNS access request response can be directly obtained from the resource record cache list stored in the DNS cache structure. Compared with the existing technology, there is no need to re-compress the DNS access request response every time and then feed it back to the terminal, thereby improving the efficiency of DNS access request processing.

[0020] In a possible implementation, obtaining a target resource record cache list of the target DNS data packet, and determining whether the target domain name of the target DNS data packet is compressed according to the target resource record cache list, includes:

[0021] When a target cache result of the target DNS data packet is queried in the first storage structure of the DNS cache structure, a target response result corresponding to the target DNS data packet is obtained in the second storage structure of the DNS cache structure according to the target cache result;

[0022] According to the target response result, a target resource record cache list of the target DNS data packet is obtained in the third storage result of the DNS cache structure;

[0023] If the target domain name is recorded with a compression flag in the target resource record cache list, it is determined that the target domain name is compressed; otherwise, it is determined that the target domain name is not compressed.

[0024] In one possible implementation, the method further includes:

[0025] If the type is a response type, parsing the request part in the target DNS data packet to obtain the second target domain name of the request part, and parsing the response part in the target data packet to obtain a response result of the response part;

[0026] Storing the second target domain name and the response result according to the cache storage format of the DNS cache structure;

[0027] Creating a compressed data result table according to the second target domain name and the response result; wherein the compressed data result table is used to indicate whether each of the N resource records included in the response result is compressed, where N is an integer greater than 0;

[0028] According to the compressed data result table, the third storage structure in the DNS cache structure updates the resource record cache list corresponding to the compressed resource records in the N resource records.

[0029] For the response type DNS data packet, since only the request part and the response part of the data packet can be parsed, and the rest of the data packet can be not parsed, the DNS cache structure (such as Figure 3 The domain name is stored in a cache storage format of the DNS cache storage structure shown in the figure, and when inserting the resource record cache list, only a one-time domain name compression calculation is performed, so that the compressed result can be directly used in subsequent use; therefore, compared with the prior art, in actual scenarios, the occupancy of bandwidth resources and the DNS cache structure can be reduced.

[0030] In a possible implementation, the resource record cache list corresponding to each resource record includes at least the domain name, type, domain name length, network type, whether there is a compression mark, domain name compression result, number of resolution result records, and resolution result array;

[0031] The parsing record result list corresponding to each resource record at least includes a parsing record TTL value, a parsing record result, and a parsing record result length.

[0032] In a second aspect, a DNS access request processing device is provided, comprising:

[0033] A receiving module, configured to receive a DNS access request from a terminal, and determine the type of the target DNS data packet according to the target DNS data packet carried in the DNS access request;

[0034] A query module, if the type is a request type, performs a query in a DNS cache structure;

[0035] The processing module obtains a target resource record cache list of the target DNS data packet when a cache result of the target DNS data packet is found in the DNS cache structure, and determines whether the target domain name of the target DNS data packet is compressed according to the target resource record cache list; if so, copies the compressed first target domain name and the first resource record result corresponding to the target domain name; if not, copies the target domain name and the original resource record result of the target domain name;

[0036] A sending module is used to send a DNS access request response to the terminal; wherein the DNS access request response carries an encapsulated first target domain name and a first resource record result, or an encapsulated target domain name and an original resource record result.

[0037] In a possible implementation, the cache storage format of the DNS cache structure is a first storage structure, a second storage structure, a third storage structure, and a fourth storage structure nested in sequence;

[0038] The first storage structure represents the storage of cache results of at least one DNS data packet; wherein each cache result includes at least a domain name, a type, a domain name length, and a response result;

[0039] The second storage structure represents and stores the effective TTL, the number of record results, and the record result array of M resource records in each response result; wherein the record result array includes the M resource records, and M is an integer greater than 0;

[0040] The third storage structure represents a resource record cache list corresponding to each resource record in the record result array;

[0041] The fourth storage structure represents a list of parsing record results corresponding to each resource record.

[0042] In a possible implementation, the processing module is specifically used to:

[0043] When a target cache result of the target DNS data packet is queried in the first storage structure of the DNS cache structure, a target response result corresponding to the target DNS data packet is obtained in the second storage structure of the DNS cache structure according to the target cache result;

[0044] According to the target response result, a target resource record cache list of the target DNS data packet is obtained in the third storage result of the DNS cache structure;

[0045] If a compression flag is recorded in the target resource record cache list, it is determined that the target domain name of the target DNS data packet is compressed; otherwise, it is determined that the target domain name of the target DNS data packet is not compressed.

[0046] In a possible implementation, the processing module is further used to:

[0047] If the type is a response type, parsing the request part in the target DNS data packet to obtain the second target domain name of the request part, and parsing the response part in the target data packet to obtain a response result of the response part;

[0048] Storing the second target domain name and the response result according to the cache storage format of the DNS cache structure;

[0049] Creating a compressed data result table according to the second target domain name and the response result; wherein the compressed data result table is used to indicate whether each of the N resource records included in the response result is compressed, where N is an integer greater than 0;

[0050] According to the compressed data result table, the third storage structure in the DNS cache structure updates the resource record cache list corresponding to the compressed resource records in the N resource records.

[0051] In a possible implementation, the resource record cache list corresponding to each resource record includes at least the domain name, type, domain name length, network type, whether there is a compression mark, domain name compression result, number of resolution result records, and resolution result array;

[0052] The parsing record result list corresponding to each resource record at least includes a parsing record TTL value, a parsing record result, and a parsing record result length.

[0053] According to a third aspect, an electronic device is provided, including:

[0054] A memory for storing a computer program; a processor for implementing any one of the method steps in the first aspect when executing the computer program stored in the memory.

[0055] According to a fourth aspect, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method steps described in any one of the first aspects are implemented.

[0056] For each aspect from the second to the fourth aspect and the technical effects that may be achieved by each aspect, please refer to the above description of the technical effects that can be achieved by the first aspect or various possible schemes in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 A schematic diagram of an application scenario applicable to the embodiments of the present application;

[0058] Figure 2 A flowchart of a DNS access request processing method provided in an embodiment of the present application;

[0059] Figure 3 A schematic diagram of a storage structure of a DNS cache structure provided in an embodiment of the present application;

[0060] Figure 4 A flowchart of another DNS access request processing method provided in an embodiment of the present application;

[0061] Figure 5 A logical diagram of a DNS access request processing provided in an embodiment of the present application;

[0062] Figure 6 A schematic diagram of the structure of a DNS access request processing device provided in an embodiment of the present application;

[0063] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The specific operating methods in the method embodiments can also be applied to device embodiments or system embodiments. It should be noted that in the description of the present application, "multiple" is understood as "at least two". "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A is connected to B, which can represent: A is directly connected to B and A is connected to B through C. In addition, in the description of the present application, words such as "first" and "second" are only used to distinguish the purpose of description, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.

[0065] In order to better understand the embodiments of the present application, the technical terms involved in the embodiments of the present application are first explained below.

[0066] (1) A domain name is a name of a computer or group of computers on a network consisting of a series of names separated by dots. It is used to identify the electronic location of the computer during data transmission (it can also refer to the geographical location, geographical domain name, etc.)

[0067] (2) Time To Live (TTL) is the duration of a resource record in a DNS server. For example, if there is a domain name called myhost.abc.com, this is a resource record, which usually means that there is a host named myhost in the abc.com domain with an IP address of 1.1.1.1. Its TTL is 10, and this resource record is stored on a DNS server called dns.abc.com.

[0068] (3) Resource record (RR) refers to the record added to the zone file. There are many types of resource records, each with different uses, which can be understood as the resources related to each domain name. For example, each RR is used to record the information mapping relationship of the domain name, which may include the domain name's ownership, type, TTL, etc.

[0069] The following is a brief introduction to the application scenarios to which the technical solutions of the embodiments of the present application can be applied. It should be noted that the application scenarios introduced below are only used to illustrate the embodiments of the present application and are not limited. In specific implementation, the technical solutions provided by the embodiments of the present application can be flexibly applied according to actual needs.

[0070] Figure 1 The present invention is a schematic diagram of an application scenario applicable to the embodiment of the present application. As shown in the figure, the scenario mainly includes a terminal 10, a DNS cache server 11, and a DNS recursive server 12; wherein, the DNS recursive server 12 may govern multiple levels of servers such as a DNS root server, a top-level domain name server, a second-level domain name server, and a DNS authoritative server; the terminal 10 and the DNS cache server 11 may exchange information through a communication network, and the DNS cache server 11 and the DNS recursive server 12 may exchange information through a communication network, and the communication mode adopted by the communication network may include: a wireless communication mode and a wired communication mode.

[0071] Exemplarily, the terminal 10 can access the network through cellular mobile communication technology and communicate with the DNS cache server 11. For example, the terminal 10 can send a DNS access request to the DNS cache server 11. The cellular mobile communication technology may include the fifth generation mobile communication (5th Generation Mobile Networks, 5G) technology.

[0072] Exemplarily, the terminal 10 can access the network through short-range wireless communication and communicate with the DNS cache server 11. For example, the terminal 10 can send a DNS access request to the DNS cache server 11. The short-range wireless communication may include Wireless Fidelity (Wi-Fi) technology.

[0073] The terminal 10 is a device that can provide voice and / or data connectivity to the user, including: a handheld terminal device with a wireless connection function, a vehicle-mounted terminal device, etc. For example, the terminal 10 includes but is not limited to: a mobile phone, a tablet computer, a laptop computer, a PDA, a mobile Internet device (Mobile Internet Device, MID), a wearable device, a virtual reality (Virtual Reality, VR) device, an augmented reality (Augmented Reality, AR) device, a wireless terminal device in industrial control, a wireless terminal device in unmanned driving, a wireless terminal device in a smart grid, a wireless terminal device in transportation safety, a wireless terminal device in a smart city, or a wireless terminal device in a smart home, etc.

[0074] The DNS cache server 11 is equipped with a DNS access request processing device, which can be used to receive a DNS access request from the terminal 10 and perform corresponding processing according to the DNS access request.

[0075] For example, the terminal 10 sends a DNS access request carrying a target DNS data packet to the DNS cache server 11. When the DNS cache server 11 resolves that the target DNS data packet is a request type data packet, it queries the cache in its own DNS cache structure. If no result is found, the DNS access request is forwarded to the DNS recursive server 12. The DNS recursive server 12 can be responsible for initiating the DNS access request to the DNS root server, the top-level domain name server, the second-level domain name server, and the DNS authoritative server to obtain the final result, and then send the result to the DNS cache server 11, so that the DNS cache server 11 performs subsequent processing according to the result; if the cache is searched in the DNS cache server 11 and the result is found, the DNS cache server performs subsequent processing based on the queried result.

[0076] For another example, the terminal 10 sends a DNS access request carrying a target DNS data packet to the DNS cache server 11. When the DNS cache server 11 resolves the target DNS data packet as a response type data packet, the DNS cache server 11 stores the response result of the target DNS data packet in the DNS cache structure according to its own cache storage format for subsequent use.

[0077] To further illustrate the technical solution provided by the embodiment of the present application, this is described in detail below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiment of the present application provides the method operation steps as shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on routine or no creative labor. In the steps where there is no necessary causal relationship logically, the execution order of these steps is not limited to the execution order provided by the embodiment of the present application. The method may be executed or executed in parallel in the actual processing process or when the device is executed in accordance with the method sequence shown in the embodiment or drawings.

[0078] Figure 2 The flowchart of a DNS access request processing method provided in an embodiment of the present application. The process can be executed by a DNS access request processing device, which can be implemented by software and / or hardware. Figure 2 As shown, the process includes the following steps:

[0079] 201: Receive a DNS access request from a terminal, and determine the type of the target DNS data packet according to the target DNS data packet carried in the DNS access request.

[0080] In this step, the DNS cache server (such as Figure 1 The DSN cache server 11 shown in the figure receives data from the terminal (such as Figure 1After receiving the DNS access request of the terminal 10), the target DNS data packet carried in the DNS access request is parsed to determine the type of the target DNS data packet.

[0081] 202: If the type of the target DNS data packet is a request type, a query is performed in the DNS cache structure.

[0082] Exemplarily, the cache storage format of the DNS cache structure is a first storage structure, a second storage structure, a third storage structure, and a fourth storage structure nested in sequence, such as Figure 3 As shown, a schematic diagram of the storage structure of the DNS cache structure is exemplified.

[0083] Figure 3 The first storage structure in represents the cache result storing at least one DNS data packet; illustratively, each cache result includes at least a domain name, a type, a domain name length, and a response result.

[0084] Figure 3 The second storage structure in represents the effective TTL, the number of record results, and the record result array of M (M is an integer greater than 0) resource records in each response result; illustratively, the number of record results can be specifically divided into the number of domain name server record results and the number of response resource record results in the M resource records; the record result array includes the M resource records.

[0085] Figure 3 The third storage structure in the storage record result array represents a resource record cache list corresponding to each resource record; exemplarily, the resource record cache list corresponding to each resource record includes at least the domain name, type, domain name length, network type, whether there is a compression mark, domain name compression result, number of resolution result records, and resolution result array.

[0086] Figure 3 The fourth storage structure in the storage represents the storage of the resolution record result list corresponding to each resource record; illustratively, the resolution record result list corresponding to each resource record includes at least the resolution record TTL value, the resolution record result, and the resolution record result length.

[0087] In an embodiment of the present application, a DNS cache structure using the above-mentioned cache storage format can be used to obtain a corresponding DNS access request response directly from a resource record cache list stored in the DNS cache structure when a cache hit occurs during a subsequent DNS access request. Compared with the prior art, there is no need to re-compress the DNS access request response each time before feeding back the DNS access request response to the terminal, thereby improving the efficiency of DNS access request processing.

[0088] In other embodiments, for a DNS data packet whose target DNS data is a response type, it can be stored according to the cache storage format of the above-mentioned DNS cache structure, such as Figure 4 As shown, a flowchart of another DNS access request processing method provided by an embodiment of the present application is exemplified.

[0089] 401: If the type of the DNS data packet is a response type, the request part in the target DNS data packet is parsed to obtain the second target domain name of the request part, and the response part in the target data packet is parsed to obtain the response result of the response part.

[0090] In this step, assuming that the response result includes N resource records, each resource record can be parsed according to its corresponding network protocol format.

[0091] 402: The second target domain name and the response result are stored according to the cache storage format of the DNS cache structure.

[0092] Exemplarily, the second target domain name of the target DNS data packet can be stored in the first storage structure of the DNS cache structure, and the type of the target DNS data packet can also be stored in the first storage structure, etc.; the effective TTL, number of record results, and record result array of each of the N resource records in the response result are stored in the second storage structure; the specific resource content of each of the N resource records is stored in the third storage structure to generate a respective resource record cache list; the specific resolution record content of each of the N resource records is stored in the fourth storage structure to generate a respective resolution record result list.

[0093] In some embodiments, for domain name compression, the domain name compression algorithm can be fully expanded and then stored, so that the resource record contents of the same resource record can be summarized and stored, that is, the resource record contents of the same resource record can be summarized into one resource record in an array.

[0094] 403: Create a compressed data result table according to the second target domain name and the response result.

[0095] Exemplarily, the compressed data result table is used to indicate whether each of the N resource records included in the response result is compressed, where N is an integer greater than 0.

[0096] 404: According to the above compression data result table, the third storage structure in the DNS cache structure updates the resource record cache list corresponding to the compressed resource record in the N resource records.

[0097] Exemplarily, updating the resource record cache list corresponding to the compressed resource record may specifically include: setting a compression flag in the resource record cache list, updating two variables, namely, the domain name length recorded in the resource record cache list and the domain name compression result recorded.

[0098] Through the above Figure 4 The method shown in the figure is for a response type DNS data packet. Since only the request part and the response part of the data packet can be parsed, and the rest of the data packet can be not parsed, the domain name and the response result obtained by parsing are then stored in the DNS cache structure (such as Figure 3 The DNS cache storage structure shown in the figure is stored in a cache storage format, and when inserting a resource record cache list, only a one-time domain name compression calculation is performed, so that the compressed result can be directly used in subsequent use; therefore, compared with the prior art, in actual scenarios, the occupancy of bandwidth resources and the storage resource occupancy of the DNS cache structure can be reduced, and further, the remaining parts can be prevented from attacking the DNS cache structure.

[0099] 203: When a cache result of a target DNS data packet is found in the DNS cache structure, a target resource record cache list of the target DNS data packet is obtained, and based on the target resource record cache list, it is determined whether the target domain name of the target DNS data packet is compressed. If so, proceed to 204; if not, proceed to 205.

[0100] Exemplarily, this step may specifically be: when the target cache result of the target DNS data packet is queried in the first storage structure of the DNS cache structure, according to the target cache result, the target response result corresponding to the target DNS data packet is obtained in the second storage structure of the DNS cache structure; according to the target response result, the target resource record cache list of the target DNS data packet is obtained in the third storage result of the DNS cache structure; if a compression flag is recorded in the target resource record cache list, it is determined that the target domain name is compressed, and the process goes to 204; otherwise, it is determined that the target domain name is not compressed, and the process goes to 205.

[0101] Similarly, when there is more than one target domain name for the target DNS data packet, the logic process shown in 203 above can also be followed, and the description will not be repeated here.

[0102] In some embodiments, when the target cache result of the target DNS data packet is not found in the DNS cache structure, the DNS cache server equipped with a DNS access request processing device may forward the DNS access request to a DNS recursive server (such as Figure 1The DNS recursive server 12 shown in the figure) can be responsible for initiating the DNS access request to the DNS root server, the top-level domain name server, the second-level domain name server, and the DNS authoritative server to obtain the final result (resource record result), and then send the result to the DNS cache server 11. After receiving the result, the DNS cache server 11 can feedback to the terminal.

[0103] 204: Copy the compressed first target domain name and the first resource record result corresponding to the target domain name.

[0104] Exemplarily, the first resource record result represents all resource records related to the first target domain name.

[0105] 205: Copy the target domain name and the original resource record result of the target domain name.

[0106] Exemplarily, the original resource record result represents all resource records related to the target domain name.

[0107] 206: Send a DNS access request response to the terminal.

[0108] The DNS access request response carries the encapsulated first target domain name and the first resource record result, or the encapsulated target domain name and the original resource record result.

[0109] Specifically, the DNS access request response may include name (representing the name of the domain name, such as WWW.AAA.com), type (used to identify the type of the current resource record), TTL (representing the length of time the information in the resource record is stored in the DNS storage structure), IN (identifying the record information of a network), and other information.

[0110] In some embodiments, when there is more than one target domain name, if there are compressed target domain names and uncompressed target domain names among the target domain names, the DNS access request response carries the compressed target domain name and its resource record result, as well as the uncompressed target domain name and its resource record result.

[0111] In the embodiments of the present application, the beneficial effects are as follows:

[0112] For the target DNS data packet of the request type, when the cache hits in the DNS cache server, the target resource record cache list of the target DNS data packet can be directly obtained in the DNS cache structure; according to the content recorded in the target resource record cache list, it is determined whether the target domain name of the target DNS data packet is compressed. If so, the compressed first target domain name and the first resource record result corresponding to the target domain name can be copied; if not, the target domain name and the original resource record result of the target domain name are copied; finally, the DNS access request response can be sent to the terminal. Therefore, when the DNS cache structure hits the cache, it is only necessary to copy the compressed domain name and feedback the DNS access request response to the terminal. There is no need to compress the domain name every time, which reduces the DNS access request response delay, thereby improving the efficiency of DNS access request processing and meeting high performance requirements.

[0113] Based on the above Figure 2 and Figure 4 The method shown, Figure 5 A logical diagram of DNS access request processing provided in an embodiment of the present application.

[0114] 501: The DNS cache server receives a DNS access request from a terminal.

[0115] In this step, the DNS cache server can be Figure 1 The DNS cache server 11 in the terminal may specifically be Figure 1 Terminal 10 in.

[0116] 502: Determine the type of the target DNS data packet according to the target DNS data packet carried in the DNS access request. If the type is a request type, proceed to 503; if the type is a response type, proceed to 510.

[0117] 503: query the DNS cache structure to determine whether to query the cache result of the target DNS data packet. If yes, proceed to 504. If not, forward the DNS access request to the DNS recursive server so that the DNS recursive server performs subsequent operations.

[0118] In this step, the detailed explanation of DNS cache structure can be found in Figure 3 The description shown will not be repeated here.

[0119] 504: Get the target resource record cache list of the target DNS data packet.

[0120] In this step, the specific process of obtaining the target resource cache list can be referred to Figure 2 203 in the description will not be repeated here.

[0121] 505: Determine whether the target domain name of the target DNS data packet is compressed according to the target resource record cache list. If so, proceed to 506; if not, proceed to 507.

[0122] In this step, the specific process of determining whether the target domain name of the target DNS data packet is compressed can be referred to Figure 2 203 in the description will not be repeated here.

[0123] 506: Copy the compressed first target domain name and the first resource record result corresponding to the target domain name.

[0124] 507: Copy the target domain name and the original resource record result of the target domain name.

[0125] 508: Determine whether the target DNS data packet has other target domain names. If so, go to 504; if not, go to 509.

[0126] 509: Send a DNS access request response to the terminal.

[0127] This step is Figure 2 It is similar to 206 in , and will not be described again here.

[0128] 510: Parse the request part in the target DNS data packet to obtain the second target domain name of the request part, and parse the response part in the target data packet to obtain the response result of the response part.

[0129] 511: The second target domain name and the response result are stored according to the cache storage format of the DNS cache structure.

[0130] This step is Figure 4 It is similar to 402 in , and will not be repeated here.

[0131] 512: Create a compressed data result table according to the second target domain name and the response result.

[0132] In this step, the explanation of the compressed data result table can be referred to Figure 4 The 403 in the above description will not be repeated here.

[0133] 513: According to the compressed data result table, the third storage structure in the DNS cache structure updates the resource record cache list corresponding to the compressed resource record in the N resource records.

[0134] This step, with Figure 4 It is similar to 404 in , and will not be repeated here.

[0135] 514: Send a target DNS access request response to the terminal.

[0136] Exemplarily, the target DNS access request response may carry an updated resource record cache list.

[0137] Based on the same technical concept, a DNS access request processing device is also provided in an embodiment of the present application, and the device can implement the above-mentioned DNS access request processing method flow in the embodiment of the present application.

[0138] Figure 6 A schematic diagram of the structure of a DNS access request processing device provided in an embodiment of the present application. The device comprises: a receiving module 601, a query module 602, a processing module 603, and a sending module 604.

[0139] The receiving module 601 is used to receive a DNS access request from a terminal, and determine the type of the target DNS data packet according to the target DNS data packet carried in the DNS access request;

[0140] Query module 602, if the type is a request type, query in the DNS cache structure;

[0141] Processing module 603, when a cache result of the target DNS data packet is found in the DNS cache structure, obtains a target resource record cache list of the target DNS data packet, and determines whether the target domain name of the target DNS data packet is compressed according to the target resource record cache list; if so, copies the compressed first target domain name and the first resource record result corresponding to the target domain name; if not, copies the target domain name and the original resource record result of the target domain name;

[0142] The sending module 604 is used to send a DNS access request response to the terminal; wherein the DNS access request response carries the encapsulated first target domain name and the first resource record result, or the encapsulated target domain name and the original resource record result.

[0143] Optionally, the processing module 603 is specifically configured to:

[0144] When the target cache result of the target DNS data packet is queried in the first storage structure of the DNS cache structure, the target response result corresponding to the target DNS data packet is obtained in the second storage structure of the DNS cache structure according to the target cache result; the target resource record cache list of the target DNS data packet is obtained in the third storage result of the DNS cache structure according to the target response result; if a compression flag is recorded in the target resource record cache list, it is determined that the target domain name of the target DNS data packet is compressed, otherwise, it is determined that the target domain name of the target DNS data packet is not compressed.

[0145] Optionally, the processing module 603 is further used to:

[0146] If the type is a response type, the request part in the target DNS data packet is parsed to obtain the second target domain name of the request part, and the response part in the target data packet is parsed to obtain the response result of the response part; the second target domain name and the response result are stored in the cache storage format of the DNS cache structure; a compressed data result table is created according to the second target domain name and the response result; wherein the compressed data result table is used to indicate whether each of the N resource records included in the response result is compressed, and N is an integer greater than 0; according to the compressed data result table, a resource record cache list corresponding to the compressed resource records in the N resource records is updated in the third storage structure in the DNS cache structure.

[0147] It should be noted here that the above-mentioned device provided in the embodiment of the present application can implement all the method steps in the above-mentioned method embodiment and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as the method embodiment will not be described in detail here.

[0148] Based on the same technical concept, an electronic device is also provided in an embodiment of the present application, and the electronic device can implement the functions of the aforementioned DNS access request processing device.

[0149] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0150] At least one processor 701, and a memory 702 connected to the at least one processor 701. The specific connection medium between the processor 701 and the memory 702 is not limited in the embodiment of the present application. Figure 7 In the example, the processor 701 and the memory 702 are connected via a bus 700. Figure 7 The connections between other components are shown in bold lines, and are not intended to be limiting. The bus 700 can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, Figure 7 Only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. Alternatively, the processor 701 can also be called a controller, and there is no limitation on the name.

[0151] In the embodiment of the present application, the memory 702 stores instructions that can be executed by at least one processor 701. The at least one processor 701 can execute a DNS access request processing method discussed above by executing the instructions stored in the memory 702. The processor 701 can implement Figure 6 The functions of each module in the device shown.

[0152] Among them, the processor 701 is the control center of the device, and can use various interfaces and lines to connect the various parts of the entire control device. By running or executing instructions stored in the memory 702 and calling data stored in the memory 702, the various functions of the device and process data, the device can be monitored as a whole.

[0153] In one possible design, the processor 701 may include one or more processing units, and the processor 701 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 701. In some embodiments, the processor 701 and the memory 702 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on separate chips.

[0154] Processor 701 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of a DNS access request processing method disclosed in the embodiments of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0155] The memory 702 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 702 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 702 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 702 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0156] By designing and programming the processor 701, the code corresponding to the DNS access request processing method described in the above embodiment can be fixed into the chip, so that the chip can execute the code when running. Figure 2 or Figure 6 The embodiment shown is a method for processing a DNS access request. How to design and program the processor 701 is a technique known to those skilled in the art and will not be described in detail here.

[0157] It should be noted here that the above-mentioned electronic device provided in the embodiment of the present application can implement all the method steps implemented in the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as the method embodiment will not be described in detail here.

[0158] An embodiment of the present application further provides a computer-readable storage medium, which stores computer-executable instructions. The computer-executable instructions are used to enable a computer to execute a DNS access request processing method in the above embodiment.

[0159] An embodiment of the present application further provides a computer program product. When the computer program product is called by a computer, the computer executes a DNS access request processing method in the above embodiment.

[0160] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0161] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0162] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0163] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

Claims

1. A method for processing a DNS access request, characterized in that: include: Receiving a domain name system DNS access request from a terminal, and determining the type of the target DNS data packet according to the target DNS data packet carried in the DNS access request; If the type is a request type, query is performed in the DNS cache structure; When a cache result of the target DNS data packet is found in the DNS cache structure, a target resource record cache list of the target DNS data packet is obtained, and whether the target domain name of the target DNS data packet is compressed is determined according to the target resource record cache list; If yes, copy the compressed first target domain name and the first resource record result corresponding to the target domain name; If not, copying the target domain name and the original resource record result of the target domain name; Sending a DNS access request response to the terminal; wherein the DNS access request response carries an encapsulated first target domain name and a first resource record result, or an encapsulated target domain name and an original resource record result; Among them, the cache storage format of the DNS cache structure is a first storage structure, a second storage structure, a third storage structure, and a fourth storage structure that are nested in sequence; the first storage structure represents the cache result of storing at least one DNS data packet; wherein each cache result includes at least a domain name, a type, a domain name length, and a response result; the second storage structure represents the storage of the effective lifetime TTL, the number of record results, and the record result array of M resource records in each response result, wherein the record result array includes the M resource records, and M is an integer greater than 0; the third storage structure represents the storage of a resource record cache list corresponding to each resource record in the record result array; the fourth storage structure represents the storage of a resolution record result list corresponding to each resource record.

2. The method according to claim 1, characterized in that The step of obtaining a target resource record cache list of the target DNS data packet, and determining whether the target domain name of the target DNS data packet is compressed according to the target resource record cache list, comprises: When a target cache result of the target DNS data packet is queried in the first storage structure of the DNS cache structure, a target response result corresponding to the target DNS data packet is obtained in the second storage structure of the DNS cache structure according to the target cache result; According to the target response result, a target resource record cache list of the target DNS data packet is obtained in the third storage result of the DNS cache structure; If the target domain name is recorded with a compression flag in the target resource record cache list, it is determined that the target domain name is compressed; otherwise, it is determined that the target domain name is not compressed.

3. The method according to claim 1, characterized in that The method further comprises: If the type is a response type, parsing the request part in the target DNS data packet to obtain the second target domain name of the request part, and parsing the response part in the target DNS data packet to obtain a response result of the response part; Storing the second target domain name and the response result according to the cache storage format of the DNS cache structure; Creating a compressed data result table according to the second target domain name and the response result; wherein the compressed data result table is used to indicate whether each of the N resource records included in the response result is compressed, where N is an integer greater than 0; According to the compressed data result table, the third storage structure in the DNS cache structure updates the resource record cache list corresponding to the compressed resource records in the N resource records.

4. The method according to claim 1, characterized in that The resource record cache list corresponding to each resource record at least includes the domain name, type, domain name length, network type, whether there is a compression mark, domain name compression result, number of parsing result records, and parsing result array; The parsing record result list corresponding to each resource record at least includes a parsing record TTL value, a parsing record result, and a parsing record result length.

5. A DNS access request processing device, characterized in that: include: A receiving module, configured to receive a domain name system DNS access request from a terminal, and determine the type of the target DNS data packet according to the target DNS data packet carried in the DNS access request; A query module, if the type is a request type, performs a query in a DNS cache structure; The processing module obtains a target resource record cache list of the target DNS data packet when a cache result of the target DNS data packet is found in the DNS cache structure, and determines whether the target domain name of the target DNS data packet is compressed according to the target resource record cache list; if so, copies the compressed first target domain name and the first resource record result corresponding to the target domain name; if not, copies the target domain name and the original resource record result of the target domain name; A sending module, configured to send a DNS access request response to the terminal; wherein the DNS access request response carries an encapsulated first target domain name and a first resource record result, or an encapsulated target domain name and an original resource record result; Among them, the cache storage format of the DNS cache structure of the DNS cache structure is a first storage structure, a second storage structure, a third storage structure, and a fourth storage structure nested in sequence; the first storage structure represents the storage of cache results of at least one DNS data packet; wherein each cache result includes at least a domain name, a type, a domain name length, and a response result; the second storage structure represents the storage of the effective lifetime TTL, the number of record results, and the record result array of M resource records in each response result; wherein the record result array includes the M resource records, and M is an integer greater than 0; the third storage structure represents the storage of a resource record cache list corresponding to each resource record in the record result array; the fourth storage structure represents the storage of a resolution record result list corresponding to each resource record.

6. The device according to claim 5, characterized in that The processing module is specifically used for: When a target cache result of the target DNS data packet is queried in the first storage structure of the DNS cache structure, a target response result corresponding to the target DNS data packet is obtained in the second storage structure of the DNS cache structure according to the target cache result; According to the target response result, a target resource record cache list of the target DNS data packet is obtained in the third storage result of the DNS cache structure; If a compression flag is recorded in the target resource record cache list, it is determined that the target domain name of the target DNS data packet is compressed; otherwise, it is determined that the target domain name of the target DNS data packet is not compressed.

7. The device according to claim 5, characterized in that The processing module is further used for: If the type is a response type, parsing the request part in the target DNS data packet to obtain the second target domain name of the request part, and parsing the response part in the target DNS data packet to obtain a response result of the response part; Storing the second target domain name and the response result according to the cache storage format of the DNS cache structure; Creating a compressed data result table according to the second target domain name and the response result; wherein the compressed data result table is used to indicate whether each of the N resource records included in the response result is compressed, where N is an integer greater than 0; According to the compressed data result table, the third storage structure in the DNS cache structure updates the resource record cache list corresponding to the compressed resource records in the N resource records.

8. The device according to claim 5, characterized in that The resource record cache list corresponding to each resource record at least includes the domain name, type, domain name length, network type, whether there is a compression mark, domain name compression result, number of parsing result records, and parsing result array; The parsing record result list corresponding to each resource record at least includes a parsing record TTL value, a parsing record result, and a parsing record result length.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to implement the method steps of any one of claims 1 to 4 when executing the computer program stored in the memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps of any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Domain name analysis method and system

    CN105306606A

  • Domain name storage and analysis method and device, electronic equipment and storage medium

    CN112839113A