Method, device, equipment and system for determining number of data packets and medium
By obtaining data packets from intermediate devices and determining their type, the problem of difficult to accurately determine the number of data packets on communication devices is solved, and the accurate identification and calculation of retransmitted and out-of-order data packets is achieved, and the reliability and accuracy of data packet transmission is improved.
Patent Information
- Application Number
- CN202311691240.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-07
- Publication Date
- 2025-06-10
AI Technical Summary
In the field of communication technology, it is difficult for the prior art to accurately determine the number of data packets on a communication device, especially in cases where retransmission and out of order occur during packet transmission.
The detection device acquires multiple data packets from the intermediate device, determines the type of each data packet, including retransmission packets and out-of-order data packets, and calculates the number of data packets according to the type. Specific methods include obtaining data packets, parsing the sequence number and TTL values, deleting duplicate data packets, updating the missing sequence number interval to determine the packet type and number.
Accurate determination of the number of data packets is achieved, and retransmitted and out-of-order data packets can be flexibly identified, improving the reliability and accuracy of the data packet transmission process.
Smart Images

Figure CN120128550A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a method, apparatus, device, system and medium for determining the number of data packets. Background Art
[0002] In the field of communication technology, data packets need to be transmitted between different communication devices. In the related art, a detection device is used to obtain data packets on a communication device so as to analyze the data packets. Among them, how to determine the number of data packets on a communication device based on such a detection device is a problem worthy of attention. Summary of the invention
[0003] The present application provides a method, apparatus, device, system and medium for determining the number of data packets on a communication device based on a detection device.
[0004] In the first aspect, the present application provides a method for determining the number of data packets. The method is applied to a detection device included in a communication system, and the communication system also includes a sending device, an intermediate device and a receiving device, and the detection device is connected to the intermediate device. In this method, the detection device obtains multiple first data packets from the intermediate device, and the multiple first data packets are sequentially sent from the sending device to the receiving device through the intermediate device. Afterwards, the detection device determines the type of each second data packet, the second data packet is one of the multiple first data packets, and the sequence number corresponding to the second data packet is less than a reference threshold, the reference threshold is the maximum value of the next sequence number corresponding to the first data packet before the second data packet, and the types include: retransmitted data packets or out-of-order data packets. Next, the detection device determines the number of at least one type of second data packets based on the type of each second data packet.
[0005] In this method, the sending device will sequentially send multiple first data packets to the receiving device through the intermediate device, and the multiple data packets will pass through the intermediate device, so the detection device can obtain the multiple first data packets from the intermediate device. Afterwards, the detection device determines the second data packet from the multiple first data packets. The sequence number corresponding to the second data packet is less than the maximum value of the next sequence number corresponding to the first data packet before the second data packet. Therefore, the second data packet is considered to be an abnormal data packet, and the type of each second data packet needs to be determined. The type may include a retransmitted data packet or an out-of-order data packet. Then, the detection device determines the number of at least one type of second data packets based on the type of each second data packet.
[0006] Since the present application divides the type of the second data packet into fine-grained categories, it is possible to determine both the number of retransmitted data packets and the number of out-of-order data packets without causing any limitation, making the process of determining the number of data packets more flexible and more applicable. Furthermore, since the type of the second data packet is determined when the second data packet is an abnormal data packet, the determined type is more accurate, thereby making the number of each type of data packet determined according to the type of each second data packet also more accurate.
[0007] In a possible implementation, the sending device is connected to the intermediate device via a first link, and the retransmitted data packet includes: a data packet retransmitted for a first situation, the first situation includes a data packet lost on the first link, and after determining the number of at least one type of second data packets, the method further includes: using the number of second data packets of the type retransmitted for the first situation as the number of data packets lost on the first link. In this way, the number of data packets lost on the first link before the intermediate device can be accurately determined, and the judgment of the packet loss location (the first link before the intermediate device) is more accurate.
[0008] In a possible implementation, the intermediate device is connected to the receiving device via a second link, and the retransmitted data packets include: data packets retransmitted for a second situation, the second situation includes data packets lost on the second link, and after determining the number of at least one type of second data packets, the method further includes: using the number of second data packets of the type retransmitted for the second situation as the number of data packets lost on the second link. In this way, the number of data packets lost on the second link after the intermediate device can be accurately determined, and the judgment of the packet loss location (the second link after the intermediate device) is more accurate.
[0009] In a possible implementation, the method further includes: if the sequence number corresponding to the second data packet and the next sequence number are in the sequence number missing interval corresponding to the second data packet, updating the sequence number missing interval corresponding to the second data packet to obtain the update interval corresponding to the second data packet, the sequence number missing interval corresponding to the second data packet includes: the missing sequence numbers between the first data packets before the second data packet; according to the update interval corresponding to the last second data packet, determining the data packet loss situation on the detection device and the third link, the detection device is connected to the intermediate device through the third link. Through this implementation, the data packet loss situation on the detection device and the third link can be determined, which is conducive to distinguishing the packet loss on the third link from the packet loss on the first link or the second link mentioned above, avoiding mistaking the packet loss on the third link for the packet loss on the first link or the second link, and making the judgment of the packet loss location (detection device and third link) more accurate.
[0010] In a possible implementation, according to the update interval corresponding to the last second data packet, determining the data packet loss situation on the detection device and the third link includes: if the update interval corresponding to the last second data packet is empty, determining that there are no lost data packets on the detection device and the third link; if the update interval corresponding to the last second data packet is not empty, determining that there are lost data packets on the detection device and the third link. According to the update interval corresponding to the last second data packet, it can be determined whether there are lost data packets on the detection device and the third link. This method is convenient, fast and highly practical.
[0011] In a possible implementation, the method further includes: if there are lost data packets on the detection device and the third link, the number of lost data packets on the detection device and the third link is determined according to a first value and a second value, the first value is the difference between the upper limit and the lower limit of the update interval corresponding to the last second data packet; the second value is the value of the MSS, or the second value is the length of the payload field in the third data packet, the difference between the acquisition time of the third data packet and the first time is less than the first threshold, and the first time is the time when the update interval corresponding to the last second data packet is obtained. In this implementation, the number of lost data packets on the detection device and the third link can be quantitatively determined, which has strong applicability.
[0012] In a possible implementation, updating the missing sequence number interval corresponding to the second data packet to obtain the update interval includes: if the sequence number corresponding to the second data packet is the same as the lower limit of the missing sequence number interval corresponding to the second data packet, and the next sequence number corresponding to the second data packet is the same as the upper limit of the missing sequence number interval corresponding to the second data packet, the update interval corresponding to the second data packet is obtained to be empty; if the first condition is met, the sequence number corresponding to the second data packet is deleted from the missing sequence number interval corresponding to the second data packet to the next sequence number, and the update interval corresponding to the second data packet is obtained, and the first condition includes at least one of the following: the sequence number corresponding to the second data packet is different from the lower limit of the missing sequence number interval corresponding to the second data packet; the next sequence number corresponding to the second data packet is different from the upper limit of the missing sequence number interval corresponding to the second data packet. Among them, the bytes carried in the second data packet can fill the bytes corresponding to the sequence number in the missing sequence number interval corresponding to the second data packet, so that the missing sequence number is updated. Therefore, it is necessary to update the missing sequence number interval to obtain the update interval, which indicates the missing sequence number after obtaining the second data packet, that is, the missing sequence number of the latest sequence number, which ensures the accuracy of the actual situation of the sequence number, and is conducive to ensuring the accuracy of the determined number of data packets.
[0013] In a possible implementation, the method further includes: determining a reliability index of the detection device and the third link according to the packet loss situation on the detection device and the third link, the reliability index being used to indicate the reliability of the detection device and the third link; and managing the detection device and the third link according to the reliability index. Determining the reliability of the detection device and the third link by detecting the packet loss situation on the detection device and the third link is conducive to managing the detection device and the third link, so as to reduce the packet loss on the detection device and the third link through management and improve reliability.
[0014] In a possible implementation, multiple first data packets are obtained from an intermediate device, including: obtaining multiple fourth data packets from the intermediate device, the multiple fourth data packets are sequentially sent from the sending device to the receiving device through the intermediate device; parsing the first characteristic information from the fifth data packet, if the first characteristic information hits the second characteristic information in the storage space, deleting the fifth data packet from the multiple fourth data packets to obtain the remaining fourth data packets, the fifth data packet is any one of the multiple fourth data packets, and the hit second characteristic information is parsed from the fourth data packet before the fifth data packet; and obtaining multiple first data packets based on the remaining fourth data packets. In this implementation, duplicate data packets are deleted to avoid duplicate data packets affecting the subsequent process of determining the number of data packets, which is not only conducive to reducing overhead, but also can ensure the accuracy of the number of data packets determined subsequently.
[0015] In a possible implementation, the method further includes: if the first characteristic information hits the second characteristic information in the storage space, modifying the writing time corresponding to the hit second characteristic information to the acquisition time of the fifth data packet; if the first characteristic information does not hit any second characteristic information in the storage space, writing the first characteristic information and the acquisition time of the fifth data packet into the storage space accordingly. This implementation reasonably updates the characteristic information in the storage space, ensuring the timeliness and accuracy of the characteristic information in the storage space.
[0016] In a possible implementation, the method further includes: updating the storage space in accordance with a reference method, the reference method including at least one of the following: if the amount of characteristic information included in the storage space is greater than or equal to a second threshold, deleting at least one characteristic information from the earliest characteristic information at the corresponding writing time in the characteristic information included in the storage space, the characteristic information including the first characteristic information and the second characteristic information; periodically clearing the characteristic information included in the storage space. Among them, timely clearing the characteristic information included in the storage space is also conducive to ensuring the accuracy of the number of data packets determined subsequently.
[0017] In a possible implementation, multiple first data packets are obtained based on the remaining fourth data packets, including: parsing the value of TTL from the sixth data packet, the sixth data packet being any one of the remaining fourth data packets; if the value of TTL satisfies the second condition, deleting the sixth data packet from the remaining fourth data packets to obtain multiple first data packets, the second condition including any one of the following: the value of TTL is less than or equal to the third threshold value; the difference between the value of TTL and the initial value of TTL is greater than or equal to the fourth threshold value, the initial value of TTL includes: the value of TTL in the data packet exchanged during the handshake process between the sending device and the receiving device. Through this implementation, duplicate data packets can be deleted again to more thoroughly delete duplicate data packets and avoid omissions, thereby further improving the accuracy of the number of data packets determined subsequently.
[0018] In one possible implementation, determining the type of each second data packet includes: determining the type of the second data packet based on the relationship between a reference interval and a sequence number missing interval corresponding to the second data packet, the reference interval consisting of the sequence number corresponding to the second data packet to the next sequence number. By comparing different intervals, the type of the second data packet can be determined, and this method is relatively convenient. In the following implementations, the retransmitted data packets are divided into a more fine-grained manner, so that the retransmitted data packets can include data packets retransmitted for the first situation, false retransmitted data packets, and data packets retransmitted for the second situation. In this way, the number of second data packets of richer types can be determined, and the accuracy of the determined number of second data packets can be improved.
[0019] In a possible implementation, the type of the second data packet is determined based on the relationship between the reference interval and the sequence number missing interval corresponding to the second data packet, including: if the reference interval is within the sequence number missing interval corresponding to the second data packet, and the difference between the acquisition time of the second data packet and the second moment is greater than or equal to a fifth threshold, determining that the type of the second data packet is a data packet retransmitted for a first situation, the first situation including a data packet lost on a first link between a sending device and an intermediate device; wherein the second moment includes any one of the following: the second moment is the acquisition time of a previous confirmation data packet, the confirmation data packet is sent by the receiving device to the sending device via the intermediate device; the second moment is the acquisition time of the previous seventh data packet, the type of the seventh data packet is an out-of-order data packet, or the type of the seventh data packet is questionable.
[0020] In one possible implementation, the type of the second data packet is determined based on the relationship between the reference interval and the sequence number missing interval corresponding to the second data packet, including: if the reference interval is outside the sequence number missing interval corresponding to the second data packet, and the next sequence number corresponding to the second data packet is less than the maximum value of the confirmation number sent by the receiving device, determining that the type of the second data packet is a false retransmitted data packet.
[0021] In a possible implementation, the type of the second data packet is determined based on the relationship between the reference interval and the sequence number missing interval corresponding to the second data packet, including: if the reference interval is outside the sequence number missing interval corresponding to the second data packet, and the next sequence number corresponding to the second data packet is greater than or equal to the maximum value of the confirmation number sent by the receiving device, the type of the second data packet is determined to be a data packet retransmitted for the second situation, and the second situation includes losing the data packet on the second link between the intermediate device and the receiving device. In the following, the data packets retransmitted for the second situation are also divided into a plurality of more fine-grained types, making the method of determining the number of data packets in the present application more flexible.
[0022] In a possible implementation, the data packets retransmitted for the second situation include: fast retransmitted data packets, timeout retransmitted data packets, and other retransmitted data packets, and determining the type of the second data packet as a data packet retransmitted for the second situation includes: if the number of confirmation data packets obtained from the intermediate device is greater than or equal to a sixth threshold, determining the type of the second data packet is a fast retransmitted data packet, and the confirmation data packet is sent by the receiving device to the sending device through the intermediate device; if the difference between the acquisition time of the second data packet and the acquisition time of the previous confirmation data packet is greater than or equal to RTO, determining the type of the second data packet is a timeout retransmitted data packet; if the type of the second data packet is not a fast retransmitted data packet, and the type of the second data packet is not a timeout retransmitted data packet, determining the type of the second data packet is other retransmitted data packets.
[0023] In a possible implementation, the type of the second data packet is determined based on the relationship between the reference interval and the sequence number missing interval corresponding to the second data packet, including: if the reference interval is within the sequence number missing interval corresponding to the second data packet, the difference between the acquisition time of the second data packet and the second moment is less than the fifth threshold, and there is a duplication of the confirmation data packet obtained from the intermediate device, the type of the second data packet is determined to be an out-of-order data packet; wherein the second moment includes any one of the following: the second moment is the acquisition time of the previous confirmation data packet, and the confirmation data packet is sent from the receiving device to the sending device through the intermediate device; the second moment is the acquisition time of the previous seventh data packet, and the type of the seventh data packet is an out-of-order data packet, or the type of the seventh data packet is questionable. In this implementation, whether the type of the second data packet is an out-of-order data packet is determined based on three different conditions, thereby improving the accuracy of the determined out-of-order data packets.
[0024] In a second aspect, a device for determining the number of data packets is provided, the device is applied to a detection device included in a communication system, the communication system also includes a sending device, an intermediate device and a receiving device, the detection device is connected to the intermediate device, and the device includes:
[0025] An acquisition module, used for acquiring a plurality of first data packets from an intermediate device, wherein the plurality of first data packets are sequentially sent by a sending device to a receiving device via the intermediate device;
[0026] A first determination module is used to determine the type of each second data packet, the second data packet is one of the multiple first data packets, the sequence number corresponding to the second data packet is less than a reference threshold, the reference threshold is the maximum value of the next sequence number corresponding to the first data packet before the second data packet, and the type includes: a retransmitted data packet or an out-of-order data packet;
[0027] The second determining module is used to determine the quantity of at least one type of second data packets according to the types of each second data packet.
[0028] In one possible implementation, a sending device is connected to an intermediate device via a first link, and the retransmitted data packets include: data packets retransmitted for a first situation, the first situation including data packets lost on the first link, and the second determination module is further used to use the number of second data packets of the type retransmitted for the first situation as the number of data packets lost on the first link.
[0029] In one possible implementation, the intermediate device is connected to the receiving device via a second link, and the retransmitted data packets include: data packets retransmitted for a second situation, the second situation includes data packets lost on the second link, and the second determination module is further used to use the number of second data packets of the type retransmitted for the second situation as the number of data packets lost on the second link.
[0030] In a possible embodiment, the device also includes: a first update module, which is used to update the sequence number missing interval corresponding to the second data packet if the sequence number corresponding to the second data packet and the next sequence number are in the sequence number missing interval corresponding to the second data packet, so as to obtain the update interval corresponding to the second data packet, and the sequence number missing interval corresponding to the second data packet includes: the missing sequence numbers between the first data packets before the second data packet; a third determination module, which is used to determine the data packet loss situation on the detection device and the third link according to the update interval corresponding to the last second data packet, and the detection device is connected to the intermediate device through the third link.
[0031] In one possible implementation, the third determination module is used to determine that there are no lost data packets on the detection device and the third link if the update interval corresponding to the last second data packet is empty; if the update interval corresponding to the last second data packet is not empty, determine that there are lost data packets on the detection device and the third link.
[0032] In a possible implementation, the second determination module is also used to determine the number of lost data packets on the detection device and the third link based on the first value and the second value if there are lost data packets on the detection device and the third link, the first value being the difference between the upper limit and the lower limit of the update interval corresponding to the last second data packet; the second value being the value of the MSS, or the second value being the length of the payload field in the third data packet, the difference between the time when the third data packet is obtained and the first time is less than the first threshold, and the first time is the time when the update interval corresponding to the last second data packet is obtained.
[0033] In one possible implementation, a first update module is used to obtain an update interval corresponding to the second data packet as empty if the sequence number corresponding to the second data packet is the same as the lower limit of the sequence number missing interval corresponding to the second data packet, and the next sequence number corresponding to the second data packet is the same as the upper limit of the sequence number missing interval corresponding to the second data packet; if a first condition is met, delete the sequence number corresponding to the second data packet to the next sequence number from the sequence number missing interval corresponding to the second data packet to obtain an update interval corresponding to the second data packet, and the first condition includes at least one of the following: the sequence number corresponding to the second data packet is different from the lower limit of the sequence number missing interval corresponding to the second data packet; the next sequence number corresponding to the second data packet is different from the upper limit of the sequence number missing interval corresponding to the second data packet.
[0034] In a possible embodiment, the device also includes: a fourth determination module, used to determine the reliability index of the detection device and the third link according to the data packet loss situation on the detection device and the third link, and the reliability index is used to indicate the reliability of the detection device and the third link; a management module, used to manage the detection device and the third link according to the reliability index.
[0035] In one possible implementation, an acquisition module is used to acquire multiple fourth data packets from an intermediate device, where the multiple fourth data packets are sequentially sent from a sending device to a receiving device via an intermediate device; first characteristic information is parsed from a fifth data packet, and if the first characteristic information hits the second characteristic information in a storage space, the fifth data packet is deleted from the multiple fourth data packets to obtain remaining fourth data packets, where the fifth data packet is any one of the multiple fourth data packets, and the hit second characteristic information is parsed from a fourth data packet before the fifth data packet; and multiple first data packets are acquired based on the remaining fourth data packets.
[0036] In a possible implementation, the device also includes: a writing module, which is used to modify the writing time corresponding to the hit second characteristic information to the acquisition time of the fifth data packet if the first characteristic information hits the second characteristic information in the storage space; if the first characteristic information does not hit any second characteristic information in the storage space, write the first characteristic information and the acquisition time of the fifth data packet into the storage space accordingly.
[0037] In a possible implementation, the device also includes: a second update module, used to update the storage space according to a reference method, the reference method including at least one of the following: if the amount of characteristic information included in the storage space is greater than or equal to a second threshold, among the characteristic information included in the storage space, at least one characteristic information is deleted starting from the earliest characteristic information at the corresponding writing time, and the characteristic information includes first characteristic information and second characteristic information; and the characteristic information included in the storage space is periodically cleared.
[0038] In one possible implementation, an acquisition module is used to parse a TTL value from a sixth data packet, where the sixth data packet is any one of the remaining fourth data packets; if the TTL value satisfies a second condition, the sixth data packet is deleted from the remaining fourth data packets to obtain multiple first data packets, and the second condition includes any one of the following: the TTL value is less than or equal to a third threshold; the difference between the TTL value and the initial value of the TTL is greater than or equal to a fourth threshold, and the initial value of the TTL includes: the TTL value in the data packet exchanged during the handshake process between the sending device and the receiving device.
[0039] In a possible implementation, the first determination module is used to determine the type of the second data packet based on the relationship between the reference interval and the sequence number missing interval corresponding to the second data packet, and the reference interval consists of the sequence number corresponding to the second data packet to the next sequence number.
[0040] In one possible implementation, a first determination module is used to determine that the type of the second data packet is a data packet retransmitted for a first situation if the reference interval is within a sequence number missing interval corresponding to the second data packet, and the difference between the time when the second data packet is acquired and the second time is greater than or equal to a fifth threshold, wherein the first situation includes a data packet lost on a first link between a sending device and an intermediate device; wherein the second time includes any one of the following: the second time is the time when the previous confirmation data packet is acquired, and the confirmation data packet is sent by the receiving device to the sending device via the intermediate device; the second time is the time when the previous seventh data packet is acquired, and the type of the seventh data packet is an out-of-order data packet, or the type of the seventh data packet is questionable.
[0041] In one possible implementation, the first determination module is used to determine that the type of the second data packet is a false retransmitted data packet if the reference interval is outside the sequence number missing interval corresponding to the second data packet and the next sequence number corresponding to the second data packet is less than the maximum value of the confirmation number sent by the receiving device.
[0042] In one possible implementation, the first determination module is used to determine that the type of the second data packet is a data packet retransmitted for a second situation if the reference interval is outside the sequence number missing interval corresponding to the second data packet and the next sequence number corresponding to the second data packet is greater than or equal to the maximum value of the confirmation number sent by the receiving device, and the second situation includes the loss of a data packet on a second link between the intermediate device and the receiving device.
[0043] In a possible implementation, the data packets retransmitted for the second situation include: fast-retransmitted data packets, timed-retransmitted data packets, and other retransmitted data packets. The first determination module is used to determine that the type of the second data packet is a fast-retransmitted data packet if the number of confirmation data packets obtained from the intermediate device is greater than or equal to a sixth threshold, and the confirmation data packet is sent by the receiving device to the sending device through the intermediate device; if the difference between the acquisition time of the second data packet and the acquisition time of the previous confirmation data packet is greater than or equal to RTO, determine that the type of the second data packet is a timed-retransmitted data packet; if the type of the second data packet is not a fast-retransmitted data packet, and the type of the second data packet is not a timed-retransmitted data packet, determine that the type of the second data packet is other retransmitted data packets.
[0044] In one possible implementation, the first determination module is used to determine that the type of the second data packet is an out-of-order data packet if the reference interval is within the sequence number missing interval corresponding to the second data packet, the difference between the time when the second data packet is acquired and the second time is less than a fifth threshold, and there are duplicate confirmation data packets acquired from the intermediate device, wherein the second time includes any one of the following: the second time is the time when the previous confirmation data packet is acquired, and the confirmation data packet is sent by the receiving device to the sending device through the intermediate device; the second time is the time when the previous seventh data packet is acquired, and the type of the seventh data packet is an out-of-order data packet, or the type of the seventh data packet is questionable.
[0045] In a third aspect, a device for determining the number of data packets is provided, the device comprising a memory and a processor; at least one computer instruction is stored in the memory, and the at least one computer instruction is loaded and executed by the processor, so that the device for determining the number of data packets implements the method for determining the number of data packets in the above-mentioned first aspect or any possible implementation of the first aspect.
[0046] In a fourth aspect, a communication system is provided, which includes a detection device, a sending device, an intermediate device and a receiving device. The detection device is connected to the intermediate device, and the detection device is used to execute the method for determining the number of data packets in the above-mentioned first aspect or any possible implementation manner of the first aspect.
[0047] In a fifth aspect, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, and the instruction is loaded and executed by a processor so that a computer implements the method for determining the number of data packets in the above-mentioned first aspect or any possible implementation of the first aspect.
[0048] In a sixth aspect, a computer program (product) is provided, which, when executed by a computer, can enable a processor or a computer to execute the method for determining the number of data packets in the above-mentioned first aspect or any possible implementation of the first aspect.
[0049] In a seventh aspect, a chip is provided, comprising a processor for calling and executing instructions stored in a memory, so that a computer equipped with the chip executes the method for determining the number of data packets in the above-mentioned first aspect or any possible implementation of the first aspect.
[0050] In an eighth aspect, another chip is provided, comprising: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, a computer equipped with the chip executes the method for determining the number of data packets in the above-mentioned first aspect or any possible implementation manner of the first aspect.
[0051] It should be understood that the beneficial effects achieved by the technical solutions of the second to eighth aspects of the present application and the corresponding possible implementation methods can be referred to the technical effects of the first aspect and its corresponding possible implementation methods mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 A schematic diagram of a data packet provided in an embodiment of the present application;
[0053] Figure 2 A schematic diagram of a communication scenario corresponding to a related technology provided in an embodiment of the present application;
[0054] Figure 3 A schematic diagram of a communication scenario corresponding to another related technology provided in an embodiment of the present application;
[0055] Figure 4 A schematic diagram of an implementation environment provided for an embodiment of the present application;
[0056] Figure 5 A schematic diagram of another implementation environment provided for an embodiment of the present application;
[0057] Figure 6 A flowchart of a method for determining the number of data packets provided in an embodiment of the present application;
[0058] Figure 7 A schematic diagram of a data packet transmission process provided in an embodiment of the present application;
[0059] Figure 8 A schematic diagram of determining the number of data packets at different locations provided in an embodiment of the present application;
[0060] Fig. 9 A schematic diagram of determining the number of data packets provided in an embodiment of the present application;
[0061] Fig.10 A schematic diagram of a process for determining the number of data packets provided in an embodiment of the present application;
[0062] Fig.11 A schematic diagram of the structure of a device for determining the number of data packets provided in an embodiment of the present application;
[0063] Fig.12 A schematic diagram of the structure of a network device provided in an embodiment of the present application;
[0064] Fig.13 A schematic diagram of the structure of another network device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0065] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0066] In the field of communication technology, data streams need to be transmitted between different communication devices. The data stream includes multiple bytes in order, so the data stream is also called a byte stream. In the transmission process of data packets, after the communication device used as the sending end generates at least one data packet, it sends the generated data packet to the communication device used as the receiving end, wherein each data packet includes at least one byte in the data stream to be transmitted, and the data packet is also called a message. There may be abnormal transmission situations in the transmission process, resulting in various types of abnormal data packets. How to determine the number of abnormal data packets has become a problem worthy of attention.
[0067] Before explaining the methods provided by the related art and the methods provided by the embodiments of the present application, the basic knowledge is introduced by taking the communication device used as the transmitting end as communication device A and the communication device used as the receiving end as communication device B as an example to facilitate understanding of the various methods described later.
[0068] The above data streams include but are not limited to transmission control protocol (TCP) data streams, see Figure 1 , Figure 1 An exemplary data packet in a TCP data stream is shown. Figure 1 In the embodiment, a data packet includes a TCP header and a TCP data portion, the TCP data portion is also called a payload, and the payload can be used to carry at least one byte of the data stream to be transmitted in the above description. The fields included in the TCP header are described as follows.
[0069] Source port, indicating the port on communication device A used to send data packets.
[0070] Destination port, indicating the port on communication device B used to receive data packets.
[0071] The sequence number indicates the order of the first byte of at least one byte carried by the payload in the multiple bytes, where the multiple bytes are the ordered multiple bytes included in the data stream in the above description. For example, if the data stream includes 100 bytes in total, if the sequence number is 30, it means that the first byte carried by the payload is the 30th byte of the 100 bytes.
[0072] For a data packet, the next sequence number (next sequence number) corresponding to the data packet can be determined based on the sequence number in the data packet and the length of the payload (TCP length, TCP_Len). The length of the payload is the number of bytes occupied by the payload. If there is no abnormal transmission, the next sequence number corresponding to the data packet should be the sequence number in the next data packet of the data packet. The next data packet of the data packet refers to the data packet with the same transmission direction as the data packet.
[0073] In some embodiments, if the values of the synchronization (SYN) flag and the finish (FIN) flag in the flag bits included in the TCP message header are both 0, then the next sequence number corresponding to a data packet is equal to the sum of the sequence number in the data packet and the length of the payload. In other embodiments, if the values of the SYN flag and the FIN flag in the flag bits included in the TCP message header are both 1, then the next sequence number corresponding to a data packet is equal to the sum of the sequence number in the data packet and the length of the payload plus one, that is, one byte is added to the sum of the sequence number in the data packet and the length of the payload.
[0074] Taking the first of the two implementations in the above paragraph as an example, if the sequence number of a data packet sent by communication device A to communication device B is 30, and the length of the payload in the data packet is 10, it means that the bytes carried by the payload include the 30th byte to the 39th byte (a total of 10 bytes). Therefore, the next sequence number corresponding to the data packet is 40, which means that the sequence number in the next data packet of the data packet should be 40, that is, in the next data packet of the data packet that communication device A needs to send to communication device B, the first byte carried by the payload should be the 40th byte.
[0075] The acknowledgment number indicates the sequence number of the next data packet expected to be received. The acknowledgment number is equal to the sequence number corresponding to the last byte received plus 1. In the flag bits included in the TCP message header, if the value of the acknowledgment (ACK) flag bit is 0, the acknowledgment number is invalid. If the value of the ACK flag bit is 1, the acknowledgment number is valid.
[0076] Data offset indicates the length of the TCP message header, that is, the number of bytes occupied by the TCP message header.
[0077] Reserved field. Currently has no indication function.
[0078] The flag bit may include the SYN flag bit, FIN flag bit and ACK flag bit described above, and may also include an urgent (URG) flag bit, a push (PSH) flag bit and a reset (RST) flag bit, which will not be described in detail here.
[0079] The window, checksum, urgent pointer, options and padding are not described here.
[0080] For example, Figure 1 As shown, the data packet may also include an Internet Protocol (IP) header. The IP header is located in the outer layer of the TCP header, and the TCP header and the TCP data part are used as the IP data part. Figure 1 ) are described as follows.
[0081] Source IP address, indicating the IP address of communication device A.
[0082] Destination IP address, indicating the IP address of communication device B.
[0083] The header length indicates the length of the IP header, that is, the number of bytes occupied by the IP header.
[0084] Total length: indicates the sum of the length of the IP header and the length of the IP data part.
[0085] Protocol number, indicating the communication protocol currently used, such as TCP.
[0086] Time to live (TTL) indicates the number of communication devices that a data packet is allowed to pass through. When communication device A sends a data packet, the TTL value is the initial value. After that, the TTL value decreases by one every time the data packet passes through a communication device. When the TTL value is zero, the data packet will be discarded by the communication device.
[0087] Based on the data packets described above, the TCP data stream can correspond to the following various mechanisms to ensure the reliability of the transmission process.
[0088] Handshake mechanism, communication device A and communication device B need to perform three-way handshake to establish a TCP session before transmitting TCP data traffic. During the three-way handshake process, communication device A and communication device B can negotiate the value of the maximum segment size (MSS), which is the upper limit of the payload length. The value of MSS is, for example, 1460 bytes. Communication device A and communication device B can also negotiate the initial value of TTL described above.
[0089] Confirmation mechanism, in the data packet sent by communication device A to communication device B, the payload carries at least one byte in the data stream that needs to be transmitted, and the value of the ACK flag is 0, indicating that the confirmation number is invalid. After receiving the data packet, communication device B will return a confirmation data packet for the data packet to communication device A, so that communication device A can determine whether the sent data packet has been received by communication device B. In the confirmation data packet returned by communication device B, the payload does not carry at least one byte, and the value of the ACK flag is 1, indicating that the confirmation number is valid. Based on the above description of the confirmation number, it can be seen that the confirmation number is the sequence number of the next data packet that communication device B expects to receive, and the confirmation number is equal to the sequence number corresponding to the last byte received by communication device B plus one.
[0090] For example, the sequence number of the data packet sent by communication device A is 30, the length of the payload in the data packet is 10, and the sequence number corresponding to the last byte received is 39. Therefore, after communication device B receives the data packet, the confirmation number in the confirmation data packet returned to communication device A is 40. After receiving the confirmation data packet, communication device A can determine not only that communication device B has received the byte corresponding to the sequence number before sequence number 40, but also that the sequence number of the next data packet that communication device B expects to receive is 40 based on the confirmation number 40 in the confirmation data packet.
[0091] Retransmission mechanism, according to the above description of the confirmation mechanism, communication device A determines whether the sent data packet has been received by communication device B. Therefore, when communication device A determines that the sent data packet has not been received by communication device B, communication device A can resend the unreceived data packet to communication device B to ensure the reliability of the transmission process.
[0092] The above is a brief introduction to the basic knowledge. The following is an explanation of the related technologies.
[0093] In the related technology, based on Figure 2 The scenario shown determines the packet loss, ie the number of packets that have been lost. Figure 2 In the example, the devices, device 1, device 2, device 3 and server (all of which are communication devices) in the service network are connected in sequence through real links. Device 1, device 2, device 3 and server are also connected to the detection device through mirror links. There are mirror points in device 1, device 2, device 3 and server. After the devices in the service network send data packets, the data packets are transmitted in the real link. The mirror point is used to copy the data packets transmitted in the real link to obtain the copied data packets, and send the copied data packets to the detection device through the mirror link. After receiving the copied data packets, the detection device counts them to obtain the number A of data packets on device 1, the number B of data packets on device 2, the number C of data packets on device 3 and the number D of data packets on the server. After that, (number B - number A) is used as the number of packet loss between device 2 and device 1, (number C - number B) is used as the number of packet loss between device 2 and device 3, and (number D - number C) is used as the number of packet loss between device 3 and the server.
[0094] However, the first related technology can only determine the number of packet loss, which is very limited. Moreover, since the method provided by the first related technology is relatively simple, the determined number of packet loss may not be accurate enough.
[0095] In the related technology 2, based on Figure 3 The scenario shown determines the number of packet losses. Figure 3 The scenario shown is similar to Figure 2The scenario shown is not described here. After the detection device receives the replicated data packets sent by the mirror point through the mirror link, it determines the number of data packets lost before device 1, the number of data packets lost before device 2, the number of data packets lost before device 3, and the number of data packets lost before the server, respectively. After that, (number F - number E) is used as the number of packet losses between device 2 and device 1, (number G - number F) is used as the number of packet losses between device 2 and device 3, and (number H - number G) is used as the number of packet losses between device 3 and the server.
[0096] Taking the determination of the number E of data packets lost before by device 1 as an example, the detection device analyzes the duplicated data packets sent by the mirror point in device 1. For two adjacent data packets in the duplicated data packets, if the next sequence number (valued as X) corresponding to the previous data packet is different from the sequence number (valued as Y) in the next data packet, the detection device determines the difference between X and Y, and uses the ratio between the difference and the TCP_Len described above as the number E. TCP_Len is difficult to determine accurately, because the TCP_Len of different data packets may be different, so the MSS described above is used instead of TCP_Len, that is, the ratio between the difference and the MSS is used as the number E.
[0097] However, the related technology 2 can only determine the number of packet losses, which is relatively simple. Moreover, although the method provided by the related technology 2 is more complicated than that of the related technology 1, since TCP_Len is difficult to accurately determine and can only be replaced by MSS, there is still a problem that the determined number of packet losses is not accurate enough. For example, when TCP_Len is less than MSS, the number of packet losses determined according to the related technology 2 is too small.
[0098] The present application embodiment provides a Figure 4 The implementation environment shown is a communication system, which includes a detection device 401, a sending device 402, an intermediate device 403 and a receiving device 404, wherein the detection device 401 is connected to the intermediate device 403.
[0099] Exemplarily, the sending device 402, the intermediate device 403 and the receiving device 404 are connected via a real link. In the embodiment of the present application, the real link between the sending device 402 and the intermediate device 403 can be called a first link, and the real link between the intermediate device 403 and the receiving device 404 can be called a second link for easy distinction.
[0100] In an exemplary embodiment, the intermediate device 403 is connected to the detection device 401 via a mirror link, which may also be referred to as a third link. For example, the communication port on the intermediate device 403 is connected to the communication port on the detection device 401 (for example, the communication port corresponding to the network card in the detection device 401) via the mirror link, thereby achieving connection with the detection device 401. Exemplarily, the detection device 401 may include a probe, including but not limited to a network performance management (NPM) probe, and the embodiment of the present application does not limit the implementation form of the detection device 401.
[0101] The embodiment of the present application does not limit the number of the intermediate devices 403. Figure 4 , the number of the intermediate device 403 may be 1. For another example, see Figure 5 , the number of intermediate devices 403 may be N, where N is a positive integer greater than or equal to 2. For intermediate device 1, the first link is a real link between the sending device 402 and intermediate device 1, and the second link includes all real links between intermediate device 1 and receiving device 404. For intermediate device N, the first link includes all real links between the sending device 402 and intermediate device N, and the second link is a real link between intermediate device N and receiving device 404.
[0102] The sending device 402 can send a data packet to the intermediate device 403, and the intermediate device 403 forwards the data packet to the receiving device 404, thereby realizing the data packet transmission between the sending device 402 and the receiving device 404. The intermediate device 403 includes at least one mirror point, which can copy the data packet in the intermediate device 403 to obtain the copied data packet, and send the copied data packet to the detection device 401 through the mirror link, so that the detection device 401 performs the method for determining the number of data packets provided in the embodiment of the present application according to the received copied data packet, which will be described later. Figure 6 The description in the corresponding method embodiment will not be repeated here.
[0103] Of course, both the sending device 402 and the receiving device 404 are communication devices, and the communication device may include both sending and receiving functions. Therefore, the sending device 402 and the receiving device 404 are only an example. In other cases, the sending device 402 may be used as a receiving device, and the receiving device 404 may be used as a sending device.
[0104] The present invention provides a method for determining the number of data packets. Figure 4 or Figure 5 The detection device in the communication system shown in the figure is not limited in the present embodiment of the application. Figure 6As shown, the method includes the following steps 601 to 603.
[0105] Step 601: Acquire multiple first data packets from an intermediate device. The multiple first data packets are sequentially sent from a sending device to a receiving device via the intermediate device.
[0106] During the transmission of data packets, the sending device sends multiple data packets to the intermediate device, and the intermediate device forwards the multiple data packets to the receiving device, and copies the multiple forwarded data packets through the mirror point to obtain multiple first data packets corresponding to the multiple data packets. The corresponding data packets have the same content as the first data packets, such as the same fields and the same field values. After the intermediate device obtains the multiple first data packets through the mirror point, the detection device can obtain the multiple first data packets from the intermediate device. For example, the intermediate device pushes the multiple first data packets to the detection device. For another example, the intermediate device sends the multiple first data packets to the detection device according to the instructions of the detection device. In an embodiment of the present application, since the multiple first data packets are obtained by copying the multiple data packets, the process of the detection device obtaining the multiple first data packets from the intermediate device does not affect the process of the intermediate device forwarding the multiple data packets to the receiving device.
[0107] Exemplarily, an intermediate device includes a mirror point, and a mirror point may have multiple replication rules, and a data packet may satisfy different replication rules among the multiple replication rules. Each time a data packet satisfies a replication rule, it will be replicated once by the mirror point to obtain a first data packet. In other words, the mirror point may replicate the same data packet multiple times, resulting in duplicate first data packets among the multiple first data packets, and the duplicate first data packets are first data packets obtained by replicating the same data packet.
[0108] In the case where there are repeated first data packets among multiple first data packets, if the detection device executes subsequent steps 602 and 603 to determine the number of data packets based on the multiple first data packets, it will not only increase the overhead of the detection device, but may also cause the number of data packets determined to be inaccurate. Therefore, it is necessary to avoid the existence of repeated first data packets among multiple first data packets. In an exemplary embodiment, the process of obtaining multiple first data packets from an intermediate device includes obtaining multiple fourth data packets from an intermediate device, the multiple fourth data packets are sequentially sent from a sending device to a receiving device through the intermediate device, and the first characteristic information is parsed from the fifth data packet. If the first characteristic information hits the second characteristic information in the storage space, the fifth data packet is deleted from the multiple fourth data packets to obtain the remaining fourth data packets, and the fifth data packet is any one of the multiple fourth data packets. The hit second characteristic information is parsed from the fourth data packet before the fifth data packet, and multiple first data packets are obtained based on the remaining fourth data packets.
[0109] Among them, the multiple data packets sequentially sent by the sending device to the receiving device through the intermediate device are called multiple fourth data packets. There may be repeated fourth data packets among the multiple fourth data packets. Therefore, the detection device deduplicates the multiple fourth data packets to obtain the remaining fourth data packets, and then obtains the multiple first data packets based on the remaining fourth data packets to avoid repeated first data packets among the multiple data packets.
[0110] Exemplarily, the detection device can obtain multiple reference data packets from the intermediate device. The method for obtaining multiple reference data packets can refer to the method for obtaining multiple data packets described in step 601, which will not be described in detail here. Different reference data packets in the multiple reference data packets may have different five-tuples, and the detection device selects reference data packets with the same five-tuple from the multiple reference data packets as multiple fourth data packets. In this way, it can be ensured that the multiple fourth data packets belong to the same session and have the same transmission direction. Among them, the five-tuple includes: the source IP address in the IP packet header, the destination IP address in the IP packet header, the protocol number in the IP packet header, the source port in the TCP packet header, and the destination port in the TCP packet header. For a description of this information, please refer to the above. Figure 1 The corresponding instructions are not repeated here.
[0111] In the process of deduplication processing of multiple fourth data packets, the detection device sequentially uses each of the multiple fourth data packets as the fifth data packet. For a fifth data packet, the detection device parses the first characteristic information corresponding to the fifth data packet from the fifth data packet, and queries the second characteristic information in the storage space according to the first characteristic information. Among them, the second characteristic information in the storage space is parsed from the fourth data packet before the fifth data packet, or in other words, the fourth data packet before the fifth data packet has the corresponding second characteristic information. If the first characteristic information corresponding to a fifth data packet hits the second characteristic information in the storage space, such as being the same as the second characteristic information in the storage space (for example, completely the same), then it means that the fifth data packet is repeated with the fourth data packet corresponding to the hit second characteristic information, so the fifth data packet can be deleted from the multiple fourth data packets. If the first characteristic information corresponding to a fifth data packet does not hit any second characteristic information in the storage space, such as being different from the second characteristic information in the storage space (for example, completely different or partially the same), then it means that the fifth data packet is not repeated with any fourth data packet before the fifth data packet, so there is no need to delete the fifth data packet from the multiple fourth data packets. After traversing multiple fourth data packets in this way, the remaining fourth data packets can be obtained.
[0112] The embodiments of the present application do not limit the first characteristic information and the second characteristic information. The first characteristic information and the second characteristic information may be information included in the header packet in the data packet. Thus, the first characteristic information can be obtained by parsing the fifth data packet, and the second characteristic information can be obtained by parsing the fourth data packet before the fifth data packet. No additional complex calculations are required, and the overhead is low. Exemplarily, the first characteristic information includes at least one of the following: the protocol number included in the IP header, the checksum in the TCP header, the header length in the IP header, the total length in the IP header, and the FIN flag in the TCP header. For a description of this information, see above. Figure 1 The corresponding description is not repeated here. The second characteristic information includes the same type of information as the first characteristic information. For example, when the first characteristic information includes the protocol number included in the IP message header and the checksum in the TCP message header, the second characteristic information also includes the protocol number included in the IP message header and the checksum in the TCP message header.
[0113] The above method of performing deduplication processing through the first characteristic information and the second characteristic information is only an example, and the embodiments of the present application can also use other methods to complete deduplication processing. For example, the detection device generates a first identifier corresponding to the fifth data packet through message digest algorithm version 5 (message digest algorithm 5, MD5), generates a second identifier corresponding to the fourth data packet before the fifth data packet through MD5, and stores the second identifier in the storage space. If the first identifier hits the second identifier in the storage space, it means that the fifth data packet is repeated with the fourth data packet corresponding to the hit second identifier, and the fifth data packet is deleted. If the first identifier does not hit any second identifier in the storage space, it means that the fifth data packet is not repeated with any fourth data packet before the fifth data packet, and the fifth data packet is not deleted.
[0114] For the storage space involved in the above description, the embodiment of the present application can also update the characteristic information in the storage space (including but not limited to the second characteristic information mentioned above) to ensure the timeliness and accuracy of the characteristic information stored in the storage space.
[0115] Among them, the second characteristic information in the storage space corresponds to a writing time, and the writing time of the second characteristic information is the acquisition time of the fourth data packet corresponding to the second characteristic information. Exemplarily, if the intermediate device has the function of setting a timestamp, the acquisition time of the fourth data packet is: the time indicated by the timestamp set by the intermediate device for the fourth data packet, such as the time when the intermediate device sends the fourth data packet to the detection device. Alternatively, if the intermediate device does not have the function of setting a timestamp, the acquisition time of the fourth data packet is: the time indicated by the timestamp set by the detection device for the fourth data packet, such as the time when the detection device receives the fourth data packet. Of course, in the embodiment of the present application, the same device sets timestamps for different fourth data packets. For example, the timestamps of all fourth data packets are set by the intermediate device, or the timestamps of all fourth data packets are set by the detection device.
[0116] Based on this, the process of updating the storage space may include: if the first characteristic information hits the second characteristic information in the storage space, modifying the writing time corresponding to the hit second characteristic information to the acquisition time of the fifth data packet; if the first characteristic information does not hit any second characteristic information in the storage space, writing the first characteristic information and the acquisition time of the fifth data packet into the storage space accordingly.
[0117] Among them, if the first characteristic information hits the second characteristic information in the storage space, it means that the fifth data packet and the fourth data packet corresponding to the hit second characteristic information are repeated and belong to the same data packet, so the write time corresponding to the hit second characteristic information is modified to the acquisition time of the fifth data packet to reflect the time when this data packet was most recently acquired. If the first characteristic information does not hit any second characteristic information in the storage space, it means that the fifth data packet and the fourth data packet corresponding to the hit second characteristic information are not repeated, so it is necessary to write the first characteristic information and the acquisition time of the fifth data packet into the storage space accordingly to obtain an updated storage space. For the next fourth data packet of the fifth data packet among multiple fourth data packets, the above-mentioned deduplication processing can be completed according to the updated storage space.
[0118] Exemplarily, the method provided in an embodiment of the present application also includes: updating the storage space according to a reference method, the reference method includes at least one of the following: if the amount of characteristic information included in the storage space is greater than or equal to a second threshold, deleting at least one characteristic information from the earliest characteristic information at the corresponding writing time among the characteristic information included in the storage space (hereinafter referred to as the first method); periodically clearing the characteristic information included in the storage space (hereinafter referred to as the second method).
[0119] For the first method, according to the above description, the characteristic information stored in the storage space may include the first characteristic information and the second characteristic information, and both the first characteristic information and the second characteristic information correspond to a write time. When the amount of characteristic information included in the storage space is greater than or equal to the second threshold, it means that the storage space stores too much characteristic information and needs to be deleted to avoid affecting the accuracy of deduplication processing based on the storage space, and further avoid affecting the accuracy of determining the type of the data packet in the subsequent step 602. The embodiment of the present application does not limit the second threshold, and the second threshold can be 20. For example, if the storage space stores characteristic information corresponding to 20 data packets, it is considered that the amount of characteristic information included in the storage space is equal to the second threshold.
[0120] In the case where there is too much feature information stored in the storage space, the detection device deletes at least one feature information from the feature information included in the storage space based on the writing time corresponding to the feature information, starting from the feature information with the earliest corresponding writing time. For example, only the feature information with the earliest corresponding writing time is deleted. For another example, the feature information with the earliest corresponding writing time is deleted, and the feature information with the second earliest corresponding writing time is deleted. In the first method, the storage space is equivalent to a sliding window, sliding between different feature information.
[0121] For the second method, the characteristic information included in the storage space is periodically cleared, that is, the characteristic information included in the storage space is cleared once after each cycle. This clearing process can avoid affecting the accuracy of deduplication processing based on the storage space, and thus avoid affecting the accuracy of determining the type of the data packet in the subsequent step 602. The embodiment of the present application does not limit the duration of the above cycle, and the duration of the cycle can be 2 milliseconds.
[0122] It should be understood that the above update method is the update method used when deduplication is performed using the first characteristic information and the second characteristic information. For example, when MD5 is used for deduplication, the storage space can also be updated, and the update method used can refer to the above update method, which will not be repeated here.
[0123] In the above, the process of the detection device performing deduplication processing on multiple fourth data packets (hereinafter referred to as the first deduplication processing) to obtain the remaining fourth data packets is described. In some embodiments, the detection device directly uses the remaining fourth data packets as multiple first data packets. In other embodiments, considering that there may be omissions in the first deduplication processing, such as legacy caused by updating the storage space, the omission may cause duplicate fourth data packets to still exist in the remaining fourth data packets, and thus the detection device may perform a second deduplication processing on the remaining fourth data packets.
[0124] Based on this, the method provided in the embodiment of the present application also includes: parsing the value of TTL from the sixth data packet, the sixth data packet is any one of the remaining fourth data packets; if the value of TTL meets the second condition, the sixth data packet is deleted from the remaining fourth data packets to obtain multiple first data packets. Thus, the second deduplication process is completed. Among them, the second condition includes any one of the following: the value of TTL is less than or equal to the third threshold; the difference between the value of TTL and the initial value of TTL is greater than or equal to the fourth threshold, and the initial value of TTL includes: the value of TTL in the data packet exchanged during the handshake process between the sending device and the receiving device.
[0125] Among them, the value of TTL parsed from the sixth data packet can be the value of TTL in the IP header described above. If the outer layer of the IP header also includes at least one other header, the value of TTL parsed from the sixth data packet can also be the value of TTL in the outermost header of at least one other header. In addition, the initial value of TTL has been described in the description of the handshake mechanism above, and will not be repeated here. The third threshold value and the fourth threshold value are not limited in the embodiment of the present application. The third threshold value is, for example, 3, and the fourth threshold value is, for example, 100.
[0126] The detection device sequentially treats each of the remaining fourth data packets as the sixth data packet. For a sixth data packet, the detection device parses the sixth data packet to obtain the value of the TTL. Figure 1It can be seen from the corresponding description that TTL indicates the number of communication devices that the data packet is allowed to pass through, and the value of TTL decreases by one each time the data packet passes through a communication device. Then, no matter which of the second conditions the value of TTL in a sixth data packet satisfies, it can be explained that the sixth data packet passes through too many communication devices, and the reason for this phenomenon may be that a loop is generated in the real link. When a loop is generated, a data packet may pass through the same intermediate device multiple times, and the mirror point on the intermediate device will copy the data packet each time it passes. Among them, when the data packet is received and copied for the first time, since the copied data packet has not passed through too many communication devices, the value of TTL in the sixth data packet obtained by the first copy will not meet the second condition. As the data packet is continuously transmitted in the loop, the value of TTL of the data packet is continuously reduced, so when the data packet is received and copied later, the value of TTL in the sixth data packet obtained by the subsequent copy will meet the second condition, and the sixth data packet obtained by the subsequent copy is repeated with the sixth data packet obtained by the first copy. Based on this, it can be inferred that if the TTL value in a sixth data packet meets the second condition, it means that the sixth data packet is repeated with the fourth data packet before the sixth data packet (such as the sixth data packet obtained by the first copy above), and therefore the sixth data packet whose TTL value meets the second condition needs to be deleted. Of course, if the TTL value in a sixth data packet does not meet the second condition, there is no need to delete the sixth data packet whose TTL value does not meet the second condition. After traversing the remaining fourth data packets in this way, multiple first data packets can be obtained.
[0127] In an exemplary embodiment, the multiple first data packets obtained by the detection device from the intermediate device do not include special data packets. Exemplarily, the special data packets include at least one of the following: data packets that do not trigger a retransmission mechanism, and data packets whose corresponding transmission mechanism has a higher priority than the retransmission mechanism. For example, the special data packets include, but are not limited to, at least one of the following: a zero window confirmation data packet, a zero window detection data packet, a zero window detection response data packet, a keep-alive detection data packet (such as a TCP keep-alive detection data packet), a keep-alive detection response data packet (such as a TCP keep-alive detection response data packet) and a confirmation data packet, and the confirmation data packet has been described in the confirmation mechanism above.
[0128] In an embodiment of the present application, after acquiring multiple fourth data packets, the detection device may first identify and delete a special data packet from the multiple fourth data packets, and then perform the above-mentioned first deduplication processing and second deduplication processing to obtain multiple first data packets. Alternatively, after acquiring multiple fourth data packets, the detection device may first perform the above-mentioned first deduplication processing and second deduplication processing on the multiple fourth data packets, and then identify and delete the special data packet to obtain multiple first data packets. That is, the embodiment of the present application does not limit the timing of identifying and deleting the special data packet, as long as it is ensured that the multiple first data packets do not include the special data packet. In this way, special data packets can be prevented from interfering with subsequent steps 602 and 603.
[0129] Step 602, determine the type of each second data packet, the second data packet is one of multiple first data packets, the sequence number corresponding to the second data packet is less than a reference threshold, the reference threshold is the maximum value of the next sequence number corresponding to the first data packet before the second data packet, and the types include: retransmitted data packet or out-of-order data packet.
[0130] Among them, the sequence number corresponding to the second data packet is the sequence number in the second data packet. The next sequence number corresponding to the first data packet before the second data packet is calculated according to the sequence number in the first data packet. The calculation method has been described in the sequence number above and will not be repeated here. The second data packet is an abnormal data packet among multiple first data packets. When the second data packet exists, it means that there is an abnormal transmission situation. The reason is that there may be one or more first data packets before the second data packet, and each first data packet corresponds to the next sequence number, that is, there are one or more next sequence numbers in total, and the maximum value of one or more next sequence numbers is used as the reference threshold. If there is no abnormal transmission situation, the sequence number corresponding to the second data packet should be equal to the reference threshold. The reason has been described in the sequence number above and will not be repeated here. Then, when the sequence number corresponding to the second data packet is not equal to the reference threshold, for example, when the sequence number corresponding to the second data packet is less than the reference threshold, it means that there is an abnormal transmission situation, and thus the second data packet is an abnormal data packet.
[0131] For example, if the sequence number corresponding to a first data packet is 20 and the next sequence number is 30, and the sequence number corresponding to another first data packet is 40 and the next sequence number is 50, then the reference threshold is the maximum value of the next sequence number, 50. For a new first data packet after the two first data packets, if the sequence number corresponding to the new first data packet is less than 50, then the new first data packet is considered to belong to a second data packet.
[0132] Exemplarily, the reference thresholds corresponding to different second data packets may be different because the first data packets before different second data packets are different. For example, for data packet 1, data packet 2, data packet 3, and data packet 4, the first data packet before data packet 3 includes data packet 1 and data packet 2, and the reference threshold corresponding to data packet 3 is determined according to the next sequence number corresponding to data packet 1 and data packet 2, while the first data packet before data packet 4 includes data packet 1, data packet 2, and data packet 3, and the reference threshold corresponding to data packet 4 is determined according to the next sequence number corresponding to data packet 1, data packet 2, and data packet 3. It can be seen that the reference threshold corresponding to data packet 3 and the reference threshold corresponding to data packet 4 may be different.
[0133] Since the second data packets are abnormal data packets, it is necessary to determine the type of each second data packet. In the embodiment of the present application, the types include but are not limited to: retransmission data packets or disordered data packets, and these types are first described below.
[0134] Retransmitting data packets, according to the above description of the retransmission mechanism, when the sending device determines that the data packet sent by the local end is not received by the receiving device, it can resend the unreceived data packet to the receiving device through the intermediate device, that is, retransmit the data packet, and the retransmitted data packet is the retransmitted data packet. In an exemplary embodiment, the retransmitted data packet includes but is not limited to the following types 1 to 3.
[0135] Type 1, for the data packets retransmitted in the first situation, the first situation includes the loss of data packets on the first link between the sending device and the intermediate device. In other words, the first situation includes the loss of data packets on the first link before the intermediate device. Since there is a mirror point in the intermediate device, the loss of data packets on the first link before the intermediate device can also be considered as the loss of data packets on the first link before the mirror point included in the intermediate device. Among them, data packet loss does occur on the first link between the sending device and the intermediate device, so the receiving device cannot receive the data packet, and cannot return a confirmation data packet to the sending device. Therefore, the sending device correctly determines that the data packet sent by this end is not received by the receiving device, and retransmits the data packet. In this case, the retransmitted data packet is a type 1 data packet.
[0136] Type 2, false retransmitted data packets. In which, there may be no data packet loss on the first link between the sending device and the intermediate device and the second link between the intermediate device and the receiving device. The data packet sent by the sending device has been received by the receiving device, and the receiving device may have returned a confirmation data packet to the sending device, but due to various reasons (including but not limited to network delays in the communication system), the sending device fails to receive the confirmation data packet. The sending device mistakenly determines that the data packet sent by the local end has not been received by the receiving device, and thus retransmits the data packet. In this case, the retransmitted data packet is a type 2 data packet.
[0137] Type 3, for the data packets retransmitted in the second situation, the second situation includes the loss of data packets on the second link. In other words, the second situation includes the loss of data packets on the second link after the intermediate device, which can also be considered as the loss of data packets on the second link after the mirror point included in the intermediate device. Among them, data packet loss does occur on the second link between the intermediate device and the receiving device, so the receiving device cannot receive the data packet, and cannot return a confirmation data packet to the sending device. The sending device correctly determines that the data packet sent by the local end is not received by the receiving device, and retransmits the data packet. In this case, the retransmitted data packet is a type 3 data packet.
[0138] Exemplarily, the type 3 includes but is not limited to the following types 31 to 33.
[0139] Type 31, fast retransmitted data packets. In the retransmission mechanism, after receiving a data packet 1, the receiving device will return a confirmation data packet for data packet 1 to the sending device. If the receiving device does not receive a new data packet 2 after that (the reason may be that data packet 2 is lost on the second link, and data packet 2 may be the next data packet of data packet 1), then the receiving device will repeatedly return a confirmation data packet to the sending device, indicating that it expects to receive the next data packet of data packet 1, that is, data packet 2. If the sending device receives a repeatedly returned confirmation data packet, it can determine that data packet 2 has not been received by the receiving device based on the indication of the confirmation data packet, and thus retransmit data packet 2. In this case, the retransmitted data packet is a type 31 data packet.
[0140] Type 32, a timeout retransmitted data packet. In the retransmission mechanism, the sending device starts timing after sending a data packet. If a confirmation data packet for the data packet is received within a certain period of time, it is determined that the data packet sent by this end has been received by the receiving device. If a confirmation data packet for the data packet is not received within a certain period of time (i.e., timeout), it is determined that the data packet sent by this end has not been received by the receiving device (the reason may be that the data packet is lost on the second link), and the data packet is retransmitted. In this case, the retransmitted data packet is a type 32 data packet. Compared with the fast retransmitted data packet described in type 31, the sending device may need to spend a longer time to send a timeout retransmitted data packet, because the sending device needs to wait until after the timeout before sending the timeout retransmitted data packet.
[0141] Type 33, other retransmitted data packets. If a retransmitted data packet does not belong to type 1, type 2, type 31, or type 32, the retransmitted data packet is considered to be a type 33 data packet.
[0142] For out-of-order data packets, if there is no abnormal transmission, the sending device sends data packets to the receiving device in order. In the two adjacent data packets, the next sequence number corresponding to the previous data packet is equal to the sequence number in the next data packet. If there is an abnormal transmission, the sending device may send data packets to the receiving device in a disorderly order. In the two adjacent data packets, the next sequence number corresponding to the previous data packet may not be equal to the sequence number in the next data packet. The data packets sent out of order are out-of-order data packets. For example, the sending device sends data packet 1, data packet 2 and data packet 3 in sequence, which is an ordered transmission. The sending device sends data packet 1, data packet 3 and data packet 2 in sequence, which is an out-of-order transmission. Data packet 2 can be considered an out-of-order data packet.
[0143] Based on the various types described above, the process of determining the type of each second data packet in the embodiment of the present application may include determining the type of the second data packet based on the relationship between the reference interval and the sequence number missing interval corresponding to the second data packet.
[0144] The reference interval consists of the sequence number corresponding to the second data packet to the next sequence number. Figure 7 , the second data packet is data packet 3, the sequence number corresponding to the second data packet is 30, and the next sequence number is 40, then the reference interval is [30, 40]. The missing sequence number interval corresponding to the second data packet is determined based on the sequence number to the next sequence number corresponding to the first data packet before the second data packet. For example, the missing sequence number interval corresponding to the second data packet includes: the missing sequence numbers between the first data packet before the second data packet. See more Figure 7, the second data packet includes two first data packets before it, that is, the detection device obtains data packet 1 and data packet 2 before the second data packet. The sequence number corresponding to data packet 1 is 20, and the next sequence number is 30, which is expressed as [20, 30]. The sequence number corresponding to data packet 2 is 40, and the next sequence number is 50, which is expressed as [40, 50]. Since [30, 40] is missing between [20, 30] and [40, 50]. Therefore, the detection device determines that the sequence number missing interval corresponding to data packet 3 is [30, 40]. Of course, a second data packet can correspond to one or more sequence number missing intervals, and the embodiment of the present application does not limit the number of sequence number missing intervals.
[0145] Exemplarily, the sequence number missing intervals corresponding to different second data packets may be different because the first data packets before different second data packets are different. For example, for data packet 1, data packet 2, data packet 3, and data packet 4, the first data packet before data packet 3 includes data packet 1 and data packet 2, and the sequence number missing interval corresponding to data packet 3 includes: the sequence number missing between data packet 1 and data packet 2, and the first data packet before data packet 4 includes data packet 1, data packet 2, and data packet 3, and the sequence number missing interval corresponding to data packet 4 includes: the sequence number missing between data packet 1, data packet 2, and data packet 3. It can be seen that the sequence number missing interval corresponding to data packet 3 and the sequence number missing interval corresponding to data packet 4 may be different.
[0146] In addition, when the detection device is connected to multiple different intermediate devices, the detection device will generate a sequence number missing interval for each different intermediate device, and different intermediate devices may correspond to different sequence number missing intervals. In other words, the sequence number missing interval corresponding to the second data packet on each intermediate device may be different.
[0147] For example, the intermediate devices include intermediate device 1 and intermediate device 2, and the sending device sends in sequence: data packet 1 with an interval of [10, 20], data packet 2 with an interval of [20, 30], data packet 3 with an interval of [30, 40], and data packet 4 with an interval of [40, 50]. Assuming that data packet 2 is lost before reaching intermediate device 1, intermediate device 1 only receives data packet 1, data packet 3, and data packet 4. Based on this, the detection device determines that the sequence number missing interval is [20, 30]. When the second data packet subsequently reaches intermediate device 1, the sequence number missing interval corresponding to the second data packet is [20, 30]. Intermediate device 1 forwards data packet 1, data packet 3, and data packet 4. Assuming that data packet 3 is lost before reaching intermediate device 2, intermediate device 2 only receives data packet 1 and data packet 4. Then, based on this, the detection device determines that the sequence number missing interval is [20, 40]. When the second data packet subsequently reaches intermediate device 2, the sequence number missing interval corresponding to the second data packet is [20, 40].
[0148] Exemplarily, the process of determining the type of the second data packet according to the relationship between the reference interval and the sequence number missing interval corresponding to the second data packet includes but is not limited to the following cases 1 to 4. Among them, the following involves the acquisition time of different data packets, and the acquisition time of these data packets can refer to the above description of the acquisition time of the fourth data packet, and will not be repeated.
[0149] Case 1: If the reference interval is within the sequence number missing interval corresponding to the second data packet, and the difference between the acquisition time of the second data packet and the second time is greater than or equal to the fifth threshold, the type of the second data packet is determined to be a data packet retransmitted for the first case, that is, type 1 described above. The first case includes the loss of a data packet on the first link between the sending device and the intermediate device.
[0150] If the reference interval is within the sequence number missing interval corresponding to the second data packet, it means that the second data packet is a type 1 retransmission data packet or an out-of-order data packet, and not a type 2 or type 3 retransmission data packet, for the following reasons.
[0151] Assuming that the second data packet is a retransmission data packet of type 1, it means that before the second data packet, the first data packet will be lost on the first link between the sending device and the intermediate device, and the intermediate device cannot receive the lost first data packet, so the detection device connected to the intermediate device will sense the loss of the first data packet and determine the sequence number missing interval according to the above example. The sending device can also sense the loss of the first data packet, so it will retransmit the second data packet, and the reference interval of the second data packet will be located in the sequence number missing interval, because the sequence number missing interval includes the interval of the lost first data packet (composed of the sequence number corresponding to the lost first data packet and the next sequence number), and the second data packet is a retransmission of the lost first data packet. It can be seen that if the reference interval is located in the sequence number missing interval corresponding to the second data packet, it means that the second data packet may belong to a retransmission data packet of type 1.
[0152] Alternatively, assuming that the second data packet is an out-of-order data packet, it means that the data packet that should have been transmitted after the second data packet is actually transmitted before the second data packet, and such a data packet will also cause the sequence number missing interval to be generated, and the sequence number missing interval will include the reference interval of the second data packet. It can be seen that if the reference interval is within the sequence number missing interval corresponding to the second data packet, it means that the second data packet may also be an out-of-order data packet.
[0153] Or, assuming that the second data packet is a retransmission data packet of type 2, since it is a false retransmission, the second data packet is not a retransmission of the lost data packet, but a retransmission of the first data packet that is not actually lost. This makes the reference interval of the second data packet the same as the interval corresponding to the first data packet that is not actually lost (composed of the sequence number corresponding to the first data packet that is not lost and the next sequence number), and will not be located in the sequence number missing interval. It can be seen that if the reference interval is located in the sequence number missing interval corresponding to the second data packet, it means that the second data packet does not belong to the retransmission data packet of type 2.
[0154] Alternatively, assuming that the second data packet is a type 3 retransmission data packet, it means that before the second data packet, the first data packet will be lost on the second link between the intermediate device and the receiving device. As mentioned above, the second link is the link after the intermediate device, so the first data packet is lost after the intermediate device. The intermediate device can still receive the lost first data packet, and the detection device connected to the intermediate device will not perceive the loss of the first data packet, and naturally will not generate a missing sequence number interval for the intermediate device. However, the sending device can perceive the loss of the first data packet, and will retransmit the second data packet for the lost first data packet. However, when the second data packet arrives at the intermediate device, since the detection device did not generate a missing sequence number interval for the intermediate device before, the reference interval of the second data packet will not be located in the missing sequence number interval. It can be seen that if the reference interval is located in the missing sequence number interval corresponding to the second data packet, it means that the second data packet does not belong to a type 3 retransmission data packet.
[0155] In addition, if the difference between the acquisition time of the second data packet and the second time is greater than or equal to the fifth threshold, it means that the second data packet is a retransmitted data packet, not an out-of-order data packet, for the following reasons.
[0156] In an embodiment of the present application, the second moment includes any one of the following: the second moment is the moment of obtaining the last confirmation data packet, and the confirmation data packet is sent by the receiving device to the sending device through the intermediate device; the second moment is the moment of obtaining the last seventh data packet, and the type of the seventh data packet is an out-of-order data packet, or the type of the seventh data packet is in doubt. When the type of the seventh data packet is in doubt, it can be considered that the type of the seventh data packet cannot be accurately determined. The embodiment of the present application does not limit the fifth threshold value. For example, the fifth threshold value can be the smaller of 3 milliseconds and the network delay corresponding to the communication system.
[0157] See also Figure 7, if data packet 3 is the second data packet sent by the sending device to the receiving device, then the acquisition time of the last confirmation data packet refers to: the acquisition time of the most recent confirmation data packet sent by the receiving device to the sending device before the sending device sends the second data packet. For example, the confirmation data packet sent by the receiving device to the sending device for data packet 2 ( Figure 7 The acquisition time of (not shown in).
[0158] Continue to see Figure 7 , if data packet 3 is the second data packet sent by the sending device to the receiving device, then the acquisition time of the last seventh data packet refers to: the acquisition time of the most recent seventh data packet sent by the receiving device to the sending device before the sending device sends the second data packet. Among them, the detection device can record the acquisition time of the seventh data packet after determining the seventh data packet (the determination method can refer to the description in the following situation 4), so that when determining the type of the second data packet, the recorded acquisition time of the seventh data packet is queried to obtain the acquisition time of the most recent seventh data packet.
[0159] If the difference between the acquisition time of the second data packet and the second moment is greater than or equal to the fifth threshold, it means that the difference between the acquisition time of the second data packet and the second moment is large enough, and such a difference may be caused by triggering the retransmission mechanism of the sending device. If the sending device sends an out-of-order data packet and does not trigger the retransmission mechanism, it may only take a short time and will not cause such a difference. It can be seen that if the difference between the acquisition time of the second data packet and the second moment is greater than or equal to the fifth threshold, it means that the second data packet is a retransmission data packet, not an out-of-order data packet.
[0160] According to the above description, when the reference interval is within the sequence number missing interval corresponding to the second data packet, the second data packet belongs to a retransmitted data packet or an out-of-order data packet of type 1, and when the difference between the acquisition time of the second data packet and the second time is greater than or equal to the fifth threshold, the second data packet belongs to a retransmitted data packet and does not belong to an out-of-order data packet. Therefore, it can be comprehensively determined that the type of the second data packet is a retransmitted data packet of type 1, that is, a data packet retransmitted for the first situation.
[0161] like Figure 7 As shown, the reference interval of data packet 3 is [30, 40], the sequence number 30 corresponding to data packet 3 is less than the reference threshold 50 corresponding to data packet 3, and thus data packet 3 belongs to the second data packet, and the reference interval [30, 40] of data packet 3 is within the sequence number missing interval [30, 40] corresponding to data packet 3. If the difference between the acquisition time of data packet 3 and the second time is greater than or equal to the fifth threshold, it is determined that the type of data packet 3 is a data packet retransmitted for the first situation.
[0162] Case 2: If the reference interval is outside the sequence number missing interval corresponding to the second data packet, and the next sequence number corresponding to the second data packet is less than the maximum value of the confirmation number sent by the receiving device, the type of the second data packet is determined to be a false retransmitted data packet, that is, type 2 described above.
[0163] If the reference interval is outside the sequence number missing interval corresponding to the second data packet, it means that the second data packet is a type 2 or type 3 retransmission data packet. The reason is described in the above situation 1 and will not be repeated here.
[0164] If the next sequence number corresponding to the second data packet is smaller than the maximum value of the confirmation number sent by the receiving device, it means that the second data packet is a false retransmission type data packet, and the reason is as follows.
[0165] according to Figure 1 From the corresponding description, it can be seen that the confirmation number indicates the sequence number of the next data packet expected to be received, and the confirmation number is equal to the sequence number corresponding to the last byte received. In other words, if the value of the sequence number corresponding to a byte is less than the value of the confirmation number, then it can be considered that the byte is the byte that the receiving device has received. Therefore, if the next sequence number corresponding to the second data packet is less than the maximum value of the confirmation number sent by the receiving device, it means that the values of the sequence numbers corresponding to the bytes carried in the second data packet are all less than the value of the confirmation number sent by the receiving device, thereby indicating that the bytes carried in the second data packet are the bytes that the receiving device has received. Then, the second data packet is a retransmitted data packet for the data packet that has been received by the receiving device. Combined with the type 2 described above, it can be seen that in this case, the type of the second data packet is a type 2 retransmitted data packet, that is, a false retransmitted data packet.
[0166] Case 3: If the reference interval is outside the sequence number missing interval corresponding to the second data packet, and the next sequence number corresponding to the second data packet is greater than or equal to the maximum value of the confirmation number sent by the receiving device, the type of the second data packet is determined to be a data packet retransmitted for the second case, that is, type 3 described above, and the second case includes the loss of a data packet on the second link between the intermediate device and the receiving device.
[0167] If the reference interval is outside the missing interval of the sequence number corresponding to the second data packet, it means that the second data packet is a retransmitted data packet of type 2 or type 3, and the reason is described in the above case 1. If the next sequence number corresponding to the second data packet is less than the maximum value of the confirmation number sent by the receiving device, it means that the second data packet is a retransmitted data packet of type 2, and the reason is described in the above case 2. Therefore, if the next sequence number corresponding to the second data packet is greater than or equal to the maximum value of the confirmation number sent by the receiving device, it means that the second data packet is a retransmitted data packet of type 3.
[0168] As mentioned above, type 3 includes types 31 to 33, so when the detection device determines that the type of the second data packet is type 3, it can further determine whether the type of the second data packet belongs to type 31, type 32 or type 33. Therefore, the process of determining that the type of the second data packet is a data packet retransmitted for the second situation can include the following situations 31 to 33.
[0169] Case 31, if the number of confirmation data packets obtained from the intermediate device is greater than or equal to the sixth threshold, it is determined that the type of the second data packet is a fast retransmitted data packet, and the confirmation data packet is sent by the receiving device to the sending device through the intermediate device.
[0170] Among them, the confirmation data packets whose number is greater than or equal to the sixth threshold are confirmation data packets used to indicate the second data packet, that is, the confirmation numbers in the confirmation data packets whose number is greater than or equal to the sixth threshold are the sequence numbers in the second data packet. These confirmation data packets are confirmation data packets that the receiving device repeatedly returns to the sending device, which means that the receiving device has not received the second data packet after receiving the first data packet before the second data packet, and therefore the receiving device expects to receive the second data packet. According to the above description of the fast retransmitted data packets, the sending device will quickly retransmit the second data packet indicated by these confirmation data packets after receiving the repeatedly returned confirmation data packets. Therefore, if the number of confirmation data packets obtained by the detection device from the middle is greater than or equal to the sixth threshold, the detection device can determine that a fast retransmission will occur, and determine that the type of the second data packet indicated by these confirmation data packets is the type of fast retransmission.
[0171] The embodiment of the present application does not limit the sixth threshold, and the sixth threshold is, for example, 3. That is, if the number of confirmation data packets (all used to indicate the second data packet) obtained by the detection device from the intermediate device is greater than or equal to 3, the type of the second data packet is determined to be a fast retransmitted data packet.
[0172] Case 32: if the difference between the acquisition time of the second data packet and the acquisition time of the last confirmation data packet is greater than or equal to the retransmission time out (RTO), it is determined that the type of the second data packet is a timeout retransmission data packet.
[0173] Since the difference between the acquisition time of the second data packet and the acquisition time of the last confirmation data packet is greater than RTO, it means that the difference between the acquisition time of the second data packet and the acquisition time of the last confirmation data packet is large enough, which means that the sending device took a long time to complete the sending of the second data packet. According to the above description of timeout retransmission, the time required for timeout retransmission may be long, so it can be determined that the type of the second data packet is a timeout retransmission data packet.
[0174] Of course, the above RTO is only an example, and the embodiment of the present application can also set a threshold value based on experience or actual needs, and use the set threshold value instead of RTO. Accordingly, if the difference between the acquisition time of the second data packet and the acquisition time of the previous confirmation data packet is greater than or equal to the set threshold value, the type of the second data packet is determined to be a timeout retransmission data packet.
[0175] In case 33, if the type of the second data packet is not a fast retransmitted data packet, and the type of the second data packet is not a timeout retransmitted data packet, it is determined that the type of the second data packet is other retransmitted data packets.
[0176] Exemplarily, the types included in the retransmitted data packets are mutually exclusive. In other words, the type of a second data packet belongs to one of type 1, type 2, type 31, type 32 and type 33, but not type 1 and type 2, etc. This is because different types of retransmitted data packets in the retransmission mechanism have a certain priority overlay relationship. Based on this, the embodiment of the present application can sequentially determine the type of a second data packet.
[0177] In the process of determining the sequence, the detection device first determines whether the second data packet satisfies condition 1. If so, the type of the second data packet is determined to be type 1. If it does not meet condition 1, for example, the reference interval of the second data packet is outside the sequence number missing interval corresponding to the second data packet, the type of the second data packet is determined to be type 2, type 31, type 32, or type 33. For example, Figure 7 As shown, after determining the type of data packet 3 (according to the above example, data packet 3 belongs to the second data packet), the sequence number missing interval [30, 40] corresponding to data packet 3 is updated according to the reference interval [30, 40] of data packet 3, and the sequence number missing interval corresponding to data packet 4 is obtained to be empty. The update process of the sequence number missing interval will be described in detail below and will not be repeated here. The reference interval of data packet 4 is [40, 50], and the sequence number 40 corresponding to data packet 4 is less than the reference threshold 50 corresponding to data packet 4, so data packet 4 also belongs to the second data packet, and the reference interval [40, 50] of data packet 4 is outside the sequence number missing interval corresponding to data packet 4, which does not meet situation 1, so the type of data packet 4 is determined to be type 2, type 31, type 32 or type 33.
[0178] If the second data packet does not meet condition 1, the detection device continues to determine whether the second data packet meets condition 2. If it meets condition 2, the type of the second data packet is determined to be type 2; if it does not meet condition 2, it may continue to determine whether the second data packet meets condition 31. If it meets condition 31, the type of the second data packet is determined to be type 31; if it does not meet condition 31, it may continue to determine whether the second data packet meets condition 32. If it meets condition 32, the type of the second data packet is determined to be type 32; if it does not meet condition 32, it may determine that the type of the second data packet is type 33.
[0179] In case 4, if the reference interval is within the sequence number missing interval corresponding to the second data packet, the difference between the acquisition time of the second data packet and the second time is less than the fifth threshold, and the confirmation data packet obtained from the intermediate device is repeated, then the type of the second data packet is determined to be an out-of-order data packet. The second time and the fifth threshold can be referred to in the description of case 1 above, and will not be repeated here.
[0180] If the reference interval is within the sequence number missing interval corresponding to the second data packet, it means that the second data packet may be a retransmission data packet or an out-of-order data packet of type 1. The reason is detailed in the description of situation 1. If the difference between the acquisition time of the second data packet and the second moment is less than the fifth threshold, it means that the difference between the acquisition time of the second data packet and the second moment is small. Such a difference may be caused by the sending device sending an out-of-order data packet, because sending an out-of-order data packet only takes a short time. If the retransmission mechanism of the sending device is triggered, it may take longer time and will not cause such a difference. It can be seen that if the difference between the acquisition time of the second data packet and the second moment is less than the fifth threshold, it means that the second data packet may be an out-of-order data packet, and not a retransmission data packet.
[0181] Therefore, if the reference interval is within the sequence number missing interval corresponding to the second data packet (the first condition), and the difference between the acquisition time of the second data packet and the second time is less than the fifth threshold (the second condition), it can be comprehensively determined that the type of the second data packet may be an out-of-order data packet. On the basis of satisfying the first and second conditions, if the confirmation data packet obtained from the intermediate device is repeated (the third condition), it is determined that the type of the second data packet is an out-of-order data packet.
[0182] Among them, the existence of duplicate confirmation data packets obtained from the intermediate device means that at least two confirmation data packets carrying the same confirmation number are obtained from the intermediate device. When there are duplicate confirmation data packets obtained from the intermediate device, it means that the receiving device has returned duplicate confirmation data packets to the sending device through the intermediate device, which means that the second data packet has affected the data packet transmission process on the real link between the sending device and the receiving device, because if the data packet transmission process is not affected, the receiving device may not return duplicate confirmation data packets. Therefore, by adding the third condition, the present application realizes that when the second data packet affects the data packet transmission process, the type of the second data packet is determined as an out-of-order data packet.
[0183] like Figure 7 As shown, the second data packet is data packet 3, and the reference interval of data packet 3 is [30, 40], which is located in the sequence number missing interval [30, 40] corresponding to data packet 3. If the difference between the acquisition time of data packet 3 and the second time is less than the fifth threshold, and the confirmation data packet obtained from the intermediate device is repeated, it is determined that the type of data packet 3 is an out-of-order data packet.
[0184] Of course, if only the first and second conditions are met but the third condition is not met, that is, there is no duplication of the confirmation data packets obtained from the intermediate device, then it means that the second data packet will not affect the data packet transmission process on the real link between the sending device and the receiving device. Therefore, it can be considered that the second data packet is questionable, or the type of the second data packet cannot be accurately determined, and the type of the data packet is not determined as an out-of-order data packet.
[0185] In the above, the process of determining the type of the second data packet is illustrated by using cases 1 to 4. In an embodiment of the present application, in addition to determining the type of the second data packet according to cases 1 to 4, the type of the second data packet may also be determined based on other information. Exemplarily, the other information includes, but is not limited to: information carried by options and padding fields in a TCP header, which is used to indicate the type of the data packet. For the second data packet, the detection device may parse the second data packet, obtain options and padding fields in the TCP header of the second data packet, and determine the type of the data packet based on the information carried by the fields.
[0186] In some embodiments, when all the communication devices included in the communication system support options and padding fields, when determining the type of the second data packet, it can be based on the relationship between the reference interval and the sequence number missing interval corresponding to the second data packet (i.e., the above-mentioned cases 1 to 4), or based on the options and padding fields, and these two determination methods can also be used in combination. In other embodiments, when only some of the communication devices included in the communication system support options and padding fields, when determining the type of the second data packet, it can be based only on the relationship between the reference interval and the sequence number missing interval corresponding to the second data packet (i.e., the above-mentioned cases 1 to 4), and not on the options and padding fields, so as to avoid compatibility problems and ensure consistency and stability of different communication devices. Among them, the communication devices included in the communication system may refer to the sending device, intermediate device, receiving device and detection device in the above description.
[0187] Since the process of determining the type of the second data packet described above involves updating the missing interval of the sequence number corresponding to the second data packet, the updating process is described in detail below. Exemplarily, the method provided in the embodiment of the present application also includes: if the sequence number corresponding to the second data packet and the next sequence number are in the missing interval of the sequence number corresponding to the second data packet, updating the missing interval of the sequence number corresponding to the second data packet to obtain the update interval corresponding to the second data packet.
[0188] As described above, the missing sequence number interval corresponding to the second data packet includes the missing sequence numbers between the first data packets before the second data packet. If the sequence number corresponding to the second data packet and the next sequence number are in the missing sequence number interval corresponding to the second data packet, it means that at least a part of the missing sequence numbers included in the missing sequence number interval corresponding to the second data packet has been filled by the sequence number corresponding to the second data packet to the next sequence number and is no longer missing. In other words, due to the existence of the second data packet, the missing sequence number situation is updated. Therefore, it is necessary to update the missing sequence number interval corresponding to the second data packet to obtain the updated interval corresponding to the second data packet, which indicates the missing sequence number after obtaining the second data packet, that is, the missing sequence number of the latest current data packet. An update interval corresponding to a second data packet can be used to determine the type of other second data packets after the second data packet. For example, see the above based on Figure 7 For example, after determining the type of data packet 3, the sequence number missing interval corresponding to data packet 3 is updated to obtain an update interval, and then the type of data packet 4 is determined based on the update interval.
[0189] Exemplarily, the embodiment of the present application updates the sequence number missing interval corresponding to the second data packet and obtains the process of updating the interval, including but not limited to the following two cases A and B.
[0190] Case A, if the sequence number corresponding to the second data packet is the same as the lower limit of the sequence number missing interval corresponding to the second data packet, and the next sequence number in the second data packet is the same as the upper limit of the sequence number missing interval corresponding to the second data packet, the update interval corresponding to the second data packet is empty.
[0191] In this case, it means that all missing sequence numbers in the missing sequence number interval corresponding to the second data packet have been filled by the second data packet and are no longer missing, so the update interval corresponding to the second data packet is empty. Figure 7 The second data packet includes data packet 3, and the missing sequence number interval corresponding to data packet 3 is [30, 40], with a lower limit of 30 and an upper limit of 40. The sequence number corresponding to data packet 3 is 30, which is the same as the lower limit 30, and the next sequence number corresponding to data packet 4 is 40, which is the same as the upper limit 40, so the update interval corresponding to the second data packet is empty.
[0192] Case B: If the first condition is met, the sequence number corresponding to the second data packet is deleted to the next sequence number from the sequence number missing interval corresponding to the second data packet to obtain the update interval corresponding to the second data packet. The first condition includes at least one of the following: the sequence number corresponding to the second data packet is different from the lower limit of the sequence number missing interval corresponding to the second data packet; the next sequence number corresponding to the second data packet is different from the upper limit of the sequence number missing interval corresponding to the second data packet.
[0193] In this case, it means that the partially missing sequence numbers in the sequence number missing interval corresponding to the second data packet have been filled by the second data packet and are no longer missing, so these no longer missing sequence numbers can be deleted from the sequence number missing interval corresponding to the second data packet, that is, the sequence number corresponding to the second data packet to the next sequence number are deleted, so as to obtain the update interval corresponding to the second data packet. The update interval corresponding to the second data packet is not empty. Based on the first condition in the case B, the case B may include the following cases B1 to B3.
[0194] In case B1, the sequence number corresponding to the second data packet is different from the lower limit of the sequence number missing interval corresponding to the second data packet, and the next sequence number corresponding to the second data packet is the same as the upper limit of the sequence number missing interval corresponding to the second data packet. For example, the sequence number missing interval corresponding to the second data packet is [30, 40], with a lower limit of 30 and an upper limit of 40. The sequence number corresponding to the second data packet is 33, which is different from the lower limit 30, and the next sequence number corresponding to the second data packet is 40, which is the same as the upper limit 40. Therefore, [33, 40] is deleted from [30, 40], and the update interval corresponding to the second data packet is obtained as [30, 33].
[0195] In case B2, the sequence number corresponding to the second data packet is the same as the lower limit of the sequence number missing interval corresponding to the second data packet, and the next sequence number corresponding to the second data packet is different from the upper limit of the sequence number missing interval corresponding to the second data packet. For example, the sequence number missing interval corresponding to the second data packet is [30, 40], with a lower limit of 30 and an upper limit of 40. The sequence number corresponding to the second data packet is 30, which is the same as the lower limit 30, and the next sequence number corresponding to the second data packet is 37, which is different from the upper limit 40. Therefore, [30, 37] is deleted from [30, 40], and the update interval corresponding to the second data packet is obtained as [37, 40].
[0196] In case B3, the sequence number corresponding to the second data packet is different from the lower limit of the sequence number missing interval corresponding to the second data packet, and the next sequence number corresponding to the second data packet is different from the upper limit of the sequence number missing interval corresponding to the second data packet. For example, the sequence number missing interval corresponding to the second data packet is [30, 40], with a lower limit of 30 and an upper limit of 40. The sequence number corresponding to the second data packet is 33, which is different from the lower limit 30, and the next sequence number corresponding to the second data packet is 37, which is different from the upper limit 40. Therefore, [33, 37] is deleted from [30, 40], and the update intervals corresponding to the second data packet are obtained as [30, 33] and [37, 40].
[0197] Exemplarily, after each detection device determines the type of a second data packet, it will update the missing sequence number interval corresponding to the second data packet, until the type of the last second data packet in each second data packet is determined, and the missing sequence number interval corresponding to the last data packet is also updated to obtain the update interval corresponding to the last second data packet. Then, the method provided in the embodiment of the present application may also include: determining the packet loss situation on the detection device and the third link according to the update interval corresponding to the last second data packet, the detection device is connected to the intermediate device via the third link, and the third link is the mirror link between the intermediate device and the detection device.
[0198] Among them, if no data packets are lost on the detection device and the third link, then the loss of data packets will only occur on the real link. When data packets are lost on the real link, the sending device can sense it and retransmit the lost data packets, so that the missing intervals of the sequence numbers are completely filled by the retransmitted data packets, so that the update interval corresponding to the last second data packet is empty, that is, there is no missing sequence number, so reliable transmission is achieved. Based on this, it can be inferred that when the update interval corresponding to the last second data packet is empty, there is no lost data packet on the detection device and the third link.
[0199] However, if at least one of the detection device and the third link loses a data packet, the loss of such a data packet will not be sensed by the sending device, and the retransmission mechanism of the sending device will not be triggered, which may cause the sequence number missing interval to be incompletely filled, so that the update interval corresponding to the last second data packet is not empty, that is, there are still missing sequence retransmission data packets. Based on this, it can be inferred that when the update interval corresponding to the last second data packet is not empty, there may be lost data packets on the detection device and the third link.
[0200] Therefore, according to the update interval corresponding to the last second data packet, the data packet loss situation on the detection device and the third link is determined, including: if the update interval corresponding to the last second data packet is empty, it is determined that there are no lost data packets on the detection device and the third link; if the update interval corresponding to the last second data packet is not empty, it is determined that there are lost data packets on the detection device and the third link. Among them, the lost data packets on the detection device and the third link may be lost data packets only at the detection device (such as at the network card of the detection device), or lost data packets only on the third link, or lost data packets at both the detection device and the third link, which is not limited in the embodiments of the present application.
[0201] In the case where there are lost data packets on the detection device and the third link, the embodiment of the present application can continue to determine the number of lost data packets. Therefore, the method also includes: if there are lost data packets on the detection device and the third link, determining the number of lost data packets on the detection device and the third link according to the first value and the second value.
[0202] The first value is the difference between the upper limit and the lower limit of the update interval corresponding to the last second data packet. In addition, the second value is the value of the MSS, or the second value is the length of the payload field in the third data packet (i.e. Figure 1The length of the payload field in the corresponding description), the difference between the acquisition time of the third data packet and the first time is less than the first threshold, and the first time is the time when the update interval corresponding to the last second data packet is obtained. For example, after the detection device obtains the update interval corresponding to the last second data packet at the first time, the second data packet whose difference between the acquisition time and the first time is less than the first threshold is taken as the third data packet, and the length of the payload field in the third data packet is taken as the second value. The third data packet is, for example: the previous second data packet of the last second data packet, and among all the second data packets, the difference between the acquisition time and the first time of the previous second data packet is the smallest. The length of the payload field in such a third data packet is often closer to the length of the payload field in the lost data packet, so that the second value has a higher accuracy, thereby making it more accurate to determine the number of lost data packets on the detection device and the third link.
[0203] Exemplarily, determining the number of data packets lost on the detection device and the third link according to the first numerical value and the second numerical value includes: determining the ratio between the first numerical value and the second numerical value, rounding up the comparison value, and obtaining the number of data packets lost on the detection device and the third link. Of course, this determination method is only an example, and the embodiment of the present application does not limit the determination method. For example, after the comparison value is rounded up, an upward rounded value is obtained, and the upward rounded value is adjusted using an adjustment coefficient to obtain the number of data packets lost on the detection device and the third link. The adjustment coefficient can be set according to experience or actual needs, and the adjustment coefficient is used to improve the accuracy of the number of data packets lost on the detection device and the third link.
[0204] In an exemplary embodiment, the method also includes: determining a reliability index of the detection device and the third link based on a packet loss situation on the detection device and the third link, wherein the reliability index is used to indicate the reliability of the detection device and the third link, and managing the detection device and the third link based on the reliability index.
[0205] The reliability index is used to quantitatively represent the reliability of the detection device and the third link. The embodiment of the present application does not limit the form of the reliability index. For example, the reliability index can be in a numerical form or in a percentage form. If there are no lost packets on the detection device and the third link, the reliability index indicates that the detection device and the third link have a higher reliability. If there are lost packets on the detection device and the third link, the reliability index indicates that the detection device and the third link have a lower reliability. In addition, the more packets are lost on the detection device and the third link, the lower the reliability indicated by the reliability index.
[0206] When the reliability index indicates that the detection device and the third link have lower reliability, the detection device and the third link can be maintained to complete the management. The embodiment of the present application does not limit the maintenance process. For example, the detection device can be replaced, the third link can be rebuilt or the bandwidth of the third link can be increased to reduce the number of data packets lost on the detection device and the third link. Exemplarily, a backup strategy can also be implemented, such as setting a backup detection device, establishing a backup third link, enabling the backup detection device if the detection device fails, and starting the backup third link if the third link fails, thereby reducing the number of data packets lost on the detection device and the third link.
[0207] In an exemplary embodiment, the sequence number missing intervals involved in the above description are stored in a storage space. After determining the data packet loss situation on the detection device and the third link according to the update interval corresponding to the last second data packet, the embodiment of the present application can clear all sequence number missing intervals in the storage space. Exemplarily, the storage space can be used as a sliding window to slide between different sequence number missing intervals so that the sequence number missing intervals stored in the storage space are updated and the number of sequence number missing intervals stored in the storage space is prevented from exceeding a certain threshold, such as 20, which is not limited here.
[0208] In the above description, multiple thresholds are involved, such as the first threshold to the seventh threshold. The embodiment of the present application does not limit the values of these thresholds. For example, it can be set based on experience and the networking architecture of the communication system, and it can be set based on experience and the business scenario of the communication device. The threshold set in this way can be static, or fixed. For another example, a dynamic threshold can be adaptively set based on the dynamic baseline method, then the threshold is not fixed, but can be dynamically adjusted according to the operation of the communication system. In the method based on the dynamic baseline, network indicator data such as traffic, delay, etc. in the communication device corresponding to different thresholds are obtained, and the network indicator data can reflect the operation of the communication system. After that, modeling is performed according to the threshold and the network indicator data corresponding to the threshold to obtain a reference model, which has the ability to output a threshold according to the input network indicator data. After the modeling is completed, the network indicator data can be obtained, the network indicator data can be input into the reference model, the threshold output by the reference model is obtained, and the threshold output by the reference model is used as the above thresholds. Thus, a dynamic threshold can be obtained according to different network indicator data, and the adaptive setting of the threshold is realized, so that the threshold can be better adapted to the operation of the communication system. Exemplarily, the reference model may be a time series model or a regression model. The time series model is used to analyze the behavior of data (e.g., thresholds and network indicator data) changing over time, and the regression model is used to analyze the relationship between different variables (e.g., thresholds and network indicator data). In addition, mathematical modeling or machine learning techniques may be used to complete the above modeling.
[0209] Step 603: Determine the quantity of at least one type of second data packets according to the types of the second data packets.
[0210] Since the types of the second data packets are determined in step 602, the number of the second data packets of at least one type can be determined according to the types of the second data packets. The at least one type can be each type, or one or more types can be selected from each type according to actual needs. The embodiment of the present application does not limit the at least one type.
[0211] For example, there are 10 second data packets in total, and the types of the 1st to 8th second data packets are determined to be retransmission data packets, and the types of the 9th to 10th second data packets are determined to be out-of-order data packets, then it can be determined that the number of second data packets of the type of retransmission data packets is 8, and the number of second data packets of the type of out-of-order data packets is 2. Of course, among the 1st to 8th second data packets, it can also be determined that the 1st to 5th second data packets are retransmission data packets of the above-mentioned type 1, and the 6th to 8th second data packets are retransmission data packets of the above-mentioned type 2, thereby determining that the number of retransmission data packets of type 1 is 5, and the number of retransmission data packets of type 2 is 3.
[0212] Exemplarily, the retransmitted data packets include data packets retransmitted for a first situation, i.e., retransmitted data packets of type 1 mentioned above. After determining the number of at least one type of second data packets, the detection device uses the number of second data packets of the type retransmitted for the first situation as the number of data packets lost on the first link. Wherein, the first situation includes data packets lost on the first link. Based on the retransmission mechanism of the sending device, the sending device may retransmit a second data packet for the first situation each time the first situation occurs, resulting in data packets lost on the first link, so that the number of second data packets retransmitted for the first situation is similar to or the same as the number of data packets lost on the first link. Therefore, the detection device may use the number of second data packets of the type retransmitted for the first situation as the number of data packets lost on the first link.
[0213] Exemplarily, the retransmitted data packets include data packets retransmitted for the second situation, i.e., the retransmitted data packets of type 3 mentioned above. After determining the number of at least one type of second data packets, the detection device uses the number of second data packets of the type retransmitted for the second situation as the number of data packets lost on the second link. The second situation includes data packets lost on the second link. Based on the retransmission mechanism of the sending device, the sending device can retransmit a second data packet for the second situation each time the second situation occurs, resulting in data packets lost on the second link, so that the number of second data packets retransmitted for the second situation is similar or the same as the number of data packets lost on the second link. Therefore, the detection device can use the number of second data packets of the type retransmitted for the second situation as the number of data packets lost on the second link.
[0214] Exemplarily, the detection device may determine the number of second data packets of various types on each intermediate device, and determine the number of second data packets of various types on the first link before the intermediate device (or the mirror point included in the intermediate device) and the number of second data packets of various types on the second link after the intermediate device according to the number of second data packets of various types. Figure 8 , the intermediate devices include device 1, device 2 and device 3, device 1 is connected to the sending device, and device 2 is connected to the receiving device ( Figure 8 The sending device and the receiving device are not shown in the figure). Then, the detection device can perform the following process.
[0215] Determine the number of second data packets of various types on device 1, and based on this, obtain: the number of second data packets of various types on the first link before device 1 (the link between the sending device and device 1), and the number of second data packets of various types on the second link after device 1 (the link between device 1 and the receiving device).
[0216] Determine the number of second data packets of various types on device 2, and based on this, obtain: the number of second data packets of various types on the first link before device 2 (the link between the sending device and device 2), and the number of second data packets of various types on the second link after device 2 (the link between device 2 and the receiving device).
[0217] Determine the number of second data packets of various types on device 3, and based on this, obtain: the number of second data packets of various types on the first link before device 3 (the link between the sending device and device 3), and the number of second data packets of various types on the second link after device 3 (the link between device 3 and the receiving device).
[0218] In the exemplary embodiment, continue to see Figure 8 For two adjacent intermediate devices, the detection device can determine the number of data packets lost on the link (a real link) between the two intermediate devices. The number is equal to: the number of data packets lost on the first link corresponding to the latter intermediate device minus the number of data packets lost on the first link corresponding to the former intermediate device.
[0219] Next, continue based on Fig. 9 Let's take an example. Fig. 9 In the example, device 1, device 2 and device 3 are intermediate devices, each of which includes a mirror point, and the sending device sends a data packet to the receiving device.
[0220] Exemplarily, the detection device may first determine the following multiple quantities.
[0221] Amount A1, the number of packets lost on the first link before device 1;
[0222] Quantity A2, the total number of retransmitted packets on device 1;
[0223] The number A3 is the number of false retransmitted packets on device 1, and A2-A3-A1 is the number of lost packets on the second link after device 1;
[0224] Number B1, the number of packets lost on the first link before device 2;
[0225] Quantity B2, the total number of retransmitted packets on device 2;
[0226] The number B3 is the number of false retransmitted packets on device 2, and B2-B3-B1 is the number of lost packets on the second link after device 2;
[0227] Number C1, the number of packets lost on the first link before device 3;
[0228] Quantity C2, the total number of retransmitted packets on device 3;
[0229] The number C3 is the number of false retransmitted data packets on device 3, and C2-C1-C3 is the number of data packets lost on the second link after device 3.
[0230] Based on the above quantities, the detection device can further determine the following quantities.
[0231] The number of data packets lost on the link between the sending device and device 1 (may include the number of data packets lost on device 1), that is, the number A1;
[0232] The number of packets lost on the link between device 1 and device 2 (may include the number of packets lost on device 2), that is, B1-A1. If B1=A1, no packets are lost. If B1>A1, packets are lost.
[0233] The number of packets lost on the link between device 2 and device 3 (may include the number of packets lost on device 3), that is, C1-B1. If C1=B1, no packets are lost. If C1>B1, packets are lost.
[0234] The number of packets lost on the link between device 3 and the receiving device, that is, C2-C1-C3.
[0235] It can be seen that the detection device can determine the number of data packets lost on multiple links only by the number of various types of second data packets on each intermediate device, with low overhead and high efficiency. In addition, the detection device can also determine whether data packet loss occurs on each mirror link and the detection device according to the description in step 602 above. For example, it can determine whether data packet loss occurs on each mirror link separately, thereby locating the lost data packets between 901, 902 and 903, also known as packet loss delimitation. Packet loss delimitation can clearly distinguish between data packets lost on the real link and data packets lost on each mirror link. If the data packet is lost on the mirror link, an alarm for lost data packets will not be issued for the real link to avoid false alarms. In comparison, Figure 2 The corresponding related technology 1 is difficult to distinguish the data packets lost on 201, 202 and 203. Even the data packets lost in the mirrored links 202 and 203 will be regarded as the data packets lost on the real link 201, which is not accurate enough. Figure 3 The corresponding related technology 2 is difficult to distinguish the data packets lost on 301, 302 and 303. Even the data packets lost in the mirror links 303 and 304 will be regarded as the data packets lost on the real link 301, which is also not accurate enough.
[0236] See also Fig.10 In the process of determining the number of data packets, after the detection device obtains multiple data packets from the intermediate device, it performs the first deduplication processing on the multiple data packets (for example, the first deduplication processing is performed according to the description in step 601 above). Afterwards, among the multiple data packets that have completed the first deduplication processing (for example, multiple first data packets), traversal is performed starting from the first data packet. During the traversal process, the next sequence number of the first data packet is first recorded as the maximum value of the next sequence number. If the sequence number of the second data packet is equal to the maximum value of the next sequence number, the maximum value of the next sequence number is updated to the next sequence number of the second data packet. If the sequence number of the second data packet is greater than the maximum value of the next sequence number, it means that the first data packet and the second data packet are discontinuous, and there is a missing sequence number between the first data packet and the second data packet. Therefore, not only is the maximum value of the next sequence number updated to the next sequence number of the second data packet, but a missing sequence number interval is also generated.
[0237] For the data packets after the second data packet, if the sequence number of the data packet is less than the maximum value of the next sequence number, the data packet is considered to be an abnormal data packet (such as the second data packet), and after the second deduplication processing (such as the second deduplication processing according to the description in step 601 above), it can be determined whether the type of the data packet belongs to a retransmission data packet of type 1, type 2, type 3, or an out-of-order data packet. If it is a retransmission data packet of type 3, it can be further determined to be a retransmission data packet of type 31, type 32, or type 33. In addition, after determining the type of the data packet, if the sequence number of the data packet to the next sequence number is in the sequence number missing interval, the sequence number missing interval can also be updated according to the data packet.
[0238] After determining the type of each second data packet in this way, the number of different types of data packets can be determined, and packet loss can be demarcated in the communication system, thereby accurately determining the number of data packets lost on each real link in the communication system, as well as the number of data packets lost on the mirror link and the detection device.
[0239] In summary, in the embodiment of the present application, the detection device obtains a plurality of first data packets from the intermediate device, and uses the first data packets among the plurality of first data packets whose corresponding sequence numbers are less than the reference threshold as second data packets, that is, abnormal data packets. Then, the types of the respective second data packets are determined. The types of the second data packets may be retransmitted data packets or out-of-order data packets. Next, according to the types of the respective second data packets determined, the number of at least one type of second data packets is determined. Since the embodiment of the present application makes a fine-grained division of the types of the second data packets, the number of retransmitted data packets can be determined, and the number of out-of-order data packets can also be determined, without causing limitations, making the determination process more flexible and more applicable. Moreover, the number of at least one type of data packets determined is also relatively accurate.
[0240] The method for determining the number of data packets provided by the embodiment of the present application is introduced above. Corresponding to the above method, the embodiment of the present application also provides a device for determining the number of data packets. Among them, the device is applied to a detection device included in a communication system, and the communication system further includes a sending device, an intermediate device, and a receiving device. The device is used to Fig.11 execute the method for determining the number of data packets performed by the detection device in the above description through the Figure 6 modules shown, such as Fig.11 the method shown. As
[0241] The obtaining module 1101 is configured to obtain a plurality of first data packets from the intermediate device, and the plurality of first data packets are sequentially sent by the sending device to the receiving device through the intermediate device;
[0242] The first determining module 1102 is configured to determine the type of each second data packet. The second data packet is one of the plurality of first data packets, and the sequence number corresponding to the second data packet is less than the reference threshold. The reference threshold is the maximum value of the next sequence number corresponding to the first data packet before the second data packet. The types include: retransmitted data packets or out-of-order data packets;
[0243] The second determining module 1103 is configured to determine the number of at least one type of second data packets according to the types of the respective second data packets.
[0244] In an exemplary embodiment, the sending device is connected to the intermediate device through a first link. The retransmitted data packets include: data packets retransmitted for the first case, and the first case includes losing data packets on the first link. The second determining module 1103 is further configured to use the number of second data packets of the type retransmitted for the first case as the number of data packets lost on the first link.
[0245] In an exemplary embodiment, the intermediate device is connected to the receiving device via a second link. The retransmitted data packet includes: a data packet retransmitted for a second case, where the second case includes the loss of a data packet on the second link. The second determination module 1103 is further configured to use the number of second data packets of the type retransmitted for the second case as the number of data packets lost on the second link.
[0246] In an exemplary embodiment, the apparatus further includes:
[0247] A first update module, configured to update the sequence number missing range corresponding to the second data packet to obtain an updated range corresponding to the second data packet if the sequence number corresponding to the second data packet and the next sequence number are within the sequence number missing range corresponding to the second data packet. The sequence number missing range corresponding to the second data packet includes: the sequence numbers missing between the first data packet before the second data packet.
[0248] A third determination module, configured to determine the data packet loss situation on the probing device and the third link according to the updated range corresponding to the last second data packet. The probing device is connected to the intermediate device via the third link.
[0249] In an exemplary embodiment, the third determination module is configured to determine that there are no lost data packets on the probing device and the third link if the updated range corresponding to the last second data packet is empty; and determine that there are lost data packets on the probing device and the third link if the updated range corresponding to the last second data packet is not empty.
[0250] In an exemplary embodiment, the second determination module 1103 is further configured to, if there are lost data packets on the probing device and the third link, determine the number of lost data packets on the probing device and the third link according to a first value and a second value. The first value is the difference between the upper limit and the lower limit of the updated range corresponding to the last second data packet; the second value is the value of the MSS, or the second value is the length of the payload field in the third data packet, and the time difference between the acquisition time of the third data packet and the first time is less than the first threshold, and the first time is the time when the updated range corresponding to the last second data packet is obtained.
[0251] In an exemplary embodiment, a first update module is configured to, if the sequence number corresponding to the second data packet is the same as the lower limit of the sequence number missing range corresponding to the second data packet, and the next sequence number corresponding to the second data packet is the same as the upper limit of the sequence number missing range corresponding to the second data packet, obtain that the update range corresponding to the second data packet is empty; if a first condition is satisfied, delete the sequence number corresponding to the second data packet to the next sequence number from the sequence number missing range corresponding to the second data packet, to obtain the update range corresponding to the second data packet, where the first condition includes at least one of the following: the sequence number corresponding to the second data packet is different from the lower limit of the sequence number missing range corresponding to the second data packet; the next sequence number corresponding to the second data packet is different from the upper limit of the sequence number missing range corresponding to the second data packet.
[0252] In an exemplary embodiment, the apparatus further includes:
[0253] A fourth determination module is configured to determine a reliability metric for the detection device and the third link according to the packet loss situation of the detection device and the third link, where the reliability metric is used to indicate the reliability of the detection device and the third link;
[0254] A management module is configured to manage the detection device and the third link according to the reliability metric.
[0255] In an exemplary embodiment, an acquisition module 1101 is configured to obtain a plurality of fourth data packets from an intermediate device, where the plurality of fourth data packets are sequentially sent by a sending device to a receiving device through the intermediate device; parse first feature information from a fifth data packet, and if the first feature information hits second feature information in a storage space, delete the fifth data packet from the plurality of fourth data packets to obtain the remaining fourth data packets, where the fifth data packet is any one of the plurality of fourth data packets, and the hit second feature information is parsed from the fourth data packet before the fifth data packet; obtain a plurality of first data packets according to the remaining fourth data packets.
[0256] In an exemplary embodiment, the apparatus further includes:
[0257] A writing module is configured to, if the first feature information hits second feature information in a storage space, modify the writing time corresponding to the hit second feature information to the acquisition time of the fifth data packet; if the first feature information does not hit any second feature information in the storage space, write the first feature information and the acquisition time of the fifth data packet into the storage space correspondingly.
[0258] In an exemplary embodiment, the apparatus further includes:
[0259] A second update module, configured to update the storage space according to a reference manner, where the reference manner includes at least one of the following: if the amount of information of the feature information included in the storage space is greater than or equal to a second threshold, in the feature information included in the storage space, at least one feature information is deleted starting from the feature information with the earliest corresponding writing time, and the feature information includes first feature information and second feature information; periodically clear the feature information included in the storage space.
[0260] In an exemplary embodiment, an obtaining module 1101 is configured to parse the value of TTL from a sixth data packet, where the sixth data packet is any one of the remaining fourth data packets; if the value of TTL meets a second condition, the sixth data packet is deleted from the remaining fourth data packets to obtain a plurality of first data packets, and the second condition includes any one of the following: the value of TTL is less than or equal to a third threshold; the difference between the value of TTL and the initial value of TTL is greater than or equal to a fourth threshold, and the initial value of TTL includes: the value of TTL in the data packet exchanged during the handshake process between the sending device and the receiving device.
[0261] In an exemplary embodiment, a first determination module 1102 is configured to determine the type of the second data packet according to the relationship between a reference interval and a sequence number missing interval corresponding to the second data packet, where the reference interval is composed of the sequence number corresponding to the second data packet to the next sequence number.
[0262] In an exemplary embodiment, the first determination module 1102 is configured to, if the reference interval is within the sequence number missing interval corresponding to the second data packet, and the difference between the obtaining time of the second data packet and a second time is greater than or equal to a fifth threshold, determine that the type of the second data packet is a retransmitted packet for a first case, where the first case includes losing a data packet on a first link between the sending device and an intermediate device; where the second time includes any one of the following: the second time is the obtaining time of the previous acknowledgment data packet, and the acknowledgment data packet is sent by the receiving device to the sending device through the intermediate device; the second time is the obtaining time of the previous seventh data packet, and the type of the seventh data packet is an out-of-order data packet, or the type of the seventh data packet is in doubt.
[0263] In an exemplary embodiment, the first determination module 1102 is configured to, if the reference interval is outside the sequence number missing interval corresponding to the second data packet, and the next sequence number corresponding to the second data packet is less than the maximum value of the acknowledgment number sent by the receiving device, determine that the type of the second data packet is a false retransmitted packet.
[0264] In an exemplary embodiment, the first determination module 1102 is configured to determine that the type of the second data packet is a retransmitted packet for a second scenario if the reference interval is outside the sequence number missing interval corresponding to the second data packet and the next sequence number corresponding to the second data packet is greater than or equal to the maximum value of the acknowledgment numbers sent by the receiving device, where the second scenario includes the loss of data packets on a second link between the intermediate device and the receiving device.
[0265] In an exemplary embodiment, the data packets retransmitted for the second scenario include: fast retransmitted data packets, timeout retransmitted data packets, and other retransmitted data packets. The first determination module 1102 is configured to determine that the type of the second data packet is a fast retransmitted data packet if the number of acknowledgment data packets obtained from the intermediate device is greater than or equal to a sixth threshold, where the acknowledgment data packets are sent by the receiving device to the sending device through the intermediate device; determine that the type of the second data packet is a timeout retransmitted data packet if the difference between the acquisition time of the second data packet and the acquisition time of the previous acknowledgment data packet is greater than or equal to the RTO; and determine that the type of the second data packet is an other retransmitted data packet if the type of the second data packet is not a fast retransmitted data packet and the type of the second data packet is not a timeout retransmitted data packet.
[0266] In an exemplary embodiment, the first determination module 1102 is configured to determine that the type of the second data packet is an out-of-order data packet if the reference interval is within the sequence number missing interval corresponding to the second data packet, the difference between the acquisition time of the second data packet and a second time is less than a fifth threshold, and there are duplicate acknowledgment data packets obtained from the intermediate device; where the second time includes any one of the following: the second time is the acquisition time of the previous acknowledgment data packet, where the acknowledgment data packet is sent by the receiving device to the sending device through the intermediate device; the second time is the acquisition time of the previous seventh data packet, where the type of the seventh data packet is an out-of-order data packet or the type of the seventh data packet is in doubt.
[0267] It should be understood that Fig.11 when the device shown above implements its functions, the beneficial effects it has are the same as Figure 6 those of the method shown. Fig.11 When the device shown above implements its functions, only the division of the above function modules is used as an example for illustration. In actual applications, the above functions can be allocated to different function modules according to needs, that is, the internal structure of the device is divided into different function modules to complete all or part of the functions described above. In addition, the device provided in the above embodiment and the method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be elaborated here.
[0268] An embodiment of the present application provides a device for determining the number of data packets. The device includes a memory and a processor. At least one computer instruction is stored in the memory and loaded and executed by the processor to enable the device for determining the number of data packets to implement Figure 6 the method for determining the number of data packets as shown.
[0269] Refer to Fig.12 , Fig.12 which shows a schematic structural diagram of a network device 1200 provided by the present application. Fig.12 The network device 1200 as shown is used to perform the operations involved in the method for determining the number of data packets as described above Figure 4 as shown. The network device 1200 is, for example, a switch, a router, etc. The network device 1200 can be implemented by a general bus architecture.
[0270] As Fig.12 shown, the network device 1200 includes at least one processor 1201, a memory 1203, and at least one communication interface 1204.
[0271] The processor 1201 is, for example, a general-purpose central processing unit (CPU), a digital signal processor (DSP), a network processor (NP), a graphics processing unit (GPU), a neural-network processing unit (NPU), a data processing unit (DPU), a microprocessor, or one or more integrated circuits for implementing the solution of this application. For example, the processor 1201 includes an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The PLD is, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. It can implement or execute various logic blocks, modules, and circuits described in connection with the disclosed content of the embodiments of the present invention. The processor can also be a combination for implementing computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and so on.
[0272] Optionally, the network device 1200 further includes a bus. The bus is used to transfer information between the components of the network device 1200. The bus can be a peripheral component interconnect (PCI) bus, an extended industry standard architecture (EISA) bus, or the like. The bus can be divided into an address bus, a data bus, a control bus, and so on. For ease of representation, Fig.12 only one line is shown in the figure, but it does not mean that there is only one bus or one type of bus.
[0273] The memory 1203 is, for example, a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, such as a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, such as an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1203 exists independently, for example, and is connected to the processor 1201 through a bus. The memory 1203 can also be integrated with the processor 1201.
[0274] The communication interface 1204 uses any device such as a transceiver to communicate with other devices or communication networks, and the communication network can be an Ethernet, a radio access network (RAN) or a wireless local area network (WLAN), etc. The communication interface 1204 can include a wired communication interface and can also include a wireless communication interface. Specifically, the communication interface 1204 can be an Ethernet interface, a Fast Ethernet (FE) interface, a Gigabit Ethernet (GE) interface, an Asynchronous Transfer Mode (ATM) interface, a wireless local area network (WLAN) interface, a cellular network communication interface, or a combination thereof. The Ethernet interface can be an optical interface, an electrical interface, or a combination thereof. In the embodiments of the present application, the communication interface 1204 can be used for the network device 1200 to communicate with other devices.
[0275] In a specific implementation, as an embodiment, the processor 1201 can include one or more CPUs, such as Fig.12CPU0 and CPU1 shown in []. Each of these processors can be a single-core CPU or a multi-core CPU. Here, the processor can refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0276] In a specific implementation, as an example, network device 1200 may include multiple processors, such as Fig.12 processor 1201 and processor 1205 shown in []. Each of these processors can be a single-core CPU or a multi-core CPU. Here, the processor can refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0277] In a specific implementation, as an example, network device 1200 may further include an output device and an input device. The output device communicates with processor 1201 and can display information in various ways. For example, the output device can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector, etc. The input device communicates with processor 1201 and can receive user input in various ways. For example, the input device can be a mouse, a keyboard, a touch screen device, or a sensing device, etc.
[0278] In some embodiments, memory 1203 is used to store program code 1210 for executing the solution of this application, and processor 1201 can execute the program code 1210 stored in memory 1203. That is, network device 1200 can implement the method for determining the number of data packets provided by the method embodiment through processor 1201 and program code 1210 in memory 1203. The program code 1210 may include one or more software modules. Optionally, processor 1201 itself can also store the program code or instructions for executing the solution of this application.
[0279] In a specific embodiment, network device 1200 of the embodiment of this application can correspond to the detection device in each of the above method embodiments. Processor 1201 in network device 1200 reads the instructions in memory 1203, so that Fig.12 the network device 1200 shown can perform all or part of the operations performed by the detection device.
[0280] Other optional embodiments are not described herein for the sake of brevity.
[0281] The network device 1200 may also correspond to the above Fig.12 shown apparatus for determining the number of data packets, each functional module in the apparatus for determining the number of data packets is implemented by software of the network device 1200. In other words, the functional modules included in the apparatus for determining the number of data packets are generated after the processor 1201 of the network device 1200 reads the program code 1210 stored in the memory 1203.
[0282] Among them, Figure 6 each step of the method for determining the number of data packets shown is completed by an integrated logic circuit of hardware in the processor of the network device 1200 or an instruction in software form. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps of the above method. For the sake of avoiding repetition, it is not described in detail here.
[0283] Refer to Fig.13 , Fig.13 which shows a schematic structural diagram of a network device 1300 provided by another exemplary embodiment of the present application. Fig.13 The network device 1300 shown is used to perform all or part of the operations involved in the method for determining the number of data packets shown above. The network device 1300 is, for example, a switch, a router, etc., and the network device 1300 can be implemented by a general bus architecture. Figure 6 shown.
[0284] As Fig.13 shown, the network device 1300 includes: a main control board 1310 and an interface board 1330.
[0285] The main control board is also called a main processing unit (MPU) or a route processor card. The main control board 1310 is used for controlling and managing each component in the network device 1300, including routing calculation, device management, device maintenance, and protocol processing functions. The main control board 1310 includes: a central processor 1311 and a memory 1312.
[0286] The interface board 1330 is also referred to as a line processing unit (LPU), a linecard, or a service board. The interface board 1330 is used to provide various service interfaces and implement the forwarding of data packets. The service interfaces include, but are not limited to, Ethernet interfaces, POS (Packet over SONET / SDH) interfaces, etc. The Ethernet interface is, for example, a Flexible Ethernet Clients (FlexE Clients). The interface board 1330 includes: a central processing unit 1331, a network processor 1332, a forwarding table entry memory 1334, and a physical interface card (PIC) 1333.
[0287] The central processing unit 1331 on the interface board 1330 is used to control and manage the interface board 1330 and communicate with the central processing unit 1311 on the main control board 1310.
[0288] The network processor 1332 is used to determine the number of data packets. The form of the network processor 1332 can be a forwarding chip. The forwarding chip can be a network processor (NP). In some embodiments, the forwarding chip can be implemented by an application-specific integrated circuit (ASIC) or a field programmable gate array (FPGA). Specifically, the network processor 1332 is used to forward the received packets based on the forwarding table stored in the forwarding table entry memory 1334. If the destination address of the packet is the address of the network device 1300, the packet is sent to the CPU (such as the central processing unit 1331) for processing; if the destination address of the packet is not the address of the network device 1300, the next hop and the outgoing interface corresponding to the destination address are found from the forwarding table according to the destination address, and the packet is forwarded to the outgoing interface corresponding to the destination address. Among them, the processing of the upstream packets can include: the processing of the packet incoming interface, and the search of the forwarding table; the processing of the downstream packets can include: the search of the forwarding table, etc. In some embodiments, the central processing unit can also perform the function of the forwarding chip, such as implementing software forwarding based on a general CPU, so that there is no need for a forwarding chip in the interface board.
[0289] The physical interface card 1333 is used to implement the docking function at the physical layer. The original traffic enters the interface board 1330 from here, and the processed packets are sent out from this physical interface card 1333. The physical interface card 1333, also known as a daughter card, can be installed on the interface board 1330. It is responsible for converting optical and electrical signals into packets, performing a legality check on the packets, and then forwarding them to the network processor 1332 for processing. In some embodiments, the central processor 1331 can also execute the functions of the network processor 1332, such as implementing software forwarding based on a general-purpose CPU, so that the network processor 1332 is not required in the physical interface card 1333.
[0290] Optionally, the network device 1300 includes multiple interface boards. For example, the network device 1300 further includes an interface board 1340, which includes: a central processor 1341, a network processor 1342, a forwarding table entry memory 1344, and a physical interface card 1343. The functions and implementation manners of the components in the interface board 1340 are the same as or similar to those of the interface board 1330, and will not be elaborated here.
[0291] Optionally, the network device 1300 further includes a switching fabric board 1320. The switching fabric board 1320 can also be referred to as a switch fabric unit (SFU). In the case where the network device 1300 has multiple interface boards, the switching fabric board 1320 is used to complete data exchange between the interface boards. For example, the interface board 1330 and the interface board 1340 can communicate through the switching fabric board 1320.
[0292] The main control board 1310 is coupled to the interface board. For example, the main control board 1310, the interface board 1330, the interface board 1340, and the switching fabric board 1320 are interconnected through a system bus and a system backplane. In a possible implementation manner, an inter-process communication (IPC) channel is established between the main control board 1310 and the interface board 1330 and the interface board 1340, and the main control board 1310 communicates with the interface board 1330 and the interface board 1340 through the IPC channel.
[0293] Logically, the network device 1300 includes a control plane and a forwarding plane. The control plane includes a main control board 1310 and a central processing unit 1311. The forwarding plane includes various components that perform forwarding, such as a forwarding table entry memory 1334, a physical interface card 1333, and a network processor 1332. The control plane performs functions such as acting as a router, generating a forwarding table, processing signaling and protocol packets, configuring and maintaining the status of the network device, etc. The control plane sends the generated forwarding table to the forwarding plane. In the forwarding plane, the network processor 1332 looks up the packets received by the physical interface card 1333 based on the forwarding table sent by the control plane and forwards them. The forwarding table sent by the control plane can be stored in the forwarding table entry memory 1334. In some embodiments, the control plane and the forwarding plane can be completely separated and not on the same network device.
[0294] It is worth noting that there may be one or more main control boards. When there are multiple main control boards, they may include an active main control board and a standby main control board. There may be one or more interface boards. The stronger the data processing ability of the network device, the more interface boards are provided. There may also be one or more physical interface cards on the interface board. There may be no switching fabric board, or there may be one or more switching fabric boards. When there are multiple switching fabric boards, they can jointly achieve load sharing and redundant backup. In a centralized forwarding architecture, the network device may not require a switching fabric board, and the interface board undertakes the processing function of the service data of the entire system. In a distributed forwarding architecture, the network device may have at least one switching fabric board, and data exchange between multiple interface boards is achieved through the switching fabric board, providing a large-capacity data exchange and processing ability. Therefore, the data access and processing ability of the network device with a distributed architecture is greater than that of the network device with a centralized architecture. Optionally, the form of the network device can also be a single board, that is, without a switching fabric board, and the functions of the interface board and the main control board are integrated on this single board. At this time, the central processing units on the interface board and the main control board can be combined into one central processing unit on this single board to execute the functions after their superposition. The data exchange and processing ability of this form of network device is relatively low (for example, network devices such as low-end switches or routers). Which architecture to specifically adopt depends on the specific networking deployment scenario and is not limited here.
[0295] In a specific embodiment, the network device 1300 corresponds to the device for determining the number of data packets shown above Fig.11 as described.
[0296] It should be understood that the above-mentioned processor can be a CPU, or other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc. It is worth noting that the processor can be a processor that supports the advanced RISC machines (ARM) architecture.
[0297] Further, in an optional embodiment, the above-mentioned memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. The memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.
[0298] The memory can be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available. For example, static random access memory (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0299] The embodiments of the present application further provide a communication system, which includes a detection device, a sending device, an intermediate device, and a receiving device. The detection device is connected to the intermediate device, and the detection device is configured to execute Figure 6 the method for determining the number of data packets shown.
[0300] The embodiments of the present application further provide a computer-readable storage medium, in which at least one instruction is stored. The instruction is loaded and executed by a processor to enable a computer to implement Figure 6 the method for determining the number of data packets shown.
[0301] The embodiments of the present application further provide a computer program (product). When the computer program is executed by a computer, it can cause a processor or a computer to execute Figure 6 the method for determining the number of data packets shown.
[0302] The embodiments of the present application further provide a chip, including a processor, which is configured to call and run an instruction stored in a memory, so that a computer installed with the chip executes Figure 6 the method for determining the number of data packets shown.
[0303] The embodiments of the present application further provide another chip, including: an input interface, an output interface, a processor, and a memory. The input interface, the output interface, the processor, and the memory are connected through an internal connection path. The processor is configured to execute code in the memory. When the code is executed, it causes a computer installed with the chip to execute Figure 6 the method for determining the number of data packets shown.
[0304] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk), etc.
[0305] Those of ordinary skill in the art can realize that, in combination with the method steps and modules described in the embodiments disclosed herein, they can be implemented by software, hardware, firmware, or any combination thereof. To clearly illustrate the interchangeability of hardware and software, the steps and components of each embodiment have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those of ordinary skill in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0306] Those of ordinary skill in the art can understand that all or part of the steps for implementing the above embodiments can be completed by hardware or by instructing relevant hardware through a program. The program can be stored in a computer-readable storage medium, and the above-mentioned storage medium can be a read-only memory, a magnetic disk, an optical disc, etc.
[0307] When implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer program instructions. As an example, the method of the embodiments of the present application may be described in the context of machine-executable instructions, such as program modules executed in devices included in a target real or virtual processor. Generally, program modules include routines, programs, libraries, objects, classes, components, data structures, etc., which perform specific tasks or implement specific abstract data structures. In various embodiments, the functions of the program modules may be combined or split among the described program modules. The machine-executable instructions for the program modules may be executed within a local or distributed device. In a distributed device, the program modules may be located in both local and remote storage media.
[0308] The computer program code for implementing the method of the embodiments of the present application may be written in one or more programming languages. These computer program codes may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program code is executed by the computer or other programmable data processing device, the functions / operations specified in the flowchart and / or block diagram are implemented. The program code may be executed entirely on the computer, partially on the computer, as a stand-alone software package, partially on the computer and partially on a remote computer, or entirely on a remote computer or server.
[0309] In the context of the embodiments of the present application, the computer program code or related data may be carried by any suitable carrier so that the device, apparatus, or processor can perform the various processes and operations described above. Examples of the carrier include signals, computer-readable media, and the like.
[0310] Examples of signals may include electrical, optical, radio, acoustic, or other forms of propagating signals, such as carrier waves, infrared signals, etc.
[0311] A machine-readable medium may be any tangible medium that contains or stores a program for or related to an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. More specific examples of machine-readable storage media include electrical connections with one or more wires, portable computer disks, hard disks, random access memories (RAMs), read-only memories (ROMs), erasable programmable read-only memories (EPROMs or flash memories), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0312] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices, and modules described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0313] In several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Additionally, the displayed or discussed couplings, direct couplings, or communication connections to each other can be indirect couplings or communication connections through some interfaces, devices, or modules, and can also be electrical, mechanical, or other forms of connection.
[0314] The module described as a separate component may or may not be physically separated, and the component shown as a module may or may not be a physical module, that is, it may be located in one place or distributed to multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of the embodiments of the present application.
[0315] In addition, in each embodiment of the present application, the functional modules can be integrated in a processing module, or each module can exist physically alone, or two or more modules can be integrated in one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules.
[0316] If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in each embodiment of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.
[0317] In this application, terms such as "first" and "second" are used to distinguish between identical or similar items with basically the same functions and effects. It should be understood that there is no logical or chronological dependence between "first", "second", and "nth", nor are the quantity and execution order limited. It should also be understood that although the following description uses terms such as first and second to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another. For example, without departing from the scope of various examples, the first link can be referred to as the second link, and similarly, the second link can be referred to as the first link. Both the first link and the second link can be links, and in some cases, they can be separate and different links.
[0318] It should also be understood that in various embodiments of this application, the magnitude of the serial numbers of each process does not mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not impose any limitation on the implementation process of the embodiments of this application.
[0319] In this application, the meaning of the term "at least one" refers to one or more, and the meaning of the term "multiple" refers to two or more. For example, multiple first data packets refer to two or more first data packets. In this document, the terms "system" and "network" are often used interchangeably.
[0320] It should be understood that the terms used in the description of various examples herein are only for describing specific examples and are not intended to be limiting. As used in the description of various examples and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
[0321] It should also be understood that the term "and / or" used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items. The term "and / or" describes the association relationship of associated objects and indicates that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this application generally represents an "or" relationship between the preceding and following associated objects.
[0322] It should also be understood that the term "comprise" (also referred to as "includes", "including", "comprises", and / or "comprising") when used in this specification specifies the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or their groups.
[0323] It should also be understood that the terms "if" and "when" can be interpreted to mean "when" or "upon" or "in response to determining" or "in response to detecting". Similarly, depending on the context, the phrase "if it is determined that..." or "if [the stated condition or event] is detected" can be interpreted to mean "when it is determined that..." or "in response to determining..." or "when [the stated condition or event] is detected" or "in response to detecting [the stated condition or event]".
[0324] It should be understood that determining B based on A does not mean determining B solely based on A. B can also be determined based on A and / or other information.
[0325] It should also be understood that the "one embodiment", "an embodiment", "a possible implementation" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment or implementation are included in at least one embodiment of the present application. Therefore, the appearances of "in one embodiment" or "in an embodiment", "a possible implementation" throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner.
[0326] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for determining the number of data packets, characterized in that, the method is applied to a detection device included in a communication system, the communication system further includes a sending device, an intermediate device, and a receiving device, the detection device is connected to the intermediate device, and the method includes: Obtaining a plurality of first data packets from the intermediate device, the plurality of first data packets being sequentially sent by the sending device to the receiving device through the intermediate device; Determining the type of each second data packet, the second data packet being one of the plurality of first data packets, the sequence number corresponding to the second data packet being less than a reference threshold, the reference threshold being the maximum value of the next sequence number corresponding to the first data packet before the second data packet, and the type including: retransmitted data packets or out-of-order data packets; Determining the number of at least one type of second data packet according to the type of each second data packet.
2. The method according to claim 1, characterized in that, the sending device is connected to the intermediate device through a first link, and the retransmitted data packets include: data packets retransmitted for a first case, the first case including losing data packets on the first link, after determining the number of at least one type of second data packet, the method further includes: Taking the number of second data packets of the type retransmitted for the first case as the number of data packets lost on the first link.
3. The method according to claim 1 or 2, characterized in that, the intermediate device is connected to the receiving device through a second link, and the retransmitted data packets include: data packets retransmitted for a second case, the second case including losing data packets on the second link, after determining the number of at least one type of second data packet, the method further includes: Taking the number of second data packets of the type retransmitted for the second case as the number of data packets lost on the second link.
4. The method according to any one of claims 1-3, characterized in that, the method further includes: If the sequence number corresponding to the second data packet and the next sequence number are within the sequence number missing interval corresponding to the second data packet, updating the sequence number missing interval corresponding to the second data packet to obtain the updated interval corresponding to the second data packet, and the sequence number missing interval corresponding to the second data packet includes: the missing sequence numbers between the first data packets before the second data packet; Determining the data packet loss situation on the detection device and a third link according to the updated interval corresponding to the last second data packet, the detection device being connected to the intermediate device through the third link.
5. The method according to claim 4, characterized in that, the determining the data packet loss situation on the detection device and the third link according to the updated interval corresponding to the last second data packet includes: If the updated interval corresponding to the last second data packet is empty, determining that there are no lost data packets on the detection device and the third link; If the updated interval corresponding to the last second data packet is not empty, determining that there are lost data packets on the detection device and the third link.
6. The method according to claim 5, wherein, the method further comprises: if there are lost data packets on the detection device and the third link, determining the number of lost data packets on the detection device and the third link according to a first value and a second value, the first value being the difference between the upper limit and the lower limit of the update interval corresponding to the last second data packet; the second value is the value of the maximum segment size MSS, or the second value is the length of the payload field in the third data packet, the difference between the acquisition time of the third data packet and the first time being less than a first threshold, the first time being the time when the update interval corresponding to the last second data packet is obtained.
7. The method according to any one of claims 4-6, wherein, the updating the sequence number missing interval corresponding to the second data packet to obtain an update interval includes: if the sequence number corresponding to the second data packet is the same as the lower limit of the sequence number missing interval corresponding to the second data packet, and the next sequence number corresponding to the second data packet is the same as the upper limit of the sequence number missing interval corresponding to the second data packet, obtaining that the update interval corresponding to the second data packet is empty; if a first condition is satisfied, deleting the sequence number corresponding to the second data packet to the next sequence number from the sequence number missing interval corresponding to the second data packet to obtain the update interval corresponding to the second data packet, the first condition including at least one of the following: the sequence number corresponding to the second data packet is different from the lower limit of the sequence number missing interval corresponding to the second data packet; the next sequence number corresponding to the second data packet is different from the upper limit of the sequence number missing interval corresponding to the second data packet.
8. The method according to any one of claims 4-7, wherein, the method further comprises: determining a reliability index of the detection device and the third link according to the data packet loss situation on the detection device and the third link, the reliability index being used to indicate the reliability of the detection device and the third link; managing the detection device and the third link according to the reliability index.
9. The method according to any one of claims 1-8, wherein, the obtaining a plurality of first data packets from the intermediate device includes: obtaining a plurality of fourth data packets from the intermediate device, the plurality of fourth data packets being sequentially sent by the sending device to the receiving device through the intermediate device; parsing first feature information from a fifth data packet, if the first feature information hits the second feature information in the storage space, deleting the fifth data packet from the plurality of fourth data packets to obtain the remaining fourth data packets, the fifth data packet being any one of the plurality of fourth data packets, and the hit second feature information being parsed from the fourth data packet before the fifth data packet; obtaining the plurality of first data packets according to the remaining fourth data packets.
10. The method according to claim 9, wherein, the method further comprises: If the first feature information hits the second feature information in the storage space, modify the write time corresponding to the hit second feature information to the acquisition time of the fifth data packet; If the first feature information does not hit any second feature information in the storage space, write the first feature information and the acquisition time of the fifth data packet into the storage space correspondingly.
11. The method according to claim 9 or 10, wherein, the method further includes: updating the storage space according to a reference manner, the reference manner including at least one of the following: If the amount of feature information included in the storage space is greater than or equal to a second threshold, among the feature information included in the storage space, delete at least one feature information starting from the feature information with the earliest corresponding write time, and the feature information includes the first feature information and the second feature information; periodically clear the feature information included in the storage space.
12. The method according to any one of claims 9-11, wherein, the obtaining the plurality of first data packets according to the remaining fourth data packets includes: parsing the value of the time to live (TTL) from the sixth data packet, and the sixth data packet is any one of the remaining fourth data packets; If the value of the TTL satisfies a second condition, delete the sixth data packet from the remaining fourth data packets to obtain the plurality of first data packets, and the second condition includes any one of the following: the value of the TTL is less than or equal to a third threshold; the difference between the value of the TTL and the initial value of the TTL is greater than or equal to a fourth threshold, and the initial value of the TTL includes: the value of the TTL in the data packet exchanged during the handshake process between the sending device and the receiving device.
13. The method according to any one of claims 1-12, wherein, the determining the types of the respective second data packets includes: determining the type of the second data packet according to the relationship between the reference interval and the sequence number missing interval corresponding to the second data packet, and the reference interval is composed of the sequence number corresponding to the second data packet to the next sequence number.
14. The method according to claim 13, wherein, the determining the type of the second data packet according to the relationship between the reference interval and the sequence number missing interval corresponding to the second data packet includes: If the reference interval is within the sequence number missing interval corresponding to the second data packet, and the difference between the acquisition time of the second data packet and the second time is greater than or equal to a fifth threshold, determine that the type of the second data packet is a retransmitted packet for the first case, and the first case includes losing a data packet on the first link between the sending device and the intermediate device; wherein, the second time includes any one of the following: the second time is the acquisition time of the previous acknowledgment data packet, and the acknowledgment data packet is sent by the receiving device to the sending device through the intermediate device; The second moment is the acquisition moment of the previous seventh data packet, and the type of the seventh data packet is the out-of-order data packet, or the type of the seventh data packet is in doubt.
15. The method according to claim 13, wherein, determining the type of the second data packet according to the relationship between the reference interval and the sequence number missing interval corresponding to the second data packet includes: If the reference interval is outside the sequence number missing interval corresponding to the second data packet, and the next sequence number corresponding to the second data packet is less than the maximum value of the acknowledgment number sent by the receiving device, determining that the type of the second data packet is a falsely retransmitted data packet.
16. The method according to claim 13, wherein, determining the type of the second data packet according to the relationship between the reference interval and the sequence number missing interval corresponding to the second data packet includes: If the reference interval is outside the sequence number missing interval corresponding to the second data packet, and the next sequence number corresponding to the second data packet is greater than or equal to the maximum value of the acknowledgment number sent by the receiving device, determining that the type of the second data packet is a data packet retransmitted for the second case, and the second case includes losing data packets on the second link between the intermediate device and the receiving device.
17. The method according to claim 16, wherein, the data packets retransmitted for the second case include: fast retransmitted data packets, timeout retransmitted data packets, and other retransmitted data packets, and determining that the type of the second data packet is a data packet retransmitted for the second case includes: If the number of acknowledgment data packets obtained from the intermediate device is greater than or equal to the sixth threshold, determining that the type of the second data packet is the fast retransmitted data packet, and the acknowledgment data packets are sent by the receiving device to the sending device through the intermediate device; If the difference between the acquisition moment of the second data packet and the acquisition moment of the previous acknowledgment data packet is greater than or equal to the retransmission timeout time RTO, determining that the type of the second data packet is a timeout retransmitted data packet; If the type of the second data packet is not the fast retransmitted data packet, and the type of the second data packet is not the timeout retransmitted data packet, determining that the type of the second data packet is the other retransmitted data packet.
18. The method according to claim 13, wherein, determining the type of the second data packet according to the relationship between the reference interval and the sequence number missing interval corresponding to the second data packet includes: If the reference interval is within the sequence number missing interval corresponding to the second data packet, the difference between the acquisition moment of the second data packet and the second moment is less than the fifth threshold, and there are duplicate acknowledgment data packets obtained from the intermediate device, determining that the type of the second data packet is an out-of-order data packet; wherein, the second moment includes any one of the following: The second moment is the acquisition moment of the previous acknowledgment data packet, and the acknowledgment data packet is sent by the receiving device to the sending device through the intermediate device; The second moment is the acquisition moment of the previous seventh data packet, and the type of the seventh data packet is the out-of-order data packet, or the type of the seventh data packet is in doubt.
19. An apparatus for determining the number of data packets, characterized in that the apparatus is applied to a detection device included in a communication system, the communication system further includes a sending device, an intermediate device and a receiving device, the detection device is connected to the intermediate device, and the apparatus includes: an acquisition module, configured to acquire a plurality of first data packets from the intermediate device, and the plurality of first data packets are sequentially sent by the sending device to the receiving device through the intermediate device; a first determination module, configured to determine the type of each second data packet, the second data packet is one of the plurality of first data packets, the sequence number corresponding to the second data packet is less than a reference threshold, and the reference threshold is the maximum value of the next sequence number corresponding to the first data packet before the second data packet, and the type includes: a retransmitted data packet or an out-of-order data packet; a second determination module, configured to determine the number of at least one type of second data packet according to the type of each second data packet.
20. A device for determining the number of data packets, characterized in that the device includes a memory and a processor; at least one computer instruction is stored in the memory, and the at least one computer instruction is loaded and executed by the processor to enable the device to implement the method for determining the number of data packets according to any one of claims 1-18.
21. A communication system, characterized in that the communication system includes a detection device, a sending device, an intermediate device and a receiving device, the detection device is connected to the intermediate device, and the detection device is configured to execute the method for determining the number of data packets according to any one of claims 1-18.
22. A computer-readable storage medium, characterized in that at least one instruction is stored in the computer storage medium, and the at least one instruction is loaded and executed by a processor to enable a computer to implement the method for determining the number of data packets according to any one of claims 1-18.
23. A computer program product, characterized in that the computer program product includes: computer program code, and the computer program code is loaded and executed by a computer to enable the computer to implement the method for determining the number of data packets according to any one of claims 1-18.