CN112995039A - Message processing method and system - Google Patents

Message processing method and system Download PDF

Info

Publication number
CN112995039A
CN112995039A CN202110249122.4A CN202110249122A CN112995039A CN 112995039 A CN112995039 A CN 112995039A CN 202110249122 A CN202110249122 A CN 202110249122A CN 112995039 A CN112995039 A CN 112995039A
Authority
CN
China
Prior art keywords
message
compressed
forwarded
value
length
Prior art date
Legal status (The legal status 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 status listed.)
Withdrawn
Application number
CN202110249122.4A
Other languages
Chinese (zh)
Inventor
张晓东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Maipu Communication Technology Co Ltd
Original Assignee
Maipu Communication Technology Co Ltd
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 Maipu Communication Technology Co Ltd filed Critical Maipu Communication Technology Co Ltd
Priority to CN202110249122.4A priority Critical patent/CN112995039A/en
Publication of CN112995039A publication Critical patent/CN112995039A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • H04L63/101Access control lists [ACL]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Abstract

The application provides a message processing method and a system, wherein the method comprises the following steps: a source router connected with a source end device receives a message to be forwarded, which is sent by the source end device; compressing the effective load in the message to be forwarded to obtain a compressed message; forwarding the compressed message to a destination router connected with destination end equipment; and the destination router receives the compressed message, decompresses the compressed message to obtain a message to be forwarded, and sends the message to be forwarded to destination terminal equipment. By compressing the effective load in the message to be forwarded and forwarding the compressed message to the router connected with the destination terminal device, the message transmission efficiency is improved because the size of the compressed message is obviously smaller than that of the message to be forwarded; the target router decompresses the compressed message and then sends the decompressed message to the target end equipment, so that the target end equipment can quickly extract the effective load from the received message without decompressing the received message.

Description

Message processing method and system
Technical Field
The present application relates to the technical field of communication devices, and in particular, to a method and a system for processing a packet.
Background
The router is a communication device, which mainly works in the network layer of transmission Control Protocol/Internet Protocol (TCP/IP), and its rough working flow is: for a message to be forwarded, a destination IP address in the message is analyzed, then a router connected with a destination device is determined according to a routing table, and finally the message is forwarded to the router connected with the destination device, and finally the message is forwarded to the destination device corresponding to the destination IP address.
With the rapid development of the internet technology, the number of packets that need to be forwarded by the router is increasing, however, in the prior art, after receiving a packet to be forwarded, the router connected to the source device directly forwards the packet to the router connected to the destination device, and then under the condition of limited network bandwidth, the router has the disadvantage of low packet transmission efficiency.
Disclosure of Invention
In view of this, an object of the embodiments of the present application is to provide a method and a system for processing a packet, so as to improve the transmission efficiency of the packet under the condition of a certain network bandwidth.
In a first aspect, an embodiment of the present application provides a method for processing a packet, where the method includes: a source router connected with a source end device receives a message to be forwarded, which is sent by the source end device; compressing the effective load in the message to be forwarded to obtain a compressed message; forwarding the compressed message to a destination router connected with destination end equipment; and the destination router receives the compressed message, decompresses the compressed message to obtain the message to be forwarded, and sends the message to be forwarded to the destination terminal equipment.
In the implementation process, after receiving the message to be forwarded, the source router connected to the source end device compresses the payload in the message to be forwarded and forwards the compressed message to the destination router connected to the destination end device, so that the size of the compressed message is obviously smaller than that of the message to be forwarded, thereby effectively improving the message transmission efficiency; the target router decompresses the compressed message and then sends the decompressed message to the target end equipment, so that the target end equipment can quickly extract the effective load from the received message without decompressing the received message.
Based on the first aspect, in a possible design, before compressing the payload in the packet to be forwarded to obtain a compressed packet, the method further includes: the source router determines that the message to be forwarded meets a preset matching rule; and/or determining that the length of the payload has a value equal to or greater than a preset length.
Under the condition that the effective load is small, the effective load is compressed, and the sizes of data before and after compression do not differ too much; secondly, if the message which does not need to be compressed is compressed, the pressure of the router can be increased, therefore, in the implementation process, only the message which needs to be compressed is compressed, the defect that the pressure of the router is increased due to the fact that the message which does not need to be compressed is avoided being compressed, when the length of the effective load in the message is determined to be larger than or equal to the preset length, the effective load in the message is compressed, the compression of the smaller effective load is avoided, and therefore the processing pressure of the router is reduced on the basis of guaranteeing the message transmission efficiency.
Based on the first aspect, in a possible design, the compressing the payload in the message to be forwarded to obtain a compressed message includes: extracting the effective load from the message to be forwarded; compressing the effective load to obtain compressed data; and replacing the effective load in the message to be forwarded by using the compressed data and the compressed mark to obtain the compressed message.
In the implementation process, the compressed data and the compression mark are used for replacing the payload in the message to be forwarded, so that the router receiving the compressed message can quickly and accurately determine that the compressed message is the message to be decompressed according to the compression mark.
Based on the first aspect, in a possible design, after obtaining the compressed packet, the method further includes: the source router determines the value of the length of the compressed message; the source router resets the value of the first length field in the compressed message to the value of the length of the compressed message to obtain a preliminarily reset message; wherein, the first length field is a field in an IP header in the compressed message; the first length field is used for recording the length of the compressed message; the forwarding the compressed packet to a destination router connected to a destination device includes: and forwarding the preliminarily reset message to the destination router.
In the implementation process, the value of the first length field in the compressed message is reset to the value of the length of the compressed message, so as to obtain a preliminarily reset message, and then, when the router forwards the message corresponding to the message to be forwarded (i.e., the preliminarily reset message), even if other messages to be forwarded are stored in the router, the router cannot mistakenly forward the message irrelevant to be forwarded to the destination router connected to the destination device, so that the accuracy of forwarding the message is ensured.
Based on the first aspect, in a possible design, after obtaining the message after the initial reset, the method further includes: the source router carries out check calculation on the preliminarily reset message to obtain a first check value; the source router resets the value of the check field of the IP header in the preliminarily reset message to the first check value to obtain a re-reset message; the forwarding the packet after the preliminary reset to the destination router includes: and forwarding the re-reset message to the destination router.
In the implementation process, the message after the initial reset is subjected to checking calculation to obtain a first checking value, the value of the checking field of the IP header in the message after the initial reset is reset to be the first checking value, the value of the checking field is updated, the accuracy of the value of the checking field is ensured, the message after the initial reset can successfully pass the checking of the router connected with the destination end device, and the message cannot be discarded by the router connected with the destination end device, so that the normal forwarding of the message is ensured.
Based on the first aspect, in a possible design, the performing, by the source router, a verification calculation on the packet after the initial reconfiguration to obtain a first verification value includes: the source router resets the value of a second length field in the preliminarily reset message to the sum of the value of the length of the compressed data corresponding to the effective load in the compressed message and 8 to obtain a middle message; wherein, the second length field is a field in a UDP header in the preliminary reset message; the second length field is used for recording the total length of the compressed data and the UDP header; the source router carries out check calculation on the intermediate message to obtain the first check value; the source router resets the value of the check field of the IP header in the preliminarily reset message to the first check value to obtain a re-reset message, and the method comprises the following steps: and the source router resets the value of the check field of the IP header in the intermediate message to the first check value to obtain the message after resetting.
Since the second length field in the UDP header in the UDP message records the total length of the UDP header and the data portion in the message, it is worth mentioning that the total length of the UDP header is 8, in the above implementation process, when the message after the preliminary reset belongs to the UDP message, the value of the second length field in the message after the preliminary reset is reset to the sum of the value of the length of the compressed data and 8, so as to ensure the accuracy of the first check value, thereby ensuring the normal forwarding of the message.
In a possible design, based on the first aspect, the method includes: extracting compressed data from the compressed message; decompressing the compressed data to obtain the effective load; and replacing the compressed data in the compressed message by using the effective load to obtain the message to be forwarded.
In the implementation process, the compressed data in the compressed message is decompressed to obtain the payload, the payload is used for replacing the compressed data in the compressed message to obtain the message to be forwarded, and finally the message to be forwarded is forwarded to the destination device, so that the destination device can quickly extract the payload from the received message without decompressing the received message.
Based on the first aspect, in a possible design, the replacing, by the payload, the compressed data in the compressed message to obtain the packet to be forwarded includes: replacing the compressed data in the compressed message with the payload to obtain a decompressed message; determining the value of the length of the decompressed message; resetting the value of a third length field in the decompressed message to the value of the length of the decompressed message to obtain the message to be forwarded; wherein the third length field is a field in an IP header in the decompressed message; and the third length field is used for recording the length of the decompressed message.
In the implementation process, the value of the third length field in the decompressed message is reset to the value of the length of the decompressed message, so that the message to be forwarded is obtained, and then it is ensured that when the router forwards the message (i.e. the message to be forwarded) corresponding to the compressed message, the router does not forward the message irrelevant to the compressed message together, and the accuracy of message forwarding is ensured.
Based on the first aspect, in a possible design, resetting a value of a third length field in the decompressed message to a value of the length of the decompressed message to obtain the to-be-forwarded message includes: resetting the value of the third length field in the decompressed message to the value of the length of the decompressed message to obtain a preliminarily processed message; carrying out check calculation on the preliminarily processed message to obtain a second check value; and resetting the value of the check field of the IP header in the preliminarily processed message to the second check value to obtain the message to be forwarded.
In the implementation process, the second check value is obtained by performing check calculation on the preliminarily processed message, and the value of the check field of the IP header in the preliminarily processed message is reset to the second check value to obtain the message to be forwarded, so that the message to be forwarded can be successfully checked by the destination device, the message processed again by the destination device is prevented from being discarded, and the normal forwarding of the message is ensured.
Based on the first aspect, in a possible design, the performing a check calculation on the preliminarily processed packet to obtain a second check value includes: resetting the value of a fourth length field in the preliminarily processed message to the sum of the value of the length of the effective load and 8 to obtain a modified message; wherein, the fourth length field is a field in a UDP header in the preliminarily processed message; the fourth length field is to record a total length of the payload and the UDP header; carrying out check calculation on the modified message to obtain the second check value; the resetting the value of the check field of the IP header in the preliminarily processed message to the second check value to obtain the message to be forwarded includes: resetting the value of the check field of the IP header in the modified message to the second check value to obtain the message to be forwarded.
Since the fourth length field in the UDP header in the UDP message records the total length of the UDP header and the data portion in the message, it is worth mentioning that the total length of the UDP header is 8, in the above implementation process, when the preliminarily processed message belongs to the UDP message, the value of the fourth length field in the preliminarily processed message is reset to the sum of the value of the length of the decompressed data and 8, so as to ensure the accuracy of the second check value, thereby ensuring the normal forwarding of the message.
In a second aspect, an embodiment of the present application provides a message processing system, where the system includes: the source router is connected with the source end equipment, and the destination router is connected with the destination end equipment; the source router receives a message to be forwarded, which is sent by source end equipment; compressing the effective load in the message to be forwarded to obtain a compressed message; forwarding the compressed message to the destination router; and the destination router receives the compressed message, decompresses the compressed message to obtain the message to be forwarded, and sends the message to be forwarded to the destination terminal equipment.
Additional features and advantages of the present application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the present application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a schematic structural diagram of a message processing system according to an embodiment of the present application.
Fig. 2 is a schematic flowchart of a message processing method according to an embodiment of the present application.
Detailed Description
The technical solution in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a message processing system according to an embodiment of the present application, where the system includes: the source router is connected with the source end device, the destination router is connected with the destination end device, and the source router is in communication connection with the destination router.
The source router receives a message to be forwarded, which is sent by the source end device; compressing the effective load in the message to be forwarded to obtain a compressed message; and forwarding the compressed message to the destination router.
And the destination router receives the compressed message, decompresses the compressed message to obtain the message to be forwarded, and sends the message to be forwarded to the destination terminal equipment.
Referring to fig. 2, fig. 2 is a flowchart of a message processing method according to an embodiment of the present application, where the method is applied to the system shown in fig. 1, and the flow shown in fig. 2 will be described in detail below, where the method includes steps S21-S22.
S21: a source router connected with a source end device receives a message to be forwarded, which is sent by the source end device; compressing the effective load in the message to be forwarded to obtain a compressed message; and forwarding the compressed message to a destination router connected with destination end equipment.
S22: and the destination router receives the compressed message, decompresses the compressed message to obtain the message to be forwarded, and sends the message to be forwarded to the destination terminal equipment.
The above method is described in detail below.
S21: a source router connected with a source end device receives a message to be forwarded, which is sent by the source end device; compressing the effective load in the message to be forwarded to obtain a compressed message; and forwarding the compressed message to a destination router connected with destination end equipment.
Specifically, for convenience, step S21 may be further illustrated by steps A1-A3.
A1: and the source router receives the message to be forwarded sent by the source end equipment.
A2: and the source router compresses the effective load in the message to be forwarded to obtain a compressed message.
A3: and the source router forwards the compressed message to a destination router connected with destination end equipment.
Steps A1-A3 are described in detail below.
A1: and the source router receives the message to be forwarded sent by the source end equipment.
In practical implementation, a1 may be implemented in such a way that the source router receives the packet to be forwarded, sent by the source end device, in real time or in an irregular time.
The Protocol type of the message to be forwarded may be a Transmission Control Protocol (TCP), a User Datagram Protocol (UDP), or another Protocol type.
The source device is a device that generates a message to be forwarded, and a source IP address in the message to be forwarded is an Internet Protocol (IP) address of the source device.
After receiving the message to be forwarded, step a2 is executed.
A2: and the source router compresses the effective load in the message to be forwarded to obtain a compressed message.
In order to facilitate the router receiving the message sent by the source router to quickly and accurately determine whether the received message is a message that needs to be decompressed, a2 includes steps a21-a23 as an embodiment.
A21, the source router extracts the effective load from the message to be forwarded.
In an actual implementation process, a21 may be implemented as follows, and according to the data structure of the message to be forwarded, the payload is extracted from the data part field of the message to be forwarded.
It is noted that the content in the data portion field of the packet to be forwarded is the payload.
After the payload is extracted, step a22 is performed.
A22: and the source router compresses the effective load to obtain compressed data.
The specific implementation of compressing the payload is well known in the art, and therefore, will not be described herein.
After the compressed data is obtained, step a23 is performed.
A23: and the source router replaces the effective load in the message to be forwarded by using the compressed data and the compressed mark to obtain the compressed message.
The compression flag may be a character such as 0, 1, a, etc., and is set according to actual requirements, which is not particularly limited.
In an actual implementation process, a23 may be implemented in a manner that, according to a data structure of a message to be forwarded, a position of a data portion field is determined, and then, content in the data portion field in the message to be forwarded is replaced by the compressed data and a predetermined compression flag, so as to obtain a compressed message. In this embodiment, the compression flag is located on the left side of the compressed data, and in other embodiments, the compression flag may also be located on the right side of the compressed data.
The source router may also generate the compact token mentioned in step A23 after step A22.
As an implementation manner, a2 may be implemented as follows, according to the data structure of the message to be forwarded, extracting a payload from the data part field of the message to be forwarded, then compressing the payload to obtain compressed data, and then replacing the payload in the message to be forwarded with the compressed data to obtain a compressed message.
After the compressed message is obtained, step a3 is performed.
A3: and the source router forwards the compressed message to a destination router connected with destination end equipment.
In the actual implementation process, a3 is implemented as follows, and a destination IP address is determined from the compressed message according to the data structure of the compressed message; then, according to the destination IP address and a pre-stored routing table, the IP address of the router connected with the destination end equipment is determined; and finally, forwarding the compressed message to a destination router connected with the destination end equipment in real time or untimely according to the IP address of the router connected with the destination end equipment.
In a case that the payload is relatively small, the payload is compressed, and the sizes of data before and after compression do not differ too much, so as to reduce the compression processing pressure of the router on the basis of ensuring the message transmission efficiency, as an embodiment, before step a2, the method further includes: determining that a value of a length of the payload is equal to or greater than a preset length.
The preset length is set according to actual requirements, and in this embodiment, a value range of the preset length may be 64 to 1024 bytes.
It is worth mentioning that, under the condition that the number of the messages forwarded by the source router is certain, the larger the value of the preset length is, the smaller the number of the messages to be compressed by the source router is, and vice versa.
Specifically, after the payload is obtained, a value of the length of the payload is determined, the value of the length of the payload is then compared with a preset length value, and when the comparison result indicates that the value of the length of the payload is greater than or equal to the preset length, step a2 is executed;
otherwise, when the comparison result represents that the length value of the payload is smaller than the preset length, the source router directly forwards the packet to be forwarded to the destination router connected with the destination end device, and the step a2 is not executed, so as to reduce the processing pressure of the source router.
In order to avoid the disadvantage that the compressed message is not needed to be compressed, and thus the pressure of the router is increased, as an embodiment, before step a2, the method further includes: and the source router determines that the message to be forwarded meets a preset matching rule.
Specifically, it is determined that the message to be forwarded meets a rule in a pre-stored Access Control List (ACL); and the ACL is used for screening out messages needing to be compressed.
The rules in the ACL are set according to user requirements, wherein the user requirements include: source IP address, destination IP address, source port, destination port, TCP flag, etc.
Specifically, after receiving a message to be forwarded, a source router determines a sending port corresponding to a destination IP address from ports of the source router according to the destination IP address in the message to be forwarded and a pre-stored routing table, obtains a rule in an ACL in a transmission layer load Compression (TPC) structure table corresponding to the identifier of the sending port, which is pre-stored, according to the identifier of the sending port, compares corresponding content in the message to be forwarded with the rule in the ACL according to the rule in the ACL and a data structure of the message to be forwarded, and determines that the message to be forwarded satisfies the rule in the pre-stored ACL when the corresponding content in the message to be forwarded is consistent with the rule in the ACL; otherwise, determining that the message to be forwarded does not meet the rules in the prestored ACL.
As an embodiment, when only a rule in an ACL is stored in the source router, the rule in the ACL in the TPC structure table stored in advance is directly acquired.
It should be noted that, when it is determined that the packet to be forwarded does not satisfy the rule in the pre-stored ACL, the source router directly forwards the packet to be forwarded to the destination router connected to the destination device, and step a2 is not performed, so as to avoid the disadvantage that the pressure of the router is increased by compressing the packet that does not need to be compressed.
When other messages to be forwarded are stored in the source router, in order to avoid erroneously forwarding the message unrelated to the message to be forwarded to the destination router connected to the destination end device together, so as to ensure the accuracy of message forwarding, as an embodiment, after the step a2, the method further includes steps B1-B2.
B1: and the source router determines the length of the compressed message.
It can be understood that the value of the length of the compressed message is smaller than the value of the length of the message to be forwarded.
After determining the value of the length of the compressed message, step B2 is performed.
B2: the source router resets the value of the first length field in the compressed message to the value of the length of the compressed message to obtain a preliminarily reset message; wherein, the first length field is a field in an IP header in the compressed message; the first length field is used for recording the length of the compressed message.
In an actual implementation process, B2 may be implemented as follows, where a position of a first length field in the compressed message is determined according to a data structure of the compressed message, and then a value of the length of the compressed message is used to replace the content in the first length field, so as to obtain a preliminarily reset message.
Step a3 includes: and forwarding the preliminarily reset message to the destination router connected with the destination end equipment.
And the message after the initial reset is the same as the destination IP address in the message to be forwarded.
In order to ensure that the payload in the message to be forwarded can be forwarded normally, as an embodiment, after step B2, the method further includes steps C1-C2.
C1: and the source router carries out check calculation on the preliminarily reset message to obtain a first check value.
The specific implementation of calculating the checksum of the packet is well known in the art, and therefore, the detailed description thereof is omitted here.
And if the preliminarily reset message belongs to the IP message, directly carrying out check calculation on the preliminarily reset message to obtain a first check value.
Since the second length field in the UDP header in the UDP message records the total length of the data portion and the UDP header in the message, in order to ensure normal forwarding in the case that the preliminary reset message belongs to the UDP message, the step C1 includes steps C11-C12 as an embodiment.
C11: and the source router resets the value of the second length field in the preliminarily reset message to the sum of the value of the length of the compressed data corresponding to the effective load in the compressed message and 8 to obtain a middle message. Wherein, the second length field is a field in a UDP header in the preliminary reset message; the second length field is used to record a total length of the compressed data and the UDP header.
In an actual implementation process, C11 may be implemented in a manner of determining a value of a length of compressed data corresponding to a payload in a compressed message, where the compressed data is the compressed data mentioned in the implementation manner of step a 2; meanwhile, because the length value of the UDP header in the message after the initial reset is 8, the sum of the length value of the compressed data and 8 is determined, and the position of a second length field in the message after the initial reset is determined according to the data structure of the message after the initial reset; and replacing the content in the second length field by using the sum of the length value of the compressed data and 8 to obtain the intermediate message.
After the intermediate message is obtained, step C12 is performed.
C12: and the source router carries out check calculation on the intermediate message to obtain the first check value.
After the sum of the values of the first check sum is obtained, step C2 is performed.
C2: and the source router resets the value of the check field of the IP header in the preliminarily reset message to the first check value to obtain the re-reset message.
If the preliminarily reset message belongs to a TCP message, C2 may be implemented as follows, and determine a position of a check field of an IP header in the preliminarily reset message according to a data structure of the preliminarily reset message; therefore, the content in the check field is replaced by the value of the first check sum, and the message after being reset again is obtained.
As an implementation manner, C2 includes: resetting the value of the check field of the IP header in the intermediate message to the first check value to obtain the message after resetting again.
The forwarding the packet after the preliminary reset to the destination router includes: and forwarding the re-reset message to the destination router.
It should be noted that the destination IP address in the re-reset message and the message to be forwarded is the same.
In order to avoid the disadvantage of compressing the message that does not need to be compressed, which increases the pressure of the router, as an embodiment, before step a2, the method further includes: and determining that the protocol type of the message to be forwarded belongs to a preset protocol according to the content recorded in the protocol field of the message to be forwarded.
In this embodiment, the preset protocol includes: TCP protocol and UDP protocol; in other embodiments, the predetermined protocol may include only the TCP protocol.
Specifically, determining a protocol type of a message to be forwarded, then determining whether the protocol type belongs to a preset protocol, and determining that the protocol type belongs to the preset protocol when determining that the protocol type belongs to a TCP protocol or a UDP protocol; otherwise, determining that the protocol type does not belong to the preset protocol.
It is worth mentioning that when it is determined that the protocol type does not belong to the preset protocol, the packet to be forwarded is directly forwarded to the router connected to the destination device, and step a2 is not executed, so as to avoid the disadvantage that the router pressure is increased due to compression of the packet that does not need to be compressed.
As an embodiment, before determining that the packet to be forwarded satisfies a rule in a pre-stored ACL, the method further includes: it is determined that it has stored the rule in the ACL.
Specifically, after receiving a message to be forwarded, a source router determines a sending port corresponding to a destination IP address from ports of the source router according to the destination IP address in the message to be forwarded and a pre-stored routing table, acquires a pre-stored storage address corresponding to an identifier of the sending port according to the identifier of the sending port, and determines a rule in an ACL stored in the source router when finding the rule in the ACL in the TPC structure table according to the corresponding storage address; otherwise, it is determined that it does not store a rule in the ACL.
In the case where the router has only one sending port, it is directly determined whether or not the router itself stores a rule in the ACL.
As an embodiment, before determining that the packet to be forwarded satisfies a rule in a pre-stored ACL, the method further includes: it is determined that it has stored a TPC structure table.
Specifically, after receiving a message to be forwarded, a source router determines a sending port corresponding to a destination IP address from ports of the source router according to the destination IP address in the message to be forwarded and a pre-stored routing table, acquires a pre-stored storage address corresponding to the identification of the sending port according to the identification of the sending port, and determines a self-stored TPC structure table when finding the TPC structure table according to the corresponding storage address; otherwise, determining that the TPC structure table is not stored by the TPC structure table.
And under the condition that the source router has only one sending port, directly determining whether the source router stores the TPC structure table or not.
As an embodiment, before step a2, the method further comprises: and determining that the message to be forwarded is not a fragment message according to the data structure of the message to be forwarded.
The specific implementation of determining whether the packet to be forwarded is a fragment packet is well-known in the art, and therefore, details are not described herein.
After the source router forwards the compressed packet to the destination router connected to the destination device, step S22 is executed.
S22: and the destination router receives the compressed message, decompresses the compressed message to obtain the message to be forwarded, and sends the message to be forwarded to the destination terminal equipment.
Specifically, for convenience, step S22 may be further elaborated by steps D1-D3.
D1: and the destination router receives the compressed message.
D2: and the target router decompresses the compressed message to obtain the message to be forwarded.
D3: and the destination router sends the message to be forwarded to the destination terminal equipment.
Steps D1-D3 are described in detail below.
D1: and the destination router receives the compressed message.
In practical implementation, D1 may be implemented as follows, and receives the compressed packet sent by the source router in real time or in an irregular time.
After receiving the compressed message, step D2 is performed.
D2: and the target router decompresses the compressed message to obtain the message to be forwarded.
As an embodiment, D2 includes steps D21-D23.
D21: and extracting compressed data from the compressed message.
In an actual implementation process, D21 may be implemented as follows, according to a data structure of the compressed message, determining a position of the data part field in the compressed message, and then according to the position of the data part field, extracting the compressed data in the data part field from the compressed message.
After the compressed data is obtained, step D22 is performed.
D22: and decompressing the compressed data to obtain the effective load.
After the payload is obtained, step D23 is performed.
D23: and replacing the compressed data in the compressed message by using the effective load to obtain the message to be forwarded.
In an actual implementation process, D23 may be implemented in a manner that, according to a data structure of the compressed message, a position of a data part field in the compressed message is determined, and then the payload is used to replace all contents in the data part field in the compressed message, so as to obtain a message to be forwarded.
As an embodiment, D23 includes steps E1-E3.
E1: and replacing the compressed data in the compressed message by using the effective load to obtain a decompressed message.
In an actual implementation process, E1 may be implemented in such a manner that, according to the data structure of the compressed message, the position of the data portion field in the compressed message is determined, and then the payload is used to replace all the contents in the data portion field in the compressed message, so as to obtain a decompressed message.
After the decompressed message is obtained, step E2 is performed.
E2: and determining the length value of the decompressed message.
After determining the value of the length of the decompressed message, step E3 is performed.
E3: resetting the value of a third length field in the decompressed message to the value of the length of the decompressed message to obtain the message to be forwarded; wherein the third length field is a field in an IP header in the decompressed message; and the third length field is used for recording the length of the decompressed message.
In an actual implementation process, E3 may be implemented in such a manner that, according to a data structure of the decompressed message, a position of a third length field in the decompressed message is determined, and then a value of the length of the decompressed message is used to replace the content in the third length field, so as to obtain the message to be forwarded.
As an embodiment, the step E3 includes the steps of: E11-E13.
E11: and resetting the value of the third length field in the decompressed message to the value of the length of the decompressed message to obtain the preliminarily processed message.
After the preliminary processed message is obtained, step E12 is performed.
E12: and carrying out check calculation on the preliminarily processed message to obtain a second check value.
As an implementation manner, the preliminarily processed packet belongs to a UDP packet, and E12 includes the steps of: E121-E122.
E121: resetting the value of a fourth length field in the preliminarily processed message to the sum of the value of the length of the effective load and 8 to obtain a modified message; wherein, the fourth length field is a field in a UDP header in the preliminarily processed message; the fourth length field is used to record the total length of the payload and the UDP header.
E122: and carrying out check calculation on the modified message to obtain the second check value.
E13: and resetting the value of the check field of the IP header in the preliminarily processed message to the second check value to obtain the message to be forwarded.
Comprising the steps at E12: in the case of E121-E122, as an embodiment, E13 includes: resetting the value of the check field of the IP header in the modified message to the second check value to obtain the message to be forwarded.
The embodiments of steps E12-E13 refer to steps C1-C2, and thus are not described herein again.
D3: and the destination router sends the message to be forwarded to the destination terminal equipment.
In the actual implementation process, D3 is implemented as follows, and according to the destination IP address in the to-be-forwarded message, forwards the to-be-forwarded message to the destination device corresponding to the destination IP address.
To sum up, in the packet processing method and system provided in the embodiments of the present application, after receiving a packet to be forwarded, a source router connected to a source end device compresses a payload in the packet to be forwarded, and forwards the compressed packet to a destination router connected to a destination end device, where the size of the compressed packet is significantly smaller than that of the packet to be forwarded, so that the packet transmission efficiency is effectively improved; the target router decompresses the compressed message and then sends the decompressed message to the target end equipment, so that the target end equipment can quickly extract the effective load from the received message without decompressing the received message.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based devices that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

Claims (11)

1. A method for sending a message, the method comprising:
a source router connected with a source end device receives a message to be forwarded, which is sent by the source end device; compressing the effective load in the message to be forwarded to obtain a compressed message; forwarding the compressed message to a destination router connected with destination end equipment;
and the destination router receives the compressed message, decompresses the compressed message to obtain the message to be forwarded, and sends the message to be forwarded to the destination terminal equipment.
2. The method according to claim 1, wherein before compressing the payload in the packet to be forwarded to obtain a compressed packet, the method further comprises:
the source router determines that the message to be forwarded meets a preset matching rule; and/or
Determining that the length of the payload is greater than or equal to a preset length.
3. The method according to claim 1, wherein the compressing the payload in the message to be forwarded to obtain a compressed message comprises:
extracting the effective load from the message to be forwarded;
compressing the effective load to obtain compressed data;
and replacing the effective load in the message to be forwarded by using the compressed data and the compressed mark to obtain the compressed message.
4. The method of claim 1, wherein after obtaining the compressed message, the method further comprises:
the source router determines the length of the compressed message;
the source router resets the value of a first length field in the compressed message to the length of the compressed message to obtain a preliminarily reset message; wherein, the first length field is a field in an IP header in the compressed message; the first length field is used for recording the length of the compressed message;
the forwarding the compressed packet to a destination router connected to a destination device includes: and forwarding the preliminarily reset message to the destination router.
5. The method of claim 4, wherein after obtaining the message after the initial reset, the method further comprises:
the source router carries out check calculation on the preliminarily reset message to obtain a first check value;
the source router resets the value of the check field of the IP header in the preliminarily reset message to the first check value to obtain a re-reset message;
the forwarding the packet after the preliminary reset to the destination router includes: and forwarding the re-reset message to the destination router.
6. The method of claim 5, wherein the preliminarily reset packet belongs to a User Datagram Protocol (UDP) packet, and wherein the performing, by the source router, a check calculation on the preliminarily reset packet to obtain a first check value comprises:
the source router resets the value of a second length field in the preliminarily reset message to the sum of the value of the length of the compressed data corresponding to the effective load in the compressed message and 8 to obtain a middle message; wherein, the second length field is a field in a UDP header in the preliminary reset message; the second length field is used for recording the total length of the compressed data and the UDP header;
the source router carries out check calculation on the intermediate message to obtain the first check value;
the source router resets the value of the check field of the IP header in the preliminarily reset message to the first check value to obtain a re-reset message, and the method comprises the following steps: and the source router resets the value of the check field of the IP header in the intermediate message to the first check value to obtain the message after resetting.
7. The method according to claim 1, wherein decompressing the compressed packet to obtain the packet to be forwarded comprises:
extracting compressed data from the compressed message;
decompressing the compressed data to obtain the effective load;
and replacing the compressed data in the compressed message by using the effective load to obtain the message to be forwarded.
8. The method according to claim 7, wherein the replacing the compressed data in the compressed message with the payload to obtain the message to be forwarded comprises:
replacing the compressed data in the compressed message with the payload to obtain a decompressed message;
determining the value of the length of the decompressed message;
resetting the value of a third length field in the decompressed message to the value of the length of the decompressed message to obtain the message to be forwarded; wherein the third length field is a field in an IP header in the decompressed message; and the third length field is used for recording the length of the decompressed message.
9. The method according to claim 8, wherein resetting a value of a third length field in the decompressed message to a value of the length of the decompressed message to obtain the message to be forwarded comprises:
resetting the value of the third length field in the decompressed message to the value of the length of the decompressed message to obtain a preliminarily processed message;
carrying out check calculation on the preliminarily processed message to obtain a second check value;
and resetting the value of the check field of the IP header in the preliminarily processed message to the second check value to obtain the message to be forwarded.
10. The method according to claim 9, wherein the preliminarily processed packet belongs to a user datagram protocol UDP packet, and the performing the check calculation on the preliminarily processed packet to obtain the second check value comprises:
resetting the value of a fourth length field in the preliminarily processed message to the sum of the value of the length of the effective load and 8 to obtain a modified message; wherein, the fourth length field is a field in a UDP header in the preliminarily processed message; the fourth length field is to record a total length of the payload and the UDP header;
carrying out check calculation on the modified message to obtain the second check value;
the resetting the value of the check field of the IP header in the preliminarily processed message to the second check value to obtain the message to be forwarded includes:
resetting the value of the check field of the IP header in the modified message to the second check value to obtain the message to be forwarded.
11. A message processing system, the system comprising: the source router is connected with the source end equipment, and the destination router is connected with the destination end equipment;
the source router receives a message to be forwarded, which is sent by source end equipment; compressing the effective load in the message to be forwarded to obtain a compressed message; forwarding the compressed message to the destination router;
and the destination router receives the compressed message, decompresses the compressed message to obtain the message to be forwarded, and sends the message to be forwarded to the destination terminal equipment.
CN202110249122.4A 2021-03-05 2021-03-05 Message processing method and system Withdrawn CN112995039A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110249122.4A CN112995039A (en) 2021-03-05 2021-03-05 Message processing method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110249122.4A CN112995039A (en) 2021-03-05 2021-03-05 Message processing method and system

Publications (1)

Publication Number Publication Date
CN112995039A true CN112995039A (en) 2021-06-18

Family

ID=76335536

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110249122.4A Withdrawn CN112995039A (en) 2021-03-05 2021-03-05 Message processing method and system

Country Status (1)

Country Link
CN (1) CN112995039A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101075937A (en) * 2007-07-20 2007-11-21 华为技术有限公司 Method, system and apparatus for converting message in three-layer virtual special network
CN103780342A (en) * 2014-01-13 2014-05-07 中国人民解放军理工大学 Satellite link quality adaptive header compression method based gain control
US20140172795A1 (en) * 2012-03-02 2014-06-19 Huawei Technologies Co., Ltd. Data processing method and data processing device
CN105592030A (en) * 2014-11-18 2016-05-18 华为技术有限公司 IP message processing method and device
CN105812094A (en) * 2016-03-07 2016-07-27 电信科学技术研究院 Data processing method, device, terminal and access device
CN109526030A (en) * 2017-09-18 2019-03-26 华为技术有限公司 Processing method, device and the equipment of message

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101075937A (en) * 2007-07-20 2007-11-21 华为技术有限公司 Method, system and apparatus for converting message in three-layer virtual special network
US20140172795A1 (en) * 2012-03-02 2014-06-19 Huawei Technologies Co., Ltd. Data processing method and data processing device
CN103780342A (en) * 2014-01-13 2014-05-07 中国人民解放军理工大学 Satellite link quality adaptive header compression method based gain control
CN105592030A (en) * 2014-11-18 2016-05-18 华为技术有限公司 IP message processing method and device
CN105812094A (en) * 2016-03-07 2016-07-27 电信科学技术研究院 Data processing method, device, terminal and access device
CN109526030A (en) * 2017-09-18 2019-03-26 华为技术有限公司 Processing method, device and the equipment of message

Similar Documents

Publication Publication Date Title
US7643505B1 (en) Method and system for real time compression and decompression
US8060633B2 (en) Method and apparatus for identifying data content
US7596809B2 (en) System security approaches using multiple processing units
CN112311789B (en) Deep packet processing method and device, electronic device and storage medium
US20130094501A1 (en) Processing data packets in performance enhancing proxy (pep) environment
US20170048155A1 (en) Protocol type identification method and apparatus
US8254388B2 (en) Management device to investigate path states of network and network system
CN109818970B (en) Data processing method and device
US8213325B2 (en) Packet analysis method, packet analysis apparatus, recording medium storing packet analysis program
US20070233892A1 (en) System and method for performing information detection
US7362780B2 (en) Avoiding compression of encrypted payload
CN108270783B (en) Data processing method and device, electronic equipment and storage medium
US9807204B2 (en) Optimized message processing
CN110650097B (en) Data broadcasting method and device and computer readable storage medium
CN109951425B (en) TCP (Transmission control protocol) flow state integrity detection method based on FPGA (field programmable Gate array)
WO2002051077A1 (en) A method and system for distinguishing higher layer protocols of the internet traffic
CN112217780A (en) Apparatus and method for identifying attacks in a computer network
CN112995039A (en) Message processing method and system
CN112527772A (en) Graph database auditing method and auditing equipment
CN111405007A (en) TCP session management method, device, storage medium and electronic equipment
CN116015889A (en) Data stream forwarding method, device, network equipment and storage medium
CN106961393B (en) Detection method and device for UDP (user Datagram protocol) message in network session
JP4538370B2 (en) Abnormal communication detector
CN113347186B (en) Reflection attack detection method and device and electronic equipment
US11533327B2 (en) Method and device for intrusion detection in a computer network

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20210618