WO2022116178A1 - 一种tcp mss调整方法、装置及系统 - Google Patents

一种tcp mss调整方法、装置及系统 Download PDF

Info

Publication number
WO2022116178A1
WO2022116178A1 PCT/CN2020/134002 CN2020134002W WO2022116178A1 WO 2022116178 A1 WO2022116178 A1 WO 2022116178A1 CN 2020134002 W CN2020134002 W CN 2020134002W WO 2022116178 A1 WO2022116178 A1 WO 2022116178A1
Authority
WO
WIPO (PCT)
Prior art keywords
tcp
value
message
mss
syn
Prior art date
Application number
PCT/CN2020/134002
Other languages
English (en)
French (fr)
Inventor
贺奇
丁蓓菁
靳松魁
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2020/134002 priority Critical patent/WO2022116178A1/zh
Publication of WO2022116178A1 publication Critical patent/WO2022116178A1/zh

Links

Images

Definitions

  • the present application relates to the field of communications, and in particular to a TCP MSS adjustment method, device and system.
  • TCP Transmission Control Protocol
  • IETF Internet Engineering Task Force
  • TCP is a byte-oriented protocol
  • MSS Maximum Segment Size, the maximum message length
  • the MTU Maximum Transmission Unit
  • the MTU Maximum Transmission Unit of an intermediate transmission node in the network
  • it will cause service damage (when the packet can be fragmented
  • the packet is fragmented; when the packet cannot be fragmented, the packet is discarded, and the discard node sends an ICMP error message or an ICMPv6 error message to the source to notify the MTU of the discarded interface); or, in a worse case,
  • the intermediate transmission node does not reply to the ICMP (Internet Control Message Protocol, Internet Control Message Protocol) error message, and the TCP data sender cannot update the PMTU (PathMaximum Transmission Unit, path maximum transmission unit), resulting in the continuous loss of oversized packets at the intermediate transmission node packet, which eventually leads to the disconnection of the TCP connection.
  • it may enter an abnormal state in the face of repeated re-establishment and disconnection of TCP connections
  • the embodiments of the present application provide a TCP MSS adjustment method and device, which can adjust the TCP MSS in the TCP three-way handshake phase, determine to send TCP packets with the optimal TCP MSS, and avoid service damage in the subsequent data service phase; even if TCP packets cannot be fragmented, and the intermediate node does not reply with an ICMP error message or an ICMPv6 error message after discarding the oversized TCP packet to prompt the source to refresh the PMTU. It is also possible to detect the fault in advance in the TCP three-way handshake phase, so as to avoid the TCP connection after the three-way handshake is established.
  • the data service that the client sends the complete MSS payload length message is discarded by the intermediate transmission node because the message length is too large, and then the discarded message is repeatedly retransmitted to reach the maximum number of retransmissions, and the chain is disconnected.
  • the infinite loop of disconnection due to the same reason improves the TCP communication performance and the maintenance and testing efficiency.
  • the embodiment of the present application provides a method for adjusting the TCP MSS, the method is used to set the transmission control protocol TCP server in the Internet Protocol IP network, including:
  • the packet length of the first SYN-ACK packet is the IP packet length corresponding to the first TCP MSS value
  • the first SYN-ACK message carries the TCP advMSS value of the TCP server.
  • the TCP server after receiving the SYN message from the TCP client, the TCP server does not directly reply to the SYN-ACK message, but adjusts the TCP MSS and sends the first SYN-ACK after determining the optimal first TCP MSS.
  • the message length of the first SYN-ACK message is the length of the IP message corresponding to the first TCP MSS value, so as to realize the TCP MSS adjustment in the TCP three-way handshake stage, and avoid causing traffic in the subsequent data service stage. damaged.
  • the detected PMTU value in this method may refer to: the PMTU value detected by the TCP server by actively sending PMTU detection packets; or the previously sent service packets are discarded because the service packets are too large , after passively receiving the ICMP path detection message, the PMTU value adjusted according to the MTU value carried in the ICMP path detection message.
  • the configured PMTU value in this method may refer to: a manually configured PMTU value.
  • the user may input PMTU configuration information on the server interface.
  • the default PMTU value in this method may refer to: pre-configured in the TCP server.
  • the default PMTU value of the TCP server is the MTU value of the sending interface of the TCP server.
  • the method for generating the first SYN-ACK message in the method may be: according to the first TCP MSS value, padding the SYN-ACK message to obtain a first SYN-ACK message, the first SYN-ACK message
  • the message length of the ACK message is the length of the IP message corresponding to the first TCP MSS value; or, the first SYN-ACK message is generated according to the first TCP MSS value, and the message length of the first SYN-ACK message is The IP packet length corresponding to the first TCP MSS value.
  • Padding means padding.
  • the padding value is all 0 bits, and other padding algorithms are also allowed, and the padding value is not all 0 bits.
  • IPv6 header 40 bytes
  • TCP header 20 bytes
  • Payload 40 bytes
  • the sent message is as follows: IPv6 header (40 bytes) + TCP header (20 bytes) + Payload (40 bytes) + Padding (1400 bytes).
  • the difference between the length of the IP packet corresponding to the first TCP MSS value and the first TCP MSS value is 40 bytes, that is, the IPv4 header (20 bytes) + the TCP header (20 bytes)
  • the difference between the IP message length corresponding to the first TCP MSS value and the first TCP MSS value is 60 bytes, i.e. IPv6 head (40 bytes)+TCP head (20 bytes) ).
  • the set IP network is an Internet Protocol version IPv6 network.
  • the TCP server of the IPv6 network can adjust the TCP MSS when sending the SYN-ACK message, so as to avoid service damage in the subsequent data service stage.
  • the set IP network is an IPv4 network, and the first SYN-ACK packet does not allow fragmentation.
  • the TCP server of the IPv4 network only performs TCP MSS adjustment when sending the SYN-ACK message when the SYN-ACK message does not allow fragmentation, which also avoids the need for subsequent data
  • the business phase leads to business damage.
  • the first TCP MSS value is the smaller value of the TCP MSS value corresponding to the first PMTU value and the TCP advMSS value of the TCP client. That is to say, in this implementation, the smaller value of the TCP MSS value corresponding to the first PMTU value and the TCP advMSS value of the TCP client can be determined as the optimal TCP MSS when sending the SYN-ACK message This ensures that the SYN-ACK message is sent with the optimal TCP MSS value, which improves the efficiency of TCP MSS adjustment.
  • it also includes:
  • it also includes:
  • the first SYN-ACK message is retransmitted to the TCP client ;
  • the failure can be detected in advance in the TCP three-way handshake phase, so as to avoid the client sending the complete MSS payload length packet data after the three-way handshake establishes the TCP connection.
  • the service is discarded by the intermediate transmission node because the packet length is too large, and then the discarded packet is repeatedly retransmitted.
  • the number of retransmissions reaches the threshold and the chain is disconnected. After the three-way handshake is successful, the chain is disconnected again for the same reason. TCP communication performance.
  • it also includes:
  • the ICMP or ICMPv6 error message If an Internet Control Packet Protocol ICMP or ICMPv6 error message is received from the packet loss node, the ICMP or ICMPv6 error message carries the MTU value indicated by the packet loss node, and the packet loss node is the TCP An intermediate transmission node between the server and the TCP client, then according to the MTU value carried by the ICMP or ICMPv6 error message and the TCP advMSS value of the TCP client, the first TCP MSS value is adjusted, obtain the adjusted second TCP MSS value;
  • the message length of the first SYN-ACK message is adjusted to obtain a second SYN-ACK message, and the message length of the second SYN-ACK message is Describe the IP packet length corresponding to the second TCP MSS value;
  • the TCP MSS adjustment can be performed again, and the second SYN-ACK message can be sent after the optimal second TCP MSS is determined.
  • the message length of the second SYN-ACK message is the length of the IP message corresponding to the second TCP MSS value, thereby realizing the TCP MSS adjustment in the TCP three-way handshake stage and avoiding service damage in the subsequent data service stage. .
  • the MTU value indicated by the packet loss node in this implementation manner may be the MTU value of the interface of the packet loss node, which is related to the transmission direction, and the corresponding MTU values may be the same or different depending on the transmission direction.
  • the second TCP MSS value is the smaller value of the TCP MSS value corresponding to the second PMTU value and the TCP advMSS value of the TCP client;
  • the second PMTU value is a PMTU value obtained by the TCP server after updating the first PMTU value according to the MTU value carried in the ICMP or ICMPv6 error message.
  • the smaller value of the TCP MSS value corresponding to the second PMTU value and the TCP advMSS value of the TCP client can be determined as the optimal TCP MSS when sending the SYN-ACK message This ensures that the SYN-ACK message is sent with the optimal TCP MSS value, which further improves the efficiency of TCP MSS adjustment.
  • it also includes:
  • the ACK message from the TCP client is received, it is determined that the TCP three-way handshake is successful, and data transmission is performed with the TCP client according to the second TCP MSS value.
  • it also includes:
  • the second SYN-ACK packet is retransmitted to the TCP client ;
  • the failure can be detected in advance in the TCP three-way handshake phase, so as to avoid the client sending the complete MSS payload length packet data after the three-way handshake establishes the TCP connection.
  • the service is discarded by the intermediate transmission node because the packet length is too large, and then the discarded packet is repeatedly retransmitted.
  • the number of retransmissions reaches the threshold and the chain is disconnected. After the three-way handshake is successful, the chain is disconnected again for the same reason. TCP communication performance.
  • an embodiment of the present application provides a method for adjusting a TCP MSS.
  • the method is used to set a transmission control protocol TCP client in an Internet Protocol IP network, including:
  • the SYN-ACK message If the synchronization sequence number confirmation SYN-ACK message from the TCP server is received, and the SYN-ACK message carries the TCP advMSS value of the TCP server, then according to the TCP advMSS value of the TCP server, and the The first path maximum transmission unit PMTU value detected by the TCP client, configured or default, determines the first TCP MSS value of the TCP client;
  • the TCP client after the TCP client receives the SYN-ACK message from the TCP server, it does not directly reply to the ACK message, but adjusts the TCP MSS, and sends the first ACK message after determining the optimal first TCP MSS.
  • the message length of the first ACK message is the length of the IP message corresponding to the first TCP MSS value, thereby realizing the TCP MSS adjustment in the TCP three-way handshake stage, and avoiding service damage in the subsequent data service stage.
  • the detected PMTU value in this method may refer to: the PMTU value detected by the TCP client by actively sending the PMTU detection packet; or the service packet sent before is discarded because the service packet is too large , after passively receiving the ICMP path detection message, the PMTU value adjusted according to the MTU value carried in the ICMP path detection message.
  • the configured PMTU value in this method may refer to: a manually configured PMTU value.
  • the user may input PMTU configuration information on the client interface.
  • the default PMTU value in this method may refer to: pre-configured in the TCP client.
  • the default PMTU value of the TCP client is the MTU value of the sending interface of the TCP client.
  • the method for generating the first ACK message may be: according to the first TCP MSS value, padding the ACK message to obtain the first ACK message, and the message length of the first ACK message is The IP message length corresponding to the first TCP MSS value; or, the first ACK message is generated according to the first TCP MSS value, and the message length of the first ACK message is the IP message length corresponding to the first TCP MSS value.
  • Padding means padding.
  • the padding value is all 0 bits, and other padding algorithms are also allowed, and the padding value is not all 0 bits.
  • IPv6 header 40 bytes
  • TCP header 20 bytes
  • Payload 40 bytes
  • the sent message is as follows: IPv6 header (40 bytes) + TCP header (20 bytes) + Payload (40 bytes) + Padding (1400 bytes).
  • the difference between the length of the IP packet corresponding to the first TCP MSS value and the first TCP MSS value is 40 bytes, that is, the IPv4 header (20 bytes) + the TCP header (20 bytes)
  • the difference between the IP message length corresponding to the first TCP MSS value and the first TCP MSS value is 60 bytes, i.e. IPv6 head (40 bytes)+TCP head (20 bytes) ).
  • the set IP network is an Internet Protocol version IPv6 network.
  • the TCP client of the IPv6 network can adjust the TCP MSS when sending the ACK message, so as to avoid service damage in the subsequent data service stage.
  • the set IP network is an IPv4 network
  • the first ACK packet does not allow fragmentation.
  • the TCP client of the IPv4 network only adjusts the TCP MSS when sending the ACK message when the ACK message does not allow fragmentation, which also avoids causing traffic in the subsequent data service stage. damaged.
  • the first TCP MSS value is the smaller value of the TCP MSS value corresponding to the first PMTU value and the TCP advMSS value of the TCP server.
  • the smaller value of the TCP MSS value corresponding to the first PMTU value and the TCP advMSS value of the TCP server can be determined as the optimal TCP MSS value when sending the ACK message, This ensures that the ACK message is sent with the optimal TCP MSS value, which improves the efficiency of TCP MSS adjustment.
  • it also includes:
  • the failure can be detected in advance in the TCP three-way handshake phase, so as to avoid the client sending the complete data of the MSS payload length message after the three-way handshake establishes the TCP connection.
  • the service is discarded by the intermediate transmission node because the packet length is too large, and then the discarded packet is repeatedly retransmitted.
  • the number of retransmissions reaches the threshold and the chain is disconnected. After the three-way handshake is successful, the chain is disconnected again for the same reason. TCP communication performance.
  • it also includes:
  • the ICMP or ICMPv6 error message If an Internet Control Packet Protocol ICMP or ICMPv6 error message is received from the packet loss node, the ICMP or ICMPv6 error message carries the MTU value indicated by the packet loss node, and the packet loss node is the TCP An intermediate transmission node between the client and the TCP server, then according to the MTU value carried by the ICMP or ICMPv6 error message and the TCP advMSS value of the TCP client, the first TCP MSS value is adjusted, obtain the adjusted second TCP MSS value;
  • the message length of the first ACK message is adjusted to obtain a second ACK message, where the message length of the second ACK message is the second TCP MSS value Corresponding IP packet length;
  • the TCP MSS adjustment can be performed again, and the second ACK message is sent after the optimal second TCP MSS is determined.
  • the message length of the second ACK message is the length of the IP message corresponding to the second TCP MSS value, so that the TCP MSS adjustment is implemented in the TCP three-way handshake phase, and the service damage is avoided in the subsequent data service phase.
  • the MTU value indicated by the packet loss node in this implementation may be the MTU value of the interface of the packet loss node, which is related to the transmission direction, and the corresponding MTU values may be the same or different in different transmission directions.
  • the second TCP MSS value is the smaller value of the TCP MSS value corresponding to the second PMTU value and the TCP advMSS value of the TCP client;
  • the second PMTU value is a PMTU value obtained by the TCP client after updating the first PMTU value according to the MTU value carried in the ICMP or ICMPv6 error message.
  • the smaller value of the TCP MSS value corresponding to the second PMTU value and the TCP advMSS value of the TCP client can be determined as the optimal TCP MSS value when sending the ACK message, This ensures that the ACK message is sent with the optimal TCP MSS value, which further improves the efficiency of TCP MSS adjustment.
  • it also includes:
  • the failure can be detected in advance in the TCP three-way handshake phase, so as to avoid the client sending the complete MSS payload length packet data after the three-way handshake establishes the TCP connection.
  • the service is discarded by the intermediate transmission node because the packet length is too large, and then the discarded packet is repeatedly retransmitted.
  • the number of retransmissions reaches the threshold and the chain is disconnected. After the three-way handshake is successful, the chain is disconnected again for the same reason. TCP communication performance.
  • an embodiment of the present application provides a TCP MSS adjustment device, the device is used to set a transmission control protocol TCP server in an Internet Protocol IP network, including:
  • a receiving module configured to receive a synchronization sequence number SYN message from the TCP client, where the SYN message carries the TCP notification maximum message length advMSS value of the TCP client;
  • the MSS determination module is configured to determine the first TCP of the TCP server according to the TCP advMSS value of the TCP client and the detected, configured or default first path maximum transmission unit PMTU value of the TCP server MSS value;
  • the first message sending module is configured to send a first SYN-ACK message to the TCP client according to the first TCP MSS value, and the message length of the first SYN-ACK message is the first SYN-ACK message.
  • the IP message length corresponding to a TCP MSS value, the first SYN-ACK message carries the TCP advMSS value of the TCP server.
  • the set IP network is an Internet Protocol version IPv6 network.
  • the set IP network is an IPv4 network, and the first SYN-ACK packet does not allow fragmentation.
  • the first TCP MSS value is the smaller value of the TCP MSS value corresponding to the first PMTU value and the TCP advMSS value of the TCP client.
  • it also includes:
  • the first determining module is configured to, after sending the first SYN-ACK message to the TCP client according to the first TCP MSS value, if receiving an acknowledgment ACK message from the TCP client, determine the TCP The three-way handshake is successful, and data transmission is performed with the TCP client according to the first TCP MSS value.
  • it also includes:
  • the second determining module is configured to, after sending the first SYN-ACK message to the TCP client according to the first TCP MSS value, if no ACK message is received from the TCP client within a set time period , or receive the SYN message from the TCP client again, retransmit the first SYN-ACK message to the TCP client; if the number of retransmissions reaches the set threshold, it is determined that the TCP three-way handshake fails.
  • it also includes:
  • the MSS adjustment module is configured to, if receiving an Internet Control Message Protocol ICMP or ICMPv6 error message from the packet loss node, the ICMP or ICMPv6 error message carries the maximum transmission unit MTU value indicated by the packet loss node, the The packet loss node is an intermediate transmission node between the TCP server and the TCP client, then according to the MTU value carried by the ICMP or ICMPv6 error message and the TCP advMSS value of the TCP client, the A TCP MSS value is adjusted to obtain an adjusted second TCP MSS value;
  • a message adjustment module configured to adjust the message length of the first SYN-ACK message according to the second TCP MSS value to obtain a second SYN-ACK message, the second SYN-ACK message
  • the message length of the message is the IP message length corresponding to the second TCP MSS value
  • the second message sending module is configured to send the second SYN-ACK message to the TCP client, where the second SYN-ACK message carries the TCP advMSS value of the TCP server.
  • the second TCP MSS value is the smaller value of the TCP MSS value corresponding to the second PMTU value and the TCP advMSS value of the TCP client;
  • the second PMTU value is a PMTU value obtained by the TCP server after updating the first PMTU value according to the MTU value carried in the ICMP or ICMPv6 error message.
  • it also includes:
  • the third determining module is configured to, after sending the second SYN-ACK message to the TCP client, if receiving the ACK message from the TCP client, determine that the TCP three-way handshake is successful, and according to the The second TCP MSS value performs data transmission with the TCP client.
  • it also includes:
  • the fourth determination module is configured to, after sending the second SYN-ACK message to the TCP client, if the ACK message from the TCP client is not received within a set time, or the ACK message is received again from the TCP client For the SYN message of the TCP client, the second SYN-ACK message is retransmitted to the TCP client; if the number of retransmissions reaches the set threshold, it is determined that the TCP three-way handshake fails.
  • an embodiment of the present application provides a TCP MSS adjustment device, the device is used to set a transmission control protocol TCP client in an Internet Protocol IP network, and the device includes:
  • the first sending module is configured to send a synchronization sequence number SYN message to the TCP server, where the SYN message carries the TCP notification maximum message length advMSS value of the TCP client;
  • the determining module is configured to receive the synchronization sequence number confirmation SYN-ACK message from the TCP server, and the SYN-ACK message carries the TCP advMSS value of the TCP server, then according to the TCP server
  • a second sending module configured to send a first ACK message to the TCP server according to the first TCP MSS value, where the message length of the first ACK message is the length corresponding to the first TCP MSS value IP packet length.
  • the set IP network is an Internet Protocol version IPv6 network.
  • the set IP network is an IPv4 network
  • the first ACK packet does not allow fragmentation.
  • the first TCP MSS value is the smaller value of the TCP MSS value corresponding to the first PMTU value and the TCP advMSS value of the TCP server.
  • it also includes:
  • the first handshake failure determination module is configured to, after sending the first ACK message to the TCP server according to the first TCP MSS value, if the SYN-ACK from the TCP server is received again within a set time If the number of retransmissions reaches the set threshold, it is determined that the TCP three-way handshake fails.
  • it also includes:
  • the first adjustment module is configured to receive the Internet Control Message Protocol ICMP or ICMPv6 error message from the packet loss node, and the ICMP or ICMPv6 error message carries the maximum transmission unit MTU value indicated by the packet loss node.
  • the packet loss node is an intermediate transmission node between the TCP client and the TCP server, then according to the MTU value carried by the ICMP or ICMPv6 error message and the TCP advMSS value of the TCP client, the The first TCP MSS value is adjusted to obtain the adjusted second TCP MSS value;
  • the second adjustment module is configured to adjust the message length of the first ACK message according to the second TCP MSS value to obtain a second ACK message, the message length of the second ACK message is the IP message length corresponding to the second TCP MSS value;
  • the third sending module is configured to send the second ACK message to the TCP server.
  • the second TCP MSS value is the smaller value of the TCP MSS value corresponding to the second PMTU value and the TCP advMSS value of the TCP client;
  • the second PMTU value is a PMTU value obtained by the TCP client after updating the first PMTU value according to the MTU value carried in the ICMP or ICMPv6 error message.
  • it also includes:
  • the second handshake failure determination module is configured to, after sending the second ACK message to the TCP server, if the SYN-ACK message from the TCP server is received again within a set time, send the second ACK message to the TCP server.
  • the TCP server retransmits the second ACK message; if the number of retransmissions reaches a set threshold, it is determined that the TCP three-way handshake fails.
  • an embodiment of the present application provides a communication device, wherein the communication device includes: a processor, and the processor is coupled to a memory;
  • the memory for storing computer instructions
  • the processor is configured to execute the computer instructions such that the method of the first aspect is performed.
  • an embodiment of the present application provides a communication device, wherein the communication device includes: a processor, and the processor is coupled to a memory;
  • the memory for storing computer instructions
  • the processor is configured to execute the computer instructions such that the method of the second aspect is performed.
  • an embodiment of the present application provides a communication system, characterized in that it includes a TCP server, a TCP client, and one or more intermediate transmission nodes; wherein the TCP server is used to execute the first aspect The method; the TCP client is used to execute the method of the second aspect.
  • an embodiment of the present application provides a computer storage medium, wherein the computer storage medium includes computer instructions, and when the computer instructions are executed, the method described in the first aspect is executed.
  • an embodiment of the present application provides a computer storage medium, wherein the computer storage medium includes computer instructions, and when the computer instructions are executed, the method of the second aspect is executed.
  • an embodiment of the present application provides a computer program product, wherein the computer program product includes computer instructions, and when the computer instructions are executed, the method described in the first aspect is executed.
  • an embodiment of the present application provides a computer program product, wherein the computer program product includes computer instructions, and when the computer instructions are executed, the method described in the second aspect is executed.
  • an embodiment of the present application provides an apparatus, where the apparatus is configured to execute the methods described in the first aspect and the second aspect.
  • the TCP MSS adjustment method, device, and system provided by the embodiments of the present application can perform TCP MSS adjustment in the TCP three-way handshake stage, and determine to send TCP data with the optimal TCP MSS, so as to avoid service damage in the subsequent data service stage;
  • the packet cannot be fragmented, and the intermediate node does not reply with an ICMP error message or an ICMPv6 error message after discarding the oversized TCP packet to prompt the source to refresh the PMTU.
  • the data service that the end sends the complete MSS payload length message is discarded by the intermediate transmission node because the message length is too large, and then the discarded message is repeatedly retransmitted.
  • the number of retransmissions reaches the threshold and the link is disconnected.
  • the infinite loop of disconnection due to the same reason improves the TCP communication performance and the maintenance and testing efficiency.
  • FIG. 1 is a schematic diagram of a TCP three-way handshake scene
  • FIG. 2 is a schematic diagram of a TCP three-way handshake scenario
  • FIG. 3 is a schematic diagram of a TCP three-way handshake scenario provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a TCP three-way handshake scenario provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a TCP three-way handshake scenario provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a TCP three-way handshake scenario provided by an embodiment of the present application.
  • FIG. 7 is a schematic flowchart of a TCP MSS adjustment method provided by an embodiment of the present application.
  • FIG. 8 is a schematic flowchart of a TCP MSS adjustment method provided by an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of a TCP MSS adjustment device of a TCP server provided by an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of a TCP MSS adjustment device of a TCP client provided by an embodiment of the application;
  • FIG. 11 is a schematic structural diagram of a communication device of a TCP server provided by an embodiment of the application.
  • FIG. 12 is a schematic structural diagram of a communication apparatus of a TCP client according to an embodiment of the present application.
  • first and second are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implying the number of indicated technical features. Thus, a feature defined as “first” or “second” may expressly or implicitly include one or more of that feature.
  • the terms “including”, “including”, “having” and their variants mean “including but not limited to” unless specifically emphasized otherwise.
  • TCP is a connection-oriented, reliable, byte stream-based transport layer communication protocol formulated by IETF.
  • the TCP Three-way Handshake or "SYN, SYN-ACK, ACK" process can realize the TCP handshake chain building between two hosts. After the TCP byte stream channel is established between the two hosts, the application layer can pass the Connections enable data transfer.
  • the MTU Maximum Transmission Unit
  • the SYN, SYN-ACK, and ACK packets do not carry application layer data during the TCP three-way handshake process, so they are small packets.
  • the two communicating parties submit advMSS (Advertisement Maximum Segment Size, the maximum message length of the advertisement) to each other through a three-way handshake (through SYN, SYN-ACK messages), indicating the maximum TCP payload length that the local end can receive.
  • advMSS Advertisement Maximum Segment Size, the maximum message length of the advertisement
  • MTU and MRU are both bytes
  • MTU represents the maximum message length when sending
  • MRU represents the maximum received message length.
  • MTU equals MRU means that the MTU value and MRU value of some systems are exactly equal.
  • MSS Maximum Segment Size, maximum packet length
  • MSS MRU-IP (Internet Protocol, Internet Protocol) header length-TCP header length
  • the length of the IPv4 (Internet Protocol version 4, Internet Protocol version 4) header is 20 bytes
  • the length of the IPv6 header is 40 bytes (excluding the extension header, and the extension header is not involved here)
  • the TCP header is not Including option (optional) is a fixed length of 20 bytes.
  • TCP is a byte-oriented protocol
  • the TCP data sender always constructs a TCP packet to send in MSS units, resulting in the data payload of the TCP service almost always using the complete MSS payload. Length message is sent.
  • the MTU of an intermediate transmission node in the network is smaller than the length of the TCP packet, the service will be damaged (when the packet can be fragmented, the packet will be fragmented; when the packet cannot be fragmented, the packet will be fragmented.
  • the packet length described in this application is the sum of the IP header + the TCP header + the payload length, which will not be repeated in the following. For data packets with the DF bit set to 1, if the MTU value of the intermediate transmission node is less than the packet length, the transmitted data packets will be discarded. There are two situations:
  • ICMP Internet Control Message Protocol, Internet Control Message Protocol
  • ICMPDestination UnreachableMessage ICMP destination unreachable message
  • the packet with a length of 1400 bytes will continue to be discarded, and the packet retransmitted by HostA TCP will be discarded, resulting in the disconnection of the TCP connection between HostA and HostB.
  • the protocol stipulates that intermediate transmission nodes do not allow fragmentation of IPv6 packets.
  • the packet length described in this application is the sum of the IP header + the TCP header + the payload length, which will not be repeated in the following.
  • ICMPv6 PTB Packet Too Big, packet too large
  • the TCP source end retransmits the data packet. After the number of retransmissions reaches the threshold, the service chain is disconnected. The TCP source end re-enters the three-way handshake to establish the chain, and the cycle repeats.
  • HostA ie, host A
  • HostB ie, host B
  • HostA sends a message whose length is 2000 bytes.
  • the packet is discarded because the MTU of RouteA (that is, router A) is 1400, and TCP packet loss and retransmission occur, which in turn leads to the degradation of TCP performance;
  • HostA receives the ICMPv6 PTB error message (that is, the ICMPv6 Packet Too Big message) sent by RouteA. After that, adjust the packet length to 1400 bytes and continue to send data to HostB.
  • ICMPv6 PTB error message that is, an ICMPv6 Packet Too Big message
  • the TCP source needs to adjust the MSS and then resend the message. Packet loss and service quality impairment.
  • ICMP error message ie ICMPDestination UnreachableMessage
  • ICMPv6 error message ie ICMPv6Packet Too Big
  • the present application provides a TCP MSS adjustment method, device and device.
  • This application can be applied to the process of TCP three-way handshake and data transmission in IPv4 and IPv6 networks.
  • advMSS in the following embodiments is specifically TCPadvMSS; similarly, the MSS in each of the following embodiments is specifically TCPMSS, which will not be described in detail in the following.
  • FIG. 3 is a schematic diagram of a scenario in which an intermediate transfer node of an IPv4 network replies to an ICMP error message provided by an embodiment of the present application; as shown in FIG. 3 , for the TCP three-way handshake stage of an IPv4 network, HostA (that is, host A) is a TCP client, HostB (that is, host B) is the TCP server, and RouteA and RouterB are both intermediate transit nodes.
  • HostA that is, host A
  • HostB that is, host B
  • RouteA and RouterB are both intermediate transit nodes.
  • the MTU and MRU of HostA are 2000; the MTU and MRU of HostB are 1500; from HostA to HostB, the MTU of RouteA is 1400, and the MTU of RouterB is 1300; from HostB to HostA, the MTU of RouteA is 1300, The MTU of RouterB is 1600.
  • the length unit of each variable in FIG. 3 is byte, which is not shown in FIG. 3, and its specific implementation process may include:
  • HostA determines the local advMSS value.
  • MRU 2000
  • PMTU 2000
  • the PMTU here is the default value, which is equal to the MTU value of the sending interface of HostA.
  • HostB determines the local advMSS value.
  • MRU 1500
  • PMTU 1500
  • the PMTU here is the default value, which is equal to the MTU value of the sending interface of HostB.
  • HostB updates the PMTU and recalculates the MSS, thereby filling the SYN-ACK message.
  • PMTU 1300
  • HostA updates the PMTU and recalculates the MSS.
  • PMTU 2000
  • the PMTU here is still the default value, which is equal to the MTU value of the sending interface of HostA.
  • HostA sends a filled ACK packet to HostB.
  • HostA updates the PMTU and recalculates the MSS, thereby filling the ACK message.
  • PMTU 1400
  • HostA sends the refilled ACK message to HostB again.
  • PMTU 1300
  • HostA sends the filled ACK message to HostB again.
  • FIG. 4 is a schematic diagram of a scenario in which an intermediate transfer node of an IPv4 network does not reply to an ICMP error message provided by an embodiment of the present application; as shown in FIG. 4 , for the TCP three-way handshake phase of an IPv4 network, HostA (that is, host A) is a TCP client , HostB (that is, host B) is the TCP server, and RouteA and RouterB are both intermediate transit nodes.
  • HostA that is, host A
  • HostB that is, host B
  • RouteA and RouterB are both intermediate transit nodes.
  • the MRU and MTU of HostA are 2000; the MRU and MTU of HostB are 1500; from HostA to HostB, the MTU of RouteA is 1400, and the MTU of RouterB is 1300; from HostB to HostA, the MTU of RouteA is 1300, The MTU of RouterB is 1600.
  • the length unit of each variable in FIG. 4 is byte, which is not shown in FIG. 4, and its specific implementation process may include:
  • HostA determines the local advMSS value.
  • MRU 2000
  • PMTU 2000
  • the PMTU here is the default value, which is equal to the MTU value of the sending interface of HostA.
  • HostB determines the local advMSS value.
  • MRU 1500
  • PMTU 1500
  • the PMTU here is the default value, which is equal to the MTU value of the sending interface of HostB.
  • Figure 5 is similar to the above Figure 3
  • Figure 6 is similar to Figure 4, the difference is that Figure 3 and Figure 4 are for IPv4 networks, and the length of the IPv4 header + the length of the TCP header is 40 bytes;
  • FIG. 6 is for an IPv6 network, and the length of the IPv6 header + the length of the TCP header is 60 bytes; the specific implementation process will not be repeated.
  • TCP is an end-to-end transport layer protocol and is byte-oriented
  • the data forwarding stage must be large-packet transmission, which is reflected in the fact that TCP data packets are sent in MSS units.
  • MTU value of the intermediate transmission node in the end-to-end network is less than MSS plus 40 bytes (IPv4) or 60 bytes (IPv6)
  • IPv4 MSS plus 40 bytes
  • IPv6 60 bytes
  • the TCP three-way handshake phase fills in the SYN-ACK message and ACK message to detect and adapt to the transmission path in advance.
  • the smallest node enters the state of lossless data transmission in the data transmission stage. Otherwise, packet loss in the "slow start" state in the early stage of TCP data transmission will have a serious impact on the rapid rise of the TCP data service rate, especially for low-latency high-speed TCP. (Note: Different TCP congestion algorithms, different RTT (round-trip delay, Round-Trip Time) delays, and different minimum node networking will cause different business losses)
  • the TCP three-way handshake stage fills in the SYN-ACK packet and ACK packet, triggering packet loss in advance and causing TCP If the chain fails to be established, the fault will be moved forward. Otherwise, after the TCP chain is successfully established, the data forwarding phase will inevitably trigger the retransmission of TCP data packets with lost packets, and finally the chain will be disconnected when the maximum number of retransmissions is reached. And according to different RTT delay and maximum number of retransmissions configuration, it may take up to a minute between the successful establishment of the TCP chain and the disconnection of the TCP chain. This process is a "pseudo-normal" state in which TCP cannot transmit data, and may enter the upper-layer application. abnormal state.
  • FIG. 7 is a schematic flowchart of a TCP MSS adjustment method provided by an embodiment of the present application.
  • the TCP MSS adjustment method can be used to set the TCP server in the IP network, for example: Host B in any of the scenarios in FIG. 3 to FIG. 6 .
  • the set IP network may be an IPv4 network or an IPv6 network.
  • the TCP MSS adjustment method may include the following steps:
  • S71 Receive a SYN message from the TCP client, where the SYN message carries the TCP advMSS value of the TCP client.
  • the TCP client may be HostA in any of the scenarios in FIG. 3 to FIG. 6 .
  • the first PMTU value at this time may be the PMTU value detected by the TCP server before, or the manually configured PMTU value, or the default PMTU value of the TCP server.
  • Value that is, the MTU value of the sending interface of the TCP server.
  • the default PMTU value of Host B in any of the scenarios shown in FIG. 3 to FIG. 6 is 1500.
  • the TCP MSS value corresponding to the first PMTU value may be subtracted from the TCP advMSS value of the TCP client to obtain the first minimum value; according to the first minimum value , to determine the first TCP MSS value.
  • the difference between the first PMTU value and the TCP MSS value corresponding to the first PMTU value is 40 bytes; for the IPv6 network, the first PMTU value and the TCP MSS value corresponding to the first PMTU value are 40 bytes; The difference between MSS values is 60 bytes.
  • the message length of the first SYN-ACK message is the IP message length corresponding to the first TCP MSS value, and the first SYN-ACK message
  • the message carries the TCP advMSS value of the TCP server.
  • the generation method of the first SYN-ACK message may be specifically: Padding the SYN-ACK message according to the first TCP MSS value to obtain a first SYN-ACK message, the first SYN-ACK message
  • the packet length of the ACK packet is the IP packet length corresponding to the first TCP MSS value.
  • Padding means padding.
  • the padding value is all 0 bits, and other padding algorithms are also allowed, and the padding value is not all 0 bits.
  • IPv6 header 40 bytes
  • TCP header 20 bytes
  • Payload 40 bytes
  • the sent packet is as follows: IPv6 header (40 bytes) + TCP header (20 bytes) + Payload (40 bytes) + Padding (1400 bytes).
  • the difference between the length of the IP message corresponding to the first TCP MSS value and the first TCP MSS value is 40 bytes.
  • the TCP server sends the first SYN-ACK message to the TCP client, if it receives an ACK message from the TCP client, it determines that the TCP three-way handshake is successful, and communicates with the TCP client according to the first TCP MSS value. end for data transmission.
  • the TCP server sends the first SYN-ACK message to the TCP client, if the ACK message from the TCP client is not received within the set time, or the SYN message from the TCP client is received again, Then, the first SYN-ACK message is retransmitted to the TCP client; if the number of retransmissions reaches the set threshold, it is determined that the TCP three-way handshake fails.
  • the TCP MSS adjustment method may further include the following steps:
  • the ICMP or ICMPv6 error message carries the MTU value indicated by the packet loss node, and the packet loss node is an intermediate transmission node between the TCP server and the TCP client , then according to the MTU value carried by the ICMP or ICMPv6 error message and the TCP advMSS value of the TCP client, the first TCP MSS value is adjusted to obtain the adjusted second TCP MSS value.
  • the MTU value indicated by the packet loss node is the MTU value of the interface of the packet loss node, which is related to the transmission direction.
  • the corresponding MTU values may be the same or different in different transmission directions.
  • the MTU of RouteA is 1400, and the MTU of RouterB is 1300; in the direction from HostB to HostA, the MTU of RouteA is 1300, and the MTU of RouterB is 1300. is 1600.
  • the packet loss node may be one or more of RouteA and RouterB. For each packet loss node, after receiving the ICMP or ICMPv6 error message, the MSS value is adjusted to obtain the corresponding second TCP MSS value.
  • the TCP server when the TCP server adjusts the TCP MSS, it can update the PMTU value of the TCP server according to the MTU value in the ICMP error message sent by the packet loss node to obtain the updated second PMTU value;
  • the TCP MSS value corresponding to the two PMTU values is subtracted from the TCP advMSS value of the TCP client to obtain the second minimum value; the second TCP MSS value is determined according to the second minimum value.
  • the difference between the second PMTU value and the TCP MSS value corresponding to the second PMTU value is 40 bytes; for the IPv6 network, the second PMTU value and the TCP MSS value corresponding to the second PMTU value The difference is 60 bytes.
  • the TCP server sends the second SYN-ACK message to the TCP client, if it receives the ACK message returned by the TCP client, it is determined that the TCP three-way handshake is successful, and according to the first TCP MSS value and the TCP client for data transfer.
  • the TCP server sends the second SYN-ACK packet to the TCP client
  • the ACK packet sent by the TCP client is not received within the set time, or the SYN retransmitted by the TCP client is received message, retransmit the second SYN-ACK message to the TCP client; if the number of retransmissions reaches the set threshold, it is determined that the TCP three-way handshake fails.
  • the packet loss node involved in the above S74 to S76 is an intermediate transmission node between the TCP server and the TCP client. If the TCP server receives the ICMP or ICMPv6 error message sent by the first packet loss node, the TCP server According to the MTU in the ICMP or ICMPv6 error message sent by the first packet loss node, the above steps S74 to S76 to adjust the MSS will be performed; similarly, if the TCP server receives the ICMP or ICMPv6 sent by the second packet loss node again The error message indicates that there is a smaller MTU between the TCP server and the TCP client.
  • the TCP server will continue to repeat the above S74 to S76 adjustment according to the MTU in the ICMP or ICMPv6 error message sent by the second packet loss node.
  • the MTU in the error message continues to repeat the steps of adjusting the MSS from S74 to S76, which will not be repeated here.
  • the TCP server can adjust the TCP MSS in the TCP three-way handshake phase, and determine the optimal sending TCP MSS to avoid service damage in the subsequent data service phase; even if the intermediate transmission node does not reply to the ICMP or ICMPv6 error message.
  • the fault can also be found in advance in the TCP three-way handshake phase, so as to avoid that after the three-way handshake establishes the TCP connection, the data service of the client sending the complete MSS payload length message is discarded by the intermediate transmission node because the message length is too large, and then the data service is repeatedly retransmitted. The packet is discarded, the number of retransmissions reaches the threshold and the chain is disconnected, and then after the successful three-way handshake, the chain is disconnected again for the same reason in an infinite loop, which improves the TCP communication performance.
  • FIG. 8 is a schematic flowchart of a TCP MSS adjustment method provided by an embodiment of the present application.
  • the TCP MSS adjustment method can be used to set the TCP client in the IP network, for example: HostA in any scenario of FIG. 3 to FIG. 6 .
  • the set IP network may be an IPv4 network or an IPv6 network.
  • the TCP MSS adjustment method may include the following steps:
  • S81 Send a SYN message to the TCP server, where the SYN message carries the TCP advMSS value of the TCP client.
  • the TCP server may be HostB in any of the scenarios in FIG. 3 to FIG. 6 .
  • the SYN-ACK message If a SYN-ACK message from the TCP server is received, and the SYN-ACK message carries the TCP advMSS value of the TCP server, according to the TCP advMSS value of the TCP server and the detected, configured or The default first PMTU value, which determines the first TCP MSS value of the TCP client.
  • the SYN-ACK packet received by the TCP client may be the first SYN-ACK packet sent by the TCP client, and the first SYN-ACK packet carries the TCP advMSS value of the TCP server; it may also be a TCP
  • the second SYN-ACK packet sent by the client, the second SYN-ACK packet carries the TCP advMSS value of the TCP server.
  • the first SYN-ACK message is a SYN-ACK message obtained after the TCP server receives the SYN message and performs TCP MSS adjustment according to the detected, configured or default first PMTU value of the local end;
  • a SYN-ACK message is the SYN-ACK message obtained after the TCP server receives the MTU indicated by the packet loss node, obtains the updated PMTU value according to the indicated MTU, and performs TCP MSS adjustment according to the updated PMTU value.
  • the first PMTU value may be a PMTU value detected by the TCP client before, a manually configured PMTU value, or a default PMTU value of the TCP client, that is, the MTU value of the sending interface of the TCP client.
  • the default PMTU value of HostA in any of the scenarios shown in FIG. 3 to FIG. 6 is 2000.
  • the TCP MSS value corresponding to the first PMTU value may be subtracted from the TCP advMSS value of the TCP server to obtain the first minimum value; The minimum value, determines the first TCP MSS value.
  • the difference between the first PMTU value and the TCP MSS value corresponding to the first PMTU value is 40 bytes; for the IPv6 network, the first PMTU value and the TCP MSS value corresponding to the first PMTU value are 40 bytes; The difference between MSS values is 60 bytes.
  • the difference between the length of the IP packet corresponding to the first TCP MSS value and the first TCP MSS value is 40 bytes.
  • the TCP client sends the first ACK message to the TCP server, if it receives a SYN-ACK message from the TCP server again within the set time, it retransmits the first ACK message to the TCP server. If the number of retransmissions reaches the set threshold, it is determined that the TCP three-way handshake fails.
  • the TCP MSS adjustment method may further include the following steps:
  • the ICMP or ICMPv6 error message If an ICMP or ICMPv6 error message from the packet loss node is received, the ICMP or ICMPv6 error message carries the MTU value indicated by the packet loss node, and the packet loss node is an intermediate transmission node between the TCP client and the TCP server. Then, according to the MTU value carried by the ICMP or ICMPv6 error message and the TCP advMSS value of the TCP client, the first TCP MSS value is adjusted to obtain the adjusted second TCP MSS value.
  • the MTU value indicated by the packet loss node is the MTU value of the interface of the packet loss node, which is related to the transmission direction.
  • the corresponding MTU values may be the same or different in different transmission directions.
  • the MTU of RouteA in the direction from HostA to HostB, the MTU of RouteA is 1400, and the MTU of RouterB is 1300; in the direction from HostB to HostA, the MTU of RouteA is 1300, and the MTU of RouterB is 1300. is 1600.
  • the TCP client when the TCP client adjusts the TCP MSS, it can update the PMTU value of the TCP client according to the MTU value indicated by the packet loss node to obtain the updated second PMTU value;
  • the TCP MSS value is calculated with the TCP advMSS value of the TCP server to obtain the second minimum value; according to the second minimum value, the second TCP MSS value is determined.
  • the difference between the second PMTU value and the TCP MSS value corresponding to the second PMTU value is 40 bytes; for the IPv6 network, the second PMTU value and the TCP MSS value corresponding to the second PMTU value The difference is 60 bytes.
  • the TCP client sends the second ACK message to the TCP server, if it receives a SYN-ACK message from the TCP server again within the set time, it retransmits the second ACK message to the TCP server. If the number of retransmissions reaches the set threshold, it is determined that the TCP three-way handshake fails.
  • the TCP client After the TCP client sends a SYN message to the TCP server, if it does not receive a SYN-ACK message from the TCP server within the set time, it will retransmit the SYN message to the TCP client; If the number of transmissions reaches the set threshold, it is determined that the TCP three-way handshake fails.
  • the packet loss node involved in the above S84 to S86 is for any intermediate transmission node between the TCP client and the TCP server. If the TCP client receives the ICMP or ICMPv6 error message sent by the first packet loss node, the TCP client The client will perform the above steps S84 to S86 to adjust the MSS according to the MTU in the ICMP or ICMPv6 error message sent by the first packet loss node; similarly, if the TCP client receives the ICMP or ICMPv6 error message sent by the second packet loss node again The ICMPv6 error message indicates that there is a smaller MTU between the TCP client and the TCP server.
  • the TCP client will continue to repeat the above S84 to S86 according to the MTU in the ICMP or ICMPv6 error message sent by the second packet loss node. Steps to adjust the MSS; and so on, there may be a third packet loss node, a fourth packet loss node, etc. between the TCP client and the TCP server.
  • the MTU in the ICMPv6 error message continues to repeat the above steps of S84 to S86 for adjusting the MSS, which will not be repeated here.
  • the TCP client can adjust the TCP MSS in the TCP three-way handshake phase to determine the optimal sending TCP MSS to avoid service damage in the subsequent data service phase; even if the intermediate transmission node does not reply to the ICMP or ICMPv6 error message.
  • the fault can also be found in advance in the TCP three-way handshake phase, so as to avoid that after the three-way handshake establishes the TCP connection, the data service of the client sending the complete MSS payload length message is discarded by the intermediate transmission node because the message length is too large, and then the data service is repeatedly retransmitted. Discarded packets reach the maximum number of retransmissions and the chain is disconnected. After the three-way handshake is successful, the chain is disconnected again due to the same reason. The infinite loop improves the TCP communication performance.
  • FIG. 9 is a schematic structural diagram of a TCP MSS adjustment device of a TCP server provided by an embodiment of the present application.
  • the TCP MSS adjustment device can be used to set the TCP server in the IP network, such as: HostB in any scenario of FIG. 3 to FIG. 6 .
  • the set IP network may be an IPv4 network or an IPv6 network. Especially when the IP network is set as an IPv4 network, fragmentation of SYN-ACK packets and ACK packets in the TCP three-way handshake phase is not allowed, that is, the DF bit needs to be set to 1.
  • the TCP MSS adjustment device may include:
  • the receiving module 91 is configured to receive the synchronization sequence number SYN message from the TCP client, and the SYN message carries the TCP advertisement maximum message length advMSS value of the TCP client;
  • the MSS determination module 92 is configured to determine the first path maximum transmission unit PMTU value of the TCP server according to the TCP advMSS value of the TCP client and the detected, configured or default first path maximum transmission unit PMTU value of the TCP server. TCP MSS value;
  • the first message sending module 93 is configured to send a first SYN-ACK message to the TCP client according to the first TCP MSS value, and the message length of the first SYN-ACK message is the The IP message length corresponding to the first TCP MSS value, and the first SYN-ACK message carries the TCP advMSS value of the TCP server.
  • the set IP network is an Internet Protocol version IPv6 network.
  • the set IP network is an IPv4 network, and the first SYN-ACK packet does not allow fragmentation.
  • the first TCP MSS value is the smaller value of the TCP MSS value corresponding to the first PMTU value and the TCP advMSS value of the TCP client.
  • the TCP MSS adjustment device may further include:
  • the first determining module is configured to, after sending the first SYN-ACK message to the TCP client according to the first TCP MSS value, if receiving an acknowledgment ACK message from the TCP client, determine the TCP The three-way handshake is successful, and data transmission is performed with the TCP client according to the first TCP MSS value.
  • the TCP MSS adjustment device may further include:
  • the second determining module is configured to, after sending the first SYN-ACK message to the TCP client according to the first TCP MSS value, if no ACK message is received from the TCP client within a set time period , or receive the SYN message from the TCP client again, retransmit the first SYN-ACK message to the TCP client; if the number of retransmissions reaches the set threshold, it is determined that the TCP three-way handshake fails.
  • the TCP MSS adjustment device may further include:
  • the MSS adjustment module is configured to, if receiving an Internet Control Message Protocol ICMP or ICMPv6 error message from the packet loss node, the ICMP or ICMPv6 error message carries the maximum transmission unit MTU value indicated by the packet loss node, the The packet loss node is an intermediate transmission node between the TCP server and the TCP client, then according to the MTU value carried by the ICMP or ICMPv6 error message and the TCP advMSS value of the TCP client, the A TCP MSS value is adjusted to obtain an adjusted second TCP MSS value;
  • a message adjustment module configured to adjust the message length of the first SYN-ACK message according to the second TCP MSS value to obtain a second SYN-ACK message, the second SYN-ACK message
  • the message length of the message is the IP message length corresponding to the second TCP MSS value
  • the second message sending module is configured to send the second SYN-ACK message to the TCP client, where the second SYN-ACK message carries the TCP advMSS value of the TCP server.
  • the second TCP MSS value is the smaller value of the TCP MSS value corresponding to the second PMTU value and the TCP advMSS value of the TCP client;
  • the second PMTU value is a PMTU value obtained by the TCP server after updating the first PMTU value according to the MTU value carried in the ICMP or ICMPv6 error message.
  • the TCP MSS adjustment device may further include:
  • the third determining module is configured to, after sending the second SYN-ACK message to the TCP client, if receiving the ACK message from the TCP client, determine that the TCP three-way handshake is successful, and according to the The second TCP MSS value performs data transmission with the TCP client.
  • the TCP MSS adjustment device may further include:
  • the fourth determination module is configured to, after sending the second SYN-ACK message to the TCP client, if the ACK message from the TCP client is not received within a set time, or the ACK message is received again from the TCP client For the SYN message of the TCP client, the second SYN-ACK message is retransmitted to the TCP client; if the number of retransmissions reaches the set threshold, it is determined that the TCP three-way handshake fails.
  • the above-mentioned device is used to execute the TCP MSS adjustment method for the TCP server in the above-described embodiment, and the corresponding program module in the device, its realization principle and technical effect are the same as those used in the TCP MSS adjustment method for the TCP server.
  • the description of the device is similar, and the working process of the device can refer to the corresponding process in the above-mentioned TCP MSS adjustment method for the TCP server, which will not be repeated here.
  • FIG. 10 is a schematic structural diagram of a TCPMSS adjustment apparatus of a TCP client according to an embodiment of the present application.
  • the TCP MSS adjustment device can set the TCP client in the IP network, such as: HostA in any scenario of FIG. 3 to FIG. 6 .
  • the set IP network may be an IPv4 network or an IPv6 network.
  • the TCP MSS adjustment device may include:
  • the first sending module 101 is configured to send a synchronization sequence number SYN message to the TCP server, where the SYN message carries the TCP notification maximum message length advMSS value of the TCP client;
  • the determining module 102 is configured to receive a synchronization sequence number confirmation SYN-ACK message from the TCP server, and the SYN-ACK message carries the TCP advMSS value of the TCP server, then according to the TCP service
  • the second sending module 103 is configured to send a first ACK message to the TCP server according to the first TCP MSS value, and the message length of the first ACK message is the length corresponding to the first TCP MSS value IP packet length.
  • the set IP network is an Internet Protocol version IPv6 network.
  • the set IP network is an IPv4 network, and the first ACK packet does not allow fragmentation.
  • the first TCP MSS value is the smaller value of the TCP MSS value corresponding to the first PMTU value and the TCP advMSS value of the TCP server.
  • the TCP MSS adjustment device may further include:
  • the first handshake failure determination module is configured to, after sending the first ACK message to the TCP server according to the first TCP MSS value, if the SYN-ACK from the TCP server is received again within a set time If the number of retransmissions reaches the set threshold, it is determined that the TCP three-way handshake fails.
  • the TCP MSS adjustment device may further include:
  • the first adjustment module is configured to receive the Internet Control Message Protocol ICMP or ICMPv6 error message from the packet loss node, and the ICMP or ICMPv6 error message carries the maximum transmission unit MTU value indicated by the packet loss node.
  • the packet loss node is an intermediate transmission node between the TCP client and the TCP server, then according to the MTU value carried by the ICMP or ICMPv6 error message and the TCP advMSS value of the TCP client, the The first TCP MSS value is adjusted to obtain the adjusted second TCP MSS value;
  • the second adjustment module is configured to adjust the message length of the first ACK message according to the second TCP MSS value to obtain a second ACK message, the message length of the second ACK message is the IP message length corresponding to the second TCP MSS value;
  • the third sending module is configured to send the second ACK message to the TCP server.
  • the second TCP MSS value is the smaller value of the TCP MSS value corresponding to the second PMTU value and the TCP advMSS value of the TCP client;
  • the second PMTU value is a PMTU value obtained by the TCP client after updating the first PMTU value according to the MTU value carried in the ICMP or ICMPv6 error message.
  • the TCP MSS adjustment device may further include:
  • the second handshake failure determination module is configured to, after sending the second ACK message to the TCP server, if the SYN-ACK message from the TCP server is received again within a set time, send the second ACK message to the TCP server.
  • the TCP server retransmits the second ACK message; if the number of retransmissions reaches a set threshold, it is determined that the TCP three-way handshake fails.
  • the above-mentioned device is used to execute the TCP MSS adjustment method for the TCP client in the above-described embodiment, and the corresponding program module in the device, its realization principle and technical effect are the same as those used in the TCP MSS adjustment method for the TCP client.
  • the description of the device is similar, and the working process of the device can refer to the corresponding process in the above-mentioned TCP MSS adjustment method for the TCP client, which will not be repeated here.
  • FIG. 11 is a schematic structural diagram of a communication device for a TCP server provided by an embodiment of the application, and the communication device can be used to set a TCP server in an IP network, for example: any scenario in FIG. 3 to FIG. 6 HostB in .
  • the TCP server may be any type of communication device such as a terminal and a base station, which is not limited in this embodiment.
  • the set IP network may be an IPv4 network or an IPv6 network. Especially when the IP network is set as an IPv4 network, fragmentation of SYN-ACK packets and ACK packets in the TCP three-way handshake phase is not allowed, that is, the DF bit needs to be set to 1.
  • Figure 11 illustrates the main components of the communication device of the TCP server, as shown in Figure 11:
  • the communication device of the TCP server includes at least one processor 1111 , at least one transmission medium 1112 and at least one memory 1113 .
  • the processor 1111 , the memory 1113 and the transmission medium 1112 are connected.
  • the processor 1111 is mainly used to process communication protocols and communication data, control the entire communication device, execute software programs, and process data of the software programs.
  • the communication apparatus may include a baseband processor and a central processing unit.
  • the baseband processor is mainly used to process communication protocols and communication data.
  • the central processing unit is mainly used to control the entire communication device, execute software programs, and process data of the software programs.
  • the processor 1111 in FIG. 11 may integrate the functions of a baseband processor and a central processing unit.
  • the baseband processor and the central processing unit may also be independent processors, interconnected by technologies such as a bus.
  • the communication device may include multiple baseband processors to adapt to different network standards, the communication device may include multiple central processors to enhance its processing capability, and each component of the communication device may connected via various buses.
  • the baseband processor may also be expressed as a baseband processing circuit or a baseband processing chip.
  • the central processing unit can also be expressed as a central processing circuit or a central processing chip.
  • the function of processing the communication protocol and communication data may be built in the processor, or may be stored in the memory in the form of a software program, and the processor executes the software program to realize the baseband processing function.
  • the memory 1113 is mainly used to store software programs and data.
  • the memory 1113 may exist independently and be connected to the processor 1111 .
  • the memory 1113 may be integrated with the processor 1111, for example, integrated within a chip, that is, an on-chip memory, or the memory 1113 may be an independent storage element, which is not limited in this embodiment of the present application.
  • the memory 1113 can store program codes for implementing the technical solutions of the embodiments of the present application, and is controlled and executed by the processor 1111 .
  • the transmission medium 1112 may be any type of transmission medium, such as wireless, optical fiber, twisted pair, and coaxial cable, which is not limited in this embodiment.
  • HostB in any of the scenarios in FIG. 3 to FIG. 6 can communicate with RouterB in a wireless manner (for example, a transceiver), or communicate with RouterB in a wired manner (for example, optical fiber, twisted pair, coaxial cable, etc.) RouterB communicates.
  • the transmission medium 1112 may be a transceiver and an antenna.
  • the transceiver can be used for the conversion of baseband signal and radio frequency signal and the processing of radio frequency signal, and the transceiver can be connected with the antenna.
  • the transceiver includes a transmitter (transmitter, Tx) and a receiver (receiver, Rx).
  • one or more antennas can receive radio frequency signals
  • the receiver Rx of the transceiver is configured to receive the radio frequency signals from the antennas, convert the radio frequency signals into digital baseband signals or digital intermediate frequency signals, and convert the digital baseband signals Or the digital intermediate frequency signal is provided to the processor 1111, so that the processor 1111 performs further processing on the digital baseband signal or the digital intermediate frequency signal, such as demodulation processing and decoding processing.
  • the transmitter Tx in the transceiver is used to receive the modulated digital baseband signal or digital intermediate frequency signal from the processor 1111, convert the modulated digital baseband signal or digital intermediate frequency signal into a radio frequency signal, and pass one or more antennas to transmit the radio frequency signal.
  • the receiver Rx can selectively perform one or more stages of down-mixing processing and analog-to-digital conversion processing on the radio frequency signal to obtain a digital baseband signal or a digital intermediate frequency signal.
  • the order of precedence is adjustable.
  • the transmitter Tx can selectively perform one or more stages of up-mixing processing and digital-to-analog conversion processing on the modulated digital baseband signal or digital intermediate frequency signal to obtain a radio frequency signal, and the up-mixing processing and digital-to-analog conversion processing
  • the sequence of s is adjustable.
  • Digital baseband signals and digital intermediate frequency signals can be collectively referred to as digital signals.
  • the transmitter Tx and the receiver Rx may be implemented by different physical structures/circuits, or may be implemented by the same physical structure/circuit, that is, the transmitter Tx and the receiver Rx may be inherited together.
  • a transceiver may also be referred to as a transceiver unit, a transceiver, a transceiver, or the like.
  • the device used to implement the receiving function in the transceiver unit may be regarded as a receiving unit
  • the device used to implement the transmitting function in the transceiver unit may be regarded as a transmitting unit, that is, the transceiver unit includes a receiving unit and a transmitting unit, and the receiving unit also It can be called a receiver, an input port, a receiving circuit, etc.
  • the sending unit can be called a transmitter, a transmitter, or a transmitting circuit, etc.
  • a combination of Tx, Rx and antenna can be used as a transceiver.
  • FIG. 12 is a schematic structural diagram of a communication device for a TCP client provided by an embodiment of the present application, which is used to set a TCP client in an IP network, such as HostA in any of the scenarios in FIGS. 3 to 6 .
  • the TCP client may be any type of communication device such as a terminal and a base station, which is not limited in this embodiment.
  • the set IP network may be an IPv4 network or an IPv6 network. Especially when the IP network is set as an IPv4 network, fragmentation of SYN-ACK packets and ACK packets in the TCP three-way handshake phase is not allowed, that is, the DF bit needs to be set to 1.
  • FIG. 12 illustrates the main components of the communication device of the TCP client, as shown in FIG. 12 :
  • the communication device of the TCP client includes at least one processor 1211 , at least one transmission medium 1212 and at least one memory 1213 .
  • the processor 1211, the memory 1213 and the transmission medium 1212 are connected.
  • the processor 1211 is mainly used to process communication protocols and communication data, control the entire communication device, execute software programs, and process data of the software programs.
  • the communication apparatus may include a baseband processor and a central processing unit.
  • the baseband processor is mainly used to process communication protocols and communication data.
  • the central processing unit is mainly used to control the entire communication device, execute software programs, and process data of the software programs.
  • the processor 1211 in FIG. 12 may integrate the functions of a baseband processor and a central processing unit.
  • the baseband processor and the central processing unit may also be independent processors, interconnected by technologies such as a bus.
  • the communication device may include multiple baseband processors to adapt to different network standards, the communication device may include multiple central processors to enhance its processing capability, and each component of the communication device may connected via various buses.
  • the baseband processor can also be expressed as a baseband processing circuit or a baseband processing chip.
  • the central processing unit can also be expressed as a central processing circuit or a central processing chip.
  • the function of processing the communication protocol and communication data may be built in the processor, or may be stored in the memory in the form of a software program, and the processor executes the software program to realize the baseband processing function.
  • the memory 1213 is mainly used to store software programs and data.
  • the memory 1213 may exist independently and be connected to the processor 1211 .
  • the memory 1213 may be integrated with the processor 1211, for example, integrated within a chip, that is, an on-chip memory, or the memory 1213 is an independent storage element, which is not limited in this embodiment of the present application.
  • the memory 1213 can store program codes for implementing the technical solutions of the embodiments of the present application, and is controlled and executed by the processor 1211 .
  • the transmission medium 1212 may be any type of transmission medium such as wireless, optical fiber, twisted pair, and coaxial cable, which is not limited in this embodiment.
  • HostA in any of the scenarios shown in FIG. 3 to FIG. 6 may communicate with RouterA in a wireless manner (for example, a transceiver), or communicate with RouterA in a wired manner (for example, optical fiber, twisted pair, coaxial cable, etc.). RouterA communicates.
  • the transmission medium 1212 may be a transceiver and an antenna.
  • the transceiver can be used for the conversion of baseband signal and radio frequency signal and the processing of radio frequency signal, and the transceiver can be connected with the antenna.
  • the transceiver includes a transmitter (transmitter, Tx) and a receiver (receiver, Rx).
  • one or more antennas can receive radio frequency signals
  • the receiver Rx of the transceiver is configured to receive the radio frequency signals from the antennas, convert the radio frequency signals into digital baseband signals or digital intermediate frequency signals, and convert the digital baseband signals Or the digital intermediate frequency signal is provided to the processor 1211, so that the processor 1211 performs further processing on the digital baseband signal or the digital intermediate frequency signal, such as demodulation processing and decoding processing.
  • the transmitter Tx in the transceiver is used to receive the modulated digital baseband signal or digital intermediate frequency signal from the processor 1211, convert the modulated digital baseband signal or digital intermediate frequency signal into a radio frequency signal, and pass one or more antennas to transmit the radio frequency signal.
  • the receiver Rx can selectively perform one or more stages of down-mixing processing and analog-to-digital conversion processing on the radio frequency signal to obtain a digital baseband signal or a digital intermediate frequency signal.
  • the order of precedence is adjustable.
  • the transmitter Tx can selectively perform one or more stages of up-mixing processing and digital-to-analog conversion processing on the modulated digital baseband signal or digital intermediate frequency signal to obtain a radio frequency signal, and the up-mixing processing and digital-to-analog conversion processing
  • the sequence of s is adjustable.
  • Digital baseband signals and digital intermediate frequency signals can be collectively referred to as digital signals.
  • the transmitter Tx and the receiver Rx may be implemented by different physical structures/circuits, or may be implemented by the same physical structure/circuit, that is, the transmitter Tx and the receiver Rx may be inherited together.
  • a transceiver may also be referred to as a transceiver unit, a transceiver, a transceiver, or the like.
  • the device used to implement the receiving function in the transceiver unit may be regarded as a receiving unit
  • the device used to implement the transmitting function in the transceiver unit may be regarded as a transmitting unit, that is, the transceiver unit includes a receiving unit and a transmitting unit, and the receiving unit also It can be called a receiver, an input port, a receiving circuit, etc.
  • the sending unit can be called a transmitter, a transmitter, or a transmitting circuit, etc.
  • a combination of Tx, Rx and antenna can be used as a transceiver.
  • the embodiment of the present application also provides a communication system, including a TCP server, a TCP client, and one or more intermediate transmission nodes; wherein, the TCP server can execute a TCP MSS adjustment method for the TCP server; the TCP client A TCP MSS adjustment method for TCP clients can be performed.
  • the embodiment of the present application also provides a computer storage medium, the computer storage medium includes computer instructions, when the computer instructions are run on the TCP server, so that the TCP server can execute the TCP MSS adjustment method for the TCP server side.
  • the embodiment of the present application also provides a computer storage medium, the computer storage medium includes computer instructions, when the computer instructions are run on the TCP client, the TCP client can execute the TCP MSS adjustment method for the TCP client side.
  • the embodiment of the present application also provides a computer program product, the computer program product includes computer instructions, when the computer instructions run on the TCP server, the TCP server can execute the TCP MSS adjustment method for the TCP server side.
  • the embodiment of the present application also provides a computer program product, the computer program product includes computer instructions, when the computer instructions run on the TCP client, the TCP client can execute the TCP MSS adjustment method for the TCP client side.
  • the embodiment of the present application also provides an apparatus for executing the TCP MSS adjustment method for the TCP server side and the TCP MSS adjustment method for the TCP client side.
  • processor in the embodiments of the present application may be a central processing unit (central processing unit, CPU), and may also be other general-purpose processors, digital signal processors (digital signal processors, DSP), application-specific integrated circuits (application specific integrated circuit, ASIC), field programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof.
  • CPU central processing unit
  • DSP digital signal processors
  • ASIC application specific integrated circuit
  • FPGA field programmable gate array
  • a general-purpose processor may be a microprocessor or any conventional processor.
  • the method steps in the embodiments of the present application may be implemented in a hardware manner, or may be implemented in a manner in which a processor executes software instructions.
  • Software instructions can be composed of corresponding software modules, and software modules can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (programmable rom) , PROM), erasable programmable read-only memory (erasable PROM, EPROM), electrically erasable programmable read-only memory (electrically EPROM, EEPROM), registers, hard disks, removable hard disks, CD-ROMs or known in the art in any other form of storage medium.
  • An exemplary storage medium is coupled to the processor, such that the processor can read information from, and write information to, the storage medium.
  • the storage medium can also be an integral part of the processor.
  • the processor and storage medium may reside in an ASIC.
  • the above-mentioned embodiments it may be implemented in whole or in part by software, hardware, firmware or any combination thereof.
  • 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, all or part of the processes or functions described in the embodiments of the present application are generated.
  • the computer may be a general purpose computer, special purpose computer, computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted over a computer-readable storage medium.
  • the computer instructions can be sent from one website site, computer, server, or data center to another website site by wire (eg, coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.) , computer, server or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media.
  • the usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state disks (SSDs)), and the like.

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请提供了一种TCP MSS调整方法、装置及系统,该方法包括:接收TCP客户端发送的SYN报文,SYN报文中携带有TCP客户端的TCP advMSS值;根据TCP advMSS值,以及TCP服务端探测到的、配置的或者默认的第一PMTU值,确定TCP服务端的第一TCP MSS值;根据第一TCP MSS值向TCP客户端发送第一SYN-ACK报文,第一SYN-ACK报文的报文长度为第一TCP MSS值对应的IP报文长度,第一SYN-ACK报文中携带有TCP服务端的TCP advMSS值,从而提高了TCP通信性能和维测效率。

Description

一种TCP MSS调整方法、装置及系统 技术领域
本申请涉及通信领域,特别涉及一种TCP MSS调整方法、装置及系统。
背景技术
TCP(Transmission Control Protocol,传输控制协议)是国际互联网工程任务组(The Internet Engineering Task Force,简称IETF)制定的一种面向连接的、可靠的、基于字节流的传输层通信协议。TCP三次握手(Three-way Handshake)或“SYN(Synchronize,同步序列编号),SYN-ACK(Acknowledge,确认),ACK”过程可以实现两个主机间TCP握手建链,两主机间完成TCP字节流通道的建链后,应用层可以通过该连接实现数据传输。
由于TCP是面向字节的协议,当TCP发送窗口缓存的字节足够多时,TCP数据发送端总是以MSS(Maximum Segment Size,最大报文长度)为单位构造TCP报文发送,导致TCP业务的数据载荷几乎总是以完整的MSS载荷长度报文发送。但是,当网络中存在中间传输节点的MTU(Maximum Transmission Unit,最大传输单元)小于TCP报文长度(包括TCP头部和IP头部)时,会导致业务受损(当报文可被分片时,报文则被分片处理;当报文不可被分片时,则丢弃,丢弃节点并向源发送ICMP错误消息或者ICMPv6错误消息通知丢弃接口的MTU);或者,更恶劣的情况是,中间传输节点不回复ICMP(Internet Control Message Protocol,互联网控制报文协议)错误消息,TCP数据发送端无法更新PMTU(PathMaximum Transmission Unit,路径最大传输单元),则导致超大报文持续在中间传输节点丢包,最终导致TCP连接断开。对于基于TCP的上层应用,面对TCP连接的反复重建和断开,可能进入异常状态。
发明内容
本申请实施例提供了一种TCP MSS调整方法及设备,可以在TCP三次握手阶段进行TCP MSS调整,确定以最优的TCP MSS发送TCP报文,避免在后续数据业务阶段导致业务受损;即使TCP报文不可被分片,且中间节点丢弃超大TCP报文后不回复ICMP错误消息或者ICMPv6错误消息提示源刷新PMTU,也可以在TCP三次握手阶段提前发现故障,避免三次握手建立TCP连接后,客户端发送完整的MSS载荷长度报文的数据业务因报文长度过大被中间传输节点丢弃,随后反复重传该丢弃报文达到最大重传次数而断链,随后再次三次握手成功后,再次因相同原因而断链的死循环,提高了TCP通信性能和维测效率。
第一方面,本申请实施例提供了一种所述TCP MSS调整方法,所述方法用于设定互联网协议IP网络中的传输控制协议TCP服务端,包括:
接收来自TCP客户端的同步序列编号SYN报文,所述SYN报文中携带有所述 TCP客户端的TCP通告最大报文长度advMSS值;
根据所述TCP客户端的TCP advMSS值,以及所述TCP服务端探测到的、配置的或者默认的第一路径最大传输单元PMTU值,确定所述TCP服务端的第一TCP MSS值;
根据所述第一TCP MSS值向所述TCP客户端发送第一SYN-ACK报文,所述第一SYN-ACK报文的报文长度为所述第一TCP MSS值对应的IP报文长度,所述第一SYN-ACK报文中携带有所述TCP服务端的TCP advMSS值。
也就是说,TCP服务端接收到来自TCP客户端的SYN报文后,不是直接回复SYN-ACK报文,而是进行TCP MSS调整,等到确定最优的第一TCP MSS后发送第一SYN-ACK报文,该第一SYN-ACK报文的报文长度为第一TCP MSS值对应的IP报文长度,从而实现了在TCP三次握手阶段进行TCP MSS调整,避免了在后续数据业务阶段导致业务受损。
其中,该方法中的探测到的PMTU值可以指的是:TCP服务端通过主动发送PMTU探测报文探测到的PMTU值;或者针对之前发送的业务报文,由于业务报文过大而被丢弃,被动接收到ICMP探路消息后,根据ICMP探路消息携带的MTU值调整后的PMTU值。
该方法中的配置的PMTU值可以指的是:手动配置的PMTU值。示例性的,用户可以在服务端界面上输入PMTU配置信息。
该方法中的默认的PMTU值可以指的是:预配置在TCP服务端里面的。示例性的,TCP服务端默认的PMTU值为TCP服务端的发送接口的MTU值。
该方法中的第一SYN-ACK报文的生成方式可以是:根据第一TCP MSS值,对SYN-ACK报文进行填充(Padding),得到第一SYN-ACK报文,该第一SYN-ACK报文的报文长度为第一TCP MSS值对应的IP报文长度;或者,根据第一TCP MSS值生成第一SYN-ACK报文,该第一SYN-ACK报文的报文长度为第一TCP MSS值对应的IP报文长度。
其中,Padding表示填充。一般填充值为全0bit,也允许其他填充算法,填充值不为全0bit。以IPv6报文为例:当一个IPv6的TCP报文的实际长度为100字节,如下:IPv6头部(40字节)+TCP头部(20字节)+Payload(40字节)。当需要把TCP报文扩充至1500字节的报文,就需要在报文尾部进行填充,于是发出的报文如下:IPv6头部(40字节)+TCP头部(20字节)+Payload(40字节)+Padding(1400字节)。
针对IPv4网络,第一TCP MSS值对应的IP报文长度、与第一TCP MSS值之间的差值为40字节,即IPv4头部(20字节)+TCP头部(20字节);针对IPv6网络,第一TCP MSS值对应的IP报文长度、与第一TCP MSS值之间的差值为60字节,即IPv6头部(40字节)+TCP头部(20字节)。
在一种可能的实现方式中,所述设定IP网络为网际协议版本IPv6网络。
也就是说,在该种实现方式中,IPv6网络的TCP服务端可以在发送SYN-ACK报文时进行TCP MSS调整,避免了在后续数据业务阶段导致业务受损。
在一种可能的实现方式中,所述设定IP网络为IPv4网络,所述第一SYN-ACK报文不允许分片。
也就是说,在该种实现方式中,IPv4网络的TCP服务端只有在SYN-ACK报文不允许分片时,才在发送SYN-ACK报文时进行TCP MSS调整,也避免了在后续数据业务阶段导致业务受损。
在一种可能的实现方式中,所述第一TCP MSS值为所述第一PMTU值对应的TCP MSS值、与所述TCP客户端的TCP advMSS值的较小值。也就是说,在该种实现方式中,可以将第一PMTU值对应的TCP MSS值、与TCP客户端的TCP advMSS值的较小值,确定为发送SYN-ACK报文时的最优的TCP MSS值,这样保证了以最优的TCP MSS值发送SYN-ACK报文,提高了TCP MSS调整的效率。
在一种可能的实现方式中,还包括:
若接收到来自所述TCP客户端的确认ACK报文,则确定TCP三次握手成功,并根据所述第一服务端TCP MSS值与所述TCP客户端进行数据传输。
也就是说,在该种实现方式中,在确定TCP三次握手成功后,可以通过调整后的TCP MSS值与TCP客户端进行数据传输,避免了在后续数据业务阶段导致业务受损。
在一种可能的实现方式中,还包括:
若设定时间内未接收到来自所述TCP客户端的ACK报文,或者再次接收到来自所述TCP客户端的SYN报文,则向所述TCP客户端重传所述第一SYN-ACK报文;
若重传次数达到设定阈值,则确定TCP三次握手失败。
也就是说,在该种实现方式中,在确定TCP三次握手失败后,这样可以在TCP三次握手阶段提前发现故障,避免三次握手建立TCP连接后,客户端发送完整的MSS载荷长度报文的数据业务因报文长度过大被中间传输节点丢弃,随后反复重传该丢弃报文,重传次数达到阈值而断链,随后再次三次握手成功后,再次因相同原因而断链的死循环,提高了TCP通信性能。
在一种可能的实现方式中,还包括:
若接收到来自丢包节点的互联网控制报文协议ICMP或ICMPv6错误消息,所述ICMP或ICMPv6错误消息携带有所述丢包节点指示的最大传输单元MTU值,所述丢包节点为所述TCP服务端到所述TCP客户端之间的一个中间传输节点,则根据所述ICMP或ICMPv6错误消息携带的MTU值和所述TCP客户端的TCP advMSS值,对所述第一TCP MSS值进行调整,得到调整后的第二TCP MSS值;
根据所述第二TCP MSS值,对所述第一SYN-ACK报文的报文长度进行调整,得到第二SYN-ACK报文,所述第二SYN-ACK报文的报文长度为所述第二TCP MSS值对应的IP报文长度;
向所述TCP客户端发送所述第二SYN-ACK报文,所述第二SYN-ACK报文中携带有所述TCP服务端的TCP advMSS值。
也就是说,在该种实现方式中,若接收到来自丢包节点的ICMP或ICMPv6错误消息,可以再次进行TCP MSS调整,等到确定最优的第二TCP MSS后发送第二SYN-ACK报文,该第二SYN-ACK报文的报文长度为第二TCP MSS值对应的IP报文长度,从而实现了在TCP三次握手阶段进行TCP MSS调整,避免了在后续数据业务阶段导致业务受损。
其中,该实现方式中的丢包节点指示的MTU值可以是丢包节点接口的MTU值, 其和传输方向有关,传输方向不同,其对应的MTU值可能相同,也可能不同。
在一种可能的实现方式中,所述第二TCP MSS值为第二PMTU值对应的TCP MSS值、与所述TCP客户端的TCP advMSS值的较小值;
其中,所述第二PMTU值是所述TCP服务端根据所述ICMP或ICMPv6错误消息携带的MTU值对所述第一PMTU值进行更新后得到的PMTU值。
也就是说,在该种实现方式中,可以将第二PMTU值对应的TCP MSS值、与TCP客户端的TCP advMSS值的较小值,确定为发送SYN-ACK报文时的最优的TCP MSS值,这样保证了以最优的TCP MSS值发送SYN-ACK报文,进一步提高了TCP MSS调整的效率。
在一种可能的实现方式中,还包括:
若接收到来自所述TCP客户端的ACK报文,则确定TCP三次握手成功,并根据所述第二TCP MSS值与所述TCP客户端进行数据传输。
也就是说,在该种实现方式中,在确定TCP三次握手成功后,可以通过调整后的TCP MSS值与TCP客户端进行数据传输,避免了在后续数据业务阶段导致业务受损。
在一种可能的实现方式中,还包括:
若设定时间内未接收到来自所述TCP客户端的ACK报文,或者再次接收到来自所述TCP客户端的SYN报文,则向所述TCP客户端重传所述第二SYN-ACK报文;
若重传次数达到设定阈值,则确定TCP三次握手失败。
也就是说,在该种实现方式中,在确定TCP三次握手失败后,这样可以在TCP三次握手阶段提前发现故障,避免三次握手建立TCP连接后,客户端发送完整的MSS载荷长度报文的数据业务因报文长度过大被中间传输节点丢弃,随后反复重传该丢弃报文,重传次数达到阈值而断链,随后再次三次握手成功后,再次因相同原因而断链的死循环,提高了TCP通信性能。
第二方面,本申请实施例提供了一种TCP MSS调整方法,所述方法用于设定互联网协议IP网络中的传输控制协议TCP客户端,包括:
向TCP服务端发送同步序列编号SYN报文,所述SYN报文中携带有所述TCP客户端的TCP通告最大报文长度advMSS值;
若接收到来自所述TCP服务端的同步序列编号确认SYN-ACK报文,所述SYN-ACK报文携带有所述TCP服务端的TCP advMSS值,则根据所述TCP服务端的TCP advMSS值,以及所述TCP客户端探测到的、配置的或者默认的第一路径最大传输单元PMTU值,确定所述TCP客户端的第一TCP MSS值;
根据所述第一TCP MSS值向所述TCP服务端发送第一ACK报文,所述第一ACK报文的报文长度为所述第一TCP MSS值对应的IP报文长度。
也就是说,TCP客户端接收到来自TCP服务端的SYN-ACK报文后,不是直接回复ACK报文,而是进行TCP MSS调整,等到确定最优的第一TCP MSS后发送第一ACK报文,该第一ACK报文的报文长度为第一TCP MSS值对应的IP报文长度,从而实现了在TCP三次握手阶段进行TCP MSS调整,避免了在后续数据业务阶段导致业务受损。
其中,该方法中的探测到的PMTU值可以指的是:TCP客户端通过主动发送PMTU 探测报文探测到的PMTU值;或者针对之前发送的业务报文,由于业务报文过大而被丢弃,被动接收到ICMP探路消息后,根据ICMP探路消息携带的MTU值调整后的PMTU值。
该方法中的配置的PMTU值可以指的是:手动配置的PMTU值。示例性的,用户可以在客户端界面上输入PMTU配置信息。
该方法中的默认的PMTU值可以指的是:预配置在TCP客户端里面的。示例性的,TCP客户端默认的PMTU值为TCP客户端的发送接口的MTU值。
该方法中的第一ACK报文的生成方式可以是:根据第一TCP MSS值,对ACK报文进行填充(Padding),得到第一ACK报文,该第一ACK报文的报文长度为第一TCP MSS值对应的IP报文长度;或者,根据第一TCP MSS值生成第一ACK报文,该第一ACK报文的报文长度为第一TCP MSS值对应的IP报文长度。
其中,Padding表示填充。一般填充值为全0bit,也允许其他填充算法,填充值不为全0bit。以IPv6报文为例:当一个IPv6的TCP报文的实际长度为100字节,如下:IPv6头部(40字节)+TCP头部(20字节)+Payload(40字节)。当需要把TCP报文扩充至1500字节的报文,就需要在报文尾部进行填充,于是发出的报文如下:IPv6头部(40字节)+TCP头部(20字节)+Payload(40字节)+Padding(1400字节)。
针对IPv4网络,第一TCP MSS值对应的IP报文长度、与第一TCP MSS值之间的差值为40字节,即IPv4头部(20字节)+TCP头部(20字节);针对IPv6网络,第一TCP MSS值对应的IP报文长度、与第一TCP MSS值之间的差值为60字节,即IPv6头部(40字节)+TCP头部(20字节)。
在一种可能的实现方式中,所述设定IP网络为网际协议版本IPv6网络。
也就是说,在该种实现方式中,IPv6网络的TCP客户端可以在发送ACK报文时进行TCP MSS调整,避免了在后续数据业务阶段导致业务受损。
在一种可能的实现方式中,所述设定IP网络为IPv4网络,所述第一ACK报文不允许分片。
也就是说,在该种实现方式中,IPv4网络的TCP客户端只有在ACK报文不允许分片时,才在发送ACK报文时进行TCP MSS调整,也避免了在后续数据业务阶段导致业务受损。
在一种可能的实现方式中,所述第一TCP MSS值为所述第一PMTU值对应的TCP MSS值、与所述TCP服务端的TCP advMSS值的较小值。
也就是说,在该种实现方式中,可以将第一PMTU值对应的TCP MSS值、与TCP服务端的TCP advMSS值的较小值,确定为发送ACK报文时的最优的TCP MSS值,这样保证了以最优的TCP MSS值发送ACK报文,提高了TCP MSS调整的效率。
在一种可能的实现方式中,还包括:
若设定时间内再次接收到所述TCP服务端的SYN-ACK报文,则向所述TCP服务端重传所述第一ACK报文;
若重传次数达到设定阈值,则确定TCP三次握手失败。
也就是说,在该种实现方式中,在确定TCP三次握手失败后,这样可以在TCP三次握手阶段提前发现故障,避免三次握手建立TCP连接后,客户端发送完整的MSS 载荷长度报文的数据业务因报文长度过大被中间传输节点丢弃,随后反复重传该丢弃报文,重传次数达到阈值而断链,随后再次三次握手成功后,再次因相同原因而断链的死循环,提高了TCP通信性能。
在一种可能的实现方式中,还包括:
若接收到来自丢包节点的互联网控制报文协议ICMP或ICMPv6错误消息,所述ICMP或ICMPv6错误消息携带有所述丢包节点指示的最大传输单元MTU值,所述丢包节点为所述TCP客户端到所述TCP服务端之间的一个中间传输节点,则根据所述ICMP或ICMPv6错误消息携带的MTU值和所述TCP客户端的TCP advMSS值,对所述第一TCP MSS值进行调整,得到调整后的第二TCP MSS值;
根据所述第二TCP MSS值,对所述第一ACK报文的报文长度进行调整,得到第二ACK报文,所述第二ACK报文的报文长度为所述第二TCP MSS值对应的IP报文长度;
向所述TCP服务端发送所述第二ACK报文。
也就是说,在该种实现方式中,若接收到来自丢包节点的ICMP或ICMPv6错误消息,可以再次进行TCP MSS调整,等到确定最优的第二TCP MSS后发送第二ACK报文,该第二ACK报文的报文长度为第二TCP MSS值对应的IP报文长度,从而实现了在TCP三次握手阶段进行TCP MSS调整,避免了在后续数据业务阶段导致业务受损。
其中,该实现方式中的丢包节点指示的MTU值可以是丢包节点接口的MTU值,其和传输方向有关,传输方向不同,其对应的MTU值可能相同,也可能不同。
在一种可能的实现方式中,所述第二TCP MSS值为第二PMTU值对应的TCP MSS值、与所述TCP客户端的TCP advMSS值的较小值;
其中,所述第二PMTU值是所述TCP客户端根据所述ICMP或ICMPv6错误消息携带的MTU值对所述第一PMTU值进行更新后得到的PMTU值。
也就是说,在该种实现方式中,可以将第二PMTU值对应的TCP MSS值、与TCP客户端的TCP advMSS值的较小值,确定为发送ACK报文时的最优的TCP MSS值,这样保证了以最优的TCP MSS值发送ACK报文,进一步提高了TCP MSS调整的效率。
在一种可能的实现方式中,还包括:
若设定时间内再次接收到来自所述TCP服务端的SYN-ACK报文,则向所述TCP服务端重传所述第二ACK报文;
若重传次数达到设定阈值,则确定TCP三次握手失败。
也就是说,在该种实现方式中,在确定TCP三次握手失败后,这样可以在TCP三次握手阶段提前发现故障,避免三次握手建立TCP连接后,客户端发送完整的MSS载荷长度报文的数据业务因报文长度过大被中间传输节点丢弃,随后反复重传该丢弃报文,重传次数达到阈值而断链,随后再次三次握手成功后,再次因相同原因而断链的死循环,提高了TCP通信性能。
第三方面,本申请实施例提供了一种TCP MSS调整装置,所述装置用于设定互联网协议IP网络中的传输控制协议TCP服务端,包括:
接收模块,被配置为接收来自TCP客户端的同步序列编号SYN报文,所述SYN报文中携带有所述TCP客户端的TCP通告最大报文长度advMSS值;
MSS确定模块,被配置为根据所述TCP客户端的TCP advMSS值,以及所述TCP服务端探测到的、配置的或者默认的第一路径最大传输单元PMTU值,确定所述TCP服务端的第一TCP MSS值;
第一报文发送模块,被配置为根据所述第一TCP MSS值向所述TCP客户端发送第一SYN-ACK报文,所述第一SYN-ACK报文的报文长度为所述第一TCP MSS值对应的IP报文长度,所述第一SYN-ACK报文中携带有所述TCP服务端的TCP advMSS值。
在一种可能的实现方式中,所述设定IP网络为网际协议版本IPv6网络。
在一种可能的实现方式中,所述设定IP网络为IPv4网络,所述第一SYN-ACK报文不允许分片。
在一种可能的实现方式中,所述第一TCP MSS值为所述第一PMTU值对应的TCP MSS值、与所述TCP客户端的TCP advMSS值的较小值。
在一种可能的实现方式中,还包括:
第一确定模块,被配置为在根据所述第一TCP MSS值向所述TCP客户端发送第一SYN-ACK报文之后,若接收到来自所述TCP客户端的确认ACK报文,则确定TCP三次握手成功,并根据所述第一TCP MSS值与所述TCP客户端进行数据传输。
在一种可能的实现方式中,还包括:
第二确定模块,被配置为在根据所述第一TCP MSS值向所述TCP客户端发送第一SYN-ACK报文之后,若设定时间内未接收到来自所述TCP客户端的ACK报文,或者再次接收到来自所述TCP客户端的SYN报文,则向所述TCP客户端重传所述第一SYN-ACK报文;若重传次数达到设定阈值,则确定TCP三次握手失败。
在一种可能的实现方式中,还包括:
MSS调整模块,被配置为若接收到来自丢包节点的互联网控制报文协议ICMP或ICMPv6错误消息,所述ICMP或ICMPv6错误消息携带有所述丢包节点指示的最大传输单元MTU值,所述丢包节点为所述TCP服务端到所述TCP客户端之间的一个中间传输节点,则根据所述ICMP或ICMPv6错误消息携带的MTU值和所述TCP客户端的TCP advMSS值,对所述第一TCP MSS值进行调整,得到调整后的第二TCP MSS值;
报文调整模块,被配置为根据所述第二TCP MSS值,对所述第一SYN-ACK报文的报文长度进行调整,得到第二SYN-ACK报文,所述第二SYN-ACK报文的报文长度为所述第二TCP MSS值对应的IP报文长度;
第二报文发送模块,被配置为向所述TCP客户端发送所述第二SYN-ACK报文,所述第二SYN-ACK报文中携带有所述TCP服务端的TCP advMSS值。
在一种可能的实现方式中,所述第二TCP MSS值为第二PMTU值对应的TCP MSS值、与所述TCP客户端的TCP advMSS值的较小值;
其中,所述第二PMTU值是所述TCP服务端根据所述ICMP或ICMPv6错误消息携带的MTU值对所述第一PMTU值进行更新后得到的PMTU值。
在一种可能的实现方式中,还包括:
第三确定模块,被配置为在向所述TCP客户端发送所述第二SYN-ACK报文之后,若接收到来自所述TCP客户端的ACK报文,则确定TCP三次握手成功,并根据所述第二TCP MSS值与所述TCP客户端进行数据传输。
在一种可能的实现方式中,还包括:
第四确定模块,被配置为在向所述TCP客户端发送所述第二SYN-ACK报文之后,若设定时间内未接收到来自所述TCP客户端的ACK报文,或者再次接收到来自所述TCP客户端的SYN报文,则向所述TCP客户端重传所述第二SYN-ACK报文;若重传次数达到设定阈值,则确定TCP三次握手失败。
第四方面,本申请实施例提供了一种TCP MSS调整装置,所述装置用于设定互联网协议IP网络中的传输控制协议TCP客户端,所述装置包括:
第一发送模块,被配置为向TCP服务端发送同步序列编号SYN报文,所述SYN报文中携带有所述TCP客户端的TCP通告最大报文长度advMSS值;
确定模块,被配置为若接收到来自所述TCP服务端的同步序列编号确认SYN-ACK报文,所述SYN-ACK报文携带有所述TCP服务端的TCP advMSS值,则根据所述TCP服务端的TCP advMSS值,以及所述TCP客户端探测到的、配置的或者默认的第一路径最大传输单元PMTU值,确定所述TCP客户端的第一TCP MSS值;
第二发送模块,被配置为根据所述第一TCP MSS值向所述TCP服务端发送第一ACK报文,所述第一ACK报文的报文长度为所述第一TCP MSS值对应的IP报文长度。
在一种可能的实现方式中,所述设定IP网络为网际协议版本IPv6网络。
在一种可能的实现方式中,所述设定IP网络为IPv4网络,所述第一ACK报文不允许分片。
在一种可能的实现方式中,所述第一TCP MSS值为所述第一PMTU值对应的TCP MSS值、与所述TCP服务端的TCP advMSS值的较小值。
在一种可能的实现方式中,还包括:
第一握手失败确定模块,被配置为在根据所述第一TCP MSS值向所述TCP服务端发送第一ACK报文之后,若设定时间内再次接收到来自所述TCP服务端的SYN-ACK报文,则向所述TCP服务端重传所述第一ACK报文;若重传次数达到设定阈值,则确定TCP三次握手失败。
在一种可能的实现方式中,还包括:
第一调整模块,被配置为若接收到来自丢包节点的互联网控制报文协议ICMP或ICMPv6错误消息,所述ICMP或ICMPv6错误消息携带有所述丢包节点指示的最大传输单元MTU值,所述丢包节点为所述TCP客户端到所述TCP服务端之间的一个中间传输节点,则根据所述ICMP或ICMPv6错误消息携带的MTU值和所述TCP客户端的TCP advMSS值,对所述第一TCP MSS值进行调整,得到调整后的第二TCP MSS值;
第二调整模块,被配置为根据所述第二TCP MSS值,对所述第一ACK报文的报文长度进行调整,得到第二ACK报文,所述第二ACK报文的报文长度为所述第二TCP  MSS值对应的IP报文长度;
第三发送模块,被配置为向所述TCP服务端发送所述第二ACK报文。
在一种可能的实现方式中,所述第二TCP MSS值为第二PMTU值对应的TCP MSS值、与所述TCP客户端的TCP advMSS值的较小值;
其中,所述第二PMTU值是所述TCP客户端根据所述ICMP或ICMPv6错误消息携带的MTU值对所述第一PMTU值进行更新后得到的PMTU值。
在一种可能的实现方式中,还包括:
第二握手失败确定模块,被配置为在向所述TCP服务端发送所述第二ACK报文之后,若设定时间内再次接收到来自所述TCP服务端的SYN-ACK报文,则向所述TCP服务端重传所述第二ACK报文;若重传次数达到设定阈值,则确定TCP三次握手失败。
第五方面,本申请实施例提供了一种通信装置,其特征在于,所述通信装置包括:处理器,所述处理器与存储器耦合;
所述存储器用于存储计算机指令;
所述处理器用于执行所述计算机指令,使得执行第一方面所述的方法被执行。
第六方面,本申请实施例提供了一种通信装置,其特征在于,所述通信装置包括:处理器,所述处理器与存储器耦合;
所述存储器用于存储计算机指令;
所述处理器用于执行所述计算机指令,使得执行第二方面所述的方法被执行。
第七方面,本申请实施例提供了一种通信系统,其特征在于,包括TCP服务端、TCP客户端、以及一个或多个中间传输节点;其中,所述TCP服务端用于执行第一方面所述的方法;所述TCP客户端用于执行第二方面所述的方法。
第八方面,本申请实施例提供了一种计算机存储介质,其特征在于,所述计算机存储介质包括计算机指令,当所述计算机指令运行时,使得第一方面所述的方法被执行。
第九方面,本申请实施例提供了一种计算机存储介质,其特征在于,所述计算机存储介质包括计算机指令,当所述计算机指令运行时,使得第二方面所述的方法被执行。
第十方面,本申请实施例提供了一种计算机程序产品,其特征在于,所述计算机程序产品包括计算机指令,当所述计算机指令运行时,使得第一方面所述的方法被执行。
第十一方面,本申请实施例提供了一种计算机程序产品,其特征在于,所述计算机程序产品包括计算机指令,当所述计算机指令运行时,使得第二方面所述的方法被执行。
第十二方面,本申请实施例提供了一种装置,所述装置用于执行第一方面和第二方面所述的方法。
本申请实施例提供的TCP MSS调整方法、装置及系统,可以在TCP三次握手阶段进行TCP MSS调整,确定以最优的TCP MSS发送TCP数据,避免在后续数据业务阶段导致业务受损;即使TCP报文不可被分片,且中间节点丢弃超大TCP报文后不 回复ICMP错误消息或者ICMPv6错误消息提示源刷新PMTU,也可以在TCP三次握手阶段提前发现故障,避免三次握手建立TCP连接后,客户端发送完整的MSS载荷长度报文的数据业务因报文长度过大被中间传输节点丢弃,随后反复重传该丢弃报文,重传次数达到阈值而断链,随后再次三次握手成功后,再次因相同原因而断链的死循环,提高了TCP通信性能和维测效率。
附图说明
图1为一种TCP三次握手场景示意图;
图2为一种TCP三次握手场景示意图;
图3为本申请实施例提供的一种TCP三次握手场景示意图;
图4为本申请实施例提供的一种TCP三次握手场景示意图;
图5为本申请实施例提供的一种TCP三次握手场景示意图;
图6为本申请实施例提供的一种TCP三次握手场景示意图;
图7为本申请实施例提供的一种TCP MSS调整方法的流程示意图;
图8为本申请实施例提供的一种TCP MSS调整方法的流程示意图;
图9为本申请实施例提供的一种TCP服务端的TCP MSS调整装置的结构示意图;
图10为本申请实施例提供的一种TCP客户端的TCP MSS调整装置的结构示意图;
图11为本申请实施例提供的一种TCP服务端的通信装置的结构示意图;
图12为本申请实施例提供的一种TCP客户端的通信装置的结构示意图。
具体实施方式
下面将结合附图,对本申请实施例中的技术方案进行描述。显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。
在本说明书的描述中“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。
其中,在本说明书的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,在本申请实施例的描述中,“多个”是指两个或多于两个。
在本说明书的描述中,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。
TCP是IETF制定的一种面向连接的、可靠的、基于字节流的传输层通信协议。TCP三次握手(Three-way Handshake)或“SYN,SYN-ACK,ACK”过程可以实现两 个主机间TCP握手建链,两主机间完成TCP字节流通道的建链后,应用层可以通过该连接实现数据传输。
通常情况下主机接口MTU(Maximum Transmission Unit,最大传输单元)等于MRU(Maximum Receive Unit,最大接收单元),TCP三次握手过程中SYN、SYN-ACK、ACK报文不携带应用层数据,因此为小包,通信双方通过三次握手(通过SYN、SYN-ACK报文)互相递交advMSS(Advertisement Maximum Segment Size,通告最大报文长度)给对方,表示本端可接收的最大TCP载荷长度。
其中,MTU和MRU的单位都是字节,MTU表示发送时候最大的报文长度,MRU表示最大可以接收的报文长度。“MTU等于MRU”表示某些系统的MTU值和MRU值完全相等。在配置MTU的同时,也等于配置了MRU。
为了达到最佳的传输效率,MSS(Maximum Segment Size,最大报文长度)与MRU的关系如下:
MSS=MRU-IP(Internet Protocol,网际互连协议)头部长度-TCP头部长度
其中,IPv4(Internet Protocol version 4,网际协议版本4)头部长度为20字节,IPv6头部长度为40字节(不含扩展头部,此处不涉及扩展头部),TCP头部不含option(可选)长度为固定20字节。
由于TCP是面向字节的协议,当TCP发送窗口缓存的字节足够多时,TCP数据发送端总是以MSS为单位构造TCP报文发送,导致TCP业务的数据载荷几乎总是以完整的MSS载荷长度报文发送。但是,当网络中存在中间传输节点的MTU小于TCP报文长度时,会导致业务受损(当报文可被分片时,报文则被分片处理;当报文不可被分片时,则丢弃,丢弃节点并向源发送ICMP或者ICMPv6错误消息通知丢弃接口的MTU);或者,更恶劣的情况是,中间传输节点不回复错误消息,TCP数据发送端无法学习到PMTU(PathMaximum Transmission Unit,路径最大传输单元),则导致超大报文持续在中间传输节点丢包,最终导致TCP连接断开。对于基于TCP的上层应用,面对TCP连接的反复重建和断开,可能进入异常状态。
针对IPv4网络,在TCP三次握手后数据传输过程中,若数据报文的DF(Don’t Fragment,不允许分片)位为0(即DFbit=0)则表示可以分片;若数据报文的DF位为1(即DFbit=1)则表示不能分片。并且,本申请中描述的报文长度均为IP头部+TCP头部+载荷长度之和,后续不再赘述。针对DF位为1的数据报文,若中间传输节点MTU值小于报文长度,导致传输数据报文被丢弃,接下来有两种情形:
情形一:当中间传输节点回复ICMP(Internet Control Message Protocol,互联网控制报文协议)错误消息,即ICMPDestination UnreachableMessage(ICMP目的地不可到达消息)(Type=3,Code=4),指示因报文过大而丢包的中间传输节点的MTU值大小,TCP源端调整PMTU,并根据PMTU调整MSS后重新发送,此时已造成业务大量丢包,TCP大量重传导致流量拥塞判定,业务质量受损;尤其在高速TCP场景,吞吐量因此掉底。
情形二:当中间传输节点不回复ICMP错误消息,即ICMPDestination UnreachableMessage(Type=3,Code=4)时,TCP源端无法更新正确的PMTU(PathMaximum Transmission Unit,路径最大传输单元)来调整合适的MSS,超时收 不到ACK报文时,TCP源端重传该数据报文,重传次数达到阈值后业务断链,TCP源端重新进入三次握手建链,循环往复。
示例性的,如图1所示,在IPv4网络中,HostA(即主机A)与HostB(即主机B)完成TCP三次握手后,进行数据传输过程中,HostA发送的DFbit=1的报文长度为2000字节的报文,由于RouteA(即路由器A)的MTU=1400而被丢弃,发生TCP的丢包和重传,进而导致TCP性能下降;如果RouteA在丢弃报文长度为2000字节的报文时同时回复了ICMP Destination Unreachable Message(Type=3,Code=4)指示MTU=1400;HostA收到RouteA发送的ICMP报文后,调整报文长度为1400字节继续发送数据给HostB,发给RouterB(MTU=1300)时,由于该报文的长度1400字节大于发送接口的MTU值1300字节而被丢弃,此时如果RouterB(即路由器B)不回复ICMP Destination Unreachable Message给HostA时,该报文长度为1400字节的报文会持续被丢弃,HostA TCP重传的该报文都被丢弃,从而导致HostA与HostB间的该TCP连接断链。
针对IPv6网络,协议规定中间传输结节不允许对IPv6报文进行分片处理。并且,本申请中描述的报文长度均为IP头部+TCP头部+载荷长度之和,后续不再赘述。在TCP三次握手后数据传输过程中,若中间传输节点MTU6值小于报文长度,导致传输数据报文被丢弃,接下来有两种情形:
情形一:当传输节点回复ICMPv6错误消息,即ICMPv6 PTB(Packet Too Big,报文过大)(Type=2,Code=0)报文,指示因报文过大而丢包的中间传输节点的MTU值大小,TCP源端更新PMTU,并根据更新后的PMTU调整MSS后重新发送,此时已造成业务大量丢包,TCP大量重传导致流量拥塞判定,业务质量受损;尤其在高速TCP场景,吞吐量因此掉底。
情形二:当中间传输节点不回复ICMPv6错误消息,即ICMPv6 PTB(Type=2,Code=0)报文时,TCP源端无法更新正确的PMTU值来调整合适的MSS,超时收不到ACK报文时,TCP源端重传该数据报文,重传次数达到阈值后业务断链,TCP源端重新进入三次握手建链,循环往复。
示例性的,如图2所示,在IPv6网络中,HostA(即主机A)与HostB(即主机B)完成TCP三次握手后,进行数据传输过程中,HostA发送报文长度为2000字节的报文,由于RouteA(即路由器A)的MTU=1400而被丢弃,发生TCP的丢包和重传,进而导致TCP性能下降;如果RouteA在丢弃报文长度为2000字节的报文时同时回复了ICMPv6 PTB错误消息(即ICMPv6 Packet Too Big报文),指示MTU=1400,则HostA到HostB间的TCP业务受损;HostA收到RouteA发送的ICMPv6 PTB错误消息(即ICMPv6 Packet Too Big报文)后,调整报文长度为1400字节继续发送数据给HostB,发给RouteC(MTU=1300)时,该报文长度为1400字节的报文被丢弃;此时如果RouterB(即路由器B)不回复ICMPv6 PTB错误消息(即ICMPv6 Packet Too Big报文)给HostA时,该报文长度为1400字节的报文会持续被丢弃,HostATCP重传的该报文都被丢弃,从而导致HostA与HostB间的该TCP连接断链。
可见,IPv4(DFbit=1)及IPv6网络中,TCP三次握手后数据传输过程中,中间传输节点MTU值小于报文长度时,TCP源端需要调整MSS后重新发送报文,该过程导致的大量丢包及业务质量受损。以及,IPv4(DFbit=1)及IPv6网络中,TCP三次 握手后数据传输过程中,由于中间节点设备不回复ICMP错误消息(即ICMPDestination UnreachableMessage)及ICMPv6错误消息(即ICMPv6Packet Too Big)报文而导致的长时间的业务报文重传及TCP连接的反复建立和断链进入死循环。
因此,为了解决上述技术问题,本申请提供了一种TCP MSS调整方法、装置及设备。本申请可应用于IPv4及IPv6网络中,TCP三次握手及数据传输的过程。本申请涉及IPv4网络,都需要TCP报文IPv4头部的DFbit=1而不允许中间传输节点分片;IPv6因协议明确规定了中间传输转发节点不允许分片而适用于全场景。
下面通过具体实施例进行说明。其中,为了描述方便,下述各个实施例中的advMSS具体为TCPadvMSS;同理,下述各个实施例中的MSS具体为TCPMSS,在后续不再详细说明。
针对IPv4网络,TCP三次握手的SYN报文与SYN-ACK报文中option(可选)字段携带的advMSS值与PMTU不进行联动,advMSS=MRU-40字节;而对SYN-ACK报文与ACK报文的IP层进行填充(Padding处理),使IP报文长度=min[PMTU,advMSS+40],其中,这里及后续调整MSS所需参数advMSS皆为对端三次握手过程中携带advMSS;当收到中间传输节点的ICMP Destination Unreachable(type=3 code=4)报文时,进行MSS与PMTU联动,使本端MSS=min[PMTU-40,advMSS],并且同时联动调整报文长度,使报文长度=min[PMTU,advMSS+40]。示例性的,如图3所示;当中间节点设备未回复ICMP Destination Unreachable(type=3,code=4)报文,则TCP数据业务报文超时后重传,重传次数达到阈值后TCP连接断开,示例性的,如图4所示。
图3是本申请实施例提供的针对IPv4网络的中间传输节点回复ICMP错误消息的场景示意图;如图3所示,针对IPv4网络的TCP三次握手阶段,HostA(即主机A)为TCP客户端,HostB(即主机B)为TCP服务端,RouteA和RouterB均为中间传输节点。其中,HostA的MTU和MRU为2000;HostB的MTU和MRU为1500;从HostA到HostB的方向,RouteA的MTU为1400,RouterB的MTU为1300;从HostB到HostA的方向,RouteA的MTU为1300,RouterB的MTU为1600。并且,图3中各个变量的长度单位均为字节,在图3中未示出,其具体实现过程可以包括:
1、HostA确定本端advMSS值。
具体地,MRU=2000,PMTU=2000,advMSS(A)=MRU-40=1960。其中,这里的PMTU为默认值,其等于HostA发送接口的MTU值。
2、HostA向HostB发送SYN报文,且携带有本端advMSS值即advMSS(A)=1960。
3、HostB确定本端advMSS值。
具体地,MRU=1500,PMTU=1500,advMSS(B)=MRU(B)-40=1460,
MSS=min[PMTU-40,advMSS(A)]=1460,
IP报文长度=min[PMTU,advMSS(A)+40]=1500。其中,这里的PMTU为默认值,其等于HostB发送接口的MTU值。
4、HostB向HostA发送填充后的SYN-ACK报文,且携带有本端advMSS值即advMSS(B)=1460。
5、RouteA在丢弃SYN-ACK报文时同时回复了ICMP Destination Unreachable  Message指示MTU=1300,HostB接收RouteA发送的ICMP错误消息后,更新PMTU和重新计算出MSS,从而填充SYN-ACK报文。
具体地,PMTU=1300,MSS=min[PMTU-40,advMSS(A)]=1260,IP报文长度=min[PMTU,advMSS(A)+40]=1300。
其中,这里的PMTU是HostB根据RouteA发送的ICMP错误消息中的MTU=1300更新的PMTU值。
6、HostB再次向HostA发送重新填充后的SYN-ACK报文,且携带有本端advMSS值即advMSS(B)=1460。
7、HostA更新PMTU和重新计算出MSS。
具体地,PMTU=2000,MSS=min[PMTU-40,advMSS(B)]=1460,IP报文长度=min[PMTU,advMSS(B)+40]=1500。其中,这里的PMTU仍然为默认值,其等于HostA发送接口的MTU值。
8、HostA向HostB发送填充后的ACK报文。
9、RouteA在丢弃ACK报文时同时回复了ICMPDestination Unreachable Message指示MTU=1400,HostA接收RouteA发送的ICMP错误消息后,更新PMTU和重新计算出MSS,从而填充ACK报文。
具体地,PMTU=1400,MSS=min[PMTU-40,advMSS(B)]=1360,IP报文长度)=min[PMTU,advMSS(B)+40]=1400。
其中,这里的PMTU是HostA根据RouteA发送的ICMP错误消息中的MTU=1300更新的PMTU值。
10、HostA再次HostB向发送重新填充后的ACK报文。
11、RouterB在丢弃ACK报文时同时回复了ICMPDestination Unreachable Message指示MTU=1300,HostA接收RouterB发送的ICMP错误消息后,更新PMTU和重新计算出MSS,从而填充ACK报文。
具体地,PMTU=1300,MSS=min[PMTU-40,advMSS(B)]=1260,IP报文长度=min[PMTU,advMSS(B)+40]=1300。
其中,这里的PMTU是HostA根据RouterB发送的ICMP错误消息中的MTU=1300更新的PMTU值。
11、HostA再次向HostB发送填充后的ACK报文。
12、TCP三次握手成功,HostA可以根据最终确定的MSS值即MSS=1260与HostB进行数据传输,HostB可以根据最终确定的MSS值即MSS=1260与HostB进行数据传输。
图4是本申请实施例提供的针对IPv4网络的中间传输节点不回复ICMP错误消息的场景示意图;如图4所示,针对IPv4网络的TCP三次握手阶段,HostA(即主机A)为TCP客户端,HostB(即主机B)为TCP服务端,RouteA和RouterB均为中间传输节点。其中,HostA的MRU和MTU为2000;HostB的MRU和MTU为1500;从HostA到HostB的方向,RouteA的MTU为1400,RouterB的MTU为1300;从HostB到HostA的方向,RouteA的MTU为1300,RouterB的MTU为1600。并且,图4中各个变量的长度单位均为字节,在图4中未示出,其具体实现过程可以包括:
1、HostA确定本端advMSS值。
具体地,MRU=2000,PMTU=2000,advMSS(A)=MRU-40=1960。其中,这里的PMTU为默认值,其等于HostA发送接口的MTU值。
2、HostA向HostB发送SYN报文,且携带有本端advMSS值即advMSS(A)=1960。
3、HostB确定本端advMSS值。
具体地,MRU=1500,PMTU=1500,advMSS(B)=MRU(B)-40=1460,
MSS=min[PMTU-40,advMSS(A)]=1460,
IP报文长度=min[PMTU,advMSS(A)+40]=1500。其中,这里的PMTU为默认值,其等于HostB发送接口的MTU值。
4、HostB向HostA发送填充后的SYN-ACK报文,且携带有本端advMSS值即advMSS(B)=1460。
5、超时后,HostA再向HostB发送SYN报文,且携带有本端advMSS值即advMSS(A)=1960。
6、HostB再向HostA发送填充后的SYN-ACK报文,且携带有本端advMSS值即advMSS(B)=1460。
针对IPv6网络,可以对TCP三次握手的SYN报文与SYN-ACK报文中option(可选)字段携带的advMSS值与PMTU不进行联动,advMSS=MRU-60;而对SYN-ACK报文与ACK报文的IP层填充,使IP报文长度=min[PMTU,advMSS+60],其中,这里的advMSS为对端三次握手过程中携带的advMSS;当收到中间传输节点的PTB(Type=2,Code=0)报文时,可以进行MSS与PMTU联动,使本端MSS=min[PMTU-60,advMSS],其中,这里的advMSS为对端三次握手过程中携带的的advMSS,并且同时联动调整报文长度,使IP报文长度=min[PMTU,advMSS+60],其中,这里的advMSS也为对端三次握手过程中携带的advMSS,示例性的,如图5所示;当中间节点设备未回复ICMPv6 PTB错误消息(即ICMPv6 Packet Too Big报文),则TCP数据业务报文超时后重传,重传次数达到阈值后TCP连接断开,示例性的,如图6所示。
其中,图5与上述图3类似,图6与图4类似,其不同点是,图3和图4是针对IPv4网络,IPv4头部长度+TCP头部长度为40字节;而图5和图6是针对IPv6网络,IPv6头部长度+TCP头部长度为60字节;其具体实现过程不再重复赘述。
可见,正由于TCP为端到端的传输层协议且面向字节的特点导致数据转发阶段,TCP一定为大包传输,体现在TCP数据报文都是以MSS作为单位发送。当端到端网络存在中间传输节点的MTU值小于MSS加上40字节(IPv4)或60字节(IPv6)时,TCP数据业务会因为报文长度过大而被丢弃,所以,本申请中:
当中间传输节点配置为允许回复ICMP错误消息和ICMPv6错误消息提供丢包节点的MTU值时,TCP三次握手阶段通过对SYN-ACK报文和ACK报文进行填充,提前探测和适应传输路径中的最小节点,在数据发送阶段则进入无损数据发送状态。否则在TCP数据发送前期的“慢启动”状态下出现丢包对于TCP数据业务速率迅速爬升有严重影响,尤其对于低延迟的高速TCP。(注:不同的TCP拥塞算法、不同的RTT(往返时延,Round-Trip Time)延迟、不同的最小节点组网会对业务造成不同的损失)
当中间传输节点配置为不允许回复ICMP错误消息和ICMPv6错误消息提供丢包节点的MTU值时,TCP三次握手阶段通过对SYN-ACK报文和ACK报文进行填充,提前触发丢包而导致TCP建链失败,将故障前移。否则TCP建链成功后,进入数据转发阶段必然触发TCP数据报文丢包重传,最后达到最大重传次数而断链的状态。并且根据不同的RTT延迟和最大重传次数配置,TCP建链成功到TCP断链中间可能长达分钟级别,此过程为TCP为无法传输数据的“伪正常”状态,对于上层应用来说可能进入异常状态。
接下来,请参阅图7,图7为本申请实施例提供的一种TCP MSS调整方法的流程示意图。其中,该TCP MSS调整方法可以用于设定IP网络中的TCP服务端,比如:图3至图6任一场景中的HostB。其中,设定IP网络可以为IPv4网络或IPv6网络。尤其是当设定IP网络为IPv4网络时,TCP三次握手阶段中的SYN-ACK报文和ACK报文的不允许分片,即DF位需要置为1。如图7所示,该TCP MSS调整方法可以包括以下步骤:
S71、接收来自TCP客户端的SYN报文,该SYN报文中携带有TCP客户端的TCP advMSS值。
示例性的,TCP客户端可以为图3至图6任一场景中的HostA。
S72、根据TCP客户端的TCP advMSS值,以及TCP服务端探测到的、配置的或者默认的第一PMTU值,确定TCP服务端的第一TCP MSS值。示例性的,图3至图6任一场景中的HostB探测到的PMTU值为1500。
具体地,TCP服务端接收到SYN报文后,这时的第一PMTU值可以是TCP服务端之前探测到的PMTU值,还可以是手动配置的PMTU值,也可以为TCP服务端默认的PMTU值,即TCP服务端的发送接口的MTU值。示例性的,图3至图6任一场景中的HostB默认的PMTU值为1500。
作为一个实施例,TCP服务端在进行TCP MSS调整时,可以将第一PMTU值对应的TCP MSS值,与TCP客户端的TCP advMSS值进行取小运算,得到第一最小值;根据第一最小值,确定第一TCP MSS值。
其中,针对IPv4网络,第一PMTU值、与该第一PMTU值对应的TCP MSS值之间的差值为40字节;针对IPv6网络,第一PMTU值、与该第一PMTU值对应的TCP MSS值之间的差值为60字节。
可选地,作为另一个实施例,TCP服务端可以根据实际情况将小于第一最小值的数值确定为第一TCP MSS值;也可以直接将第一最小值确定为第一TCP MSS值,比如:图3中,MSS=min[PMTU-40字节,advMSS(A)]=1460字节,图5中的MSS=min[PMTU-60字节,advMSS(A)]=1440字节。
S73、根据第一TCP MSS值向TCP客户端发送第一SYN-ACK报文,第一SYN-ACK报文的报文长度为第一TCP MSS值对应的IP报文长度,第一SYN-ACK报文中携带有TCP服务端的TCP advMSS值。
具体地,第一SYN-ACK报文的生成方式可以具体为:根据第一TCP MSS值,对SYN-ACK报文进行填充(Padding),得到第一SYN-ACK报文,该第一SYN-ACK报 文的报文长度为第一TCP MSS值对应的IP报文长度。
其中,Padding表示填充。一般填充值为全0bit,也允许其他填充算法,填充值不为全0bit。以IPv6报文为例:当一个IPv6的TCP报文的实际长度为100字节,如下:IPv6头部(40字节)+TCP头部(20字节)+Payload(40字节)。当需要把TCP报文扩充至1500字节的报文,就需要在报文尾部进行填充,于是发出的报文如下:IPv6头部(40字节)+TCP头部(20字节)+Payload(40字节)+Padding(1400字节)。
其中,针对IPv4网络,第一TCP MSS值对应的IP报文长度、与第一TCP MSS值之间的差值为40字节,示例性的,如图3所示,MSS=min[PMTU-40字节,advMSS(A)]=1460字节,IP报文长度=min[PMTU,advMSS(A)+40字节]=1500字节;
针对IPv6网络,第一TCP MSS值对应的IP报文长度、与第一TCP MSS值之间的差值为60字节,如图5所示,MSS=min[PMTU-60字节,advMSS(A)]=1440字节,IP报文长度=min[PMTU,advMSS(A)+60字节]=1500字节。
作为一个实施例,TCP服务端向TCP客户端发送第一SYN-ACK报文后,若接收到来自TCP客户端的ACK报文,则确定TCP三次握手成功,并根据第一TCP MSS值与TCP客户端进行数据传输。
作为一个实施例,TCP服务端向TCP客户端发送第一SYN-ACK报文后,若设定时间内未接收到来自TCP客户端的ACK报文,或者再次接收到来自TCP客户端的SYN报文,则向TCP客户端重传第一SYN-ACK报文;若重传次数达到设定阈值,则确定TCP三次握手失败。
作为另一个实施例,TCP服务端向TCP客户端发送第一SYN-ACK报文后,如图7所示,该TCP MSS调整方法还可以包括以下步骤:
S74、若接收到来自丢包节点的ICMP或ICMPv6错误消息,该ICMP或ICMPv6错误消息携带有丢包节点指示的MTU值,丢包节点为TCP服务端到TCP客户端之间的一个中间传输节点,则根据ICMP或ICMPv6错误消息携带的MTU值和TCP客户端的TCP advMSS值,对第一TCP MSS值进行调整,得到调整后的第二TCP MSS值。
S75、根据第二TCP MSS值,对第一SYN-ACK报文的报文长度进行调整,得到第二SYN-ACK报文,第二SYN-ACK报文的报文长度为第二TCP MSS值对应的IP报文长度。
S76、向TCP客户端发送第二SYN-ACK报文,第二SYN-ACK报文中携带有TCP服务端的TCP advMSS值。
具体地,针对IPv4网络,ICMP错误消息可以是ICMP Destination Unreachable Message(Type=3,Code=4);针对IPv6网络,ICMPv6错误消息可以是ICMPv6Packet Too Big(Type=2,Code=0)报文。
丢包节点指示的MTU值是丢包节点接口的MTU值,其和传输方向有关,传输方向不同,其对应的MTU值可能相同,也可能不同。
示例性的,图3至图6任一场景所示,从HostA到HostB的方向,RouteA的MTU为1400,RouterB的MTU为1300;从HostB到HostA的方向,RouteA的MTU为1300,RouterB的MTU为1600。其中,丢包节点可以是RouteA和RouterB中的一个或多个。针对每个丢包节点,在接收到ICMP或者ICMPv6错误消息后调整MSS值,得到对应 的第二TCP MSS值。
作为另一个实施例,TCP服务端在进行TCP MSS调整时,可以根据丢包节点发送的ICMP错误消息中的MTU值对TCP服务端的PMTU值进行更新,得到更新后的第二PMTU值;将第二PMTU值对应的TCP MSS值,与TCP客户端的TCP advMSS值进行取小运算,得出第二最小值;根据第二最小值,确定第二TCP MSS值。
其中,针对IPv4网络,第二PMTU值与该第二PMTU值对应的TCP MSS值之间的差值为40字节;针对IPv6网络,第二PMTU值与该第二PMTU值对应的TCP MSS值之间的差值为60字节。
可选地,可以根据实际情况将小于第二最小值的数值确定为第二TCP MSS值;也可以直接将第二最小值确定为第二TCP MSS值,比如:图3中,MSS=min[PMTU-40字节,advMSS(A)]=1260字节,图5中的MSS=min[PMTU-60字节,advMSS(A)]=1240字节。
作为另一个实施例,TCP服务端向TCP客户端发送第二SYN-ACK报文后,若接收到TCP客户端返回的ACK报文,则确定TCP三次握手成功,并根据第一TCP MSS值与TCP客户端进行数据传输。
作为另一个实施例,TCP服务端向TCP客户端发送第二SYN-ACK报文后,若设定时间内未接收到TCP客户端发送的ACK报文,或者接收到TCP客户端重传的SYN报文,则向TCP客户端重传第二SYN-ACK报文;若重传次数达到设定阈值,则确定TCP三次握手失败。
上述S74至S76涉及到的丢包节点是针对TCP服务端到TCP客户端之间的一个中间传输节点,若TCP服务端接收到第一个丢包节点发送的ICMP或ICMPv6错误消息,TCP服务端会根据该第一个丢包节点发送的ICMP或ICMPv6错误消息中的MTU执行上述S74至S76调整MSS的步骤;同理,若TCP服务端再次接收到第二个丢包节点发送的ICMP或ICMPv6错误消息,表明TCP服务端到TCP客户端之间还有更小的MTU,TCP服务端会根据该第二个丢包节点发送的ICMP或ICMPv6错误消息中的MTU继续重复执行上述S74至S76调整MSS的步骤;以此类推,TCP服务端到TCP客户端之间还可能有第三个丢包节点、第四个丢包节点等,TCP服务端均会根据这些丢包节点发送的ICMP或ICMPv6错误消息中的MTU继续重复执行上述S74至S76调整MSS的步骤,在这里不再赘述。
由上述实施例可见,TCP服务端可以在TCP三次握手阶段进行TCP MSS调整,确定最优的发送TCP MSS,避免在后续数据业务阶段导致业务受损;即使中间传输节点不回复ICMP或ICMPv6错误消息,也可以在TCP三次握手阶段提前发现故障,避免三次握手建立TCP连接后,客户端发送完整的MSS载荷长度报文的数据业务因报文长度过大被中间传输节点丢弃,随后反复重传该丢弃报文,重传次数达到阈值而断链,随后再次三次握手成功后,再次因相同原因而断链的死循环,提高了TCP通信性能。
请参阅图8,图8为本申请实施例提供的一种TCP MSS调整方法的流程示意图。其中,该TCP MSS调整方法可以用于设定IP网络中的TCP客户端,比如:图3至图6任一场景中的HostA。其中,设定IP网络可以为IPv4网络或IPv6网络。尤其是当 设定IP网络为IPv4网络时,TCP三次握手阶段中的SYN-ACK报文和ACK报文的不允许分片,即DF位需要置为1。如图8所示,该TCP MSS调整方法可以包括以下步骤:
S81、向TCP服务端发送SYN报文,该SYN报文中携带有TCP客户端的TCP advMSS值。
示例性的,TCP服务端可以为图3至图6任一场景中的HostB。
S82、若接收到来自TCP服务端的SYN-ACK报文,该SYN-ACK报文携带有TCP服务端的TCP advMSS值,则根据TCP服务端的TCP advMSS值,以及TCP客户端探测到的、配置的或者默认的第一PMTU值,确定TCP客户端的第一TCP MSS值。
具体地,TCP客户端接收到的SYN-ACK报文可以是TCP客户端发送的第一SYN-ACK报文,第一SYN-ACK报文携带有TCP服务端的TCP advMSS值;也可以能是TCP客户端发送的第二SYN-ACK报文,第二SYN-ACK报文携带有TCP服务端的TCP advMSS值。其中,第一SYN-ACK报文是TCP服务端接收到SYN报文后,根据本端探测到的、配置的或默认的第一PMTU值进行TCP MSS调整后得到的SYN-ACK报文;第一SYN-ACK报文是TCP服务端接收丢包节点指示的MTU后,根据指示的MTU得到更新后的PMTU值,根据更新后的PMTU值进行TCP MSS调整后得到的SYN-ACK报文。
第一PMTU值可以是TCP客户端之前探测到的PMTU值,还可以是手动配置的PMTU值,也可以为TCP客户端默认的PMTU值,即TCP客户端的发送接口的MTU值。示例性的,图3至图6任一场景中的HostA默认的PMTU值为2000。
作为一个实施例,TCP客户端在进行TCP MSS调整时,可以将第一PMTU值对应的TCP MSS值,与所述TCP服务端的TCP advMSS值进行取小运算,得到第一最小值;根据第一最小值,确定第一TCP MSS值。
其中,针对IPv4网络,第一PMTU值、与该第一PMTU值对应的TCP MSS值之间的差值为40字节;针对IPv6网络,第一PMTU值、与该第一PMTU值对应的TCP MSS值之间的差值为60字节。
可选地,作为另一个实施例,TCP客户端可以根据实际情况将小于第一最小值的数值确定为第一TCP MSS值;也可以直接将第一最小值确定为第一TCP MSS值,比如:图3中,MSS=min[PMTU-40字节,advMSS(B)]=1460字节,图5中的MSS=min[PMTU-60字节,advMSS(B)]=1440字节。
S83、根据第一TCP MSS值向TCP服务端发送第一ACK报文,第一ACK报文的报文长度为第一TCP MSS值对应的IP报文长度。
具体地,针对IPv4网络,第一TCP MSS值对应的IP报文长度、与第一TCP MSS值之间的差值为40字节,示例性的,如图3所示,MSS=min[PMTU-40字节,advMSS(B)]=1460字节,IP报文长度=min[PMTU,advMSS(B)+40字节]=1500字节;
针对IPv6网络,第一TCP MSS值对应的IP报文长度、与第一TCP MSS值之间的差值为60字节,如图5所示,MSS=min[PMTU-60字节,advMSS(B)]=1440字节,IP报文长度=min[PMTU,advMSS(B)+60字节]=1500字节。
作为另一个实施例,TCP客户端向TCP服务端发送第一ACK报文后,若设定时 间内再次接收到来自TCP服务端的SYN-ACK报文,则向TCP服务端重传第一ACK报文;若重传次数达到设定阈值,则确定TCP三次握手失败。
作为一个实施例,TCP客户端向TCP服务端发送第一ACK报文之后,如图8所示,该TCP MSS调整方法还可以包括以下步骤:
S84、若接收到来自丢包节点的ICMP或ICMPv6错误消息,ICMP或ICMPv6错误消息携带有丢包节点指示的MTU值,丢包节点为TCP客户端到TCP服务端之间的一个中间传输节点,则根据ICMP或ICMPv6错误消息携带的MTU值和TCP客户端的TCP advMSS值,对第一TCP MSS值进行调整,得到调整后的第二TCP MSS值。
S85、根据第二TCP MSS值,对第一ACK报文的报文长度进行调整,得到第二ACK报文,第二ACK报文的报文长度为第二TCP MSS值对应的IP报文长度。
S86、向TCP服务端发送第二ACK报文。
具体地,针对IPv4网络,ICMP错误消息可以是ICMP Destination Unreachable Message(Type=3,Code=4);针对IPv6网络,ICMPv6错误消息可以是ICMPv6 Packet Too Big(Type=2,Code=0)报文。
丢包节点指示的MTU值是丢包节点接口的MTU值,其和传输方向有关,传输方向不同,其对应的MTU值可能相同,也可能不同。
示例性的,图3至图6任一场景所示,从HostA到HostB的方向,RouteA的MTU为1400,RouterB的MTU为1300;从HostB到HostA的方向,RouteA的MTU为1300,RouterB的MTU为1600。
作为另一个实施例,TCP客户端在进行TCP MSS调整时,可以根据丢包节点指示的MTU值对TCP客户端的PMTU值进行更新,得到更新后的第二PMTU值;将第二PMTU值对应的TCP MSS值,与所述TCP服务端的TCP advMSS值进行取小运算,得出第二最小值;根据第二最小值,确定第二TCP MSS值。
其中,针对IPv4网络,第二PMTU值与该第二PMTU值对应的TCP MSS值之间的差值为40字节;针对IPv6网络,第二PMTU值与该第二PMTU值对应的TCP MSS值之间的差值为60字节。
可选地,可以根据实际情况将小于第二最小值的数值确定为第二TCP MSS值;也可以直接将第二最小值确定为第二TCP MSS值,比如:图3中,MSS=min[PMTU-40字节,advMSS(B)]=1360字节,图5中,MSS=min[PMTU-60字节,advMSS(B)]=1340字节。
作为另一个实施例,TCP客户端向TCP服务端发送第二ACK报文后,若设定时间内再次接收到来自TCP服务端的SYN-ACK报文,则向TCP服务端重传第二ACK报文;若重传次数达到设定阈值,则确定TCP三次握手失败。
作为另一个实施例,TCP客户端向TCP服务端发送SYN报文后,若设定时间内未接收到来自TCP服务端的SYN-ACK报文,则向TCP客户端重传SYN报文;若重传次数达到设定阈值,则确定TCP三次握手失败。
上述S84至S86涉及到的丢包节点是针对TCP客户端到TCP服务端之间的任一中间传输节点,若TCP客户端接收到第一个丢包节点发送的ICMP或ICMPv6错误消息,TCP客户端会根据该第一个丢包节点发送的ICMP或ICMPv6错误消息中的MTU 执行上述S84至S86调整MSS的步骤;同理,若TCP客户端再次接收到第二个丢包节点发送的ICMP或ICMPv6错误消息,表明TCP客户端到TCP服务端之间还有更小的MTU,TCP客户端会根据该第二个丢包节点发送的ICMP或ICMPv6错误消息中的MTU继续重复执行上述S84至S86调整MSS的步骤;以此类推,TCP客户端到TCP服务端之间还可能有第三个丢包节点、第四个丢包节点等,TCP客户端均会根据这些丢包节点发送的ICMP或ICMPv6错误消息中的MTU继续重复执行上述S84至S86调整MSS的步骤,在这里不再赘述。
由上述实施例可见,TCP客户端可以在TCP三次握手阶段进行TCP MSS调整,确定最优的发送TCP MSS,避免在后续数据业务阶段导致业务受损;即使中间传输节点不回复ICMP或ICMPv6错误消息,也可以在TCP三次握手阶段提前发现故障,避免三次握手建立TCP连接后,客户端发送完整的MSS载荷长度报文的数据业务因报文长度过大被中间传输节点丢弃,随后反复重传该丢弃报文达到最大重传次数而断链,随后再次三次握手成功后,再次因相同原因而断链的死循环,提高了TCP通信性能。
参阅图9,图9为本申请实施例提供的一种TCP服务端的TCP MSS调整装置的结构示意图。其中,该TCP MSS调整装置可以用于设定IP网络中的TCP服务端,比如:图3至图6任一场景中的HostB。其中,设定IP网络可以为IPv4网络或IPv6网络。尤其是当设定IP网络为IPv4网络时,TCP三次握手阶段中的SYN-ACK报文和ACK报文的不允许分片,即DF位需要置为1。如图9所示,该TCP MSS调整装置可以包括:
接收模块91,被配置为接收来自TCP客户端的同步序列编号SYN报文,所述SYN报文中携带有所述TCP客户端的TCP通告最大报文长度advMSS值;
MSS确定模块92,被配置为根据所述TCP客户端的TCP advMSS值,以及所述TCP服务端探测到的、配置的或者默认的第一路径最大传输单元PMTU值,确定所述TCP服务端的第一TCP MSS值;
第一报文发送模块93,被配置为根据所述第一TCP MSS值向所述TCP客户端发送第一SYN-ACK报文,所述第一SYN-ACK报文的报文长度为所述第一TCP MSS值对应的IP报文长度,所述第一SYN-ACK报文中携带有所述TCP服务端的TCP advMSS值。
作为一个实施例,所述设定IP网络为网际协议版本IPv6网络。
作为一个实施例,所述设定IP网络为IPv4网络,所述第一SYN-ACK报文不允许分片。
作为一个实施例,所述第一TCP MSS值为所述第一PMTU值对应的TCP MSS值、与所述TCP客户端的TCP advMSS值的较小值。
作为一个实施例,该TCP MSS调整装置还可以包括:
第一确定模块,被配置为在根据所述第一TCP MSS值向所述TCP客户端发送第一SYN-ACK报文之后,若接收到来自所述TCP客户端的确认ACK报文,则确定TCP三次握手成功,并根据所述第一TCP MSS值与所述TCP客户端进行数据传输。
作为一个实施例,该TCP MSS调整装置还可以包括:
第二确定模块,被配置为在根据所述第一TCP MSS值向所述TCP客户端发送第一SYN-ACK报文之后,若设定时间内未接收到来自所述TCP客户端的ACK报文,或者再次接收到来自所述TCP客户端的SYN报文,则向所述TCP客户端重传所述第一SYN-ACK报文;若重传次数达到设定阈值,则确定TCP三次握手失败。
作为一个实施例,该TCP MSS调整装置还可以包括:
MSS调整模块,被配置为若接收到来自丢包节点的互联网控制报文协议ICMP或ICMPv6错误消息,所述ICMP或ICMPv6错误消息携带有所述丢包节点指示的最大传输单元MTU值,所述丢包节点为所述TCP服务端到所述TCP客户端之间的一个中间传输节点,则根据所述ICMP或ICMPv6错误消息携带的MTU值和所述TCP客户端的TCP advMSS值,对所述第一TCP MSS值进行调整,得到调整后的第二TCP MSS值;
报文调整模块,被配置为根据所述第二TCP MSS值,对所述第一SYN-ACK报文的报文长度进行调整,得到第二SYN-ACK报文,所述第二SYN-ACK报文的报文长度为所述第二TCP MSS值对应的IP报文长度;
第二报文发送模块,被配置为向所述TCP客户端发送所述第二SYN-ACK报文,所述第二SYN-ACK报文中携带有所述TCP服务端的TCP advMSS值。
作为一个实施例,所述第二TCP MSS值为第二PMTU值对应的TCP MSS值、与所述TCP客户端的TCP advMSS值的较小值;
其中,所述第二PMTU值是所述TCP服务端根据所述ICMP或ICMPv6错误消息携带的MTU值对所述第一PMTU值进行更新后得到的PMTU值。
作为一个实施例,该TCP MSS调整装置还可以包括:
第三确定模块,被配置为在向所述TCP客户端发送所述第二SYN-ACK报文之后,若接收到来自所述TCP客户端的ACK报文,则确定TCP三次握手成功,并根据所述第二TCP MSS值与所述TCP客户端进行数据传输。
作为一个实施例,该TCP MSS调整装置还可以包括:
第四确定模块,被配置为在向所述TCP客户端发送所述第二SYN-ACK报文之后,若设定时间内未接收到来自所述TCP客户端的ACK报文,或者再次接收到来自所述TCP客户端的SYN报文,则向所述TCP客户端重传所述第二SYN-ACK报文;若重传次数达到设定阈值,则确定TCP三次握手失败。
应当理解的是,上述装置用于执行上述实施例中的用于TCP服务端的TCP MSS调整方法,装置中的相应的程序模块,其实现原理和技术效果与用于TCP服务端的TCP MSS调整方法中的描述类似,该装置的工作过程可参考上述用于TCP服务端的TCP MSS调整方法中的对应过程,此处不再赘述。
参阅图10,图10为本申请实施例提供的一种TCP客户端的TCPMSS调整装置的结构示意图。其中,该TCP MSS调整装置可以设定IP网络中的TCP客户端,比如:图3至图6任一场景中的HostA。其中,设定IP网络可以为IPv4网络或IPv6网络。尤其是当设定IP网络为IPv4网络时,TCP三次握手阶段中的SYN-ACK报文和ACK报文的不允许分片,即DF位需要置为1。如图10所示,该TCP MSS调整装置可以包括:
第一发送模块101,被配置为向TCP服务端发送同步序列编号SYN报文,所述SYN报文中携带有所述TCP客户端的TCP通告最大报文长度advMSS值;
确定模块102,被配置为若接收到来自所述TCP服务端的同步序列编号确认SYN-ACK报文,所述SYN-ACK报文携带有所述TCP服务端的TCP advMSS值,则根据所述TCP服务端的TCP advMSS值,以及所述TCP客户端探测到的、配置的或者默认的第一路径最大传输单元PMTU值,确定所述TCP客户端的第一TCP MSS值;
第二发送模块103,被配置为根据所述第一TCP MSS值向所述TCP服务端发送第一ACK报文,所述第一ACK报文的报文长度为所述第一TCP MSS值对应的IP报文长度。
作为一个实施例,所述设定IP网络为网际协议版本IPv6网络。
作为一个实施例,所述设定IP网络为IPv4网络,所述第一ACK报文不允许分片。
作为一个实施例,所述第一TCP MSS值为所述第一PMTU值对应的TCP MSS值、与所述TCP服务端的TCP advMSS值的较小值。
作为一个实施例,该TCP MSS调整装置还可以包括:
第一握手失败确定模块,被配置为在根据所述第一TCP MSS值向所述TCP服务端发送第一ACK报文之后,若设定时间内再次接收到来自所述TCP服务端的SYN-ACK报文,则向所述TCP服务端重传所述第一ACK报文;若重传次数达到设定阈值,则确定TCP三次握手失败。
作为一个实施例,该TCP MSS调整装置还可以包括:
第一调整模块,被配置为若接收到来自丢包节点的互联网控制报文协议ICMP或ICMPv6错误消息,所述ICMP或ICMPv6错误消息携带有所述丢包节点指示的最大传输单元MTU值,所述丢包节点为所述TCP客户端到所述TCP服务端之间的一个中间传输节点,则根据所述ICMP或ICMPv6错误消息携带的MTU值和所述TCP客户端的TCP advMSS值,对所述第一TCP MSS值进行调整,得到调整后的第二TCP MSS值;
第二调整模块,被配置为根据所述第二TCP MSS值,对所述第一ACK报文的报文长度进行调整,得到第二ACK报文,所述第二ACK报文的报文长度为所述第二TCP MSS值对应的IP报文长度;
第三发送模块,被配置为向所述TCP服务端发送所述第二ACK报文。
作为一个实施例,所述第二TCP MSS值为第二PMTU值对应的TCP MSS值、与所述TCP客户端的TCP advMSS值的较小值;
其中,所述第二PMTU值是所述TCP客户端根据所述ICMP或ICMPv6错误消息携带的MTU值对所述第一PMTU值进行更新后得到的PMTU值。
作为一个实施例,该TCP MSS调整装置还可以包括:
第二握手失败确定模块,被配置为在向所述TCP服务端发送所述第二ACK报文之后,若设定时间内再次接收到来自所述TCP服务端的SYN-ACK报文,则向所述TCP服务端重传所述第二ACK报文;若重传次数达到设定阈值,则确定TCP三次握手失败。
应当理解的是,上述装置用于执行上述实施例中的用于TCP客户端的TCP MSS 调整方法,装置中的相应的程序模块,其实现原理和技术效果与用于TCP客户端的TCP MSS调整方法中的描述类似,该装置的工作过程可参考上述用于TCP客户端的TCP MSS调整方法中的对应过程,此处不再赘述。
参阅图11,图11为本申请实施例提供的一种TCP服务端的通信装置的结构示意图,该通信装置可以用于设定IP网络中的TCP服务端,比如:图3至图6任一场景中的HostB。示例性的,该TCP服务端可以为终端,基站等任意类型的通信设备,本实施例对此不做限定。其中,设定IP网络可以为IPv4网络或IPv6网络。尤其是当设定IP网络为IPv4网络时,TCP三次握手阶段中的SYN-ACK报文和ACK报文的不允许分片,即DF位需要置为1。为了便于说明,图11示意了TCP服务端的通信装置的主要部件,如图11所示:
TCP服务端的通信装置包括至少一个处理器1111、至少一个传输介质1112和至少一个存储器1113。处理器1111、存储器1113和传输介质1112相连。
处理器1111主要用于对通信协议以及通信数据进行处理,以及对整个通信装置进行控制,执行软件程序,处理软件程序的数据。
作为一种可选的实现方式,所述通信装置可以包括基带处理器和中央处理器。基带处理器主要用于对通信协议以及通信数据进行处理。中央处理器主要用于对整个通信装置进行控制,执行软件程序,处理软件程序的数据。
图11中的处理器1111可以集成基带处理器和中央处理器的功能,本领域技术人员可以理解,基带处理器和中央处理器也可以是各自独立的处理器,通过总线等技术互联。本领域技术人员可以理解,所述通信装置可以包括多个基带处理器以适应不同的网络制式,所述通信装置可以包括多个中央处理器以增强其处理能力,所述通信装置的各个部件可以通过各种总线连接。所述基带处理器也可以表述为基带处理电路或者基带处理芯片。所述中央处理器也可以表述为中央处理电路或者中央处理芯片。对通信协议以及通信数据进行处理的功能可以内置在处理器中,也可以以软件程序的形式存储在存储器中,由处理器执行软件程序以实现基带处理功能。
存储器1113主要用于存储软件程序和数据。存储器1113可以是独立存在,与处理器1111相连。可选的,存储器1113可以和处理器1111集成在一起,例如集成在一个芯片之内,即片内存储器,或者存储器1113为独立的存储元件,本申请实施例对此不做限定。其中,存储器1113能够存储执行本申请实施例的技术方案的程序代码,并由处理器1111来控制执行,被执行的各类计算机程序代码也可被视为是处理器1111的驱动程序。
传输介质1112可以为无线、光纤、双绞线、同轴电缆等任意类型的传输介质,本实施例对此不做限定。示例性的,图3至图6任一场景中的HostB可以通过无线方式(例如,收发器)与RouterB进行通信,也可以通过有线方式(例如,光纤、双绞线、同轴电缆等)与RouterB进行通信。
作为一种可选的实现方式,在所述通信装置采用无线方式进行通信时,传输介质1112可以为收发器和天线。
收发器可以用于基带信号与射频信号的转换以及对射频信号的处理,收发器可以 与天线相连。收发器包括发射机(transmitter,Tx)和接收机(receiver,Rx)。具体地,一个或多个天线可以接收射频信号,该收发器的接收机Rx用于从天线接收所述射频信号,并将射频信号转换为数字基带信号或数字中频信号,并将该数字基带信号或数字中频信号提供给所述处理器1111,以便处理器1111对该数字基带信号或数字中频信号做进一步的处理,例如解调处理和译码处理。此外,收发器中的发射机Tx用于从处理器1111接收经过调制的数字基带信号或数字中频信号,并将该经过调制的数字基带信号或数字中频信号转换为射频信号,并通过一个或多个天线发送所述射频信号。具体地,接收机Rx可以选择性地对射频信号进行一级或多级下混频处理和模数转换处理以得到数字基带信号或数字中频信号,所述下混频处理和模数转换处理的先后顺序是可调整的。发射机Tx可以选择性地对经过调制的数字基带信号或数字中频信号时进行一级或多级上混频处理和数模转换处理以得到射频信号,所述上混频处理和数模转换处理的先后顺序是可调整的。数字基带信号和数字中频信号可以统称为数字信号。可选的,发射机Tx和接收机Rx可以是由不同的物理结构/电路实现,或者可以由同一物理结构/电路实现,也就是说发射机Tx和接收机Rx可以继承在一起。
收发器也可以称为收发单元、收发机、收发装置等。可选的,可以将收发单元中用于实现接收功能的器件视为接收单元,将收发单元中用于实现发送功能的器件视为发送单元,即收发单元包括接收单元和发送单元,接收单元也可以称为接收机、输入口、接收电路等,发送单元可以称为发射机、发射器或者发射电路等。或者,可以将Tx、Rx和天线的组合成为收发器。
参阅图12,图12为本申请实施例提供的一种TCP客户端的通信装置的结构示意图,用于设定IP网络中的TCP客户端,比如:图3至图6任一场景中的HostA。示例性的,该TCP客户端可以为终端,基站等任意类型的通信设备,本实施例对此不做限定。其中,设定IP网络可以为IPv4网络或IPv6网络。尤其是当设定IP网络为IPv4网络时,TCP三次握手阶段中的SYN-ACK报文和ACK报文的不允许分片,即DF位需要置为1。为了便于说明,图12示意了TCP客户端的通信装置的主要部件,如图12所示:
TCP客户端的通信装置包括至少一个处理器1211、至少一个传输介质1212和至少一个存储器1213。处理器1211、存储器1213和传输介质1212相连。
处理器1211主要用于对通信协议以及通信数据进行处理,以及对整个通信装置进行控制,执行软件程序,处理软件程序的数据。
作为一种可选的实现方式,所述通信装置可以包括基带处理器和中央处理器。基带处理器主要用于对通信协议以及通信数据进行处理。中央处理器主要用于对整个通信装置进行控制,执行软件程序,处理软件程序的数据。
图12中的处理器1211可以集成基带处理器和中央处理器的功能,本领域技术人员可以理解,基带处理器和中央处理器也可以是各自独立的处理器,通过总线等技术互联。本领域技术人员可以理解,所述通信装置可以包括多个基带处理器以适应不同的网络制式,所述通信装置可以包括多个中央处理器以增强其处理能力,所述通信装置的各个部件可以通过各种总线连接。所述基带处理器也可以表述为基带处理电路或 者基带处理芯片。所述中央处理器也可以表述为中央处理电路或者中央处理芯片。对通信协议以及通信数据进行处理的功能可以内置在处理器中,也可以以软件程序的形式存储在存储器中,由处理器执行软件程序以实现基带处理功能。
存储器1213主要用于存储软件程序和数据。存储器1213可以是独立存在,与处理器1211相连。可选的,存储器1213可以和处理器1211集成在一起,例如集成在一个芯片之内,即片内存储器,或者存储器1213为独立的存储元件,本申请实施例对此不做限定。其中,存储器1213能够存储执行本申请实施例的技术方案的程序代码,并由处理器1211来控制执行,被执行的各类计算机程序代码也可被视为是处理器1211的驱动程序。
传输介质1212可以为无线、光纤、双绞线、同轴电缆等任意类型的传输介质,本实施例对此不做限定。示例性的,图3至图6任一场景中的HostA可以通过无线方式(例如,收发器)与RouterA进行通信,也可以通过有线方式(例如,光纤、双绞线、同轴电缆等)与RouterA进行通信。
作为一种可选的实现方式,在所述通信装置采用无线方式进行通信时,传输介质1212可以为收发器和天线。
收发器可以用于基带信号与射频信号的转换以及对射频信号的处理,收发器可以与天线相连。收发器包括发射机(transmitter,Tx)和接收机(receiver,Rx)。具体地,一个或多个天线可以接收射频信号,该收发器的接收机Rx用于从天线接收所述射频信号,并将射频信号转换为数字基带信号或数字中频信号,并将该数字基带信号或数字中频信号提供给所述处理器1211,以便处理器1211对该数字基带信号或数字中频信号做进一步的处理,例如解调处理和译码处理。此外,收发器中的发射机Tx用于从处理器1211接收经过调制的数字基带信号或数字中频信号,并将该经过调制的数字基带信号或数字中频信号转换为射频信号,并通过一个或多个天线发送所述射频信号。具体地,接收机Rx可以选择性地对射频信号进行一级或多级下混频处理和模数转换处理以得到数字基带信号或数字中频信号,所述下混频处理和模数转换处理的先后顺序是可调整的。发射机Tx可以选择性地对经过调制的数字基带信号或数字中频信号时进行一级或多级上混频处理和数模转换处理以得到射频信号,所述上混频处理和数模转换处理的先后顺序是可调整的。数字基带信号和数字中频信号可以统称为数字信号。可选的,发射机Tx和接收机Rx可以是由不同的物理结构/电路实现,或者可以由同一物理结构/电路实现,也就是说发射机Tx和接收机Rx可以继承在一起。
收发器也可以称为收发单元、收发机、收发装置等。可选的,可以将收发单元中用于实现接收功能的器件视为接收单元,将收发单元中用于实现发送功能的器件视为发送单元,即收发单元包括接收单元和发送单元,接收单元也可以称为接收机、输入口、接收电路等,发送单元可以称为发射机、发射器或者发射电路等。或者,可以将Tx、Rx和天线的组合成为收发器。
本申请实施例还提供了一种通信系统,包括TCP服务端、TCP客户端、以及一个或多个中间传输节点;其中,TCP服务端可以执行用于TCP服务端的TCP MSS调整方法;TCP客户端可以执行用于TCP客户端的TCP MSS调整方法。
本申请实施例还提供了一种计算机存储介质,该计算机存储介质包括计算机指令, 当计算机指令在TCP服务端上运行时,使得TCP服务端可以执行用于TCP服务端侧的TCP MSS调整方法。
本申请实施例还提供了一种计算机存储介质,该计算机存储介质包括计算机指令,当计算机指令在TCP客户端上运行时,使得TCP客户端可以执行用于TCP客户端侧的TCP MSS调整方法。
本申请实施例还提供了一种计算机程序产品,该计算机程序产品包括计算机指令,当计算机指令在TCP服务端上运行时,使得TCP服务端可以执行用于TCP服务端侧的TCP MSS调整方法。
本申请实施例还提供了一种计算机程序产品,该计算机程序产品包括计算机指令,当计算机指令在TCP客户端上运行时,使得TCP客户端可以执行用于TCP客户端侧的TCP MSS调整方法。
本申请实施例还提供了一种装置,所述装置用于执行用于TCP服务端侧的TCP MSS调整方法和TCP客户端侧的TCP MSS调整方法。
可以理解的是,本申请的实施例中的处理器可以是中央处理单元(central processing unit,CPU),还可以是其他通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、晶体管逻辑器件,硬件部件或者其任意组合。通用处理器可以是微处理器,也可以是任何常规的处理器。
本申请的实施例中的方法步骤可以通过硬件的方式来实现,也可以由处理器执行软件指令的方式来实现。软件指令可以由相应的软件模块组成,软件模块可以被存放于随机存取存储器(random access memory,RAM)、闪存、只读存储器(read-only memory,ROM)、可编程只读存储器(programmable rom,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)、寄存器、硬盘、移动硬盘、CD-ROM或者本领域熟知的任何其它形式的存储介质中。一种示例性的存储介质耦合至处理器,从而使处理器能够从该存储介质读取信息,且可向该存储介质写入信息。当然,存储介质也可以是处理器的组成部分。处理器和存储介质可以位于ASIC中。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者通过所述计算机可读存储介质进行传输。所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例 如,DVD)、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。
可以理解的是,在本申请的实施例中涉及的各种数字编号仅为描述方便进行的区分,并不用来限制本申请的实施例的范围。

Claims (28)

  1. 一种TCP MSS调整方法,其特征在于,所述方法用于设定互联网协议IP网络中的传输控制协议TCP服务端,包括:
    接收来自TCP客户端的同步序列编号SYN报文,所述SYN报文中携带有所述TCP客户端的TCP通告最大报文长度advMSS值;
    根据所述TCP客户端的TCP advMSS值,以及所述TCP服务端探测到的、配置的或者默认的第一路径最大传输单元PMTU值,确定所述TCP服务端的第一TCP MSS值;
    根据所述第一TCP MSS值向所述TCP客户端发送第一SYN-ACK报文,所述第一SYN-ACK报文的报文长度为所述第一TCP MSS值对应的IP报文长度,所述第一SYN-ACK报文中携带有所述TCP服务端的TCP advMSS值。
  2. 根据权利要求1所述的方法,其特征在于,所述设定IP网络为网际协议版本IPv6网络。
  3. 根据权利要求1所述的方法,其特征在于,所述设定IP网络为IPv4网络,所述第一SYN-ACK报文不允许分片。
  4. 根据权利要求1至3任一项所述的方法,其特征在于,所述第一TCP MSS值为所述第一PMTU值对应的TCP MSS值、与所述TCP客户端的TCP advMSS值的较小值。
  5. 根据权利要求1至3任一项所述的方法,其特征在于,还包括:
    若接收到来自所述TCP客户端的确认ACK报文,则确定TCP三次握手成功,并根据所述第一TCP MSS值与所述TCP客户端进行数据传输。
  6. 根据权利要求1至3任一项所述的方法,其特征在于,还包括:
    若设定时间内未接收到来自所述TCP客户端的ACK报文,或者再次接收到来自所述TCP客户端的SYN报文,则向所述TCP客户端重传所述第一SYN-ACK报文;
    若重传次数达到设定阈值,则确定TCP三次握手失败。
  7. 根据权利要求1至3任一项所述的方法,其特征在于,还包括:
    若接收到来自丢包节点的互联网控制报文协议ICMP或ICMPv6错误消息,所述ICMP或ICMPv6错误消息携带有所述丢包节点指示的最大传输单元MTU值,所述丢包节点为所述TCP服务端到所述TCP客户端之间的一个中间传输节点,则根据所述ICMP或ICMPv6错误消息携带的MTU值和所述TCP客户端的TCP advMSS值,对所述第一TCP MSS值进行调整,得到调整后的第二TCP MSS值;
    根据所述第二TCP MSS值,对所述第一SYN-ACK报文的报文长度进行调整,得到第二SYN-ACK报文,所述第二SYN-ACK报文的报文长度为所述第二TCP MSS值对应的IP报文长度;
    向所述TCP客户端发送所述第二SYN-ACK报文,所述第二SYN-ACK报文中携带有所述TCP服务端的TCP advMSS值。
  8. 根据权利要求7所述的方法,其特征在于,所述第二TCP MSS值为第二PMTU值对应的TCP MSS值、与所述TCP客户端的TCP advMSS值的较小值;
    其中,所述第二PMTU值是所述TCP服务端根据所述ICMP或ICMPv6错误消息携带的MTU值对所述第一PMTU值进行更新后得到的PMTU值。
  9. 根据权利要求7所述的方法,其特征在于,还包括:
    若接收到来自所述TCP客户端的ACK报文,则确定TCP三次握手成功,并根据所述第二TCP MSS值与所述TCP客户端进行数据传输。
  10. 根据权利要求7所述的方法,其特征在于,还包括:
    若设定时间内未接收到来自所述TCP客户端的ACK报文,或者再次接收到来自所述TCP客户端的SYN报文,则向所述TCP客户端重传所述第二SYN-ACK报文;
    若重传次数达到设定阈值,则确定TCP三次握手失败。
  11. 一种TCP MSS调整方法,其特征在于,所述方法用于设定互联网协议IP网络中的传输控制协议TCP客户端,包括:
    向TCP服务端发送同步序列编号SYN报文,所述SYN报文中携带有所述TCP客户端的TCP通告最大报文长度advMSS值;
    若接收到来自所述TCP服务端的同步序列编号确认SYN-ACK报文,所述SYN-ACK报文携带有所述TCP服务端的TCPadvMSS值,则根据所述TCP服务端的TCP advMSS值,以及所述TCP客户端探测到的、配置的或者默认的第一路径最大传输单元PMTU值,确定所述TCP客户端的第一TCP MSS值;
    根据所述第一TCP MSS值向所述TCP服务端发送第一ACK报文,所述第一ACK报文的报文长度为所述第一TCP MSS值对应的IP报文长度。
  12. 根据权利要求11所述的方法,其特征在于,所述设定IP网络为网际协议版本IPv6网络。
  13. 根据权利要求11所述的方法,其特征在于,所述设定IP网络为IPv4网络,所述第一ACK报文不允许分片。
  14. 根据权利要求11至13任一项所述的方法,其特征在于,所述第一TCP MSS值为所述第一PMTU值对应的TCP MSS值、与所述TCP服务端的TCP advMSS值的较小值。
  15. 根据权利要求11至13任一项所述的方法,其特征在于,还包括:
    若设定时间内再次接收到来自所述TCP服务端的SYN-ACK报文,则向所述TCP服务端重传所述第一ACK报文;
    若重传次数达到设定阈值,则确定TCP三次握手失败。
  16. 根据权利要求11至13任一项所述的方法,其特征在于,还包括:
    若接收到来自丢包节点的互联网控制报文协议ICMP或ICMPv6错误消息,所述ICMP或ICMPv6错误消息携带有所述丢包节点指示的最大传输单元MTU值,所述丢包节点为所述TCP客户端到所述TCP服务端之间的一个中间传输节点,则根据所述ICMP或ICMPv6错误消息携带的MTU值和所述TCP客户端的TCP advMSS值,对所述第一TCP MSS值进行调整,得到调整后的第二TCP MSS值;
    根据所述第二TCP MSS值,对所述第一ACK报文的报文长度进行调整,得到第二ACK报文,所述第二ACK报文的报文长度为所述第二TCP MSS值对应的IP报文长度;
    向所述TCP服务端发送所述第二ACK报文。
  17. 根据权利要求16所述的方法,其特征在于,所述第二TCP MSS值为第二PMTU值对应的TCP MSS值、与所述TCP客户端的TCP advMSS值的较小值;
    其中,所述第二PMTU值是所述TCP客户端根据所述ICMP或ICMPv6错误消息携带的MTU值对所述第一PMTU值进行更新后得到的PMTU值。
  18. 根据权利要求16所述的方法,其特征在于,还包括:
    若设定时间内再次接收到来自所述TCP服务端的SYN-ACK报文,则向所述TCP服务端重传所述第二ACK报文;
    若重传次数达到设定阈值,则确定TCP三次握手失败。
  19. 一种TCP MSS调整装置,其特征在于,所述装置用于设定互联网协议IP网络中的传输控制协议TCP服务端,包括:
    接收模块,被配置为接收来自TCP客户端的同步序列编号SYN报文,所述SYN报文中携带有所述TCP客户端的TCP通告最大报文长度advMSS值;
    MSS确定模块,被配置为根据所述TCP客户端的TCP advMSS值,以及所述TCP服务端探测到的、配置的或者默认的第一路径最大传输单元PMTU值,确定所述TCP服务端的第一TCP MSS值;
    第一报文发送模块,被配置为根据所述第一TCP MSS值向所述TCP客户端发送第一SYN-ACK报文,所述第一SYN-ACK报文的报文长度为所述第一TCP MSS值对应的IP报文长度,所述第一SYN-ACK报文中携带有所述TCP服务端的TCP advMSS值。
  20. 一种TCP MSS调整装置,其特征在于,所述装置用于设定互联网协议IP网络中的传输控制协议TCP客户端,所述装置包括:
    第一发送模块,被配置为向TCP服务端发送同步序列编号SYN报文,所述SYN报文中携带有所述TCP客户端的TCP通告最大报文长度advMSS值;
    确定模块,被配置为若接收到来自所述TCP服务端的同步序列编号确认SYN-ACK 报文,所述SYN-ACK报文携带有所述TCP服务端的TCP advMSS值,则根据所述TCP服务端的TCP advMSS值,以及所述TCP客户端探测到的、配置的或者默认的第一路径最大传输单元PMTU值,确定所述TCP客户端的第一TCP MSS值;
    第二发送模块,被配置为根据所述第一TCP MSS值向所述TCP服务端发送第一ACK报文,所述第一ACK报文的报文长度为所述第一TCP MSS值对应的IP报文长度。
  21. 一种通信装置,其特征在于,所述通信装置包括:处理器,所述处理器与存储器耦合;
    所述存储器用于存储计算机指令;
    所述处理器用于执行所述计算机指令,使得执行权利要求1-10任一项所述的方法被执行。
  22. 一种通信装置,其特征在于,所述通信装置包括:处理器,所述处理器与存储器耦合;
    所述存储器用于存储计算机指令;
    所述处理器用于执行所述计算机指令,使得执行权利要求11-18任一项所述的方法被执行。
  23. 一种通信系统,其特征在于,包括TCP服务端、TCP客户端、以及一个或多个中间传输节点;其中,所述TCP服务端用于执行权利要求1-10任一项所述的方法;所述TCP客户端用于执行权利要求11-18任一项所述的方法。
  24. 一种计算机存储介质,其特征在于,所述计算机存储介质包括计算机指令,当所述计算机指令运行时,使得权利要求1-10任一项所述的方法被执行。
  25. 一种计算机存储介质,其特征在于,所述计算机存储介质包括计算机指令,当所述计算机指令运行时,使得权利要求11-18任一项所述的方法被执行。
  26. 一种计算机程序产品,其特征在于,所述计算机程序产品包括计算机指令,当所述计算机指令运行时,使得权利要求1-10任一项所述的方法被执行。
  27. 一种计算机存储介质,其特征在于,所述计算机程序产品包括计算机指令,当所述计算机指令运行时,使得权利要求11-18任一项所述的方法被执行。
  28. 一种装置,所述装置用于执行权利要求1至18任一项所述的方法。
PCT/CN2020/134002 2020-12-04 2020-12-04 一种tcp mss调整方法、装置及系统 WO2022116178A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/134002 WO2022116178A1 (zh) 2020-12-04 2020-12-04 一种tcp mss调整方法、装置及系统

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/134002 WO2022116178A1 (zh) 2020-12-04 2020-12-04 一种tcp mss调整方法、装置及系统

Publications (1)

Publication Number Publication Date
WO2022116178A1 true WO2022116178A1 (zh) 2022-06-09

Family

ID=81852772

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/134002 WO2022116178A1 (zh) 2020-12-04 2020-12-04 一种tcp mss调整方法、装置及系统

Country Status (1)

Country Link
WO (1) WO2022116178A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115022419A (zh) * 2022-06-30 2022-09-06 武汉思普崚技术有限公司 一种自动调整mss的方法、装置和存储介质
CN115426317A (zh) * 2022-11-03 2022-12-02 新华三信息技术有限公司 数据传输速率控制方法、装置及电子设备
CN115842732A (zh) * 2023-02-13 2023-03-24 北京天维信通科技有限公司 分布式全路径探测mtu的方法
CN116132425A (zh) * 2022-12-27 2023-05-16 中国电子科技集团公司第三十研究所 一种大规模多路数据跨网单向导入方法及系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1434380A1 (en) * 2002-12-27 2004-06-30 NTT DoCoMo, Inc. Transmission control method and system
CN101594359A (zh) * 2009-07-01 2009-12-02 杭州华三通信技术有限公司 防御传输控制协议同步洪泛攻击方法及传输控制协议代理
CN101924689A (zh) * 2009-06-16 2010-12-22 中兴通讯股份有限公司 最大分段参数的协商方法及网络转发设备
CN101924771A (zh) * 2010-08-26 2010-12-22 北京天融信科技有限公司 一种用于加速应用代理的核心级tcp连接粘合方法
CN104734985A (zh) * 2013-12-23 2015-06-24 腾讯数码(天津)有限公司 数据接收流量控制方法及其系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1434380A1 (en) * 2002-12-27 2004-06-30 NTT DoCoMo, Inc. Transmission control method and system
CN101924689A (zh) * 2009-06-16 2010-12-22 中兴通讯股份有限公司 最大分段参数的协商方法及网络转发设备
CN101594359A (zh) * 2009-07-01 2009-12-02 杭州华三通信技术有限公司 防御传输控制协议同步洪泛攻击方法及传输控制协议代理
CN101924771A (zh) * 2010-08-26 2010-12-22 北京天融信科技有限公司 一种用于加速应用代理的核心级tcp连接粘合方法
CN104734985A (zh) * 2013-12-23 2015-06-24 腾讯数码(天津)有限公司 数据接收流量控制方法及其系统

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115022419A (zh) * 2022-06-30 2022-09-06 武汉思普崚技术有限公司 一种自动调整mss的方法、装置和存储介质
CN115022419B (zh) * 2022-06-30 2024-02-20 武汉思普崚技术有限公司 一种自动调整mss的方法、装置和存储介质
CN115426317A (zh) * 2022-11-03 2022-12-02 新华三信息技术有限公司 数据传输速率控制方法、装置及电子设备
CN115426317B (zh) * 2022-11-03 2023-03-24 新华三信息技术有限公司 数据传输速率控制方法、装置及电子设备
CN116132425A (zh) * 2022-12-27 2023-05-16 中国电子科技集团公司第三十研究所 一种大规模多路数据跨网单向导入方法及系统
CN116132425B (zh) * 2022-12-27 2024-03-26 中国电子科技集团公司第三十研究所 一种大规模多路数据跨网单向导入方法及系统
CN115842732A (zh) * 2023-02-13 2023-03-24 北京天维信通科技有限公司 分布式全路径探测mtu的方法
CN115842732B (zh) * 2023-02-13 2023-05-23 北京天维信通科技有限公司 分布式全路径探测mtu的方法

Similar Documents

Publication Publication Date Title
WO2022116178A1 (zh) 一种tcp mss调整方法、装置及系统
US10237153B2 (en) Packet retransmission method and apparatus
KR100785293B1 (ko) 다중 tcp확인응답을 이용한 tcp 혼잡 제어 시스템및 그 방법
US7609697B2 (en) Optimizing IEEE 802.11 for TCP/IP data transfer
US7471681B2 (en) Determining network path transmission unit
US7042907B2 (en) Packet transfer apparatus and method
US7061856B2 (en) Data throughput over lossy communication links
WO2018205688A1 (zh) 一种数据传输的方法、装置和系统
US8085669B2 (en) Session relay device and session relay method
US9967193B2 (en) Method and system for increasing data flow transmission
US20070171828A1 (en) Method of determining a maximum transmission unit value of a network path using transport layer feedback
JP2008508817A (ja) 低頻度ackのシステムに適した高性能tcp
US20070076618A1 (en) IP communication device and IP communication system therefor
WO2019052264A1 (zh) 传输报文的方法、网络组件和计算机可读存储介质
WO2018233376A1 (zh) 传输报文的方法、代理服务器和计算机可读存储介质
WO2017107148A1 (zh) 一种数据传输方法及网络侧设备
US7490160B2 (en) Method of efficiently transmitting/receiving data using transport layer in a mobile ad hoc network, and network device using the method
WO2020154872A1 (zh) 一种传输控制协议加速方法和装置
KR100913897B1 (ko) 재전송 타임아웃 수를 줄이기 위한 전송 제어 프로토콜혼잡제어방법
KR100468290B1 (ko) 유디피 제어시스템
US20140369189A1 (en) Method of controlling packet transmission in network system and network system transmitting packet using pseudo-tcp agent
Range Gowda et al. Survey on transmission control (TCP) protocol for wired and wireless networks
Raza et al. Persistent packet reordering attack in TCP based Ad hoc wireless networks
KR20040024628A (ko) 유디피 제어시스템의 송수신처리방법
Rohrer et al. Opportunistic transport for disrupted airborne networks

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20964024

Country of ref document: EP

Kind code of ref document: A1