A method, device, equipment and storage medium for determining a maximum transmission unit
By setting up virtual nodes and capture nodes in the source node device, monitoring and forwarding MTU detection messages, the security risks and user trust problems in determining MTUs in network transmission in the prior art are solved, and a safe and efficient MTU determination method is realized.
Patent Information
- Application Number
- CN202310207235.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-06
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2043-03-06
AI Technical Summary
When determining the maximum transmission unit (MTU) in network transmission, the prior art requires installing programs for sending and receiving specific messages at the source node, resulting in security risks such as data leakage and problems such as user distrust of the installed programs.
By setting up a virtual node and a capture node in the source node device, communicating and connecting with the data exchange node, the virtual node controls the virtual node forwards the MTU detection packet through the data exchange node, and monitors the data exchange node through the capture node, and determines the target maximum transmission unit MTU based on it after monitoring the target reply message.
It avoids installing programs that receive and send specific messages on the source node, avoids the need to obtain user permissions, reduces security risks such as data leakage, and solves the problem of users' distrust of the installer.
Smart Images

Figure CN116192768B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data communication technology, and in particular to a method, device, equipment and storage medium for determining a maximum transmission unit. Background Art
[0002] Information is usually transmitted in packets on the network. The length of the largest packet that the network can transmit is called the Maximum Transmission Unit (MTU). When the length of the packet transmitted on the network exceeds the MTU, the message will usually be fragmented or even lost, which will cause network transmission errors and large packet traffic problems. Therefore, determining the MTU in network transmission is very meaningful for troubleshooting network transmission problems.
[0003] In the prior art, a program for sending and receiving specific messages is usually installed on the source node, and when determining the MTU of the network, the program is run to enable the source node to send a probe message of a specific length to the destination node. After the source node receives the message returned by the destination node, it determines whether the length of the message returned by the destination node is a valid MTU. If it is valid, the length of the probe message sent by the source node to the destination node is continuously increased until the destination node no longer returns a message within a specific time period, thereby determining the MTU of the network.
[0004] However, in the above solution, user permissions need to be obtained to install a program for sending and receiving specific messages on the source node, which may lead to security risks such as data leakage when determining the MTU and the problem that users do not trust the installed program. Summary of the invention
[0005] The present application provides a method, apparatus, device and storage medium for determining a maximum transmission unit, which does not require the installation of a program for sending and receiving specific messages at the source node, thereby solving the security risks such as data leakage when determining the MTU and the problem that users do not trust the installed program. The technical solution is as follows.
[0006] On the one hand, a method for determining a maximum transmission unit is provided, the method being used for a source node device, the source node device including a target source node, a virtual node and a capture node; the target source node, the virtual node and the capture node are respectively connected to a data exchange node for communication;
[0007] The method comprises:
[0008] When receiving a probe request for the target maximum transmission unit MTU, the control virtual node forwards the MTU probe message through the data exchange node;
[0009] Monitor the message reception of the data exchange node through the capture node;
[0010] When a target reply message corresponding to the MTU detection message is detected, the target maximum transmission unit MTU is determined according to the target reply message.
[0011] Optionally, the MTU detection message includes a target identification number, and the method further includes:
[0012] When a reply message with a target identification number is monitored, the reply message with the target identification number is determined as a target reply message.
[0013] Optionally, the MTU detection message includes a non-fragmentation flag, and the non-fragmentation flag is used to indicate that both the MTU detection message and the target reply message cannot be sent in fragments.
[0014] Optionally, determining a target maximum transmission unit MTU according to the target reply message includes:
[0015] Obtain a first length of the target reply message and a second length of the MTU detection message;
[0016] When the first length is equal to the second length, it is determined that the target reply message is valid;
[0017] When the first length is not equal to the second length, determining that the target reply message is invalid;
[0018] Determine the target maximum transmission unit MTU based on the valid target reply message.
[0019] Optionally, determining a target maximum transmission unit MTU according to a valid target reply message includes:
[0020] Whenever a valid target reply message is obtained, the second length of the MTU detection message is updated to the latest length until the latest length meets the detection end condition;
[0021] The latest length is determined as the target maximum transmission unit MTU, wherein the detection end condition is that the latest length is the maximum value in the preset detection range.
[0022] Optionally, whenever a valid target reply message is obtained, the second length of the MTU detection message is updated to the latest length until the latest length meets the detection end condition, including:
[0023] When the second length is equal to the maximum value in the preset detection range, determining the maximum value in the preset detection range as the latest length;
[0024] When the second length is greater than or equal to the minimum value in the preset detection range and less than the maximum value in the preset detection range, the following steps are performed until the minimum value in the preset detection range after updating is equal to the maximum value:
[0025] The median value of the current preset detection range is determined as the latest length, and the updated MTU detection message is obtained;
[0026] The control virtual node forwards the updated MTU detection message through the data exchange node to obtain a reply message corresponding to the updated MTU detection message, thereby obtaining an updated reply message;
[0027] According to the third length and the median value of the updated reply message, the maximum value or the minimum value in the current preset detection range is updated to obtain the updated preset detection range.
[0028] Optionally, according to the third length and the median value of the updated reply message, the maximum value or the minimum value in the preset detection range is updated, and the updated preset detection range is obtained, including:
[0029] When the third length is equal to the median value, the median value is updated to the minimum value in the current preset detection range to obtain an updated preset detection range;
[0030] When the third length is not equal to the median value, the median value after being subtracted by one is updated to the maximum value in the current preset detection range to obtain an updated preset detection range.
[0031] In another aspect, a device for determining a maximum transmission unit is provided, the device being used for a source node device, the source node device comprising a target source node, a virtual node and a capture node; the target source node, the virtual node and the capture node are respectively connected to a data exchange node for communication;
[0032] The device comprises:
[0033] A control module, configured to control the virtual node to forward the MTU detection message through the data exchange node when receiving a detection request for the target maximum transmission unit MTU;
[0034] A monitoring module, used for monitoring the message reception of the data exchange node through the capture node;
[0035] The determination module is used to determine the target maximum transmission unit MTU according to the target reply message when a target reply message corresponding to the MTU detection message is detected.
[0036] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the above-mentioned method for determining a maximum transmission unit.
[0037] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction is stored in the storage medium, and the at least one instruction is loaded and executed by a processor to implement the above-mentioned method for determining the maximum transmission unit.
[0038] In another aspect, a computer program product or a computer program is provided, wherein the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above-mentioned method for determining the maximum transmission unit.
[0039] The technical solution provided by this application may have the following beneficial effects:
[0040] When receiving a detection request for the target maximum transmission unit MTU, since the target source node, the virtual node and the capture node are all connected to the data exchange node for communication, the virtual node can be controlled to forward the MTU detection message through the data exchange node, so as to avoid the source node from sending the MTU detection message, and there is no need to obtain relevant user permissions to install a program for sending specific messages on the target source node; the data exchange node is monitored for message reception through the capture node, and when the target reply message corresponding to the MTU detection message is detected, the target maximum transmission unit MTU is determined according to the target reply message, so as to avoid the source node from receiving the target reply message corresponding to the MTU detection message, and there is no need to obtain relevant user permissions to install a program for receiving specific messages on the target source node. In summary, by sending and monitoring messages related to determining MTU respectively through the newly set virtual node and capture node, there is no need to install a program for receiving and sending specific messages on the source node, and there is no need to obtain relevant user permission information on the target source node, which avoids security risks such as data leakage when determining MTU, and also solves the problem of users not trusting installed programs. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0042] Figure 1 The diagram is a structural diagram of a system for determining a maximum transmission unit according to an exemplary embodiment.
[0043] Figure 2 The present invention is a flowchart showing a method for determining a maximum transmission unit according to an exemplary embodiment.
[0044] Figure 3 The figure is a schematic diagram of an ICMP message structure according to an exemplary embodiment.
[0045] Figure 4 The present invention is a flowchart showing a method for determining a maximum transmission unit according to an exemplary embodiment.
[0046] Figure 5 It is a specific working flow chart of a method for determining a maximum transmission unit according to an exemplary embodiment.
[0047] Figure 6 The invention is a structural block diagram showing a device for determining a maximum transmission unit according to an exemplary embodiment.
[0048] Figure 7 A structural block diagram of a computer device shown in an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0049] The technical solution of the present application will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0050] It should be understood that the "indication" mentioned in the embodiments of the present application can be a direct indication, an indirect indication, or an indication of an association relationship. For example, A indicates B, which can mean that A directly indicates B, for example, B can be obtained through A; it can also mean that A indirectly indicates B, for example, A indicates C, and B can be obtained through C; it can also mean that there is an association relationship between A and B.
[0051] In the description of the embodiments of the present application, the term "corresponding" may indicate a direct or indirect correspondence between two items, or an association relationship between the two items, or a relationship between indication and being indicated, configuration and being configured, and the like.
[0052] In an embodiment of the present application, "predefinition" can be achieved by pre-saving corresponding codes, tables or other methods that can be used to indicate relevant information in a device (for example, including a terminal device and a network device). The present application does not limit its specific implementation method.
[0053] Figure 11 is a structural diagram of a system for determining a maximum transmission unit according to an exemplary embodiment. The system for determining a maximum transmission unit includes a source node device 110, a destination node device 120, a switch 130, and a switch 140. The source node device 110 is connected to the switch 130 through communication, and the destination node device 120 is connected to the switch 140 through communication, and the switch 130 is connected to the switch 140 through communication, so as to realize data interaction between the source node device 110 and the destination node device 120.
[0054] The switch 130 and the switch 140 are both physical switches; the source node device 110 is a network device that can send Internet Control Message Protocol (ICMP) messages and includes at least one virtual machine. Specifically, the source node device 110 includes a target source node 111, a data exchange node 112, a virtual switch 113, a virtual node 114, a capture node 115 and a sending node 116; the target source node 111, the virtual node 114 and the capture node 115 are all communicatively connected to the data exchange node 112, and the virtual switch 113 is communicatively connected to the data exchange node 112; the virtual node 114 is a pre-created virtual device that can communicate with the data exchange node 112; the capture node 115 is also a pre-created virtual device that can communicate with the data exchange node 112; the target source node 111 is a virtual machine in the source node device; the data exchange node 112 can be any virtual network device that is connected to the virtual machine and provides data sending and receiving functions, such as a tap device; the sending node 116 is communicatively connected to the virtual node 114, and the sending node 116 is the packet sending port of the packet sending program (for example, Pktgen) pre-deployed on the source node device.
[0055] The destination node device 120 is a network device such as a computer, a virtual machine, or a virtual switch that can reply to the Ping command. When the destination node device 120 is a network device including at least one virtual machine, the destination node device 120 includes a data exchange node that is communicatively connected to the virtual machine and a virtual switch that is communicatively connected to the data exchange node, and the virtual switch is communicatively connected to the switch 140. Since the destination node device 120 is configured to be able to reply to the Ping command, when the destination node device 120 includes a virtual machine, unlike the source node device 110, the destination node device 120 may not include a virtual node.
[0056] When the source node device 110 receives a detection request for the target maximum transmission unit MTU, it sends at least one MTU detection message with a payload length of a specific value to the virtual node 114 through a pre-deployed packet sending program, and then the virtual node 114 receives the MTU detection message and sends at least one MTU detection message to the data exchange node 112 for forwarding. Then the data exchange node 112 transmits the MTU detection message to the switch 130 through the virtual switch 113, and the switch 130 transmits the MTU detection message to the switch 140, and then sends the MTU detection message to the destination node device 120. When receiving the MTU detection message, the destination node device 120 will return a target reply message corresponding to the MTU detection message to the switch 140 according to the relevant commands in the MTU detection message. The switch 140 will then transmit the target reply message to the switch 130 so that the target reply message is transmitted to the data exchange node 112. The source node device 110 will then control the capture node 115 to monitor the message reception of the data exchange node 112. When the target reply message is detected, the source node device 110 will determine the target maximum transmission unit MTU between the target source node and the destination node device according to the target reply message.
[0057] It should be noted that in order to avoid installing programs for receiving and sending specific messages on the target source node, the location where the packet sending program is deployed does not include the target source node. The specific deployment location of the packet sending program is not specifically limited in the embodiments of the present application. For example, it can be deployed on a processor or server in the source node device, or it can be deployed on a network manager that manages the source node device.
[0058] Optionally, when the maximum transmission unit determination system is applied to an existing cloud computing system, the destination node device 120 can be a network device in the cloud computing system or a network device outside the cloud computing system, and the source node device 110 is a network device in the cloud computing system. At this time, the packet sending program can be deployed on a server in the cloud computing system.
[0059] Optionally, the above-mentioned server can be a single physical server, or a server cluster or a distributed system composed of multiple physical servers. It can also be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms and other technical computing services.
[0060] Figure 2 is a flowchart of a method for determining a maximum transmission unit according to an exemplary embodiment. The method is executed by a source node device, wherein the source node device Figure 1As shown, it includes a target source node, a virtual node and a capture node; the target source node, the virtual node and the capture node are respectively connected to the data exchange node for communication. Figure 2 As shown, the method for determining the maximum transmission unit may include the following steps:
[0061] Step 201: When receiving a detection request for a target maximum transmission unit MTU, the virtual node is controlled to forward the MTU detection message through a data exchange node.
[0062] The MTU detection message is an ICMP echo request message whose message type is a Ping command reply. The encapsulation structure of the ICMP message is as follows: Figure 3 As shown, the ICMP message specifically includes an Ethernet header, an IP header, an ICMP header, and a payload. The IP header includes an option for identifying whether the ICMP message can be fragmented. The ICMP header includes a type option for identifying the message type and a sequence number seq for identifying that the current ICMP message is different from other ICMP messages. The type option of the ICMP message as an MTU detection message is set to 0 (pingrequest), indicating that the message type is an ICMP echo request message for a ping command reply. The source node device is a network device that can send ICMP messages and includes at least one virtual machine. The virtual node is a pre-created virtual device that can communicate with a data exchange node. The source node device is also connected to the destination node device in communication. The destination node device is a network device such as a computer, a virtual machine, or a virtual switch that can reply to the Ping command.
[0063] When the user inputs a detection request command for the target maximum transmission unit MTU, the source node device receives the detection request for the target maximum transmission unit MTU. The source node device sends an MTU detection message with a payload length of a specific value (the specific value can be a manually preset value, or a value entered when the user inputs the detection request command for the target maximum transmission unit MTU, or a value predicted by the source node device based on the MTU value between the target active node and other destination node devices) to the virtual node through the packet sending port of the pre-deployed packet sending program, and then the virtual node receives the MTU detection message and forwards the MTU detection message to the destination node device through the data exchange node. The destination node device is used to interact with the source node device for data and respond to the received MTU detection message, and can return a reply message corresponding to the MTU detection message to the source node device.
[0064] Optionally, the source node device sends at least two MTU detection messages with the same length of payload to the virtual node through the packet sending port of the pre-deployed packet sending program, so as to control the virtual node to forward multiple MTU detection messages to the destination node device through the data exchange node, so as to avoid the problem of message loss due to network communication connection quality problems such as poor network signal, which in turn affects the MTU determination error or extends the MTU determination time.
[0065] Step 202: Monitor the data exchange node for receiving messages through the capture node.
[0066] The capture node is a pre-created virtual device that can communicate with the data exchange node. When the destination node device returns a reply message corresponding to the MTU detection message, the source node device may also receive messages returned by other devices except the destination node device and messages for other purposes returned by the destination node device through the data exchange node. Therefore, it is necessary to control the capture node to monitor the messages of the data exchange node to filter out the reply messages corresponding to the MTU detection message.
[0067] Step 203: When a target reply message corresponding to the MTU detection message is detected, a target maximum transmission unit MTU is determined according to the target reply message.
[0068] When the destination node device responds to the received MTU detection message, it will return a reply message with a payload consistent with the payload of the MTU detection message to the source node device. The source node device controls the capture node to determine the ICMP message according to the encapsulation structure of the message; according to the type option of the ICMP header in the ICMP message, the ICMP reply message with the message type of reply message is monitored, and the reply message in the ICMP reply message with a payload consistent with the MTU detection message is used as the target reply message corresponding to the MTU detection message.
[0069] After the source node device controls the capture node to monitor the target reply message, the source node device will determine whether the target reply message is valid based on whether the payload length of the target reply message is equal to the payload length of the MTU detection message. When the target reply message is valid, the source node device will change the payload length in the MTU detection message based on the payload length in the valid target reply message and the preset detection range; and then cyclically detect the MTU between the source node device and the destination node device based on the MTU detection message after the payload length is changed, until the cyclic detection is completed to obtain the target maximum transmission unit MTU.
[0070] Optionally, in order to reduce interference of other message types, that is, ICMP messages of Ping command replies, on MTU determination, the MTU detection message may include a target identification number, and the method further includes:
[0071] When a reply message with a target identification number is monitored, the reply message with the target identification number is determined as a target reply message.
[0072] Among them, the target identification number is the sequence number seq of the ICMP header in the ICMP message. Specifically, when the MTU detection message includes the target identification number, the reply message corresponding to the MTU detection message returned by the destination node to the source node device also includes the target identification number. After the source node device controls the capture node to monitor the ICMP reply message, the capture node is controlled to determine the ICMP reply message with the target identification number as the target reply message. It should be noted that the embodiment of the present application does not impose specific restrictions on the determination of the target identification number. It can be a random value selected within a preset sequence number interval as the target identification number. For example, Figure 3 As shown, a random value 51234 is selected in the interval [50000, 60000] as the target identification number, or an artificially set serial number can be determined as the target identification number.
[0073] Optionally, in order to improve the accuracy of determining the MTU, the MTU detection message includes an infragmentable flag, and the infragmentable flag is used to indicate that both the MTU detection message and the target reply message cannot be sent in fragments. Among them, the infragmentable flag is to set the option option in the IP header of the ICMP message used to identify whether the ICMP message can be fragmented to "DF" to indicate that the current ICMP message cannot be fragmented. It should be noted that when the destination node device receives the MTU detection message with an infragmentable flag, the destination node device will also return a reply message with an infragmentable flag and corresponding to the MTU detection message to the source node device. Setting the MTU detection message as infragmentable avoids the possibility of the destination node device returning a fragmented target reply message to the source node device, thereby avoiding the operation of reassembling the message when determining the MTU based on the fragmented target reply message, reducing the operational error when determining the MTU, and thus improving the accuracy of determining the MTU.
[0074] In summary, when a detection request for the target maximum transmission unit MTU is received, since the target source node, the virtual node and the capture node are all connected to the data exchange node for communication, the virtual node can be controlled to forward the MTU detection message through the data exchange node, so as to avoid the source node from sending the MTU detection message, and there is no need to obtain relevant user permissions to install a program for sending specific messages on the target source node; the data exchange node is monitored for message reception through the capture node, and when the target reply message corresponding to the MTU detection message is detected, the target maximum transmission unit MTU is determined according to the target reply message, so as to avoid the source node from receiving the target reply message corresponding to the MTU detection message, and there is no need to obtain relevant user permissions to install a program for receiving specific messages on the target source node. In summary, the newly set virtual node and capture node are used to send and monitor messages related to determining MTU respectively, so it is not necessary to install a program for receiving and sending specific messages on the source node, and it is not necessary to obtain relevant user permission information on the target source node, so as to avoid security risks such as data leakage when determining MTU, and also solve the problem that users do not trust the installed programs.
[0075] Figure 4 FIG. 1 is a flow chart of a method for determining a maximum transmission unit according to an exemplary embodiment. The method is executed by a source node device. Figure 3 As shown, the method for determining the maximum transmission unit may include the following steps:
[0076] Step 401: When receiving a detection request for a target maximum transmission unit MTU, the virtual node is controlled to forward the MTU detection message through a data exchange node.
[0077] Step 402: Monitor the data exchange node for receiving messages through the capture node.
[0078] Steps 401 to 402 in the embodiment of the present application are similar to steps 201 to 202 in the above embodiment, and are not described in detail here.
[0079] Step 403: When a target reply message corresponding to the MTU detection message is monitored, a first length of the target reply message and a second length of the MTU detection message are obtained.
[0080] Among them, the first length is the length of the effective load in the target reply message, and the second length is the length of the effective load in the MTU detection message. The specific process of the source node device monitoring the target reply message corresponding to the MTU detection message is similar to step 203 in the above embodiment, and will not be repeated here. After the source node device monitors the target reply message through the capture node, the source node device will read the first message length of the target reply message and the second message length of the MTU detection message respectively, and then subtract the length of the Ethernet header, IP header and ICMP header in the ICMP message from the first message length to obtain the value as the first length, and subtract the length of the Ethernet header, IP header and ICMP header in the ICMP message from the second message length to obtain the value as the second length.
[0081] Step 404: When the first length is equal to the second length, it is determined that the target reply message is valid.
[0082] When the first length is equal to the second length, the source node device determines that the target reply message is valid.
[0083] Step 405: When the first length is not equal to the second length, it is determined that the target reply message is invalid.
[0084] When the first length is not equal to the second length, the source node device determines that the target reply message is invalid.
[0085] Step 406: Determine the target maximum transmission unit MTU according to the valid target reply message.
[0086] The source node device will change the length of the payload in the MTU detection message according to the length of the payload in the valid target reply message and the preset detection range; and then cyclically detect the MTU between the source node device and the destination node device according to the MTU detection message after the payload length is changed, until the cyclic detection is completed and the target maximum transmission unit MTU is obtained.
[0087] Optionally, whenever the source node device obtains a valid target reply message, it updates the second length of the MTU detection message to the latest length until the latest length meets the detection end condition, and determines the latest length as the target maximum transmission unit MTU, wherein the detection end condition is that the latest length is the maximum value in the preset detection range.
[0088] Whenever the source node device obtains a valid target reply message, it means that the MTU between the source node device and the destination node device may not have reached the maximum value, and the length of the payload of the MTU detection message can be increased to detect the MTU between the source node device and the destination node device. Therefore, the source node device will continuously update the second length of the MTU detection message to the latest length, and update the preset detection range to determine the value of the latest length according to whether the reply message corresponding to the MTU detection message of the latest length is valid. Until the latest length of the MTU detection message reaches the maximum value within the preset range, the source node device determines that the MTU between the source node device and the destination node device has reached the maximum value, and uses the current latest length as the target maximum transmission unit MTU.
[0089] Optionally, in order to improve the efficiency of MTU determination, the preset detection range may be updated by using a binary search method, and then the latest length of the MTU detection message may be updated. Specifically, whenever a valid target reply message is obtained, the second length of the MTU detection message is updated to the latest length until the latest length satisfies the detection end condition, which may include:
[0090] When the second length is equal to the maximum value in the preset detection range, the maximum value in the preset detection range is determined as the latest length.
[0091] The preset detection range may be a manually preset range of values for the length of the payload in the MTU detection message, or may be a range of values for the length of the payload in the MTU detection message predicted by the source node device based on the MTU value between the target source node and other destination node devices. Whenever the source node device obtains a valid target reply message, the source node device will determine the relationship between the second length of the MTU detection message and the maximum value in the preset detection range. When the second length is equal to the maximum value in the preset detection range, the source node device will determine the maximum value in the preset detection range as the latest length.
[0092] When the second length is greater than or equal to the minimum value in the preset detection range and less than the maximum value in the preset detection range, the following steps are performed until the minimum value in the preset detection range after updating is equal to the maximum value:
[0093] The median value of the current preset detection range is determined as the latest length to obtain an updated MTU detection message.
[0094] The source node device calculates the median of the preset detection range according to Formula 1, and updates the median to the latest length to obtain an updated MTU detection message.
[0095] Median value = (minimum value in the preset detection range + maximum value in the preset detection range + 1) / 2 Formula 1
[0096] The control virtual node forwards the updated MTU detection message through the data exchange node to obtain a reply message corresponding to the updated MTU detection message, thereby obtaining an updated reply message.
[0097] The source node device will send at least one identical updated MTU detection message to the virtual node through the packet sending port of the packet sending program, and then the virtual node will receive at least one identical updated MTU detection message and forward the updated MTU detection message to the destination node device through the data exchange node. The destination node device will return a reply message corresponding to the updated MTU detection message to the source node device based on the received updated MTU detection message, and the source node device will control the capture node to monitor the message reception of the data exchange node to obtain the reply message corresponding to the updated MTU detection message and obtain the updated reply message.
[0098] According to the third length and the median value of the updated reply message, the maximum value or the minimum value in the current preset detection range is updated to obtain the updated preset detection range.
[0099] Among them, the third length is the length of the effective payload in the reply message after the update, and the source node device will determine how to update the current preset detection range maximum or minimum value based on the size relationship between the third length of the reply message after the update and the median. The source node device will update the preset detection range through binary search, speed up the update speed of the preset detection range, and then speed up the update of the latest length, so as to quickly determine the MTU. Specifically, when the third length is equal to the median, the source node device will update the median of the current preset detection range to the minimum value in the current preset detection range, and obtain the updated preset detection range. When the third length is not equal to the median, the source node device will update the median of the current preset detection range after minus one to the maximum value in the current preset detection range, and obtain the updated preset detection range.
[0100] Optionally, in order to further improve the efficiency of MTU determination, before updating the second length of the MTU probe message to the latest length, when receiving a probe request for the target maximum transmission unit MTU, the virtual node can be controlled to forward the MTU probe message with a payload length as the maximum value of a preset detection range through a data exchange node to determine whether the reply message corresponding to the MTU probe message with a payload length as the maximum value of the preset detection range is valid.
[0101] When the reply message corresponding to the MTU probe message whose payload length is the maximum value of the preset detection range is valid, the maximum value of the preset detection range is determined as the target maximum transmission unit MTU; when the reply message corresponding to the MTU probe message whose payload length is the maximum value of the preset detection range is invalid, the control virtual node forwards the MTU probe message whose payload length is the minimum value of the preset detection range through the data exchange node to determine whether the reply message corresponding to the MTU probe message whose payload length is the minimum value of the preset detection range is valid.
[0102] When the reply message corresponding to the MTU detection message whose effective payload length is the minimum value of the preset detection range is valid, the second length of the MTU detection message is updated to the latest length cycle until the latest length meets the detection end condition.
[0103] When the reply message corresponding to the MTU detection message whose payload length is the minimum value of the preset detection range is invalid, the source node device determines that the MTU between the source node device and the destination node device is not within the preset specified range, and the source node device stops determining the MTU between the target source node and the destination node device.
[0104] Optionally, when the first length of the valid target reply message obtained by the source node device is less than the minimum value in the preset detection range, the source node device will send information to the user such as "redetermine the preset detection range" or "invalid MTU detection", which may indicate that the MTU needs to be re-determined.
[0105] In summary, when a detection request for the target maximum transmission unit MTU is received, the sending of the MTU detection message and the receiving of the target reply message are realized through the virtual node and the capture node, thereby avoiding obtaining user permissions to install a program for receiving and sending specific messages on the target source node, avoiding security risks such as data leakage when the MTU is determined, and thus solving the problem of users' distrust of the installation program. When determining the target maximum transmission unit MTU, whenever a valid target reply message is obtained, on the one hand, when the latest length of the MTU detection message is the maximum value in the preset detection range, the latest length is determined as the target maximum transmission unit MTU; on the other hand, when the second length is greater than or equal to the minimum value in the preset detection range and less than the maximum value in the preset detection range, the preset detection range is updated by the median value of the preset detection range, that is, the preset detection range is updated by using the binary search method, and the median value of the preset detection range is determined as the latest length, thereby speeding up the determination speed of the target maximum transmission unit MTU.
[0106] like Figure 5An exemplary embodiment shown in the figure shows a specific workflow diagram of a method for determining a maximum transmission unit, in which an initial preset detection range (min, max) is artificially preset. When a source node device receives a detection request for a target maximum transmission unit MTU, the source node device will give priority to detecting the minimum value min and the maximum value max in the preset detection range. Specifically, the virtual node is controlled to forward five MTU detection messages with the same payload length of the maximum value max through a data exchange node, and then the data exchange node is monitored for message reception through a capture node. When a target reply message corresponding to at least one forwarded MTU detection message is detected, it is determined whether the payload length of the target reply message is equal to the payload length of the MTU detection message; when the payload length of the target reply message is equal to the payload length of the MTU detection message, the target reply message is forwarded to the target node. When the length of the target reply message is equal to the payload length of the MTU probe message, it means that the target reply message corresponding to the MTU probe message with the maximum payload length max is valid, and the maximum value max in the preset detection range is determined as the target maximum transmission unit MTU between the target source node and the destination node; when the payload length of the target reply message is not equal to the payload length of the MTU probe message, the source node device controls the virtual node to forward five MTU probe messages with the same payload length of the minimum value min through the data exchange node, and then monitors the data exchange node for message reception through the capture node. When a target reply message corresponding to at least one forwarded MTU probe message is detected, it is determined again whether the payload length of the target reply message is equal to the payload length of the MTU probe message. When the payload length of the target reply message is not equal to the payload length of the MTU probe message, the determination of the MTU between the target source node and the destination node device is terminated;
[0107] When the payload length of the target reply message is equal to the payload length of the MTU detection message, it means that although the maximum value max is not the MTU between the target source node and the destination device, the target reply message of the MTU detection message corresponding to the minimum value min is valid, and the MTU between the target source node and the destination device may be greater than min. Therefore, the source node device will further cyclically detect the preset detection range (min, max). Specifically, the source node device will determine whether the minimum value min in the current preset detection range is less than the maximum value max. When the minimum value min is less than the maximum value max, the target maximum transmission unit MTU is determined by binary search. Specifically, the source node device will calculate the median mid of the current preset detection range according to Formula 1, and determine the value of the median mid as the latest length of the MTU detection message to obtain the updated MTU detection message, and control the virtual node to forward five identical updated MTU detection messages through the data exchange node to determine whether the updated reply message corresponding to the updated MTU detection message is valid. If the reply message after the update is valid, the minimum value min in the current preset detection range is updated to the median mid; if the reply message after the update is invalid, the maximum value max in the current preset detection range is updated to the median mid-1, and the above steps are executed repeatedly until the relationship that the minimum value min in the updated preset detection range is less than the maximum value max is no longer true, and then the maximum value max in the preset detection range updated last time is returned. It can be understood that, since in the embodiment of the present application, a judgment is first made as to whether the minimum value min in the current preset detection range is less than the maximum value max, and then the maximum or minimum value in the preset detection range is updated, this results in the maximum value max in the preset detection range updated last time no longer satisfying the relationship that the minimum value min is less than the maximum value max.
[0108] Figure 6 A device for determining a maximum transmission unit is shown according to an exemplary embodiment. The device for determining a maximum transmission unit includes:
[0109] The control module 601 is used to control the virtual node to forward the MTU detection message through the data exchange node when receiving a detection request for the target maximum transmission unit MTU.
[0110] The monitoring module 602 is used to monitor the message reception of the data exchange node through the capture node.
[0111] The determination module 603 is used to determine the target maximum transmission unit MTU according to the target reply message when a target reply message corresponding to the MTU detection message is monitored.
[0112] In a possible implementation, the determination module is further configured to:
[0113] When a reply message with a target identification number is monitored, the reply message with the target identification number is determined as a target reply message.
[0114] In a possible implementation, the determination module is further configured to:
[0115] Obtain a first length of the target reply message and a second length of the MTU detection message;
[0116] When the first length is equal to the second length, it is determined that the target reply message is valid;
[0117] When the first length is not equal to the second length, determining that the target reply message is invalid;
[0118] Determine the target maximum transmission unit MTU based on the valid target reply message.
[0119] In a possible implementation, the determination module is further configured to:
[0120] Whenever a valid target reply message is obtained, the second length of the MTU detection message is updated to the latest length until the latest length meets the detection end condition;
[0121] The latest length is determined as the target maximum transmission unit MTU, wherein the detection end condition is that the latest length is the maximum value in the preset detection range.
[0122] In a possible implementation, the determination module is further configured to:
[0123] When the second length is equal to the maximum value in the preset detection range, determining the maximum value in the preset detection range as the latest length;
[0124] When the second length is greater than or equal to the minimum value in the preset detection range and less than the maximum value in the preset detection range, the following steps are performed until the minimum value in the preset detection range after updating is equal to the maximum value:
[0125] The median value of the current preset detection range is determined as the latest length, and the updated MTU detection message is obtained;
[0126] The control virtual node forwards the updated MTU detection message through the data exchange node to obtain a reply message corresponding to the updated MTU detection message, thereby obtaining an updated reply message;
[0127] According to the third length and the median value of the updated reply message, the maximum value or the minimum value in the current preset detection range is updated to obtain the updated preset detection range.
[0128] In a possible implementation, the determination module is further configured to:
[0129] When the third length is equal to the median value, the median value is updated to the minimum value in the current preset detection range to obtain an updated preset detection range;
[0130] When the third length is not equal to the median value, the median value after being subtracted by one is updated to the maximum value in the current preset detection range to obtain an updated preset detection range.
[0131] When receiving a detection request for the target maximum transmission unit MTU, since the target source node, the virtual node and the capture node are all connected to the data exchange node for communication, the virtual node can be controlled to forward the MTU detection message through the data exchange node, so as to avoid the source node from sending the MTU detection message, and there is no need to obtain relevant user permissions to install a program for sending specific messages on the target source node; the data exchange node is monitored for message reception through the capture node, and when the target reply message corresponding to the MTU detection message is detected, the target maximum transmission unit MTU is determined according to the target reply message, so as to avoid the source node from receiving the target reply message corresponding to the MTU detection message, and there is no need to obtain relevant user permissions to install a program for receiving specific messages on the target source node. In summary, by sending and monitoring messages related to determining MTU respectively through the newly set virtual node and capture node, there is no need to install a program for receiving and sending specific messages on the source node, and there is no need to obtain relevant user permission information on the target source node, which avoids security risks such as data leakage when determining MTU, and also solves the problem of users not trusting installed programs.
[0132] Figure 7 The structural block diagram of a computer device 700 shown in an exemplary embodiment of the present application is shown. The computer device can be implemented as a source node device in the above scheme of the present application. The computer device 700 includes a central processing unit (CPU) 701, a system memory 704 including a random access memory (RAM) 702 and a read-only memory (ROM) 703, and a system bus 705 connecting the system memory 704 and the central processing unit 701. The computer device 700 also includes a large-capacity storage device 706 for storing an operating system 709, an application program 710 and other program modules 711.
[0133] The mass storage device 706 is connected to the central processing unit 701 via a mass storage controller (not shown) connected to the system bus 705. The mass storage device 706 and its associated computer readable medium provide non-volatile storage for the computer device 700. That is, the mass storage device 706 may include a computer readable medium (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.
[0134] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electronically-Erasable Programmable Read-Only Memory (EEPROM) flash memory or other solid-state storage technology, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, cassette, tape, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above. The above-mentioned system memory 704 and mass storage device 706 can be collectively referred to as memory.
[0135] According to various embodiments of the present disclosure, the computer device 700 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 700 can be connected to the network 708 through the network interface unit 707 connected to the system bus 705, or the network interface unit 707 can be used to connect to other types of networks or remote computer systems (not shown).
[0136] The memory further includes at least one computer program, which is stored in the memory. The central processing unit 701 implements all or part of the steps in the methods shown in the above embodiments by executing the at least one computer program.
[0137] In an exemplary embodiment, a computer-readable storage medium is also provided, which is used to store at least one computer program, and the at least one computer program is loaded and executed by a processor to implement all or part of the steps in the above method. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0138] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned Figures 2 to 4 All or part of the steps of the method shown in any embodiment.
[0139] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0140] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for determining a maximum transmission unit, characterized in that: The method is used for a source node device, wherein the source node device includes a target source node, a virtual node and a capture node; The target source node, the virtual node and the capture node are respectively connected to the data exchange node for communication; The method comprises: When receiving a detection request for a target maximum transmission unit MTU, controlling the virtual node to forward the MTU detection message through a data exchange node; Performing message reception monitoring on the data exchange node by the capture node; When a target reply message corresponding to the MTU detection message is monitored, determining the target maximum transmission unit MTU according to the target reply message; Determining a target maximum transmission unit MTU according to the target reply message includes: Obtaining a first length of the target reply message and a second length of the MTU detection message; When the first length is equal to the second length, determining that the target reply message is valid; When the first length is not equal to the second length, determining that the target reply message is invalid; Determine the target maximum transmission unit MTU according to the valid target reply message; The determining the target maximum transmission unit MTU according to the valid target reply message comprises: Whenever the valid target reply message is obtained, the second length of the MTU detection message is updated to the latest length until the latest length meets the detection end condition; Determine the latest length as the target maximum transmission unit MTU, wherein the detection end condition is that the latest length is the maximum value in a preset detection range; Whenever the valid target reply message is obtained, updating the second length of the MTU detection message to the latest length until the latest length meets the detection end condition includes: When the second length is equal to the maximum value in the preset detection range, determining the maximum value in the preset detection range as the latest length; When the second length is greater than or equal to the minimum value in the preset detection range and less than the maximum value in the preset detection range, the following steps are performed until the minimum value in the preset detection range after updating is equal to the maximum value: Determine the median value of the current preset detection range as the latest length, and obtain an updated MTU detection message; Control the virtual node to forward the updated MTU detection message through the data exchange node to obtain a reply message corresponding to the updated MTU detection message, thereby obtaining an updated reply message; According to the third length of the updated reply message and the median value, the maximum value or the minimum value in the current preset detection range is updated to obtain the updated preset detection range.
2. The method according to claim 1, characterized in that The MTU detection message includes a target identification number, and the method further includes: When a reply message with the target identification number is monitored, the reply message with the target identification number is determined as the target reply message.
3. The method according to claim 2, characterized in that The MTU detection message includes a non-fragmentable flag, and the non-fragmentable flag is used to indicate that both the MTU detection message and the target reply message cannot be sent in fragments.
4. The method according to claim 1, characterized in that The updating of the maximum value or the minimum value in the preset detection range according to the third length of the updated reply message and the median value to obtain the updated preset detection range includes: When the third length is equal to the median value, updating the median value to the minimum value in the current preset detection range to obtain the updated preset detection range; When the third length is not equal to the median value, the median value after being subtracted by one is updated to the maximum value in the current preset detection range to obtain the updated preset detection range.
5. A device for determining a maximum transmission unit, characterized in that: The device is used for a source node device, wherein the source node device includes a target source node, a virtual node and a capture node; The target source node, the virtual node and the capture node are respectively connected to the data exchange node for communication; The device comprises: A control module, configured to control the virtual node to forward the MTU detection message through the data exchange node when receiving a detection request for the target maximum transmission unit MTU; A monitoring module, used for monitoring the message reception of the data exchange node through the capture node; A determination module, configured to determine the target maximum transmission unit MTU according to the target reply message when a target reply message corresponding to the MTU detection message is monitored; The determining module is further used for: Obtaining a first length of the target reply message and a second length of the MTU detection message; When the first length is equal to the second length, determining that the target reply message is valid; When the first length is not equal to the second length, determining that the target reply message is invalid; Determine the target maximum transmission unit MTU according to the valid target reply message; The determining module is further used for: Whenever the valid target reply message is obtained, the second length of the MTU detection message is updated to the latest length until the latest length meets the detection end condition; Determine the latest length as the target maximum transmission unit MTU, wherein the detection end condition is that the latest length is the maximum value in a preset detection range; The determining module is further used for: When the second length is equal to the maximum value in the preset detection range, determining the maximum value in the preset detection range as the latest length; When the second length is greater than or equal to the minimum value in the preset detection range and less than the maximum value in the preset detection range, the following steps are performed until the minimum value in the preset detection range after updating is equal to the maximum value: Determine the median value of the current preset detection range as the latest length, and obtain an updated MTU detection message; Control the virtual node to forward the updated MTU detection message through the data exchange node to obtain a reply message corresponding to the updated MTU detection message, thereby obtaining an updated reply message; According to the third length of the updated reply message and the median value, the maximum value or the minimum value in the current preset detection range is updated to obtain the updated preset detection range.
6. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the method for determining the maximum transmission unit as claimed in any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the method for determining the maximum transmission unit as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Network system and method for discovering path MTU in data communication network
CN1581849A