CN111371703A - Message recombination method and network equipment - Google Patents

Message recombination method and network equipment Download PDF

Info

Publication number
CN111371703A
CN111371703A CN201811593454.9A CN201811593454A CN111371703A CN 111371703 A CN111371703 A CN 111371703A CN 201811593454 A CN201811593454 A CN 201811593454A CN 111371703 A CN111371703 A CN 111371703A
Authority
CN
China
Prior art keywords
fragment
message
storage unit
chain
target
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.)
Pending
Application number
CN201811593454.9A
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 CN201811593454.9A priority Critical patent/CN111371703A/en
Publication of CN111371703A publication Critical patent/CN111371703A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9057Arrangements for supporting packet reassembly or resequencing

Abstract

The embodiment of the invention provides a message reassembling method and network equipment, relates to the field of communication, and aims to solve the problem of low efficiency of the existing message fragmentation reassembling mode. The method comprises the following steps: after receiving any message fragment, acquiring a serial number of the message fragment, and determining a corresponding target storage unit according to the serial number of the message fragment; if the adjacent storage unit of the target storage unit corresponding to any message fragment has a fragment chain, merging the message fragment to the fragment chain, and if the adjacent storage unit does not have the fragment chain, creating the fragment chain containing the message fragment in the target storage unit; and obtaining the target message according to the fragment chain comprising the tail fragment and the first fragment of the target message corresponding to any message fragment.

Description

Message recombination method and network equipment
Technical Field
The present invention relates to the field of communications, and in particular, to a packet reassembly method and a network device.
Background
In a multilink PPP application scenario, when sending a message, a sending end device splits the message into a plurality of message fragments, and then sequentially sends the message fragments to a receiving end device according to the composition sequence of the message fragments, and after receiving the message fragments, the receiving end device can recombine the message fragments into an original message. However, the message fragments sent by the sending end device may not necessarily reach the receiving end according to the sending order, and at this time, the receiving end device needs to consume extra time to reassemble the message fragments that do not reach the receiving end in order to obtain the original message.
In the prior art, a receiving end device usually reads all message fragments of a certain message in sequence according to the sending sequence of the message fragments to recombine the message fragments to obtain an original message.
However, the above-mentioned message reassembly method takes too long time, and the message reassembly can be performed only after all message fragments reach the receiving end, thereby reducing the efficiency of message reassembly and increasing the transmission delay of the message.
Disclosure of Invention
The embodiment of the invention provides a message reassembling method and network equipment, which are used for solving the problem of low efficiency of the conventional message fragmentation reassembling mode.
In order to achieve the above purpose, the embodiment of the invention adopts the following technical scheme:
in a first aspect, an embodiment of the present invention provides a packet reassembly method, which is applied to a network device, where the network device includes multiple continuous storage units for caching packet fragments, and the method includes:
after receiving any message fragment, acquiring a serial number of the message fragment, and determining a corresponding target storage unit according to the serial number of the message fragment;
if a fragment chain exists in an adjacent storage unit of a target storage unit corresponding to any message fragment, merging the message fragment into the fragment chain, and if the adjacent storage unit does not store the fragment chain, creating a fragment chain containing the message fragment in the target storage unit;
and obtaining the target message according to the fragment chain comprising the tail fragment and the first fragment of the target message corresponding to any message fragment.
Optionally, the adjacent memory cells include a front adjacent memory cell and a rear adjacent memory cell.
Optionally, when any packet fragment is a non-trailer packet fragment of the target packet, if a fragment chain exists in an adjacent storage unit of a target storage unit corresponding to any packet fragment, merging any packet fragment into the fragment chain includes:
if a first fragment chain is stored in a front adjacent storage unit of a target storage unit corresponding to any one message fragment and a second fragment chain is stored in a rear adjacent storage unit, recombining the first fragment chain, any one message fragment and the second fragment chain and recording the recombined fragment chain into the rear adjacent storage unit;
if the front adjacent storage unit is empty and the second fragment chain is stored in the rear adjacent storage unit, adding any message fragment to the head of the second fragment chain, and recording the recombined fragment chain into the rear adjacent storage unit;
and if the first fragment chain is stored in the front adjacent storage unit and the rear adjacent storage unit is empty, adding any message fragment to the tail part of the first fragment chain, and recording the recombined fragment chain into the target storage unit.
Optionally, when any packet fragment is a trailer of the target packet, if a fragment chain exists in an adjacent storage unit of a target storage unit corresponding to any packet fragment, merging any packet fragment into the fragment chain includes:
creating a third fragment chain containing a tail fragment of the target message in the target storage unit;
and judging whether a fourth fragment chain exists in a front adjacent storage unit of a target storage unit corresponding to the tail fragment of the target message, if so, adding the fourth fragment chain to the head of the third fragment chain.
Optionally, after the merging of any packet fragment into the fragment chain, the method further includes:
when the merged fragment chain comprises the tail fragment of the target message, circularly executing the following steps until the first fragment chain or the fifth fragment chain of the target message exists in the merged fragment chain and is empty: and according to the number of fragments of the current merged fragment chain, checking whether a fifth fragment chain exists in the storage units which are forward shifted by the corresponding number, if so, adding the fifth fragment chain to the head of the merged fragment chain.
In a second aspect, an embodiment of the present invention provides a network device, where the network device includes multiple continuous storage units for caching packet fragments, and the network device includes:
the receiving module is used for acquiring the serial number of any message fragment after receiving the message fragment and determining the corresponding target storage unit according to the serial number of the message fragment;
an execution module, configured to merge any one of the packet fragments into a fragment chain if a fragment chain is stored in an adjacent storage unit of a target storage unit corresponding to the any one of the packet fragments received by the receiving module, and create a fragment chain including the any one of the packet fragments in the target storage unit if a fragment chain is not stored in the adjacent storage unit;
and the acquisition module is used for acquiring the target message according to the fragment chain comprising the tail fragment and the first fragment of the target message corresponding to any message fragment.
Optionally, the adjacent memory cells include a front adjacent memory cell and a rear adjacent memory cell.
Optionally, in a case that any one of the packet fragments is a non-trailer packet fragment of the target packet, the executing module is specifically configured to:
if a first fragment chain is stored in a front adjacent storage unit of a target storage unit corresponding to any one message fragment and a second fragment chain is stored in a rear adjacent storage unit, recombining the first fragment chain, any one message fragment and the second fragment chain and recording the recombined fragment chain into the rear adjacent storage unit;
if the front adjacent storage unit is empty and the second fragment chain is stored in the rear adjacent storage unit, adding any message fragment to the head of the second fragment chain, and recording the recombined fragment chain into the rear adjacent storage unit;
and if the first fragment chain is stored in the front adjacent storage unit and the rear adjacent storage unit is empty, adding any message fragment to the tail part of the first fragment chain, and recording the recombined fragment chain into the target storage unit.
Optionally, in a case that any one of the packet fragments is a trailer of the target packet, the execution module is specifically configured to:
creating a third fragment chain containing a tail fragment of the target message in the target storage unit;
and judging whether a fourth fragment chain exists in a front adjacent storage unit of a target storage unit corresponding to the tail fragment of the target message, if so, adding the fourth fragment chain to the head of the third fragment chain.
Optionally, the execution module is further configured to:
when the merged fragment chain comprises the tail fragment of the target message, circularly executing the following steps until the first fragment chain or the fifth fragment chain of the target message exists in the merged fragment chain and is empty: and according to the number of fragments of the current merged fragment chain, checking whether a fifth fragment chain exists in the storage units which are forward shifted by the corresponding number, if so, adding the fifth fragment chain to the head of the merged fragment chain.
In the message reassembly method and the network device provided in the embodiments of the present invention, after receiving any message fragment, the network device obtains the serial number of the message fragment, determines the target storage unit corresponding to the serial number, merges any message fragment into the fragment chain if a fragment chain exists in an adjacent storage unit of the target storage unit corresponding to the any message fragment, creates a fragment chain including the any message fragment in the target storage unit if a fragment chain does not exist in the adjacent storage unit, and finally obtains the target message according to the fragment chain including the last fragment and the first fragment of the target message corresponding to the any message fragment, so that message reassembly can be implemented in the process of receiving the message fragment of the target message, and the network device can directly obtain the fragment chain of the target message after obtaining all message fragments of the target message, and the target message is obtained, so that the overall recombination efficiency is improved, and the transmission delay of the message is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic flow chart of a message reassembly method according to an embodiment of the present invention;
fig. 2 is a second schematic flow chart of a message reassembly method according to an embodiment of the present invention;
fig. 3 is a third schematic flow chart of a message reassembly method according to the embodiment of the present invention;
fig. 4 is a fourth schematic flowchart of a message reassembly method according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a network device according to an embodiment of the present invention;
fig. 6 is a second schematic structural diagram of a network device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that "/" in this context means "or", for example, A/B may mean A or B; "and/or" herein is merely an association describing an associated object, and means that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. "plurality" means two or more than two.
It should be noted that, in the embodiments of the present invention, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "e.g.," an embodiment of the present invention is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
For the convenience of clearly describing the technical solutions of the embodiments of the present invention, in the embodiments of the present invention, the words "first", "second", and the like are used to distinguish the same items or similar items with basically the same functions or actions, and those skilled in the art can understand that the words "first", "second", and the like do not limit the quantity and execution order.
The execution main body of the message reassembly method provided in the embodiment of the present invention may be a network device, a Central Processing Unit (CPU) in the network device, or a control Unit or a function module in the network device, which is not limited in this respect.
In order to make the technical solutions of the present invention better understood, the present invention will be further described in detail with reference to the accompanying drawings and specific embodiments.
The embodiment of the invention provides a message recombination method, which is applied to a multilink PPP application scene and comprises the following steps as shown in figure 1:
step 101: after receiving any message fragment, the network device obtains the serial number of the message fragment, and determines the corresponding target storage unit according to the serial number of the message fragment.
In this embodiment of the present invention, the network device includes a plurality of continuous storage units for caching the packet fragments.
In the embodiment of the present invention, since the short sequence number of the multilink PPP is in the range of 0 to 0xFFF (4095), and the long sequence number is 0 to 0xfffff, the receiving device allocates 4096 memory cells, that is, the sequence numbers of the memory cells are 0 to 4095.
Illustratively, after receiving a packet fragment with a sequence number s, the network device uses s% 4096 as the sequence number of a storage unit, and a storage unit corresponding to s% 4096 is R [ s% 4096], a storage unit R [ (s-1)% 4096] corresponding to s% 4096 is called a front adjacent storage unit, and a storage unit R [ (s + 1)% 4096] corresponding to s + 1)% 4096 is called a rear adjacent storage unit.
In the embodiment of the invention, one message fragment corresponds to one storage unit.
Step 102: if the adjacent storage unit of the target storage unit corresponding to any message fragment has a fragment chain, the network device merges the message fragment into the fragment chain, and if the adjacent storage unit does not have a fragment chain, the network device creates a fragment chain containing the message fragment in the target storage unit.
The adjacent memory cells include a front adjacent memory cell and a rear adjacent memory cell.
Step 103: the network equipment obtains the target message according to the fragment chain comprising the tail fragment and the first fragment of the target message corresponding to any message fragment.
Optionally, in this embodiment of the present invention, when any packet fragment is a non-trailer packet fragment of a target packet, if a fragment chain exists in an adjacent storage unit of a target storage unit corresponding to any packet fragment, a process of merging any packet fragment into the fragment chain specifically includes the following three scenarios:
scene 1: if a first fragment chain is stored in a front adjacent storage unit of a target storage unit corresponding to any message fragment and a second fragment chain is stored in a rear adjacent storage unit, the network equipment recombines the first fragment chain, any message fragment and the second fragment chain and records the recombined fragment chain into the rear adjacent storage unit.
Scene 2: and if the front adjacent storage unit of the target storage unit corresponding to any message fragment is empty and a second fragment chain is stored in the rear adjacent storage unit, the network equipment appends any message fragment to the head of the second fragment chain and records the recombined fragment chain into the rear adjacent storage unit.
Scene 3: and if the first fragment chain is stored in the front adjacent storage unit of the target storage unit corresponding to any message fragment and the rear adjacent storage unit is empty, the network equipment appends any message fragment to the tail part of the first fragment chain and records the recombined fragment chain into the target storage unit.
Optionally, in this embodiment of the present invention, when any packet fragment is a trailer of a target packet, a process of merging any packet fragment into a fragment chain by the network device specifically includes the following steps:
and the network equipment creates a third fragment chain containing any message fragment in the target storage unit.
And judging whether a fourth fragment chain exists in a front adjacent storage unit of a target storage unit corresponding to any message fragment, if so, the network equipment adds the fourth fragment chain to the head of the third fragment chain.
It should be noted that the first packet (i.e., the first packet fragment of the packet) of a packet can only be located at the head of a segment of the reassembly chain, and the last packet (i.e., the last packet fragment of the packet) of a packet can only be located at the tail of a segment of the reassembly chain. Therefore, when the trailer appears, the storage unit in which the trailer is located is necessarily the storage unit corresponding to the serial number of the trailer.
In addition, after receiving a trailer of a packet, if the packet fragment of the packet has not been completely received, the network device needs to record the storage unit where the trailer is located in the trailer storage unit table, so that the received subsequent packet fragments can be directly merged into the fragment chain corresponding to the trailer.
Optionally, after merging any packet fragment into the fragment chain in step 102, the method further includes:
step 102 a: when the merged fragment chain comprises a tail fragment of the target message, the network equipment circularly executes the following steps until a first fragment or a fifth fragment chain of the target message exists in the merged fragment chain and is empty: and according to the number of fragments of the current merged fragment chain, checking whether a fifth fragment chain exists in the storage units which are forward shifted by the corresponding number, and if so, adding the fifth fragment chain to the head of the merged fragment chain.
Illustratively, taking the storage unit R [ s% 4096] as the target storage unit, the storage unit R [ (s-1)% 4096] is the front adjacent storage unit of the storage unit R [ s% 4096], and the storage unit R [ (s + 1)% 4096] is the rear adjacent storage unit of the storage unit R [ s% 4096 ]. If the storage unit R [ (s-1)% 4096] and the storage unit R [ (s + 1)% 4096] are empty, then the slice is recorded in the storage unit R [ s% 4096 ]; if the storage unit R [ (s-1)% 4096] is not empty but the storage unit R [ (s + 1)% 4096] is empty, the slice is appended to the tail of the slice chain of the storage unit R [ (s-1)% 096] and the slice chain is recorded in the storage unit R [ s% 4096], and the storage unit R [ (s-1)% 4096] needs to be emptied; if the storage unit R [ (s-1)% 4096] is empty, but the storage unit R [ (s + 1)% 4096] is not empty, then the slice is appended to the head of the slice chain of the following storage unit R [ (s + 1)% 4096], and the slice chain is re-recorded in the storage unit R [ (s + 1)% 4096], requiring updating of the storage unit R [ (s + 1)% 4096 ]; if the storage unit R [ (s-1)% 4096] and the storage unit R [ (s + 1)% 4096] are not empty, the fragment chain of the storage unit R [ (s-1)% 4096], the fragment chain of the fragment and the fragment chain of the storage unit R [ (s + 1)% 4096] are merged into a new fragment chain, the new fragment chain is recorded in the storage unit R [ (s + 1)% 4096], and the storage unit R [ (s-1)% 4096] needs to be emptied and the storage unit R [ (s + 1)% 4096] needs to be updated.
It should be noted that the first slice can only be at the head of a segment of the reassembly chain and the last slice can only be at the tail of a segment of the fragmentation chain. Setting the serial number of the first fragment as s1, the fragment chain where the first fragment is located can only be recorded in a storage unit R [ k% 4096], wherein k > s1, that is, when the position of the fragment chain is adjusted in the process of receiving message fragments, the fragment chain where the first fragment is located can only move backwards; if the sequence number of the tail piece is s2, the fragment chain where the tail piece is located must be stored in the storage unit R [ s 2% 4096], and the storage unit where the tail piece is located is unchanged.
Example 1: the sequence numbers of the message fragments of a certain message received by the network device are respectively 1, 2 and 3, and according to the method, the fragment receiving process is as shown in fig. 2.
Specifically, as shown in fig. 2, after receiving a first packet fragment with a sequence number of 1, the network device stores the first packet fragment in the storage unit R [1], after receiving a packet fragment with a sequence number of 2, appends the packet fragment to the tail of a fragment chain of the storage unit R [1], records the reassembled fragment chain in the storage unit R [2], and after receiving a packet fragment with a sequence number of 3, the storage unit R [2] is not empty, appends the packet fragment to the tail of the fragment chain of the storage unit R [2], and since the packet fragment with the sequence number of 3 is a last packet fragment, since the packet fragment chain has marks of the first packet fragment and the last packet fragment (as shown in "BEGIN" and "END" in fig. 2), the fragment chain is integrated and handed over.
Example 2: the sequence numbers of the message fragments of a certain message received by the network device are respectively 3,2,1, and the fragment receiving process is as shown in fig. 3 according to the above method.
Specifically, as shown in fig. 3, after receiving a trailer message fragment with a sequence number of 3, the network device stores the trailer message fragment in the storage unit R [3], after receiving a message fragment with a sequence number of 2, appends the message fragment to the head of the fragment chain of the storage unit R [3], records the reassembled fragment chain in the storage unit R [3], and appends the message fragment to the head of the fragment chain of the storage unit R [3] after receiving a message fragment with a sequence number of 1, and since the fragment chain has the marks of the first message fragment and the trailer message fragment, integrates and submits the fragment chain.
Example 3: the sequence numbers of the message fragments of a certain message received by the network device are respectively 2,1, 4, 3, 6, 5, and the fragment receiving process is as shown in fig. 4 according to the above method.
Specifically, as shown in fig. 4, after receiving a packet fragment with sequence number 2, the network device stores the packet fragment in the storage unit R2, after receiving a packet fragment with sequence number 1, adds the packet fragment to the head of the fragment chain of the storage unit R2, records the reassembled fragment chain in the storage unit R2, stores the packet fragment in the storage unit R4 after receiving a packet fragment with sequence number 4, after receiving a packet fragment with sequence number 3, since the adjacent storage units before and after the storage unit R3 are not empty, integrates the packet fragment, the fragment chain of the storage unit R2, and the fragment chain of the storage unit R4, merges the integrated fragment chain into a new fragment chain, and stores the new fragment chain in the storage unit R4, after receiving a last fragment packet fragment with sequence number 6, storing the tail message fragment into a storage unit R6 to create a corresponding fragment chain, after receiving the message fragment with the sequence number of 5, integrating the message fragment, the fragment chain of the storage unit R4 and the fragment chain of the storage unit R6 into the fragment chain of the storage unit R6 to obtain a new fragment chain because the adjacent storage units before and after the storage unit R5 are not empty, and integrating and handing over the new fragment chain because the new fragment chain has marks of a first message fragment and a tail message fragment.
In the message reassembly method provided in the embodiments of the present invention, after receiving any message fragment, a network device obtains a serial number of the message fragment, determines a target storage unit corresponding to the message fragment according to the serial number, merges any message fragment into a fragment chain if a fragment chain exists in an adjacent storage unit of the target storage unit corresponding to the message fragment, creates a fragment chain including the message fragment in the target storage unit if the fragment chain does not exist in the adjacent storage unit, and finally obtains the target message according to the fragment chain including a last fragment and a first fragment of the target message corresponding to the message fragment, so that message reassembly can be implemented in a process of receiving the message fragment of the target message, so that the network device can directly obtain the fragment chain of the target message after obtaining all message fragments of the target message, and the target message is obtained, so that the overall recombination efficiency is improved, and the transmission delay of the message is reduced.
An embodiment of the present invention provides a network device, where the network device includes multiple continuous storage units for caching packet fragments, and as shown in fig. 5, the network device includes: a receiving module 21, an executing module 22, and an obtaining module 23, wherein:
the receiving module 21 is configured to obtain a serial number of any one packet fragment after receiving the packet fragment, and determine a corresponding target storage unit according to the serial number of the packet fragment.
The executing module 22 is configured to merge any one of the message fragments received by the receiving module 21 into a fragment chain if a fragment chain is stored in an adjacent storage unit of a target storage unit corresponding to the message fragment, and create a fragment chain including the message fragment in the target storage unit if the fragment chain is not stored in the adjacent storage unit.
The obtaining module 23 is configured to obtain the target packet according to the fragment chain including the last fragment and the first fragment of the target packet corresponding to any one of the packet fragments.
Optionally, the adjacent memory cells include a front adjacent memory cell and a rear adjacent memory cell.
Optionally, in a case that any packet fragment is a non-trailer packet fragment of the target packet, the execution module 22 is specifically configured to: if a first fragment chain is stored in a front adjacent storage unit of a target storage unit corresponding to any message fragment and a second fragment chain is stored in a rear adjacent storage unit, recombining the first fragment chain, any message fragment and the second fragment chain, and recording the recombined fragment chain into the rear adjacent storage unit; if the front adjacent storage unit is empty and a second fragment chain is stored in the rear adjacent storage unit, adding any message fragment to the head of the second fragment chain, and recording the recombined fragment chain into the rear adjacent storage unit; if the first fragment chain is stored in the front adjacent storage unit and the rear adjacent storage unit is empty, adding any message fragment to the tail of the first fragment chain, and recording the recombined fragment chain into the target storage unit.
Optionally, in a case that any one of the packet fragments is a trailer of the target packet, the executing module 22 is specifically configured to: in a target storage unit, creating a third fragment chain containing a tail fragment of the target message; and judging whether a fourth fragment chain exists in a front adjacent storage unit of the target storage unit corresponding to the tail fragment of the target message, if so, adding the fourth fragment chain to the head of the third fragment chain.
Optionally, the executing module 22 is further configured to: when the merged fragment chain comprises the tail fragment of the target message, the following steps are executed in a circulating way until the first fragment chain or the fifth fragment chain of the target message exists in the merged fragment chain and is empty: and according to the number of fragments of the current merged fragment chain, checking whether a fifth fragment chain exists in the storage units which are forward shifted by the corresponding number, and if so, adding the fifth fragment chain to the head of the merged fragment chain.
In the network device provided in the embodiment of the present invention, after receiving any packet fragment, the network device obtains a serial number of the packet fragment, determines a target storage unit corresponding to the serial number, merges any packet fragment into the fragment chain if a fragment chain exists in an adjacent storage unit of the target storage unit corresponding to the any packet fragment, creates a fragment chain including the any packet fragment in the target storage unit if the fragment chain does not exist in the adjacent storage unit, and finally obtains the target packet according to the fragment chain including a last fragment and a first fragment of the target packet corresponding to the any packet fragment, so that packet reassembly can be implemented in a process of receiving the packet fragment of the target packet, and the network device can directly obtain the fragment chain of the target packet after obtaining all packet fragments of the target packet, and the target message is obtained, so that the overall recombination efficiency is improved, and the transmission delay of the message is reduced.
An embodiment of the present invention provides a schematic diagram of a hardware structure of a network device, as shown in fig. 6, where the network device 30 includes: a processor 31, a communication interface 32, a memory 33, and a bus 34.
The communication interface 32 is configured to, after receiving any packet fragment, obtain a sequence number of the packet fragment, and determine a target storage unit corresponding to the packet fragment according to the sequence number of the packet fragment. The processor 31 is configured to merge any one of the message fragments received by the communication interface 32 into a fragment chain if a fragment chain exists in an adjacent storage unit of a target storage unit corresponding to the message fragment, and create a fragment chain including the message fragment in the target storage unit if the fragment chain does not exist in the adjacent storage unit. And obtaining the target message according to the fragment chain comprising the tail fragment and the first fragment of the target message corresponding to any message fragment.
In the network device provided in the embodiment of the present invention, after receiving any packet fragment, the network device obtains a serial number of the packet fragment, determines a target storage unit corresponding to the serial number, merges any packet fragment into the fragment chain if a fragment chain exists in an adjacent storage unit of the target storage unit corresponding to the any packet fragment, creates a fragment chain including the any packet fragment in the target storage unit if the fragment chain does not exist in the adjacent storage unit, and finally obtains the target packet according to the fragment chain including a last fragment and a first fragment of the target packet corresponding to the any packet fragment, so that packet reassembly can be implemented in a process of receiving the packet fragment of the target packet, and the network device can directly obtain the fragment chain of the target packet after obtaining all packet fragments of the target packet, and the target message is obtained, so that the overall recombination efficiency is improved, and the transmission delay of the message is reduced.
In the embodiment of the present invention, in fig. 6, the bus may comprise any number of interconnected buses and bridges, with one or more processors represented by processor 31 and various circuits of memory represented by memory 33 being linked together. It should be noted that, in a specific implementation process, each step executed by the network device in the method flow shown in fig. 1 may be implemented by the processor 31 in a hardware form executing a computer execution instruction in a software form stored in the memory 33, and is not described herein again to avoid repetition.
The programs corresponding to the actions executed by the network device can be stored in the memory of the network device in a software form, so that the processor can call and execute the operations corresponding to the modules.
The memory above may include volatile memory (volatile memory), such as random-access memory (RAM); a non-volatile memory (non-volatile memory) such as a read-only memory (ROM), a flash memory (flash memory), a hard disk (HDD) or a solid-state drive (SSD); combinations of the above categories of memory may also be included.
The processor in the network device provided above may be one processor or may be a collective term for multiple processing elements. For example, the processor may be a central processing unit (CPU; other general purpose processors, Digital Signal Processor (DSP), Application Specific Integrated Circuit (ASIC), field-programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, etc.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and modules may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical division, and in actual implementation, there may be other divisions, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be physically included alone, or two or more units may be integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A message reassembly method is applied to a network device, and the network device includes a plurality of continuous storage units for caching message fragments, and is characterized in that the method includes:
after receiving any message fragment, acquiring a serial number of the message fragment, and determining a corresponding target storage unit according to the serial number of the message fragment;
if a fragment chain exists in an adjacent storage unit of a target storage unit corresponding to any message fragment, merging the message fragment into the fragment chain, and if the adjacent storage unit does not store the fragment chain, creating a fragment chain containing the message fragment in the target storage unit;
and obtaining the target message according to the fragment chain comprising the tail fragment and the first fragment of the target message corresponding to any message fragment.
2. The message reassembly method of claim 1, wherein said adjacent memory units comprise a front adjacent memory unit and a back adjacent memory unit.
3. The message reassembly method according to claim 2, wherein in case that any of said message fragments is a non-trailer message fragment of said target message,
if a fragment chain exists in an adjacent storage unit of a target storage unit corresponding to any message fragment, merging any message fragment to the fragment chain, including:
if a first fragment chain is stored in a front adjacent storage unit of a target storage unit corresponding to any one message fragment and a second fragment chain is stored in a rear adjacent storage unit, recombining the first fragment chain, any one message fragment and the second fragment chain and recording the recombined fragment chain into the rear adjacent storage unit;
if the front adjacent storage unit is empty and the second fragment chain is stored in the rear adjacent storage unit, adding any message fragment to the head of the second fragment chain, and recording the recombined fragment chain into the rear adjacent storage unit;
and if the first fragment chain is stored in the front adjacent storage unit and the rear adjacent storage unit is empty, adding any message fragment to the tail part of the first fragment chain, and recording the recombined fragment chain into the target storage unit.
4. The message reassembly method according to claim 2, wherein in case that any of said message fragments is a trailer of said target message,
if a fragment chain exists in an adjacent storage unit of a target storage unit corresponding to any message fragment, merging any message fragment to the fragment chain includes:
creating a third fragment chain containing a tail fragment of the target message in the target storage unit;
and judging whether a fourth fragment chain exists in a front adjacent storage unit of a target storage unit corresponding to the tail fragment of the target message, if so, adding the fourth fragment chain to the head of the third fragment chain.
5. The packet reassembly method according to any of claims 1 to 4, wherein after said merging of any packet fragment into said fragment chain, said method further comprises:
when the merged fragment chain comprises the tail fragment of the target message, circularly executing the following steps until the first fragment chain or the fifth fragment chain of the target message exists in the merged fragment chain and is empty: and according to the number of fragments of the current merged fragment chain, checking whether a fifth fragment chain exists in the storage units which are forward shifted by the corresponding number, if so, adding the fifth fragment chain to the head of the merged fragment chain.
6. A network device comprising a plurality of contiguous storage units for caching packet fragments, the network device comprising:
the receiving module is used for acquiring the serial number of any message fragment after receiving the message fragment and determining the corresponding target storage unit according to the serial number of the message fragment;
an execution module, configured to merge any one of the packet fragments into a fragment chain if a fragment chain is stored in an adjacent storage unit of a target storage unit corresponding to the any one of the packet fragments received by the receiving module, and create a fragment chain including the any one of the packet fragments in the target storage unit if a fragment chain is not stored in the adjacent storage unit;
and the acquisition module is used for acquiring the target message according to the fragment chain comprising the tail fragment and the first fragment of the target message corresponding to any message fragment.
7. The network device of claim 6, wherein the adjacent storage units comprise a front adjacent storage unit and a back adjacent storage unit.
8. The network device according to claim 7, wherein, in a case that any one of the packet fragments is a non-trailer packet fragment of the target packet, the execution module is specifically configured to:
if a first fragment chain is stored in a front adjacent storage unit of a target storage unit corresponding to any one message fragment and a second fragment chain is stored in a rear adjacent storage unit, recombining the first fragment chain, any one message fragment and the second fragment chain and recording the recombined fragment chain into the rear adjacent storage unit;
if the front adjacent storage unit is empty and the second fragment chain is stored in the rear adjacent storage unit, adding any message fragment to the head of the second fragment chain, and recording the recombined fragment chain into the rear adjacent storage unit;
and if the first fragment chain is stored in the front adjacent storage unit and the rear adjacent storage unit is empty, adding any message fragment to the tail part of the first fragment chain, and recording the recombined fragment chain into the target storage unit.
9. The network device according to claim 7, wherein, in a case that any packet fragment is a trailer of the target packet, the execution module is specifically configured to:
creating a third fragment chain containing a tail fragment of the target message in the target storage unit;
and judging whether a fourth fragment chain exists in a front adjacent storage unit of a target storage unit corresponding to the tail fragment of the target message, if so, adding the fourth fragment chain to the head of the third fragment chain.
10. The network device of any of claims 6 to 9, wherein the execution module is further configured to:
when the merged fragment chain comprises the tail fragment of the target message, circularly executing the following steps until the first fragment chain or the fifth fragment chain of the target message exists in the merged fragment chain and is empty: and according to the number of fragments of the current merged fragment chain, checking whether a fifth fragment chain exists in the storage units which are forward shifted by the corresponding number, if so, adding the fifth fragment chain to the head of the merged fragment chain.
CN201811593454.9A 2018-12-25 2018-12-25 Message recombination method and network equipment Pending CN111371703A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811593454.9A CN111371703A (en) 2018-12-25 2018-12-25 Message recombination method and network equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811593454.9A CN111371703A (en) 2018-12-25 2018-12-25 Message recombination method and network equipment

Publications (1)

Publication Number Publication Date
CN111371703A true CN111371703A (en) 2020-07-03

Family

ID=71209809

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811593454.9A Pending CN111371703A (en) 2018-12-25 2018-12-25 Message recombination method and network equipment

Country Status (1)

Country Link
CN (1) CN111371703A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1509025A (en) * 2002-12-18 2004-06-30 ��Ϊ�������޹�˾ Method for realizing message partition packet
CN101022411A (en) * 2007-03-07 2007-08-22 华为技术有限公司 Multi-link binding protocol message zone receiving method
CN101122885A (en) * 2007-09-11 2008-02-13 腾讯科技(深圳)有限公司 Data cache processing method, system and data cache device
CN101917472A (en) * 2010-08-12 2010-12-15 北京星网锐捷网络技术有限公司 Method, device and equipment for recombining multi-link messages
US20110265143A1 (en) * 2010-04-26 2011-10-27 Cleversafe, Inc. Slice retrieval in accordance with an access sequence in a dispersed storage network
CN104836741A (en) * 2015-04-15 2015-08-12 国家计算机网络与信息安全管理中心 Method and processing board for processing fragmented messages in network message diverting equipment
WO2018177041A1 (en) * 2017-03-27 2018-10-04 中兴通讯股份有限公司 Method and apparatus for saving and recombining message fragment, and computer storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1509025A (en) * 2002-12-18 2004-06-30 ��Ϊ�������޹�˾ Method for realizing message partition packet
CN101022411A (en) * 2007-03-07 2007-08-22 华为技术有限公司 Multi-link binding protocol message zone receiving method
CN101122885A (en) * 2007-09-11 2008-02-13 腾讯科技(深圳)有限公司 Data cache processing method, system and data cache device
US20110265143A1 (en) * 2010-04-26 2011-10-27 Cleversafe, Inc. Slice retrieval in accordance with an access sequence in a dispersed storage network
CN101917472A (en) * 2010-08-12 2010-12-15 北京星网锐捷网络技术有限公司 Method, device and equipment for recombining multi-link messages
CN104836741A (en) * 2015-04-15 2015-08-12 国家计算机网络与信息安全管理中心 Method and processing board for processing fragmented messages in network message diverting equipment
WO2018177041A1 (en) * 2017-03-27 2018-10-04 中兴通讯股份有限公司 Method and apparatus for saving and recombining message fragment, and computer storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
佚名: "三层网络设备对于IP报文的分片和重组处理原理", Retrieved from the Internet <URL:https://blog.csdn.net/weixin_33989058/article/details/92923765> *
罗建英;: "基于缓冲聚类的分片报文乱序处理算法", 网络安全技术与应用, no. 02 *

Similar Documents

Publication Publication Date Title
US7660916B2 (en) Emulation of independent active DMA channels with a single DMA capable bus master hardware and firmware
CN110380992B (en) Message processing method and device and network traffic acquisition equipment
EP3377965B1 (en) Data processing method, device, and system
EP3316150A1 (en) Method and apparatus for file compaction in key-value storage system
CN109783014B (en) Data storage method and device
WO2021128927A1 (en) Message processing method and apparatus, storage medium, and electronic apparatus
JP7017652B2 (en) Charge state correction method and equipment
KR20230024991A (en) Bandwidth adjustment method, service transmission method, network device and readable storage medium
CN111224903B (en) Data transmission method, data transmission equipment and computer readable storage medium
WO2016058355A1 (en) Data caching method and device, and storage medium
US11231983B2 (en) Fault tolerance processing method, apparatus, and server
CN113746782A (en) Message processing method, device and related equipment
CN104461404A (en) Metadata storage method, device and system
CN105446699A (en) Data frame queue management method
CN111371703A (en) Message recombination method and network equipment
US11388028B2 (en) Communication method and device based on parallel system, and terminal
CN112702146B (en) Data processing method and device
CN111625180B (en) Data writing method and device and storage medium
US9391791B2 (en) Preprocessing unit for network data
CN104678815B (en) The interface structure and collocation method of fpga chip
CN105183373A (en) Data processing method and network device
CN115033544A (en) Data compression method, device, equipment and medium based on relation numerical value
CN108781170A (en) A kind of configuration device and method
CN107276620B (en) Earphone data transmission method, terminal equipment and computer readable storage medium
US9350686B2 (en) Data access device and method for communication system

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