A kind of message processing method and device
Technical field
The present invention relates to communication fields, more particularly to message processing method and device.
Background technique
In an ip network, when message length is more than MTU (Maximum Transmission Unit, maximum transmission unit)
When, data sending terminal needs to transmit message fragment, after data receiver receives fragment, according to the offset information weight of fragment
Group goes out complete message.Fragment passes through the gateway based on connection status, firewall such as based on state-detection, with NAT
When the router of (Network Address Translation, network address translation) function, it is also desirable to be carried out to fragment message
Recombination, could finishing service processing.
With the expansion of network size, web database technology is continuously increased, in order to improve the processing capacity of gateway, more
It is designed to distributed structure/architecture come more high-end gateways.Distributed structure/architecture generally includes master control borad, interface board and business
Plate is communicated by internal bus between these boards, and as shown in FIG. 1, FIG. 1 is the distributed structure/architecture gateways of the relevant technologies
The schematic diagram of system composition.Wherein, master control node of the master control borad as system, interface board external connection to network, business board pair
Flow into system carries out business processing.When IP packet reaches interface board, interface board according to the five-tuple information of message (i.e.
Source IP, destination IP, protocol number, source port, destination port) cryptographic Hash is calculated, and be diverted to message according to the cryptographic Hash
Purpose business board.For a size is more than MTU and the IP package of fragment transmission, only first fragment message has included
Whole five-tuple information, remaining fragment only include source IP, destination IP and protocol number, do not include source port and destination port, interface
Plate can not will be shunted according to five-tuple shunting information according to the binary group information of message.It is based on five-tuple and binary as a result,
The hash algorithm that group shunts not can guarantee the fragment message of same connection and non-fragment message calculates identical cryptographic Hash, thus
Cause fragment and non-fragment message based on same five-tuple information that may be divided to different business boards.
Summary of the invention
It is same the technical problem to be solved by the present invention is to not can guarantee under current distributed structure/architecture to the mode of message shunting
The problem of fragment message of five-tuple and non-fragment message are assigned to same business board is based on the problem, the present invention provides
A kind of message processing method and device.
According to an aspect of the invention, there is provided a kind of message processing method, comprising: the business board of distributed system exists
When receiving message, judge whether message is fragment message;If not, message is handled by business board, if so, carrying out to message
Recombination, the purpose business board of message is determined according to the five-tuple information of the message after recombination;Message is sent to purpose business board.
Wherein, the purpose business board of message is determined according to the five-tuple information of the message after recombination, comprising: after recombination
Message five-tuple information carry out Hash calculation, obtain the first cryptographic Hash;Corresponding purpose industry is searched according to the first cryptographic Hash
Business plate.
Further, the above method further include: distributed system business board before receiving message, distribution system
Whether the message that the interface board judgement of system receives is fragment message, if so, carrying out Hash according to the binary group information of message
It calculates, obtains the second cryptographic Hash, the message received is sent to by corresponding business board according to the second cryptographic Hash, if it is not, then
Hash calculation is carried out according to the five-tuple information of message, obtains third cryptographic Hash, the message that will be received according to third cryptographic Hash
It is sent to corresponding business board.
Wherein, the binary group information of fragment message includes: the source IP address and purpose IP address of fragment message.
Further, the above method further include: before message is sent to purpose business board, carry purpose in messages
The identification information of business board;When message reaches business board, purpose business panel sign is deleted.
According to another aspect of the present invention, a kind of message process device is provided, comprising: first judgment module is used for
The business board of distributed system judges whether message is fragment message when receiving message;Determining module, for sentencing first
When the judging result of disconnected module is no, message is handled by business board, when the judging result of first judgment module is to be, to message
It is recombinated, the purpose business board of message is determined according to the five-tuple information of the message after recombination;Sending module is used for message
It is sent to purpose business board.
Wherein it is determined that module includes: computing unit, by being carried out based on Hash according to the five-tuple information of the message after recombination
It calculates, obtains the first cryptographic Hash;Searching unit, for searching corresponding purpose business board according to the first cryptographic Hash.
Wherein, device further include: the second judgment module, for the business board in distributed system receive message it
Before, whether the message that the interface board judgement of distributed system receives is fragment message;Sending module is used for: judging mould second
The judging result of block is to carry out Hash calculation when being according to the binary group information of message, obtain the second cryptographic Hash, breathe out according to second
The message received is sent to corresponding business board by uncommon value, when the judging result of the second judgment module is no, then according to report
The five-tuple information of text carries out Hash calculation, obtains third cryptographic Hash, is sent to the message received according to third cryptographic Hash
Corresponding business board.
Wherein, the binary group information of fragment message includes: the source IP address and purpose IP address of fragment message.
Further, above-mentioned apparatus further include: mark module, for before message is sent to purpose business board,
The identification information of purpose business board is carried in message;Removing module, for deleting purpose business board when message reaches business board
Mark.
The scheme of the embodiment of the present invention, after the business board of distributed system receives message, the five-tuple based on message
Information determines purpose business board, can guarantee that the fragment message based on same five-tuple and non-fragment message are assigned to uniform block industry
Business plate.
Detailed description of the invention
Fig. 1 is the schematic diagram that the distributed structure/architecture gateway system of the relevant technologies forms;
Fig. 2 is the flow chart of the packet message processing method of the embodiment of the present invention;
Fig. 3 is the flow chart of the message processing method of the embodiment of the present invention 3;
Fig. 4 is the flow chart of the message processing method of the embodiment of the present invention 4;
Fig. 5 is the structural block diagram of the message process device of the embodiment of the present invention;
Fig. 6 is the Message processing schematic diagram of the embodiment of the present invention.
Specific embodiment
In order to solve not can guarantee the shunting mode of message based on same five-tuple under prior art distributed structure/architecture
The problem of fragment message and non-fragment message are arrived uniform block business board, the present invention provides a kind of message processing method and dresses
It sets, below in conjunction with attached drawing and embodiment, the present invention will be described in further detail.It should be appreciated that tool described herein
Body embodiment is only used to explain the present invention, does not limit the present invention.
Embodiment 1
Fig. 2 is the flow chart of the packet message processing method of the embodiment of the present invention.As shown in Fig. 2, this method includes following
Step:
Step 201: the business board of distributed system receives message;
Step 202: judging whether message is fragment message, if so, step 204 is executed, if not, executing step 203;
Step 203: message is handled by the business board;Step 204: message being recombinated, according to the message after recombination
Five-tuple information determines the purpose business board of message;
Step 205: message is sent to purpose business board.
Judge current business plate whether be purpose business board operation, can specifically be carried out as follows:
Wherein, the purpose business board of message is determined according to the five-tuple information of the message after recombination, comprising: after recombination
Message five-tuple information carry out Hash calculation, obtain the first cryptographic Hash;Corresponding purpose industry is searched according to the first cryptographic Hash
Business plate.
Further, on the basis of above-mentioned steps 201 to step 205, the above method can also include: to be in distribution
For the business board of system before receiving message, whether the message that the interface board judgement of distributed system receives is fragment message,
If so, carrying out Hash calculation according to the binary group information of message, the second cryptographic Hash is obtained, will be received according to the second cryptographic Hash
Message be sent to corresponding business board, if it is not, then according to the five-tuple information of message carry out Hash calculation, obtain third Kazakhstan
Uncommon value, is sent to corresponding business board for the message received according to third cryptographic Hash, wherein the binary group information packet of fragment message
It includes: the source IP address and purpose IP address of fragment message.
Identification for the ease of purpose business board to message, can be before to be forwarded to purpose business board, in messages
Add business board mark, further, the above method can also include: before message is sent to purpose business board,
The identification information of purpose business board is carried in message;When message reaches business board, purpose business panel sign is deleted.
Embodiment 2
The processing that the present embodiment carries out the message received with business board of the specific example to distributed system
Shunting is illustrated, it should be noted that the example is only a preferred embodiment of the present invention, is not made to of the invention
It is limited at unique.
In this embodiment, the business board of distributed system recombinates the fragment received, and after the completion of judging recombination
Message whether should be handled by this business board, for the message that should not be handled by this plate, it is redirected, by its turn
It is dealt into correct purpose business board, so that the fragment message and non-fragment message of realizing same connection are at same business board
Reason.
Fig. 3 is the flow chart of the message processing method of the embodiment of the present invention 3.As shown in figure 3, this method includes following place
Reason:
The business board of S301, distributed system receive message;
S302 judges whether message includes purpose business board label, if so, being transferred to S303;Otherwise, it is transferred to S304;
S303 forwards the packet to purpose business board and marks corresponding business board, and process terminates;
S304 judges whether message is fragment message, if so, being transferred to S306;Otherwise, it is transferred to S305;
S305 calculates cryptographic Hash according to the five-tuple information of message;
S306 calculates cryptographic Hash according to the binary group information of message;
S307 forwards the packet to corresponding business board according to the cryptographic Hash of calculating, and process terminates.
Embodiment 3
The processing that the present embodiment carries out the message received with business board of the specific example to distributed system
Shunting is illustrated, it should be noted that the example is only a preferred embodiment of the present invention, is not made to of the invention
It is limited at unique.
Fig. 4 is the flow chart of the message processing method of the embodiment of the present invention 4.As shown in figure 4, this method includes following place
Reason:
The business board of S401, distributed system receive message;
S402 judges whether message includes purpose business board label, if so, being transferred to S403;Otherwise, it is transferred to S404;
S403 deletes the purpose business board label of message;
S404 judges whether message is fragment message, if so, being transferred to S406;Otherwise, it is transferred to S405;
S405 gives message to Service Processing Module processing, and process terminates;
S406 calls kernel recombination module to be recombinated;
S407, judges whether kernel recombination module completes recombination, if so, being transferred to S408;Otherwise, process terminates;
S408 calculates message using hash algorithm identical with interface board according to the five-tuple information of message after recombination
Cryptographic Hash;
S409, according to the cryptographic Hash of calculating, whether message should be handled by this business board after judging recombination, if so, turning
Enter S405;Otherwise, it is transferred to S410;
S410, to the corresponding purpose business board label of one cryptographic Hash of addition in message after recombination, and forward the packet to
Purpose business board, process terminate.
Embodiment 4
To the device for realizing message processing method into description, which can be is set in business board the present embodiment
Module, i.e. the above method can realize by business board.Fig. 5 is the structural frames of the message process device of the embodiment of the present invention
Figure, as shown in figure 5, the device 50 includes following component part:
First judgment module 51, the business board for distributed system judge whether message is point when receiving message
Piece message;
Determining module 52, for the judging result in first judgment module be it is no when, message is handled by business board, first
The judging result of judgment module is when being, to recombinate to message, determine message according to the five-tuple information of the message after recombination
Purpose business board;
Sending module 53, for message to be sent to purpose business board.
Wherein, above-mentioned determining module 52 includes: computing unit, for being carried out according to the five-tuple information of the message after recombination
Hash calculation obtains the first cryptographic Hash;Searching unit, for searching corresponding purpose business board according to the first cryptographic Hash.
Further, above-mentioned apparatus 50 further include: the second judgment module is being received for the business board in distributed system
To before message, whether the message that the interface board judgement of distributed system receives is fragment message;Based on this, above-mentioned transmission mould
Block 53 is used for: when the judging result of the second judgment module is to be, being carried out Hash calculation according to the binary group information of message, is obtained
The message received is sent to corresponding business board according to the second cryptographic Hash, in sentencing for the second judgment module by the second cryptographic Hash
When disconnected result is no, then Hash calculation is carried out according to the five-tuple information of message, third cryptographic Hash is obtained, according to third cryptographic Hash
The message received is sent to corresponding business board.
Wherein, the binary group information of above-mentioned fragment message includes: the source IP address and purpose IP address of fragment message.
Further, above-mentioned apparatus further include: mark module, for before message is sent to purpose business board,
The identification information of purpose business board is carried in message;Removing module, for deleting purpose business board when message reaches business board
Mark.Fig. 6 is the Message processing schematic diagram of the embodiment of the present invention, below in conjunction with the figure in Message processing process, Message processing
The function of each section of device is introduced:
As shown in fig. 6, have in business board 1 and business board 2 receiving module, again diverter module, internal forwarding module,
Service Processing Module, herein, it can be understood as, the message process device 40 in above-mentioned business board has these modules, wherein connecing
A part that module is specifically as follows above-mentioned first judgment module is received, again at diverter module, internal forwarding module and business
A part that module can be above-mentioned processing module is managed, for realizing the partial function of processing module.
Diverter module, for non-fragment message 1 and message 3, according to the five-tuple information of message (i.e. source IP, destination IP,
Protocol number, source port, destination port) cryptographic Hash is calculated, and corresponding purpose is sent for message according to calculated cryptographic Hash
Business board;For fragment message, 2 fragment 1 of message and 2 fragment 2 of message as shown in FIG. 6, according to the binary group information of message
(i.e. source IP, destination IP) calculates cryptographic Hash, and sends corresponding purpose business board for message.
Business board receiving module is judged after receiving a message, if message is non-fragment message, by message
Service Processing Module processing is given, if message is fragment message, gives again message to diverter module processing.Again it shunts
Module recombinates fragment message, and carries out Hash fortune to the message after recombination using Diffluence Algorithm identical with interface board
Calculate, if Hash operation the result is that message should be handled by this business board, give message to Service Processing Module processing;Such as
Fruit Hash operation the result is that message should be handled by other business boards, then internal forwarding module gives message to add corresponding purpose
After business board label, forward the packet away.The internal receipt module of corresponding purpose business board receives the message of forwarding, deletes
The purpose business board of message marks, and gives message to Service Processing Module processing.
The scheme of the embodiment of the present invention, after the business board of distributed system receives message, the five-tuple based on message
Information determines purpose business board, can guarantee that the fragment message based on same five-tuple and non-fragment message are assigned to uniform block industry
Business plate.
Although for illustrative purposes, the preferred embodiment of the present invention has been disclosed, those skilled in the art will recognize
It is various improve, increase and replace be also it is possible, therefore, the scope of the present invention should be not limited to the above embodiments.