A message transmission method, device, equipment and readable storage medium
By using the connection identification field of the QUIC client in the NAT device to generate a second QUIC message and populate the reserved field of the message header, the problem of NAT device performing NAT mapping timeout aging and rebinding of the QUIC long connection session is solved. The stability of QUIC long connection is achieved.
Patent Information
- Application Number
- CN202010908611.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-02
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2040-09-02
AI Technical Summary
NAT devices perform NAT mapping timeout aging and rebinding on QUIC long connection sessions, resulting in a change in the session source port.
By obtaining the first QUIC message from the QUIC client, the second QUIC message is generated using its connection identification field, and the information that uniquely identifies the QUIC connection is filled in the reserved field of the message header, so that the NAT device can accurately maintain the QUIC long connection. The life cycle of the port map entry.
Avoid NAT mapping timeout aging and rebinding of QUIC long connection sessions by NAT devices, preventing the change of the session source port and ensuring the stability of QUIC long connections.
Smart Images

Figure CN114205425B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a message transmission method, device, equipment and readable storage medium. Background Art
[0002] The QUIC (Quick UDP Internet Connection) protocol uses UDP (User Datagram Protocol) as the transport layer. Many NAT (Network Address Translation) routers in the current network observe the SYN (synchronization), ACK (acknowledgement) and FIN (end) messages in the TCP (Transmission Control Protocol) connection to determine the establishment and termination of the connection, and then accurately maintain the life cycle of the table entries in the NAT mapping table.
[0003] Many NAT devices in the existing network do not support the recognition of the QUIC protocol. Therefore, the existing processing method may cause the NAT device to timeout and rebind the NAT mapping of the QUIC long connection session, resulting in the change of the session source port. Summary of the invention
[0004] The embodiments of the present invention provide a message transmission method, apparatus, device and readable storage medium to solve the problem of session source port change caused by NAT mapping timeout and rebinding of a QUIC long connection session by a NAT device.
[0005] In a first aspect, an embodiment of the present invention provides a message transmission method, which is applied to a NAT device, including:
[0006] Obtain a first QUIC message from a QUIC client, where a connection identification field of the first QUIC message is used to identify a QUIC connection;
[0007] Obtain a second QUIC message according to the first QUIC message;
[0008] Sending the second QUIC message to the receiving end;
[0009] Among them, the reserved field in the message header of the second QUIC message is used to uniquely identify the QUIC connection, and the information in the reserved field is obtained based on the information in the connection identification field.
[0010] The obtaining, according to the first QUIC message, a second QUIC message includes:
[0011] Filling the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message; or
[0012] Fill the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0013] The step of filling the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message includes:
[0014] Read the encoded value of the flag field Flags of the first QUIC message;
[0015] Determining a target identifier of the QUIC connection according to the encoded value of the Flags field;
[0016] Fill the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message.
[0017] The step of filling the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message includes:
[0018] Read the encoded value of the Flags field of the first QUIC message;
[0019] Determining a target identifier of the QUIC connection according to the encoded value of the Flags field;
[0020] Fill the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0021] Wherein, determining the target identifier of the QUIC connection according to the encoded value of the Flags field includes:
[0022] Determine information of a connection identification field of the first QUIC message according to the values of Bit2 and Bit3 of the Flags field;
[0023] Determine the target identifier of the QUIC connection based on the information of the connection identifier field of the first QUIC message.
[0024] Among them, determining information of the connection identification field of the first QUIC message according to the values of Bit2 and Bit3 of the Flags field includes:
[0025] If Bit2 and Bit3 of the Flags field are both 1, an 8-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0026] If the value of Bit2 of the Flags field is 0 and the value of Bit3 is 1, a 4-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0027] If the value of Bit2 of the Flags field is 1 and the value of Bit3 is 0, a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0028] If Bit2 and Bit3 of the Flags field are both 0, the QUIC connection identifier is not stored in the connection identifier field of the first QUIC message.
[0029] The determining, according to information of the connection identifier field of the first QUIC message, the target identifier of the QUIC connection includes:
[0030] If an 8-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, a hash operation is performed on the 8-byte QUIC connection identifier to obtain a 32-bit hash value, and the 32-bit hash value is used as the target identifier of the QUIC connection;
[0031] If a 4-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, the 4-byte QUIC connection identifier is used as the target identifier of the QUIC connection;
[0032] If a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, the 1-byte QUIC connection identifier is used as the lower 8 bits, and the upper 24 bits are padded with 0s to obtain the target identifier of the QUIC connection;
[0033] If the connection identifier field of the first QUIC message does not store a QUIC connection identifier, a 32-bit value is randomly generated and used as the target identifier of the QUIC connection.
[0034] In a second aspect, an embodiment of the present invention further provides a message transmission method, applied to a receiving end, comprising:
[0035] Receive a second QUIC message sent by the NAT device, wherein a reserved field in a message header of the second QUIC message is used to uniquely identify the QUIC connection, and information in the reserved field is obtained according to information in a connection identification field of a first QUIC message of the QUIC client;
[0036] Process according to the second QUIC message.
[0037] The second QUIC message is obtained in the following manner:
[0038] Filling the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message; or
[0039] Fill the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0040] In a third aspect, an embodiment of the present invention provides a message transmission device, which is applied to a NAT device, including:
[0041] A first acquisition module, configured to acquire a first QUIC message from a QUIC client, wherein a connection identification field of the first QUIC message is used to identify a QUIC connection;
[0042] A second acquisition module, configured to obtain a second QUIC message according to the first QUIC message;
[0043] A first sending module, configured to send the second QUIC message to a receiving end;
[0044] Among them, the reserved field in the message header of the second QUIC message is used to uniquely identify the QUIC connection, and the information in the reserved field is obtained based on the information in the connection identification field.
[0045] Wherein, the second acquisition module includes:
[0046] A first acquisition submodule is configured to fill in the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message; or
[0047] The second acquisition submodule is used to fill in the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0048] Wherein, the first acquisition submodule includes:
[0049] A first acquiring unit, configured to read an encoded value of a flag field Flags of the first QUIC message;
[0050] A determining unit, configured to determine a target identifier of the QUIC connection according to an encoding value of the Flags field;
[0051] The first filling unit is used to fill the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message.
[0052] Wherein, the second acquisition submodule includes:
[0053] A second acquisition unit, configured to read an encoded value of a Flags field of the first QUIC message;
[0054] A determining unit, configured to determine a target identifier of the QUIC connection according to an encoding value of the Flags field;
[0055] The second filling unit is used to fill the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0056] Wherein, the determining unit includes:
[0057] A first determination submodule, configured to determine information of a connection identification field of the first QUIC message according to values of Bit2 and Bit3 of the Flags field;
[0058] The second determination submodule is used to determine the target identifier of the QUIC connection based on the information of the connection identifier field of the first QUIC message.
[0059] Wherein, the first determining submodule is used to:
[0060] If Bit2 and Bit3 of the Flags field are both 1, an 8-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0061] If the value of Bit2 of the Flags field is 0 and the value of Bit3 is 1, a 4-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0062] If the value of Bit2 of the Flags field is 1 and the value of Bit3 is 0, a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0063] If Bit2 and Bit3 of the Flags field are both 0, the QUIC connection identifier is not stored in the connection identifier field of the first QUIC message.
[0064] Wherein, the second determining submodule is used to:
[0065] If an 8-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, a hash operation is performed on the 8-byte QUIC connection identifier to obtain a 32-bit hash value, and the 32-bit hash value is used as the target identifier of the QUIC connection;
[0066] If a 4-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, the 4-byte QUIC connection identifier is used as the target identifier of the QUIC connection;
[0067] If a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, the 1-byte QUIC connection identifier is used as the lower 8 bits, and the upper 24 bits are padded with 0s to obtain the target identifier of the QUIC connection;
[0068] If the connection identifier field of the first QUIC message does not store a QUIC connection identifier, a 32-bit value is randomly generated and used as the target identifier of the QUIC connection.
[0069] In a fourth aspect, an embodiment of the present invention provides a message transmission device, applied to a receiving end, comprising:
[0070] A first receiving module, configured to receive a second QUIC message sent by a NAT device, wherein a reserved field in a message header of the second QUIC message is used to uniquely identify the QUIC connection, and information in the reserved field is obtained according to information in a connection identification field of a first QUIC message of the QUIC client;
[0071] The first processing module is used to process according to the second QUIC message.
[0072] The second QUIC message is obtained in the following manner:
[0073] Filling the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message; or
[0074] Fill the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0075] In a fifth aspect, an embodiment of the present invention provides a message transmission device, applied to a NAT device, comprising: a processor and a transceiver;
[0076] The transceiver is used to obtain a first QUIC message from a QUIC client, where the connection identification field of the first QUIC message is used to identify a QUIC connection;
[0077] The processor is configured to obtain a second QUIC message according to the first QUIC message;
[0078] The transceiver is used to send the second QUIC message to the receiving end;
[0079] Among them, the reserved field in the message header of the second QUIC message is used to uniquely identify the QUIC connection, and the information in the reserved field is obtained based on the information in the connection identification field.
[0080] The processor is configured to fill in the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message; or fill in the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0081] Among them, the processor is used to read the encoded value of the flag field Flags of the first QUIC message; determine the target identifier of the QUIC connection according to the encoded value of the Flags field; fill the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message.
[0082] The processor is configured to read the encoded value of the Flags field of the first QUIC message; determine the target identifier of the QUIC connection according to the encoded value of the Flags field; fill the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0083] Among them, the processor is used to determine the information of the connection identification field of the first QUIC message according to the values of Bit2 and Bit3 of the Flags field; and determine the target identifier of the QUIC connection according to the information of the connection identification field of the first QUIC message.
[0084] Wherein, the processor is used for:
[0085] If Bit2 and Bit3 of the Flags field are both 1, an 8-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0086] If the value of Bit2 of the Flags field is 0 and the value of Bit3 is 1, a 4-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0087] If the value of Bit2 of the Flags field is 1 and the value of Bit3 is 0, a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0088] If Bit2 and Bit3 of the Flags field are both 0, the QUIC connection identifier is not stored in the connection identifier field of the first QUIC message.
[0089] Wherein, the processor is used for:
[0090] If an 8-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, a hash operation is performed on the 8-byte QUIC connection identifier to obtain a 32-bit hash value, and the 32-bit hash value is used as the target identifier of the QUIC connection;
[0091] If a 4-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, the 4-byte QUIC connection identifier is used as the target identifier of the QUIC connection;
[0092] If a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, the 1-byte QUIC connection identifier is used as the lower 8 bits, and the upper 24 bits are padded with 0s to obtain the target identifier of the QUIC connection;
[0093] If the connection identifier field of the first QUIC message does not store a QUIC connection identifier, a 32-bit value is randomly generated and used as the target identifier of the QUIC connection.
[0094] In a sixth aspect, an embodiment of the present invention provides a message transmission device, applied to a receiving end, comprising: a processor and a transceiver;
[0095] The transceiver is used to receive a second QUIC message sent by the NAT device, wherein a reserved field in a message header of the second QUIC message is used to uniquely identify the QUIC connection, and information in the reserved field is obtained according to information in a connection identification field of a first QUIC message of the QUIC client;
[0096] The processor is used to process according to the second QUIC message.
[0097] The second QUIC message is obtained in the following manner:
[0098] Filling the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message; or
[0099] Fill the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0100] In the seventh aspect, an embodiment of the present invention further provides a communication device, comprising: a transceiver, a memory, a processor, and a program stored in the memory and executable on the processor, wherein the processor implements the steps in the message transmission method as described above when executing the program.
[0101] In an eighth aspect, an embodiment of the present invention further provides a readable storage medium, on which a program is stored, and when the program is executed by a processor, the steps in the message transmission method as described above are implemented.
[0102] In an embodiment of the present invention, a second QUIC message is obtained according to the first QUIC message obtained by the QUIC client, wherein the reserved field in the message header of the second QUIC message is used to uniquely identify the QUIC connection, and the information in the reserved field is obtained according to the information in the connection identification field. In this way, a NAT device that does not support the QUIC protocol can accurately maintain the life cycle of the QUIC persistent connection port mapping table entry, thereby avoiding the situation where the NAT device performs NAT mapping timeout aging and rebinding on the QUIC persistent connection session, resulting in a change in the session source port. BRIEF DESCRIPTION OF THE DRAWINGS
[0103] Figure 1 It is one of the flow charts of the message transmission method provided by the embodiment of the present invention;
[0104] Figure 2 This is a schematic diagram of the QUIC message format;
[0105] Figure 3 This is the second flowchart of the message transmission method provided by the embodiment of the present invention;
[0106] Figure 4 It is one of the structural diagrams of the message transmission device provided in the embodiment of the present invention;
[0107] Figure 5 This is the second structural diagram of the message transmission device provided by the embodiment of the present invention;
[0108] Figure 6 This is the third structural diagram of the message transmission device provided by the embodiment of the present invention;
[0109] Figure 7 This is the fourth structural diagram of the message transmission device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0110] In the embodiments of the present invention, the term "and / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0111] In the embodiments of the present application, the term "plurality" refers to two or more than two, and other quantifiers are similar.
[0112] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0113] See also Figure 1 , Figure 1 Flow chart of the message transmission method provided by the embodiment of the present invention, which is applied to NAT equipment, such as Figure 1 As shown, the following steps are included:
[0114] Step 101: Obtain a first QUIC message from a QUIC client, where a connection identification field of the first QUIC message is used to identify a QUIC connection.
[0115] Among them, the format of the first QUIC message is as follows Figure 2 As shown, the Connection ID field is used to identify a QUIC connection, for example, the Connection ID of the QUIC connection can be stored. The length of this field is variable and can be 0, 1, 4 or 8 bytes, depending on the encoding of the Flags field.
[0116] Among them, Bit2 and Bit3 of the Flags field are used to indicate the length of the Connection ID in the message. The corresponding relationship between the Bit2 and Bit3 encoding and the Connection ID length is as follows:
[0117] 0x0C (Bit3 and Bit2 are both 1) indicates that the length of the Connection ID is 8 bytes;
[0118] 0x08 (Bit3 is 1, Bit2 is 0) means the length of the Connection ID is 4 bytes;
[0119] 0x04 (Bit3 is 0, Bit2 is 1) means the length of the Connection ID is 1 byte;
[0120] 0x00 (Bit3 and Bit2 are both 0) means there is no Connection ID.
[0121] Step 102: Obtain a second QUIC message based on the first QUIC message.
[0122] Among them, the reserved field in the message header of the second QUIC message is used to uniquely identify the QUIC connection, and the information in the reserved field is obtained based on the information in the connection identification field.
[0123] Specifically, in this step, the target identifier of the QUIC connection can be filled in the option field of the IPv4 message header to obtain the second QUIC message; or, the target identifier of the QUIC connection can be filled in the extension field of the IPv6 message header to obtain the second QUIC message.
[0124] If the target identifier of the QUIC connection is filled in the option field of the IPv4 message header, then the encoding value of the Flags field of the first QUIC message can be read, and the target identifier of the QUIC connection can be determined according to the encoding value of the Flags field. Afterwards, the target identifier of the QUIC connection is filled in the option field of the IPv4 message header to obtain the second QUIC message. In this way, the filling of the target identifier of the QUIC connection is achieved by extending the option field of the IPv4 message header, which makes little change to the IPv4 protocol and does not require changes to the QUIC protocol stack, making it easy to implement.
[0125] If the target identifier of the QUIC connection is filled in the extension field of the IPv6 message header, then the encoding value of the Flags field of the first QUIC message can be read, and the target identifier of the QUIC connection can be determined according to the encoding value of the Flags field. Afterwards, the target identifier of the QUIC connection is filled in the extension field of the IPv6 message header to obtain the second QUIC message. In this way, the filling of the target identifier of the QUIC connection is achieved by extending the option field of the IPv4 message header, which makes little change to the IPv6 protocol and does not require changes to the QUIC protocol stack, making it easy to implement.
[0126] In the above two cases, the target identifier of the QUIC connection can be determined in the following manner: according to the values of Bit2 and Bit3 of the Flags field, the information of the connection identifier field of the first QUIC message is determined; and according to the information of the connection identifier field of the first QUIC message, the target identifier of the QUIC connection is determined.
[0127] According to the correspondence between the Bit2 and Bit3 encodings and the Connection ID length described in step 101, if Bit2 and Bit3 of the Flags field are both 1, an 8-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message; if the Bit2 value of the Flags field is 0 and the Bit3 value is 1, a 4-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message; if the Bit2 value of the Flags field is 1 and the Bit3 value is 0, a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message; if the Bit2 value of the Flags field is 1 and the Bit3 value is 0, a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message; if the Bit2 and Bit3 of the Flags field are both 0, no QUIC connection identifier is stored in the connection identifier field of the first QUIC message.
[0128] In the embodiment of the present invention, if the option field of the IPv4 header is extended, since the option field of the IPv4 header can be at most 32 bits, in this case, 32 bits are used to identify the QUIC connection. If the extension field of the IPv6 header is extended, although it can exceed 32 bits, in the embodiment of the present invention, 32 bits can still be used to identify the QUIC connection.
[0129] Depending on the information stored in the connection identifier field of the first QUIC message, there are different ways to determine the target identifier of the QUIC connection:
[0130] (1) If an 8-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, a hash operation is performed on the 8-byte QUIC connection identifier to obtain a 32-bit hash value, and the 32-bit hash value is used as the target identifier of the QUIC connection.
[0131] That is, if the Connection ID of the first QUIC message header is 8 bytes, i.e. 64 bits, then a hash operation is performed on the 64-bit Connection ID to generate a 32-bit hash value, and the 32-bit hash value is used as the target identifier.
[0132] (2) If a 4-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, the 4-byte QUIC connection identifier is used as the target identifier of the QUIC connection.
[0133] That is, if the Connection ID of the first QUIC message header is 4 bytes, i.e. 32 bits, then the Connection ID of the first QUIC message is directly used as the target identifier.
[0134] (3) If a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, the 1-byte QUIC connection identifier is used as the lower 8 bits and the upper 24 bits are padded with 0s to obtain the target identifier of the QUIC connection.
[0135] That is, if the Connection ID of the first QUIC message header is 1 byte, i.e. 8 bits, then the Connection ID of the first QUIC message header is used as the lower 8 bits, and the upper 24 bits are all filled with 0s to obtain the target identifier.
[0136] (4) If the connection identifier field of the first QUIC message does not store a QUIC connection identifier, a 32-bit value is randomly generated, and the 32-bit value is used as the target identifier of the QUIC connection.
[0137] That is, if the Connection ID of the first QUIC message header is 0 bytes, then the NAT device may generate a randomly generated 32-bit value and use the 32-bit value as the target identifier of the QUIC connection. The randomly generated 32-bit value may be different from the identifiers of other QUIC connections. For example, the NAT device may use a random number generator to generate a 32-bit random number that is unique, and use the random number as the target identifier.
[0138] Step 103: Send the second QUIC message to the receiving end.
[0139] The receiving end may be a server, a load balancing device, a firewall, a switching routing device, etc.
[0140] It can be seen from the above description that in an embodiment of the present invention, a second QUIC message is obtained according to the first QUIC message obtained by the QUIC client, wherein the reserved field in the message header of the second QUIC message is used to uniquely identify the QUIC connection, and the information in the reserved field is obtained according to the information in the connection identification field. In this way, NAT devices that do not support the QUIC protocol can accurately maintain the life cycle of the QUIC long connection port mapping table entry, thereby avoiding the NAT device from performing NAT mapping timeout aging and rebinding on the QUIC long connection session, resulting in a change in the session source port. In other words, the NAT device does not need to support the recognition capability of the QUIC protocol to accurately maintain the life cycle of the port mapping table entry, thereby preventing the random aging of the QUIC long connection.
[0141] In addition, the QUIC connection is identified through the option field of the IPv4 message or the extension field of the IPv6 message, which introduces little overhead and does not require the transformation and upgrading of existing NAT equipment, thus facilitating the deployment and promotion of the QUIC protocol in the existing network.
[0142] See also Figure 3 , Figure 3 is a flow chart of a message transmission method provided by an embodiment of the present invention, which is applied to a receiving end, such as Figure 3 As shown, the following steps are included:
[0143] Step 301: Receive a second QUIC message sent by a NAT device, wherein a reserved field in a message header of the second QUIC message is used to uniquely identify the QUIC connection, and information in the reserved field is obtained based on information in a connection identification field of a first QUIC message of the QUIC client.
[0144] The receiving end may be a server, a load balancing device, a firewall, a switching routing device, etc.
[0145] Step 302: Process according to the second QUIC message.
[0146] The processing method is different depending on the receiving end. For example, if the receiving end is a load balancing device, then the load balancing device will perform load balancing processing based on the second QUIC message.
[0147] It can be seen from the above description that in an embodiment of the present invention, a second QUIC message is obtained according to the first QUIC message obtained by the QUIC client, wherein the reserved field in the message header of the second QUIC message is used to uniquely identify the QUIC connection, and the information in the reserved field is obtained according to the information in the connection identification field. In this way, NAT devices that do not support the QUIC protocol can accurately maintain the life cycle of the QUIC long connection port mapping table entry, thereby avoiding the NAT device from performing NAT mapping timeout aging and rebinding on the QUIC long connection session, resulting in a change in the session source port.
[0148] The embodiment of the present invention also provides a message transmission device, which is applied to a NAT device. Figure 4 , Figure 4 1 is a structural diagram of a message transmission device provided in an embodiment of the present invention. Since the principle of solving the problem by the message transmission device is similar to that of the message transmission method in an embodiment of the present invention, the implementation of the message transmission device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0149] like Figure 4As shown, the message transmission device 400 includes: a first acquisition module 401, used to obtain a first QUIC message from a QUIC client, and the connection identification field of the first QUIC message is used to identify the QUIC connection; a second acquisition module 402, used to obtain a second QUIC message according to the first QUIC message; a first sending module 403, used to send the second QUIC message to the receiving end; wherein, the reserved field of the message header of the second QUIC message is used to uniquely identify the QUIC connection, and the information in the reserved field is obtained based on the information in the connection identification field.
[0150] Wherein, the second acquisition module includes:
[0151] A first acquisition submodule is configured to fill in the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message; or
[0152] The second acquisition submodule is used to fill in the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0153] Wherein, the first acquisition submodule includes:
[0154] A first acquiring unit, configured to read an encoded value of a flag field Flags of the first QUIC message;
[0155] A determining unit, configured to determine a target identifier of the QUIC connection according to an encoding value of the Flags field;
[0156] The first filling unit is used to fill the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message.
[0157] Wherein, the second acquisition submodule includes:
[0158] A second acquisition unit, configured to read an encoded value of a Flags field of the first QUIC message;
[0159] A determining unit, configured to determine a target identifier of the QUIC connection according to an encoding value of the Flags field;
[0160] The second filling unit is used to fill the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0161] Wherein, the determining unit includes:
[0162] A first determination submodule, configured to determine information of a connection identification field of the first QUIC message according to values of Bit2 and Bit3 of the Flags field;
[0163] The second determination submodule is used to determine the target identifier of the QUIC connection based on the information of the connection identifier field of the first QUIC message.
[0164] Wherein, the first determining submodule is used to:
[0165] If Bit2 and Bit3 of the Flags field are both 1, an 8-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0166] If the value of Bit2 of the Flags field is 0 and the value of Bit3 is 1, a 4-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0167] If the value of Bit2 of the Flags field is 1 and the value of Bit3 is 0, a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0168] If Bit2 and Bit3 of the Flags field are both 0, the QUIC connection identifier is not stored in the connection identifier field of the first QUIC message.
[0169] Wherein, the second determining submodule is used to:
[0170] If an 8-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, a hash operation is performed on the 8-byte QUIC connection identifier to obtain a 32-bit hash value, and the 32-bit hash value is used as the target identifier of the QUIC connection;
[0171] If a 4-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, the 4-byte QUIC connection identifier is used as the target identifier of the QUIC connection;
[0172] If a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, the 1-byte QUIC connection identifier is used as the lower 8 bits, and the upper 24 bits are padded with 0s to obtain the target identifier of the QUIC connection;
[0173] If the connection identifier field of the first QUIC message does not store a QUIC connection identifier, a 32-bit value is randomly generated and used as the target identifier of the QUIC connection.
[0174] The device provided in the embodiment of the present invention can execute the above method embodiment, and its implementation principle and technical effects are similar, so this embodiment will not be repeated here.
[0175] The embodiment of the present invention also provides a message transmission device, which is applied to a receiving end. Figure 5 , Figure 5 1 is a structural diagram of a message transmission device provided in an embodiment of the present invention. Since the principle of solving the problem by the message transmission device is similar to that of the message transmission method in an embodiment of the present invention, the implementation of the message transmission device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0176] like Figure 5 As shown, the message transmission device 500 includes: a first receiving module 501, used to receive a second QUIC message sent by a NAT device, wherein a reserved field in a message header of the second QUIC message is used to uniquely identify the QUIC connection, and the information in the reserved field is obtained based on the information in a connection identification field of a first QUIC message of the QUIC client; a first processing module 502, used to perform processing based on the second QUIC message.
[0177] The second QUIC message is obtained in the following manner:
[0178] Filling the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message; or
[0179] Fill the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0180] The device provided in the embodiment of the present invention can execute the above method embodiment, and its implementation principle and technical effects are similar, so this embodiment will not be repeated here.
[0181] The embodiment of the present invention also provides a message transmission device, which is applied to a NAT device. Figure 6 , Figure 6 1 is a structural diagram of a message transmission device provided in an embodiment of the present invention. Since the principle of solving the problem by the message transmission device is similar to that of the message transmission method in an embodiment of the present invention, the implementation of the message transmission device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0182] like Figure 6 As shown, the message transmission device 600 includes: a processor 601 and a transceiver 602;
[0183] The transceiver 602 is used to obtain a first QUIC message from a QUIC client, where the connection identification field of the first QUIC message is used to identify a QUIC connection;
[0184] The processor 601 is configured to obtain a second QUIC message according to the first QUIC message;
[0185] The transceiver 602 is used to send the second QUIC message to the receiving end;
[0186] Among them, the reserved field in the message header of the second QUIC message is used to uniquely identify the QUIC connection, and the information in the reserved field is obtained based on the information in the connection identification field.
[0187] The processor 601 is configured to fill in the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message; or fill in the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0188] Among them, the processor 601 is used to read the encoded value of the tag field Flags of the first QUIC message; determine the target identifier of the QUIC connection according to the encoded value of the Flags field; fill the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message.
[0189] Among them, the processor 601 is used to read the encoded value of the Flags field of the first QUIC message; determine the target identifier of the QUIC connection according to the encoded value of the Flags field; fill the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0190] Among them, the processor 601 is used to determine the information of the connection identification field of the first QUIC message according to the values of Bit2 and Bit3 of the Flags field; and determine the target identifier of the QUIC connection according to the information of the connection identification field of the first QUIC message.
[0191] The processor 601 is configured to:
[0192] If Bit2 and Bit3 of the Flags field are both 1, an 8-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0193] If the value of Bit2 of the Flags field is 0 and the value of Bit3 is 1, a 4-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0194] If the value of Bit2 of the Flags field is 1 and the value of Bit3 is 0, a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message;
[0195] If Bit2 and Bit3 of the Flags field are both 0, the QUIC connection identifier is not stored in the connection identifier field of the first QUIC message.
[0196] The processor 601 is configured to:
[0197] If an 8-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, a hash operation is performed on the 8-byte QUIC connection identifier to obtain a 32-bit hash value, and the 32-bit hash value is used as the target identifier of the QUIC connection;
[0198] If a 4-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, the 4-byte QUIC connection identifier is used as the target identifier of the QUIC connection;
[0199] If a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, the 1-byte QUIC connection identifier is used as the lower 8 bits, and the upper 24 bits are padded with 0s to obtain the target identifier of the QUIC connection;
[0200] If the connection identifier field of the first QUIC message does not store a QUIC connection identifier, a 32-bit value is randomly generated and used as the target identifier of the QUIC connection.
[0201] The device provided in the embodiment of the present invention can execute the above method embodiment, and its implementation principle and technical effects are similar, so this embodiment will not be repeated here.
[0202] The embodiment of the present invention also provides a message transmission device, which is applied to a receiving end. Figure 7 , Figure 7 1 is a structural diagram of a message transmission device provided in an embodiment of the present invention. Since the principle of solving the problem by the message transmission device is similar to that of the message transmission method in an embodiment of the present invention, the implementation of the message transmission device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0203] like Figure 7As shown, the message transmission device 700 includes: a processor 701 and a transceiver 702;
[0204] The transceiver 702 is used to receive a second QUIC message sent by the NAT device, wherein the reserved field of the message header of the second QUIC message is used to uniquely identify the QUIC connection, and the information in the reserved field is obtained according to the information in the connection identification field of the first QUIC message of the QUIC client;
[0205] The processor 701 is used to process according to the second QUIC message.
[0206] The second QUIC message is obtained in the following manner:
[0207] Filling the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message; or
[0208] Fill the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
[0209] The device provided in the embodiment of the present invention can execute the above method embodiment, and its implementation principle and technical effects are similar, so this embodiment will not be repeated here.
[0210] An embodiment of the present invention further provides a communication device, comprising: a transceiver, a memory, a processor, and a program stored in the memory and executable on the processor, wherein the processor implements the steps in the message transmission method as described above when executing the program.
[0211] The embodiment of the present invention further provides a readable storage medium, on which a program is stored, and when the program is executed by a processor, each process of the above-mentioned text processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. Among them, the readable storage medium can be any available medium or data storage device that can be accessed by the processor, including but not limited to magnetic storage (such as floppy disk, hard disk, magnetic tape, magneto-optical disk (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid state drive (SSD)), etc.
[0212] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0213] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), and includes a number of instructions for a terminal (which can be a mobile phone, computer, server, air conditioner, or network equipment, etc.) to execute the methods described in each embodiment of the present invention.
[0214] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
Claims
1. A message transmission method, applied to a network address translation NAT device, characterized in that: include: Obtain a first QUIC message from a QUIC client, where a connection identification field of the first QUIC message is used to identify a QUIC connection; Obtain a second QUIC message according to the first QUIC message; Sending the second QUIC message to the receiving end; The reserved field in the message header of the second QUIC message is used to uniquely identify the QUIC connection, and the information in the reserved field is obtained according to the information in the connection identification field; The information in the reserved field includes a target identifier of the QUIC connection, and the target identifier of the QUIC connection is determined in the following manner: Determine the target identifier of the QUIC connection according to the encoded value of the Flags field of the connection identifier field.
2. The method according to claim 1, characterized in that The obtaining, according to the first QUIC message, a second QUIC message, comprises: Filling the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message; or Fill the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
3. The method according to claim 2, characterized in that Filling the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message includes: Read the encoded value of the flag field Flags of the first QUIC message; Determining a target identifier of the QUIC connection according to the encoded value of the Flags field; Fill the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message.
4. The method according to claim 2, characterized in that: Filling the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message includes: Read the encoded value of the Flags field of the first QUIC message; Determining a target identifier of the QUIC connection according to the encoded value of the Flags field; Fill the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
5. The method according to claim 3 or 4, characterized in that: The determining, according to the encoded value of the Flags field, a target identifier of the QUIC connection, includes: Determine information of a connection identification field of the first QUIC message according to the values of Bit2 and Bit3 of the Flags field; Determine the target identifier of the QUIC connection based on the information of the connection identifier field of the first QUIC message.
6. The method according to claim 5, characterized in that The determining, according to the values of Bit2 and Bit3 of the Flags field, information of the connection identification field of the first QUIC message includes: If Bit2 and Bit3 of the Flags field are both 1, an 8-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message; If the value of Bit2 of the Flags field is 0 and the value of Bit3 is 1, a 4-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message; If the value of Bit2 of the Flags field is 1 and the value of Bit3 is 0, a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message; If Bit2 and Bit3 of the Flags field are both 0, the QUIC connection identifier is not stored in the connection identifier field of the first QUIC message.
7. The method according to claim 6, characterized in that The determining, according to information of a connection identifier field of the first QUIC message, a target identifier of the QUIC connection includes: If an 8-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, a hash operation is performed on the 8-byte QUIC connection identifier to obtain a 32-bit hash value, and the 32-bit hash value is used as the target identifier of the QUIC connection; If a 4-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, the 4-byte QUIC connection identifier is used as the target identifier of the QUIC connection; If a 1-byte QUIC connection identifier is stored in the connection identifier field of the first QUIC message, the 1-byte QUIC connection identifier is used as the lower 8 bits, and the upper 24 bits are padded with 0s to obtain the target identifier of the QUIC connection; If the connection identifier field of the first QUIC message does not store a QUIC connection identifier, a 32-bit value is randomly generated and used as the target identifier of the QUIC connection.
8. A message transmission method, applied to a receiving end, characterized in that: include: Receive a second QUIC message sent by the NAT device, wherein a reserved field in a message header of the second QUIC message is used to uniquely identify the QUIC connection, and information in the reserved field is obtained according to information in a connection identification field of a first QUIC message of the QUIC client; Processing according to the second QUIC message; The information in the reserved field includes a target identifier of the QUIC connection, and the target identifier of the QUIC connection is determined in the following manner: Determine the target identifier of the QUIC connection according to the encoded value of the Flags field of the connection identifier field.
9. The method according to claim 8, characterized in that The second QUIC message is obtained in the following manner: Filling the target identifier of the QUIC connection in the option field of the IPv4 message header to obtain the second QUIC message; or Fill the target identifier of the QUIC connection in the extension field of the IPv6 message header to obtain the second QUIC message.
10. A message transmission device, applied to a NAT device, characterized in that: include: A first acquisition module, configured to acquire a first QUIC message from a QUIC client, wherein a connection identification field of the first QUIC message is used to identify a QUIC connection; A second acquisition module, configured to obtain a second QUIC message according to the first QUIC message; A first sending module, configured to send the second QUIC message to a receiving end; The reserved field in the message header of the second QUIC message is used to uniquely identify the QUIC connection, and the information in the reserved field is obtained according to the information in the connection identification field; The information in the reserved field includes a target identifier of the QUIC connection, and the target identifier of the QUIC connection is determined in the following manner: Determine the target identifier of the QUIC connection according to the encoded value of the Flags field of the connection identifier field.
11. A message transmission device, applied to a receiving end, characterized in that: include: A first receiving module, configured to receive a second QUIC message sent by a NAT device, wherein a reserved field in a message header of the second QUIC message is used to uniquely identify the QUIC connection, and information in the reserved field is obtained according to information in a connection identification field of a first QUIC message of the QUIC client; A first processing module, configured to perform processing according to the second QUIC message; The information in the reserved field includes a target identifier of the QUIC connection, and the target identifier of the QUIC connection is determined in the following manner: Determine the target identifier of the QUIC connection according to the encoded value of the Flags field of the connection identifier field.
12. A message transmission device, applied to a NAT device, characterized in that: include: processors and transceivers; The transceiver is used to obtain a first QUIC message from a QUIC client, where the connection identification field of the first QUIC message is used to identify a QUIC connection; The processor is configured to obtain a second QUIC message according to the first QUIC message; The transceiver is used to send the second QUIC message to the receiving end; The reserved field in the message header of the second QUIC message is used to uniquely identify the QUIC connection, and the information in the reserved field is obtained according to the information in the connection identification field; The information in the reserved field includes a target identifier of the QUIC connection, and the target identifier of the QUIC connection is determined in the following manner: Determine the target identifier of the QUIC connection according to the encoded value of the Flags field of the connection identifier field.
13. A message transmission device, applied to a receiving end, characterized in that: include: processors and transceivers; The transceiver is used to receive a second QUIC message sent by the NAT device, wherein a reserved field in a message header of the second QUIC message is used to uniquely identify the QUIC connection, and information in the reserved field is obtained according to information in a connection identification field of a first QUIC message of the QUIC client; The processor is configured to process according to the second QUIC message; The information in the reserved field includes a target identifier of the QUIC connection, and the target identifier of the QUIC connection is determined in the following manner: Determine the target identifier of the QUIC connection according to the encoded value of the Flags field of the connection identifier field.
14. A communication device comprising: A transceiver, a memory, a processor, and a program stored in the memory and executable on the processor; wherein the processor is used to read the program in the memory to implement the steps in the message transmission method as described in any one of claims 1 to 7; or to implement the steps in the message transmission method as described in any one of claims 8 to 9.
15. A readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the program implements the steps in the message transmission method according to any one of claims 1 to 7; or implements the steps in the message transmission method according to any one of claims 8 to 9.
Citation Information
Patent Citations
Law latency server-side redirection of UDP-based transport protocols traversing client-side NAT firewall
CN105103522A
Message processing method and device
CN110519282A