CN105515995B - Message processing method and device - Google Patents

Message processing method and device Download PDF

Info

Publication number
CN105515995B
CN105515995B CN201510868876.2A CN201510868876A CN105515995B CN 105515995 B CN105515995 B CN 105515995B CN 201510868876 A CN201510868876 A CN 201510868876A CN 105515995 B CN105515995 B CN 105515995B
Authority
CN
China
Prior art keywords
sub
stem
mask
field
message
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.)
Active
Application number
CN201510868876.2A
Other languages
Chinese (zh)
Other versions
CN105515995A (en
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.)
XFusion Digital Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201510868876.2A priority Critical patent/CN105515995B/en
Publication of CN105515995A publication Critical patent/CN105515995A/en
Application granted granted Critical
Publication of CN105515995B publication Critical patent/CN105515995B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • H04L45/745Address table lookup; Address filtering

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides message processing method, flow table generation method and device.Retransmission unit receives the first message, the first field is obtained from the first stem of first message, the second field is obtained from the second stem of first message, searches whether exist and the matched list item of the first search key in the first flow table by first search request.First message is handled according to matched list item.First field is for identifying the next stem whether first message includes first stem.Second field is for identifying the next stem whether first message includes second stem.First search request carries first search key.First search key includes first field and second field.Said program can reduce expense.

Description

Message processing method and device
Technical field
The present invention relates to the communication technology more particularly to message processing method, flow table (flow table) generation method and dresses It sets.
Background technology
In the prior art, the different messages that retransmission unit can receive.The data format of different messages may not phase Together.For example, different messages may include the stem (header) of different agreement.For example, retransmission unit receive two with Too net frame (Ethernet frame).One Ethernet frame may include Internet protocol fourth edition (internet Protocol version 4, IPv4) stem.Another Ethernet frame may include IPV 6 (internet protocol version6, IPv6) stem.Further, described in described two Ethernet frame Next stem of IPv4 stems or IPv6 stems, it may be possible to transmission control protocol (transmission control Protocol, TCP) stem, it is also possible to User Datagram Protocol (user datagram protocol, UDP) stem.For Include the message of different stems, retransmission unit needs to be handled in different ways.
When in message including multiple stems, needs repeatedly to access memory, just can determine that in message and contain Which stem thereby determines how to handle message.The expense of above-mentioned technical proposal is bigger.
Invention content
An embodiment of the present invention provides a kind of message processing method, flow table generation method and device, help to reduce to depositing The number that reservoir accesses reduces expense.
Technical solution provided in an embodiment of the present invention is as follows:
In a first aspect, a kind of message processing method is provided, including:
Retransmission unit receives the first message, and first message includes the first stem and the second stem, second stem It is next stem of first stem, the agreement of first stem is the first agreement, and the agreement of second stem is Second protocol.
The retransmission unit obtains the first field according to first position parameter from first stem, is joined according to the second position Number obtains the second field from second stem, and first field is for identifying whether first message includes described first Next stem of stem and when first message include first stem next stem when described in the first stem Next stem agreement, whether second field is used to identify first message next comprising second stem A stem and when first message include second stem next stem when described in the second stem next head The agreement in portion.
The retransmission unit is searched whether to exist to search with first in the first flow table and be closed by first search request The matched list item of key word, first search request carry first search key, and first search key includes First field and second field.
The retransmission unit, which determines in first flow table, to be existed and matched first list item of first search key Afterwards, first message is handled according to first list item, the matching domain of first list item includes the first Bit String And first mask, first Bit String include the first sub- Bit String and the second sub- Bit String, first mask includes the One sub- mask and the second sub- mask.
The first sub- Bit String and the described first sub- mask into line position and the result of operation be equal to first field with The first sub- mask into line position and operation as a result, the second sub- Bit String and the described second sub- mask into line position and operation Result be equal to second field and the described second sub- mask into line position and operation as a result, the first sub- mask and described Each bit of second sub- mask is 1.Or the first sub- Bit String and the described first sub- mask are into line position or the knot of operation Fruit is equal to first field and the described first sub- mask into line position or operation as a result, the second sub- Bit String and described the Two sub- masks into line position or the result of operation be equal to second field and the described second sub- mask into line position or operation as a result, Each bit of the first sub- mask and the second sub- mask is 0.
Through the above scheme, retransmission unit obtains the first search key from the first message.First search key packet The first field from the first stem and the second field from the second stem are contained.First field is described for identifying First message whether next stem comprising first stem and when first message includes first stem The agreement of next stem of first stem described in when next stem.Second field is for identifying whether first message wraps Described in when next stem and first message containing second stem include next stem of second stem The agreement of next stem of second stem.The retransmission unit by first search request in the first flow table determine with Matched first list item of first search key, thereby determines how to handle message.For determine how to comprising The message of first stem and the second stem is handled, and the retransmission unit need not execute following operation:To the first stem into Row parsing.According to the first stem parsed as a result, being parsed to the second stem.Parsing needs are carried out to the first stem Execute primary search.It is looked into according to what is parsed to the first stem as a result, carrying out parsing to the second stem and needing to execute another time It looks for.Therefore, the technical solution that first aspect provides need not be directed to the first stem and the second stem is executed and repeatedly searched.For example, The retransmission unit need not be searched first and institute using the first field as search key by accessing memory in a flow table State the list item of the first fields match.Then the second field is obtained from message according to the list item with first fields match, and It is searched in another flow table and the table of second fields match using the second field as search key by accessing memory .It thereby determines how to handle message.
It executes repeatedly to search and means that retransmission unit needs repeatedly to access memory.Accordingly, with respect to needing in message Multiple stems execute repeatedly to search respectively and just can determine how the technical solution that is handled message, the embodiment of the present invention carries The technical solution of confession helps to reduce expense, improves treatment effeciency.
Optionally, the retransmission unit receives after first message and the retransmission unit passes through described first Search request searched whether in first flow table exist with before the matched list item of the first search key, the side Method further includes:
The retransmission unit obtains third field according to the third place parameter from first message, and described first searches Keyword further includes the third field, and first Bit String further includes the sub- Bit String of third, and first mask further includes The sub- mask of third;The wherein described sub- Bit String of third is equal to the third with the sub- mask of the third into line position and the result of operation Field and the sub- mask of the third are into line position and operation as a result, each bit of the sub- mask of third is 0;Or described Three sub- Bit Strings are equal to the third field and the sub- mask of the third with the sub- mask of the third into line position or the result of operation Into line position or operation as a result, each bit of the sub- mask of third is 1.
Optionally, the retransmission unit receives the second message, and second message includes third stem and the 4th stem, institute Next stem that the 4th stem is the third stem is stated, the agreement of the third stem is first agreement, described The agreement of four stems is third agreement.
The retransmission unit obtains the 4th field according to the first position parameter from the third stem, according to described the Two location parameters obtain the 5th field from second message, are obtained from the 4th stem according to the third place parameter 6th field, the 4th field be used for identify second message whether comprising the third stem next stem and The agreement of next stem of the third stem, institute when second message includes next stem of the third stem State the 6th field for identify second message whether comprising the 4th stem next stem and work as described second The agreement of next stem of 4th stem described in when message includes next stem of the 4th stem.
The retransmission unit is searched whether to exist in first flow table and be looked into second by second search request The list item of keyword match is looked for, second search key is carried in second search request, described second searches key Word includes the 4th field, the 5th field and the 6th field.
The retransmission unit, which determines in first flow table, to be existed and matched second list item of second search key Afterwards, second message is handled according to second list item, the matching domain of second list item includes the second Bit String And second mask, second Bit String include the 4th sub- Bit String, the 5th sub- Bit String and the 6th sub- Bit String, it is described Second mask includes the 4th sub- mask, the 5th sub- mask and the 6th sub- mask.
The 4th sub- Bit String and the 4th sub- mask into line position and the result of operation be equal to the 4th field with The 4th sub- masked bits and operation as a result, the 5th sub- Bit String and the 5th sub- mask into the knot of line position and operation Fruit be equal to the 5th field and the 5th sub- masked bits and operation as a result, the 6th sub- Bit String and the 6th son Mask into line position and the result of operation be equal to the 6th field and the 6th sub- masked bits and operation as a result, the described 4th Each bit of sub- mask and the 6th sub- mask is 1, and each bit of the 5th sub- mask is 0.Or the described 4th Sub- Bit String and the 4th sub- mask into line position or the result of operation be equal to the 4th field and the 4th sub- mask into Line position or operation as a result, the 5th sub- Bit String and the 5th sub- mask are equal to described the into line position or the result of operation Five fields and the 5th sub- mask are into line position or operation as a result, the 6th sub- Bit String is carried out with the described 6th sub- mask The result of position or operation is equal to the 6th field and the 6th sub- mask into line position or operation as a result, the 4th son is covered Each bit of code and the 6th sub- mask is 0, and each bit of the 5th sub- mask is 1.
Through the above scheme, no matter the retransmission unit receives the first message or the second message, can be carried out phase It should handle.That is, no matter next stem of the stem of the first agreement of the message that the retransmission unit receives is described second The stem of the stem of agreement or the third agreement, the retransmission unit can be by the spies in the stem of first agreement Special field in the stem of different field and special field or the third agreement in the stem of the second protocol is led to It crosses a search request memory once access so that it is determined that matched list item.In turn, it is determined according to matched list item How message is handled.In said program, retransmission unit can be by similar mode from the message for including different stems Middle acquisition search key.So that the retransmission unit improves the processing capacity carried out to the message of different-format.
Optionally, the third place parameter includes third offset and third length, and the third offset is the described 6th The offset of initial position of the initial position of field away from the third stem, the third length are the length of the third field Degree.
Second aspect provides a kind of flow table generation method, including:
Processor obtains the first flow table and the second flow table, and first flow table includes the first list item, the first list item packet Matching domain and jump instruction are included, the jump instruction of first list item is directed toward second flow table, is directed toward second flow table The quantity of jump instruction is equal to 1, and second flow table includes the second list item, and second list item includes matching domain.
The processor generates a third flow table, and the third flow table includes third list item, and the third list item includes The matching domain of matching domain, the third list item includes the first sub- matching domain and the second sub- matching domain, the first sub- matching domain packet The first sub- Bit String and the first sub- mask are included, the second sub- matching domain includes the second sub- Bit String and the second sub- mask, described The matching domain of first sub- Bit String and first list item is equal, the matching domain of the second sub- Bit String and second list item It is equal.
Each bit of the first sub- mask and the second sub- mask is 1, the first sub- matching domain and described the The mask matches algorithm of two sub- matching domains is position and operation.Or each ratio of the first sub- mask and the second sub- mask Specially for 0, the mask matches algorithm of the first sub- matching domain and the second sub- matching domain is position or operation.
Through the above scheme, the processor generates a third flow table, and the third flow table can be implementation of the present invention First flow table in the message processing method that example first aspect is provided.The third flow table is sent to forwarding by processor Device, the retransmission unit are determined and the search key matched the by a search request in the third flow table One list item, and then determine how and message is handled.
Optionally, the processor obtains the 4th flow table, and the 4th flow table includes the 4th list item, the 4th list item packet Matching domain is included, first flow table further includes the 5th list item, and the 5th list item includes matching domain and jump instruction, and the described 5th The 4th flow table is directed toward in the jump instruction of list item, and the quantity for being directed toward the jump instruction of the 4th flow table is equal to 1.
The matching domain of the third list item further includes the sub- matching domain of third, and the sub- matching domain of third includes the sub- bit of third String and the sub- mask of third.
Each bit of the sub- mask of third is 0 and the mask matches algorithm of the sub- matching domain of the third is position and fortune It calculates, alternatively, each bit of the sub- mask of the third is 1 and the mask matches algorithm of the sub- matching domain of the third is position or fortune It calculates.
The third flow table further includes the 6th list item, and the 6th list item includes matching domain, the matching of the 6th list item Domain includes the 4th sub- matching domain, the 5th sub- matching domain and the 6th sub- matching domain, and the 4th sub- matching domain includes the 4th sub- bit String and the 4th sub- mask, the 5th sub- matching domain include the 5th sub- Bit String and the 5th sub- mask, the 6th sub- matching domain Including the 6th sub- Bit String and the 6th sub- mask, the 4th sub- Bit String is equal with the matching domain of the 5th list item, described 6th sub- Bit String is equal with the matching domain of the 4th list item.
Each bit of the 4th sub- mask is 1, and each bit of the 5th sub- mask is 0, and the 6th son is covered Each bit of code is 1, the 4th sub- matching domain, the mask matches of the 5th sub- matching domain and the 6th sub- matching domain Algorithm is position and operation.Alternatively, each bit of the 4th sub- mask is 0, each bit of the 5th sub- mask is 1, Each bit of the 6th sub- mask is 0, the 4th sub- matching domain, the 5th sub- matching domain and the 6th son matching The mask matches algorithm in domain is position or operation.
Optionally, the processor obtains first position parameter and second position parameter, the first position parameter are used for Position of first field in the first message that retransmission unit receives is identified, first field is first in first message Field in the stem of agreement, first field with the matching domain of first list item for being matched, the second Parameter is set for identifying position of second field in first message, second field is second in first message Field in the stem of agreement, second field with the matching domain of second list item for being matched, first report The stem of second protocol described in text is next stem of the stem of the first agreement described in first message.
The processor according to the first position parameter and the second position parameter, generate the third place parameter and 4th location parameter, the third place parameter is for identifying position of the third field in the second message that retransmission unit receives Set, the third field is the field in the stem of the first agreement described in second message, the third field be used for First sub- matching domain of the third list item is matched, and the 4th location parameter is for identifying the 4th field described second Position in message, the 4th field are the fields in the stem of second protocol described in second message, the described 4th Field with the second sub- matching domain of the third list item for being matched, the stem of second protocol described in second message It is next stem of the stem of the first agreement described in second message.
The initial position of the third field is away from the initial position of the stem of the first agreement described in second message Offset is equal to the initial position of first field away from the initial position of the stem of the first agreement described in first message Offset, the initial position of the 4th field is away from the offset of the initial position of the stem of second protocol described in second message Equal to second field initial position away from the offset of the initial position of the stem of second protocol described in first message.
The third aspect, the present invention provides a kind of device of Message processing, including receiving unit, acquiring unit is searched single Member and processing unit:
The receiving unit, for receiving the first message, first message includes the first stem and the second stem, described Second stem is next stem of first stem, and the agreement of first stem is the first agreement, second stem Agreement be second protocol.
The acquiring unit, the institute of first message for being received from the receiving unit according to first position parameter It states the first stem and obtains the first field, described in first message received from the receiving unit according to second position parameter Second stem obtains the second field, and whether first field is for identifying first message comprising under first stem One stem and when first message include first stem next stem when described in the first stem it is next The agreement of stem, the second field be used for identify first message whether comprising second stem next stem and institute The agreement of next stem of second stem described in stating when the first message includes next stem of second stem.
The searching unit, for by first search request, searching whether exist and first in the first flow table The matched list item of search key, first search request carry first search key, and described first searches key Word includes first field and second field that the acquiring unit obtains.
The processing unit is looked into for being found in first flow table according to the searching unit with described first The first list item for looking for keyword match, first message received to the receiving unit are handled, first list item Matching domain include the first Bit String and the first mask, first Bit String include the first sub- Bit String and the second sub- bit String, first mask include the first sub- mask and the second sub- mask.
The first sub- Bit String and the described first sub- mask into line position and the result of operation be equal to first field with The first sub- mask into line position and operation as a result, the second sub- Bit String and the described second sub- mask into line position and operation Result be equal to second field and the described second sub- mask into line position and operation as a result, the first sub- mask and described Each bit of second sub- mask is 1.Or the first sub- Bit String and the described first sub- mask are into line position or the knot of operation Fruit is equal to first field and the described first sub- mask into line position or operation as a result, the second sub- Bit String and described the Two sub- masks into line position or the result of operation be equal to second field and the described second sub- mask into line position or operation as a result, Each bit of the first sub- mask and the second sub- mask is 0.
Optionally, the acquiring unit is additionally operable to, described received from the receiving unit according to the third place parameter Third field is obtained in one message, first search key further includes the third field, and first Bit String also wraps The sub- Bit String of third is included, first mask further includes the sub- mask of third.
The sub- Bit String of third and the sub- mask of the third into line position and the result of operation be equal to the third field with The sub- mask of third carries out positioned at operation as a result, each bit of the sub- mask of third is 0;Or the sub- ratio of third Spy's string is equal to the third field and the sub- mask of the third into line position with the sub- mask of the third into line position or the result of operation Or operation as a result, each bit of the sub- mask of third be 1.
Optionally, the receiving unit is additionally operable to receive the second message, and second message includes third stem and the 4th Stem, the 4th stem are next stems of the third stem, and the agreement of the third stem is first agreement, The agreement of 4th stem is third agreement.
The acquiring unit is additionally operable to obtain the 4th field from the third stem according to the first position parameter, according to The second position parameter obtains the 5th field from second message, first from the described 4th according to the third place parameter Portion obtains the 6th field, and the 4th field is for identifying the next head whether second message includes the third stem Portion and next stem of the third stem when second message includes next stem of the third stem Agreement, the 6th field are used to identify whether second message to include next stem of the 4th stem and work as institute The agreement of next stem of 4th stem described in stating when the second message includes next stem of the 4th stem.
The searching unit is additionally operable to through second search request, search whether to exist in first flow table with The matched list item of second search key carries second search key in second search request, and described second looks into It includes the 4th field, the 5th field and the 6th field that the acquiring unit obtains to look for keyword.
The processing unit be additionally operable to be found in first flow table according to the searching unit with described second Matched second list item of search key, second message received to the receiving unit are handled, second table The matching domain of item includes the second Bit String and the second mask, and second Bit String includes the 4th sub- Bit String, the 5th sub- ratio Spy's string and the 6th sub- Bit String, second mask include the 4th sub- mask, the 5th sub- mask and the 6th sub- mask.
The 4th sub- Bit String and the 4th sub- mask into line position and the result of operation be equal to the 4th field with The 4th sub- masked bits and operation as a result, the 5th sub- Bit String and the 5th sub- mask into the knot of line position and operation Fruit be equal to the 5th field and the 5th sub- masked bits and operation as a result, the 6th sub- Bit String and the 6th son Mask into line position and the result of operation be equal to the 6th field and the 6th sub- masked bits and operation as a result, the described 4th Each bit of sub- mask and the 6th sub- mask is 1, and each bit of the 5th sub- mask is 0.Or the described 4th Sub- Bit String and the 4th sub- mask into line position or the result of operation be equal to the 4th field and the 4th sub- mask into Line position or operation as a result, the 5th sub- Bit String and the 5th sub- mask are equal to described the into line position or the result of operation Five fields and the 5th sub- mask are into line position or operation as a result, the 6th sub- Bit String is carried out with the described 6th sub- mask The result of position or operation is equal to the 6th field and the 6th sub- mask into line position or operation as a result, the 4th son is covered Each bit of code and the 6th sub- mask is 0, and each bit of the 5th sub- mask is 1.
Optionally, in the technical solution that first aspect or the third aspect provide, the first position parameter includes first Offset and the first length, first offset are the initial position of first field away from the initial position of first stem Offset, first length are the length of first field.
Optionally, in the technical solution that first aspect or the third aspect provide, the second position parameter includes second Offset and the second length, second offset are the initial position of second field away from the initial position of first stem Offset, second length are the length of second field.
Optionally, in the technical solution that first aspect or the third aspect provide, the first position parameter includes first Basic offset, the first specific offset and the first length, the described first basic offset is zero, and the described first specific offset is described the The offset of initial position of the initial position of one field away from first stem, first length are the length of first field Degree.
Optionally, in the technical solution that first aspect or the third aspect provide, the second position parameter includes second Basic offset, the second specific offset and the second length, second length are the length of second field, and described second is basic Offset is the offset of initial position of first stem initial position away from second stem, and the described second specific offset is institute State the offset of initial position of the second field initial position away from second stem.
Optionally, in the technical solution that first aspect or the third aspect provide, the agreement of first stem can be base Two-layer protocol in open system interconnection (open system interconnection, OSI) model.Such as media connect Enter control (media access control, MAC) agreement or asynchronous transfer mode (asynchronous transfer Mode, ATM) agreement.The agreement of second stem can be three layer protocols.Such as IPv4 or IPv6.Alternatively, described The agreement of first stem can be three layer protocols, and the agreement of second stem is four layer protocols.Four layer protocol can be TCP or UDP.Alternatively, the agreement of first stem can be four layer protocols, and the agreement of second stem can be Five layer protocols.Five layer protocol can be remote procedure call (remote procedure call, RPC) agreement or knot Structure query language (structured query language, SQL) agreement.Alternatively, the agreement of first stem can To be five layer protocols, the agreement of second stem can be six layer protocols.Six layer protocol can be that U.S. information exchanges Standard code (American standard code for information interchange, ASCII) agreement.Alternatively The agreement on ground, first stem can be six layer protocols, and the agreement of second stem can be seven layer protocols.Described seven layers Agreement can be hypertext transfer protocol (hypertext transfer protocol, HTTP) or File Transfer Protocol (file transfer protocol,FTP).Alternatively, the agreement of first stem can be user-defined association View.The agreement of second stem can be user-defined agreement.The user is the user of the network equipment.Example Such as, the user can be network operator.The network operator can be prestige news wireless (Verizon Wireless) or Person China Mobile Communications Corporation (China Mobile Communications Corporation).
Optionally, in the technical solution that first aspect or the third aspect provide, the agreement of first stem is IPv4 associations View, first field is the protocol field in first stem.Alternatively, the agreement of first stem is IPv6 associations View, first field is the Next Header fields in first stem.Alternatively, the agreement of second stem It is IPv4 agreements, second field is the protocol field in second stem.Alternatively, the agreement of second stem It is IPv6 agreements, second field is the Next Header fields in second stem.
Fourth aspect provides a kind of flow table generating means, including:First acquisition unit, the first generation unit.
The first acquisition unit includes the first list item for obtaining the first flow table and the second flow table, first flow table, First list item includes matching domain and jump instruction, and the jump instruction of first list item is directed toward second flow table, is directed toward The quantity of the jump instruction of second flow table is equal to 1, and second flow table includes the second list item, and second list item includes With domain.
First flow table and described second that first generation unit is used to be obtained according to the first acquisition unit Flow table generates a third flow table, and the third flow table includes third list item, and the third list item includes matching domain, and described the The matching domain of three list items includes the first sub- matching domain and the second sub- matching domain, and the first sub- matching domain includes the first sub- Bit String With the first sub- mask, the second sub- matching domain include the second sub- Bit String and the second sub- mask, the first sub- Bit String and The matching domain of first list item is equal, and the matching domain of the second sub- Bit String and second list item is equal.
Each bit of the first sub- mask and the second sub- mask is 1, the first sub- matching domain and described the The mask matches algorithm of two sub- matching domains is position and operation;Or each ratio of the first sub- mask and the second sub- mask Specially for 0, the mask matches algorithm of the first sub- matching domain and the second sub- matching domain is position or operation.
Optionally, the first acquisition unit is additionally operable to obtain the 4th flow table, and the 4th flow table includes the 4th list item, institute It includes matching domain to state the 4th list item, and first flow table further includes the 5th list item, and the 5th list item includes matching domain and redirects The 4th flow table is directed toward in the jump instruction of instruction, the 5th list item, is directed toward the quantity of the jump instruction of the 4th flow table Equal to 1.
The matching domain of the third list item further includes the sub- matching domain of third, and the sub- matching domain of third includes the sub- bit of third String and the sub- mask of third.
Each bit of the sub- mask of third is 0 and the mask matches algorithm of the sub- matching domain of the third is position and fortune It calculates, alternatively, each bit of the sub- mask of the third is 1 and the mask matches algorithm of the sub- matching domain of the third is position or fortune It calculates.
The third flow table further includes the 6th list item, and the 6th list item includes matching domain, the matching of the 6th list item Domain includes the 4th sub- matching domain, the 5th sub- matching domain and the 6th sub- matching domain, and the 4th sub- matching domain includes the 4th sub- bit String and the 4th sub- mask, the 5th sub- matching domain include the 5th sub- Bit String and the 5th sub- mask, the 6th sub- matching domain Including the 6th sub- Bit String and the 6th sub- mask, the 4th sub- Bit String is equal with the matching domain of the 5th list item, described 6th sub- Bit String is equal with the matching domain of the 4th list item.
Each bit of the 4th sub- mask is 1, and each bit of the 5th sub- mask is 0, and the 6th son is covered Code each bit be 1, the 4th sub- matching domain, the 5th sub- matching domain and the 6th sub- matching domain mask matches Algorithm is position and operation;Or each bit of the 4th sub- mask is 0, each bit of the 5th sub- mask is 1, institute The each bit for stating the 6th sub- mask is 0, the 4th sub- matching domain, the 5th sub- matching domain and the 6th sub- matching domain Mask matches algorithm be position or operation.
Optionally, further include second acquisition unit and the second generation unit.
The second acquisition unit is used for obtaining first position parameter and second position parameter, the first position parameter Position of the matched field in the message that the retransmission unit receives, institute are carried out in mark and the matching domain of first list item Second position parameter is stated to receive in the retransmission unit with the matched field of the matching domain of second list item progress for identifying Message in position.
The first position parameter that second generation unit is used to be obtained according to the second acquisition unit and described Second position parameter generates the third place parameter and the 4th location parameter.The third place parameter is for identifying third field Position in the second message that retransmission unit receives, the third field is the head of the first agreement described in second message Field in portion, the third field with the first sub- matching domain of the third list item for being matched.4th position For parameter for identifying position of the 4th field in second message, the 4th field is the described in second message Field in the stem of two agreements, the 4th field with the second sub- matching domain of the third list item for being matched, institute The stem for stating second protocol described in the second message is next stem of the stem of the first agreement described in second message.
The initial position of the third field is away from the initial position of the stem of the first agreement described in second message Offset is equal to the initial position of first field away from the initial position of the stem of the first agreement described in first message Offset, the initial position of the 4th field is away from the offset of the initial position of the stem of second protocol described in second message Equal to second field initial position away from the offset of the initial position of the stem of second protocol described in first message.
Optionally, in the technical solution that second aspect or fourth aspect provide, the first position parameter and described the Each location parameter in two location parameters respectively includes offset and length, the third place parameter and the 4th position Each location parameter in parameter respectively includes offset substantially, specific offset and length, the base in the third place parameter This offset is zero, and the specific offset in the third place parameter is equal with the offset in the first position parameter, described the Length in three location parameters and the equal length in the first position parameter, basic offset of the 4th location parameter etc. The length of the stem of the first agreement described in second message, specific offset in the 4th location parameter and described the Offset in two location parameters is equal, the length in the 4th location parameter and the length phase in the second position parameter Deng.
Optionally, in the technical solution that second aspect or fourth aspect provide, that is directed toward first flow table redirects finger The quantity of order is more than 1, or is directed toward first flow table without jump instruction.
Optionally, in the technical solution that first aspect, second aspect, the third aspect or fourth aspect provide, described first Next stem of stem refers to adjacent with first stem, and relative to first header bits in first message The stem of internal layer.Next stem of second stem refers to adjacent with second stem, and first relative to described second Portion is located at the stem of the internal layer of first message.Next stem of the third stem refers to and the third stem phase Neighbour, and it is located at relative to the third stem stem of the internal layer of second message.Next stem of 4th stem Refer to adjacent with the 4th stem, and is located at relative to the 4th stem stem of the internal layer of second message.
Optionally, in the technical solution that first aspect, second aspect, the third aspect or fourth aspect provide, flow table certain The mask matches algorithm of a sub- matching domain is that position refers to operation, when in message certain field and certain described a sub- matching domain packet The sub- Bit String included is into line position and operation as a result, the sub- Bit String and certain described height for including equal to certain described sub- matching domain Result of the sub- mask that matching domain includes into line position and operation, it is determined that the certain field is matched with the sub- matching domain.Stream The mask matches algorithm of certain sub- matching domain of table is position or operation refers to, when in message certain field and certain described height The sub- Bit String for including with domain into line position or operation as a result, the sub- Bit String for including equal to certain described sub- matching domain with it is described The sub- mask that certain sub- matching domain includes is into line position or the result of operation, it is determined that the certain field and the sub- matching domain Match.
Description of the drawings
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is this hair Some bright embodiments for those of ordinary skill in the art without having to pay creative labor, can be with Obtain other attached drawings according to these attached drawings.
Fig. 1 is a kind of schematic diagram of application scenarios of technical solution provided in an embodiment of the present invention.
Fig. 2 is a kind of structural schematic diagram of possible executive agent of technical solution provided in an embodiment of the present invention.
Fig. 3 is a kind of flow diagram of message processing method provided in an embodiment of the present invention.
Fig. 4 is the flow diagram of another message processing method provided in an embodiment of the present invention.
Fig. 5 is the flow diagram of another message processing method provided in an embodiment of the present invention.
Fig. 6 is the particular flow sheet that special field is obtained according to location parameter that Fig. 5 is provided.
Fig. 7 is a kind of flow diagram of the generation method of flow table provided in an embodiment of the present invention.
Fig. 8 is the relation schematic diagram between the flow table jump instruction that Fig. 7 is provided.
Fig. 9 is a kind of structural schematic diagram of message process device provided in an embodiment of the present invention.
Figure 10 is a kind of structural schematic diagram of flow table generating means provided in an embodiment of the present invention.
Specific implementation mode
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical solution in the embodiment of the present invention is described, it is clear that described embodiment is a part of the invention Embodiment, instead of all the embodiments.
The embodiment of the present invention description application scenarios be in order to more clearly illustrate the technical solution of the embodiment of the present invention, The restriction for technical solution provided in an embodiment of the present invention is not constituted.Those of ordinary skill in the art are it is found that with network The appearance of the differentiation and new business scene of framework, technical solution provided in an embodiment of the present invention is for similar technical problem, together Sample is applicable in.
In the application, the agreement of stem refers to the agreement that the stem is followed.Such as the agreement of IPv4 header is IPv4.The agreement of TCP header is TCP.Virtual local area network tags (virtual local area network tag, VLAN Tag agreement) is VLAN agreements.
In the application, next stem of some stem of message is adjacent with some described stem.Relative to it is described some Stem, next stem is located at the internal layer of the message, and relative to next stem, some described stem is located at institute State the outer layer of message.Same reason, a upper stem for some stem of message with it is described some is adjacent, relative to it is described certain A stem, a upper stem are located at the outer layer of the message, and relative to a upper stem, some described stem is located at The internal layer of the message.
In the application, whether the special field in some stem of message refers to, for identifying in the message comprising institute State next stem of some stem, and when the message includes next stem of some stem, it is described some The field of the agreement of next stem of stem.For example, the special field in Ethernet frame head is Ethernet the type fields. Special field in IPv4 header is protocol field.Special field in IPv6 header is Next Header words Section.
In the application, the parsing to message refers to the stem for including in determining message.Parsing to some stem refers to root The next stem for whether including some stem in the message is determined according to the special field in some described stem, and When the message includes next stem of some stem, the agreement of next stem of some stem.
In the application, the mask matches algorithm of certain sub- matching domain of flow table is that position refers to operation, when certain in message The sub- Bit String that a field includes with certain described sub- matching domain is into line position and operation as a result, equal to certain described sub- matching domain Including the sub- Bit String mask that includes with certain described sub- matching domain into line position and operation as a result, the certain field with The sub- matching domain matching.The mask matches algorithm of certain sub- matching domain of flow table is position or operation refers to, when certain in message The sub- Bit String that a field includes with certain described sub- matching domain is into line position or operation as a result, equal to certain described sub- matching domain Including the sub- Bit String mask that includes with certain described sub- matching domain into line position or operation as a result, the certain field with The sub- matching domain matching.
In the application, location parameter is used to indicate position of the certain field in some message.The location parameter can be with Including offset and length.The offset of the certain field is the initial position of the certain field away from the benchmark of the location parameter The offset of position.
In the application, the initial position of certain field refers to the Most Significant Bit (most of the certain field Significant bit, MSB).The initial position of some stem refers to the MSB of some stem.The start bit of some message Set the MSB of some message described in referring to.
Fig. 1 is a kind of application scenarios schematic diagram of technical solution provided in an embodiment of the present invention.As shown, fixed in software In adopted network (software design network, SDN), the network architecture includes control device (controller) and forwarding Device.Controller is communicated by control channel with retransmission unit.Engineer can be compiled using controller Journey, the final control realized to retransmission unit.For example, engineer generates flow table (flow by being programmed on controller table).Flow table is sent to retransmission unit by Controller by control channel.Each flow table by a list item (entry) or Multiple list item compositions.Each flow table includes matching domain (match field) and domain of instruction (instruction field).Each The list item of flow table corresponds to Message processing rule.Specifically, after retransmission unit receives message, the flow table required to look up is determined.Example Such as, retransmission unit determines the flow table required to look up according to the port for receiving message.Retransmission unit is according to the flow table, from report It is obtained in text for carrying out matched search key with the matching domain of the flow table.Then, retransmission unit is according to the lookup Keyword determines and the matched flow table item of message, and is handled message according to the instruction in matched flow table item.
Retransmission unit involved by the application can be that the network switch, fire wall, load equalizer, wavelength-division multiplex are set Standby, Packet Transport Network equipment, base station, base station controller or data center.
The different messages that the retransmission unit receives, the data format of message may and differ.For example, router can be with Including atm interface, synchronous digital system bearing message (packet over synchronous digital hierarchy, POS) interface and Ethernet interface.The router can receive ATM frames by atm interface.The router can pass through Pos interface receives peer-peer protocol (point to point protocol, PPP) message.The router can pass through ether Network interface receives ethernet frame.Hereafter illustrated by taking ethernet frame as an example.For example, the Ethernet of the ethernet frame Next stem of frame header may be VLAN tag, it is also possible to IPv4 header.In another example existing When IPv4header, next stem of the IPv4 header may be TCP header, it is also possible to UDP header. It realizes and the message of different data format is properly processed, it is necessary to first the message is parsed, so that it is determined that The stem for including in message.As an example it is assumed that including in the ethernet frame that the router is received by Ethernet interface IP header.The router is to realize to determine next-hop according to IP header and routing table, it is necessary to determine purpose net The position of field in ethernet frames internet protocol address (Destination IP Address).The router is to realize to determine Whether IP header and IP header position in the message, the routing are included in the ethernet frame Device is needed to the Ethernet frame header parsings in the ethernet frame, so that it is determined that in the ethernet frame Next stem of Ethernet frame header.If in the ethernet frame under Ethernet frame header One stem is VLAN tag, and the router also needs to parse the VLAN tag so that it is determined that the VLAN tag Next stem whether be the IP header.Certainly, described if in the ethernet frame including multiple VLAN tag Ethernet frame needs parse each VLAN tag.
Fig. 2 shows a kind of structural schematic diagrams of retransmission unit 200 provided in an embodiment of the present invention.Forwarding shown in Fig. 2 Device 200 can be used to implement retransmission unit 200 shown in FIG. 1.As shown, the retransmission unit 200 includes interface circuit 201, processor (processor) 202, three-state content addressing memory (ternary content addressable Memory, TCAM) 203 and bus (bus) 204.Interface circuit 201, processor 202 and TCAM203 pass through 204 phase of bus Even.The interface circuit 201 is for receiving message.After institute's interface circuit 201 receives message, processing is sent to by bus 204 Device 202.Processor 202 can be by packet storage in the register 205 of processor 202.For example, the processor can be with It is monokaryon (single-core) processor, can also be multinuclear (multi-core) processor.
After processor 202 receives the message of the reception of the interface circuit 201, from command memory (instruction Memory, IMEM) in obtain flow table mark and location parameter.Comprising for the message in described instruction memory The computer program that stem is parsed.It may include the mark of the flow table in the computer program.For example, described Command memory can be static RAM (static random access memory, SRAM), the SRAM It can be integrated in processor 202 in a chip.The SRAM and processor 202 can also be respectively included in two chips It is interior.
Flow table is stored in TCAM 203.Processor 202 obtains search key according to the location parameter from message Afterwards, search request is sent to TCAM203.The search request carries the search key.TCAM203 receives the lookup After keyword, searched and the matched list item of the search key in flow table.The matching domain of the flow table include Bit String and Mask.TCAM203 determines the matched list item of the search key by mask matches algorithm.TCAM 203 passes through bus 204 It is responded to 202 feedback search of processor.Searching response can include and the information in the matched list item of the search key.Example Such as, described to search the storage address that response include the instruction of domain of instruction in matched list item.The processor 202 is according to institute The storage address for stating instruction, obtains described instruction in command memory 206, and according to described instruction to the message at Reason.
Processor 202 can pass through central processing unit (central processing unit, CPU), Digital Signal Processing Device (digital signal processor, DSP), application-specific integrated circuit (application-specific integrated Circuit, ASIC), field programmable gate array (field programmable gate array, FPGA) or other can Programmed logic device is realized.It may be implemented or execute the various illustrative logic sides in conjunction with described in the disclosure of invention Frame, module and circuit.
Fig. 3 is a kind of flow diagram of the method for Message processing provided in an embodiment of the present invention.The execution of the method Main body can be the retransmission unit 200 of Fig. 2.Specifically, it can be processor 202.
Referring to Fig. 3, the method includes S201, S202 and S203.
S201, retransmission unit receive message, and the message includes multiple stems.
S202, by being parsed to the message, so that it is determined that the processing mode of the message.
S203, the message is handled according to the processing mode.
May include when S202 specific implementations:
When in the message including multiple stems, the message can be parsed in the following way:Processor 202 respectively by carrying out multiple flow tables to search the parsing realized to multiple stems.Retransmission unit 200 maintains the multiple stream Table.Specifically, the multiple flow table can be stored in TCAM203.The agreement of the multiple flow table and the multiple stem It corresponds.Processor 202, which to the multiple flow table search, to be needed to realize by TCAM203 repeatedly access.Place Reason device 202 carries out primary access to TCAM203 and specifically includes:Retransmission unit 200 obtains institute from a stem of the message The special field for stating stem searches matched table according to the special field in flow table corresponding with the agreement of the stem , and next operation is determined according to the matched list item.For example, retransmission unit 200 receives ethernet frame.The ether Net frame includes Ethernet frame header, IPv4 header and TCP header.The Ethernet frame Header is the stem of the ethernet frame.The IPv4 header and the TCP header belong to the ethernet frame Payload.The IPv4 header are next stems of the Ethernet frame header.The TCP header are Next stem of the IPv4 header.Retransmission unit 200 is obtained from the Ethernet frame header Ethernet the type fields.Retransmission unit 200 accesses TCAM203 using the Ethernet the type fields as search key. Specifically, retransmission unit 200 is searched and Ethernet the type fields in the corresponding flow tables of Ethernet frame header Matched list item, and be after determining Ethernet frame header described in the ethernet frame according to matched list item It is no to have next stem, and there are the agreements of next stem when next stem after the Ether frame stem. For example, the value of the Ethernet type fields is equal to 0x0800 (hexadecimal), with the Ethernet the type fields In the list item matched, matching domain is also equal to 0x0800 (hexadecimal), then the retransmission unit determines described in the ethernet frame It is IPv4 to have the agreement of next stem and next stem after Ethernet frame header.With it is described The matched list item of Ethernet the type fields includes jump instruction.The operand of the jump instruction is described for parsing The storage address or instruction block number of the corresponding instruction block of flow table of the stem of IPv4.Retransmission unit 200 can be according to for solving The corresponding instruction of the flow table flow table mark in the block for analysing the stem of the IPv4, accesses the corresponding flow table of stem of IPv4 agreements, According to location parameter in the block is instructed search key is obtained from the IPv4 header.For example, retransmission unit 200 is from institute It states in IPv4 header and obtains protocol field, using the protocol field as search key, access again TCAM203.It is matched with protocol field specifically, retransmission unit 200 is searched in the corresponding flow tables of the IPv4 header List item.Such as the value of the protocol field is equal to 0x06 (hexadecimal), then it is matched with the protocol field The matching domain of list item is equal to 0x06 (hexadecimal).The retransmission unit determines the Ethernet according to the matched list item There is next stem after IPv4 header described in frame, and next stem is TCP header.
The specific implementation of S203 may include, right according to the corresponding processing mode of the protocol type of stem in the message The message is handled.For example, being forwarded, abandoning, encapsulate or decapsulating to the message.At the message Reason can also be that the metadata (metadata) of the message is arranged.The metadata can be for handling the message The parameter of computer program.After the network equipment is configured the metadata, the network equipment can according to The message is handled in the computer program and the parameter for handling the message.
In above-mentioned technical proposal, when in message including multiple stems, retransmission unit is needed to the storage in retransmission unit Device is repeatedly accessed, and thereby determines how to handle message.Include in the number and the message of access memory The number of stem is identical.Expense is bigger.
Fig. 4 is the flow diagram of another message processing method provided in an embodiment of the present invention.The forwarding dress that Fig. 4 is related to Setting can specifically be realized by retransmission unit 200 shown in Fig. 2.With reference to Fig. 4, at message provided in an embodiment of the present invention Reason method illustrates.The message processing method includes S301, S302, S303 and S304.
S301, retransmission unit receive the first message.
First message includes the first stem and the second stem, and second stem is the next of first stem The agreement of stem, first stem is the first agreement, and the agreement of second stem is second protocol.
For example, the agreement of first stem is based on the two-layer protocol in osi model.Such as the two-layer protocol Can be MAC protocol or ATM agreements.The agreement of second stem can be three layer protocols.Such as three layer protocol can To be IPv4 or IPv6.Alternatively, the agreement of first stem is three layer protocols, and the agreement of second stem is four Layer protocol.Four layer protocol can be TCP or UDP.Alternatively, the agreement of first stem is four layer protocols, institute The agreement for stating the second stem is five layer protocols.Five layer protocol can be RPC agreements or HTTP protocol.Alternatively, described The agreement of first stem is five layer protocols, and the agreement of second stem is six layer protocols.Six layer protocol can be ASCII Agreement.Alternatively, the agreement of first stem is six layer protocols, and the agreement of second stem is seven layer protocols.It is described Seven layer protocols can be HTTP or FTP.Alternatively, the agreement of first stem is user-defined agreement, described The agreement of second stem is user-defined agreement.The user is the user of the network equipment.For example, the user can To be network operator.The network operator can be that prestige interrogates wireless or China Mobile Communications Corporation.
For example, first stem can be the stem of first message, can also be first message Stem in payload.For example, first message can be ethernet frame.For example, first stem can be Ethernet Frame header, first stem can also be the header in the payload of ethernet frame.Such as IP header, or TCP header。
The executive agent of S301 can be interface circuit 201.In addition, after interface circuit 201 receives first message, First message can be saved in register 205 by processor 202.
S302, the retransmission unit obtains the first field according to first position parameter from first stem, according to second Location parameter obtains the second field from second stem.
First field be used for identify first message whether comprising first stem next stem and The agreement of next stem of first stem described in when first message includes next stem of first stem, the Two fields are used to identify whether first message to include next stem of second stem and the first message packet The agreement of next stem of second stem described in when next stem containing second stem.That is, first field is Special field in first stem, second field are the special fields in second stem.
Whether the function of first field is next comprising first stem for identifying first message Stem and when first message include first stem next stem when described in the first stem next stem Agreement.The function of first field is by first protocol definition.First message is to follow first association The message of view.When next stem of the first stem described in first message is second stem, first word The agreement of the agreement and the stem of next stem of first stem of segment identification is consistent.That is, described The agreement of next stem of first stem of first field identification is the second protocol.The first position parameter is used The position of special field in the stem for identifying the first agreement, the second position parameter are used to identify in the stem of second protocol The position of special field.
The executive agent of S302 can be processor 202.Specifically, described can be preserved in command memory 206 One location parameter and the second position parameter.Processor 202 can obtain the first position ginseng from command memory 206 Several and described second position parameter.Processor 202 can be according to the first position parameter and the second position parameter First field and second field are obtained from first message preserved in register 205.
Optionally, the first position parameter includes the first offset and the first length.First offset is described first The offset of initial position of the initial position of field away from first stem.First length is the length of first field Degree.The second position parameter includes the second offset and the second length.Second offset is the start bit of second field Set the offset of the initial position away from first stem.Second length is the length of second field.
For example, first offset and described second deviates, and is the position on the basis of the initial position of the first stem Offset.In the retransmission unit according to the first position parameter and the first field of second position parameter acquiring and the second word Before section, reference position can be set to the initial position of the first stem.That is, the reference position of first field Reference position with second field can be identical.For example, the first offset is 41 bits (bit), the first length is It is word of the 41st bit from the initial position of first stem to the 48th bit that 8bit, which refers to first field, Section.Second offset is 65bit, and the second length is 8bit, refer to second field is from the initial position of first stem Field of the 65th bit risen to the 72nd bit.
Optionally, the first position parameter includes the first basic offset, the first specific offset and the first length.Described One basic offset is zero.Described first specific offset is the initial position of first field away from the start bit of first stem The offset set.First length is the length of first field.The second position parameter includes the second basic offset, the Two specific offsets and the second length.Second length is the length of second field.Described second basic offset is described The offset of initial position of the first stem initial position away from second stem.Described second specific offset is second field The offset of initial position of the initial position away from second stem.
Described first basic offset is offset of the initial position far from reference position of first stem, and described first is specific Offset is the offset of initial position of first field away from first stem.First basic offset with described first it is specific partially It the sum of moves, be the initial position of first field away from the offset of the reference position reference position is first stem Initial position.Described second basic offset is the initial position of second stem away from the offset of the reference position, described Second specific offset is the initial position of second field away from the offset of the initial position of second stem.Second base The sum of this offset and the described second specific offset are the initial positions of second field away from the offset of the reference position.
For example, the first stem is Ethernet frame header, the first field is from First in first stem The 97th bit that the initial position in portion is risen is to the 112nd bit.The length of first stem is 112bit, then first position The basic offset of the first of parameter is 0, and the first specific offset is 97bit, and the first length is 16bit.Second stem is IPv4 stems, Second field is the 41st bit from the second stem to the 48th bit.Second stem initial position is away from described First stem initial position is 112bit, then the second basic offset is 112bit.Second specific offset is 41bit.Second length For 8bit.
S303, the retransmission unit search whether exist and first by first search request in the first flow table The matched list item of search key, first search request carry first search key, and described first searches key Word includes first field and second field.
For example, the retransmission unit obtains first flow table by the mark of the first flow table.The retransmission unit When obtaining the mark of first flow table, the first position parameter and the second position parameter are also obtained.For example, described The identifying of first flow table, the first position parameter and the second position parameter are stored in command memory 206.It is specific next It says, the identifying of first flow table, the first position parameter and the second position parameter can be in command memory 206 Information in the computer program of preservation.
The executive agent of S303 can be processor 202.Specifically, processor 202 can be according to described the of acquisition One field and second field generate one first search request.The processor can by bus 204 to TCAM203 sends one first search request.First flow table is stored in TCAM203.Receive one After one search request, TCAM203 searches whether exist and the matched list item of the first search key in the first flow table.
The quantity of first search request is 1.That is, only there are one first search requests.
In one possible implementation, first stem is the stem of first message.Retransmission unit receives When to the message, reception first message according to the bootstrap of the retransmission unit and for the retransmission unit Port, obtain the first flow table mark.For example, first message is ethernet frame, the retransmission unit passes through ethernet side Mouth receives first message.The retransmission unit saves the ethernet port and for parsing the micro- of Ethernet frame head The mapping relations of the address of code.The retransmission unit determines described for parsing Ethernet frame head according to the ethernet port The address of microcode.The microcode includes the first flow table mark, first position parameter and second position parameter.
In alternatively possible realization method, first stem is the stem in the payload of first message.Institute The jump instruction for stating the matching list item in upper level flow table of the retransmission unit by executing first flow table, obtains described in storage The instruction block of first flow table mark.Described instruction block includes first flow table mark, the first position parameter and described Second position parameter.The retransmission unit carries out with first search key of first message and the first flow table With before, also matched with another flow table with others search key.The retransmission unit is according to another flow table Jump instruction in matching list item determines first flow table.For example, the operand of the jump instruction is equal to described first-class The mark of table.Another flow table is the upper level flow table of first flow table.
It, can be with it should be noted that the retransmission unit is before obtaining first field and second field According to the instruction in the matching list item in the bootstrap or the first flow table upper level flow table, by the first position The reference position of parameter and the offset in the second position parameter is set as the initial position of first stem.
S304, the retransmission unit, which determines in first flow table, to be existed and first search key matched first After list item, the retransmission unit is handled first message according to first list item.
The matching domain of first list item includes the first Bit String and the first mask.First Bit String includes first Sub- Bit String and the second sub- Bit String, first mask include the first sub- mask and the second sub- mask.
The first sub- mask and the second sub- mask can be realized according to mode 1 or be realized according to mode 2.
Mode 1, the first sub- Bit String are equal to described first with the described first sub- mask into line position and the result of operation Field and the described first sub- mask into line position and operation as a result, the second sub- Bit String and the described second sub- mask into line position It is equal to result of second field with the described second sub- mask into line position and operation with the result of operation.The first sub- mask Each bit with the described second sub- mask is 1.
Mode 2, the first sub- Bit String are equal to described first with the described first sub- mask into line position or the result of operation Field and the described first sub- mask into line position or operation as a result, the second sub- Bit String and the described second sub- mask into line position Or the result of operation is equal to second field and the described second sub- mask into line position or operation as a result, the first sub- mask Each bit with the described second sub- mask is 0.
For example, first field, the equal length of the first sub- Bit String and the first sub- mask.It is described The equal length of second field, the second sub- Bit String and the second sub- mask.
The executive agent of S304 can be processor 202 and TCAM203.Specifically, first can be preserved in TCAM203 The matching domain of flow table, and responded to 202 feedback search of processor by bus.The lookup response can be contained in described first The information of matched first list item of search key, such as the lookup response can include domain of instruction in first list item The storage address of instruction.The processor 202 according to the storage address of described instruction, obtained in command memory 206 described in Instruction, and the message is handled according to described instruction.
For example, the retransmission unit is handled first message according to the first list item, including according to Instruction in first list item handles first message.
In one possible implementation, the instruction in first list item includes for metadata to be arranged (metadata) instruction.For example, metadata can be stored in register 205.Processor 202 is according to for being arranged The instruction of the instruction of metadata can execute following operation:The first information is recorded in the metadata of the first message.It is described It includes second stem that the first information, which is used to indicate in first message,.And described in second field identification When one message further includes next stem of second stem, the second letter is recorded also in the metadata of first message Breath.Second information is used to indicate the next stem for including second stem in first message.In another example processing Device 202 can execute following operation according to the instruction of metadata instructions:Third is recorded in the metadata of first message Information.The third information is used to indicate initial position or the final position of second stem.When first message also wraps When including next stem of second stem, the 4th information is recorded also in the metadata of first message.Described Four information are used to indicate initial position or the final position of next stem of second stem.
In alternatively possible example, the retransmission unit is determined in first message according to first list item and is wrapped Include second stem.When first message includes next stem of second stem, the retransmission unit root According to first list item, the agreement of next stem of second stem is determined.Optionally, the retransmission unit is according to Next stem of second stem or second stem is forwarded first message.For example, according to described The corresponding forwarding table of agreement of two stems is forwarded first message.Alternatively, according to next with second stem The corresponding forwarding table of agreement of a stem is forwarded first message.When the agreement of second stem is multi-protocols mark When label exchange (Multiprotocol Label Switching, MPLS) agreement, the corresponding forwarding of agreement of second stem Table can be into label mapping (incoming label map, ILM) table.Second stem is MPLS header.When described When the agreement of next stem of second stem is Internet protocol (internet protocol, IP), under second stem The corresponding forwarding table of one stem can be routing table.Next stem of second stem is IP header.Citing comes It says, the retransmission unit is according to the metadata of first message, it is determined that after the stem for including in first message, According to the stem for including in first message, first message is forwarded, abandoned, encapsulated, decapsulates or changed Processing.For example, according to the information recorded in the metadata of first message, determine that first message includes IPv4 head The initial position of portion and the IPv4 stems in first message.In turn, the life span in IPv4 stems is changed The value of (time to live, TTL) field.In addition, the retransmission unit is with can also extracting the destination IP in IPv4 header Location, and first message is forwarded to by next-hop according to the destination IP address.
For example, the retransmission unit is obtaining first flow table mark, the first position parameter and described the While two location parameters, more location parameters, such as nth position parameter can also be obtained, N is the integer more than 2;Accordingly , can also include more fields in first search key.Such as it is obtained from N stems according to nth position parameter The N fields taken;Correspondingly, it is described with matched first list item of the first search key in, including the sub- Bit Strings of N and The sub- masks of N.The sub- Bit Strings of N are equal to the N fields and institute with the sub- masks of N into line position and the result of operation The sub- masks of N are stated into line position and operation as a result, each bit of the sub- masks of N is 1;Or the sub- Bit Strings of N It is equal to the N fields and the sub- masks of N into line position or operation into line position or the result of operation with the sub- masks of N As a result, each bit of the sub- masks of N is 0.The retransmission unit determines and first search key matched the After one list item, determines how and the first message is handled.
Fig. 5 is the flow chart of another message processing method provided in an embodiment of the present invention.
S401, retransmission unit receive the first message.
First message includes the first stem and the second stem, and second stem is the next of first stem The agreement of stem, first stem is the first agreement, and the agreement of second stem is second protocol.
S402, the retransmission unit obtains the first field according to first position parameter from first stem, according to second Location parameter obtains the second field from second stem, and third is obtained from first message according to the third place parameter Field.
First field is used to identify the next stem whether first message includes first stem, and When first message includes next stem of first stem, the agreement of next stem of first stem. Second field is for identifying the next stem whether first message include second stem, and works as described the When one message includes second stem next stem, the agreement of next stem of second stem.That is, described first Field is the special field in first stem, and second field is the special field in second stem.Described The position of special field in stem of one location parameter for identifying the first agreement, the second position parameter is for identifying second The position of special field in the stem of agreement.The third place parameter is used to identify the message when the retransmission unit receives In, when next stem of the stem of the first agreement is the stem of third agreement, the special word in the stem of the third agreement The position of section.For example, next stem of the stem of the first agreement is the stem of third agreement in the second message in S405.Cause This, third field is not the special field in first message.
S403, the retransmission unit by first search request, searched whether in first flow table exist with The matched list item of first search key.
First search request carries the first search key.First search key includes first word Section, second field and the third field.
S404, the retransmission unit, which determines in first flow table, to be existed and first search key matched first After list item, the retransmission unit is handled first message according to first list item.
The matching domain of first list item includes the first Bit String and the first mask, and first Bit String includes first Sub- Bit String, the second sub- Bit String and the sub- Bit String of third, first mask include the first sub- mask, the second sub- mask with And the sub- mask of third.
The first sub- mask and the second sub- mask can by pass-through mode 1 or in a manner of 2 realize.
Mode 1, the first sub- Bit String are equal to described first with the described first sub- mask into line position and the result of operation Field and the described first sub- mask into line position and operation as a result, the second sub- Bit String and the described second sub- mask into line position It is equal to result of second field with the described second sub- mask into line position and operation with the result of operation.The first sub- mask Each bit with the described second sub- mask is 1.
Mode 2, the first sub- Bit String are equal to described first with the described first sub- mask into line position or the result of operation Field and the described first sub- mask into line position or operation as a result, the second sub- Bit String and the described second sub- mask into line position Or the result of operation is equal to second field and the described second sub- mask into line position or operation as a result, the first sub- mask Each bit with the described second sub- mask is 0.
The sub- mask of third can by pass-through mode 3 or in a manner of 4 realize.
Mode 3, the sub- Bit String of third are equal to the third with the sub- mask of the third into line position and the result of operation Field and the sub- mask of the third are into line position and operation as a result, each bit of the sub- mask of third is 0.
Mode 4, the sub- Bit String of third are equal to the third with the sub- mask of the third into line position or the result of operation Field and the sub- mask of the third are into line position or operation as a result, each bit of the sub- mask of third is 1.
For example, the third field, the sub- Bit String of the third and the sub- mask-length of the third are equal.
It should be noted that the specific implementation details of S401-S404 can respectively with the specific implementation details of S301-S304 It is similar.Accordingly, with respect to the specific implementation of S401-S404, details are not described herein again.
S405, retransmission unit receive the second message.
Second message includes third stem and the 4th stem, and the 4th stem is the next of the third stem The agreement of stem, the third stem is first agreement, and the agreement of the 4th stem is third agreement.
Specifically, the First of the first message in the S405 in the agreement and S401 of the third stem of the second message The agreement in portion is all first agreement.The agreement that i.e. described first stem and the third stem are followed is identical.In S405 Described in the second message the 4th stem agreement and the parts S401 described in the first message second stem association View, is the third agreement and the second protocol respectively.For example, first agreement is IPv4, the second protocol is TCP, the third agreement is UDP, i.e., in described first message, first stem is the stem of IPv4, the IPv4's Adjacent second stem is the stem of TCP after stem.In second message, the third stem is the head of IPv4 Portion, adjacent the 4th stem is the stem of UDP after the stem of the IPv4.
S406, the retransmission unit obtain the 4th field according to the first position parameter from the third stem, according to The second position parameter obtains the 5th field from the message, is obtained from the 4th stem according to the third place parameter Take the 6th field.
4th field is used to identify the next stem whether second message includes the third stem, and When second message includes next stem of the third stem, the agreement of next stem of the third stem. 6th field be used to identify second message whether next stem comprising the 4th stem and when described the The agreement of next stem of 4th stem described in when two messages include next stem of the 4th stem.That is, described Four fields are the special fields in the third stem, and the 6th field is the special field in the 4th stem.It is described The position of special field in stem of the first position parameter for identifying first agreement, the third place parameter is for marking Know the position of special field in the stem of the third agreement.The second position parameter is for identifying when the retransmission unit connects In the message of receipts, when next stem of the stem of first agreement is the stem of the second protocol, the second protocol Stem in special field position.For example, the stem of the first agreement described in first message in S401 is next A stem is the stem of the second protocol.Therefore, the 5th field is not the special field in second message.
Optionally, the first position parameter includes the first offset and the first length, and first offset is the described 4th The offset of initial position of the initial position of field away from the third stem, first length are the length of the 4th field Degree;The third place parameter includes third offset and third length, and the third offset is the start bit of the 6th field The offset of the initial position away from the third stem is set, the third length is the length of the 6th field.
Optionally, the first position parameter includes the first basic offset, the first specific offset and the first length, and described the One basic offset is zero, and the described first specific offset is the initial position of the 4th field away from the start bit of the third stem The offset set, first length are the length of the 4th field;The third place parameter include third deviate substantially, Three specific offsets and third length, the third length are the length of the 6th field, and it is described that the third deviates substantially The offset of initial position of the 4th stem initial position away from the third stem, specifically offset is the 6th field to the third The offset of initial position of the initial position away from the 4th stem.
Fig. 6 is shown according to the first position parameter, the second position parameter and the third place parameter, The first field, the second field and third field in S402 are obtained in one message, and are obtained the 4th in S406 in the second message The schematic diagram of field, the 5th field and the 6th field.
After retransmission unit obtains first message or second message, the first position parameter, described is obtained When second position parameter and the third place parameter, also reference position is arranged in first stem or the third stem Initial position.The reference position is the first position parameter, the second position parameter and the third place ginseng Several reference positions.During extracting above-mentioned field, the reference position does not change.The second position parameter mark Know, when next stem of the stem of the first agreement described in the message is the stem of the second protocol, described second The position of special field in messages in the stem of agreement;The third place parameter identification, first described in the message When next stem of the stem of agreement is the stem of the third agreement, special field is being reported in the stem of the third agreement Position in text.
In the message that the retransmission unit receives, the next stem that may include the stem of first agreement is institute The message of the stem of second protocol is stated, such as first message;May also include next head of the stem of first agreement Portion is the message of the stem of the third agreement, such as second message.After the retransmission unit receives message, both according to institute It states second position parameter and extracts field from message, field is extracted from message also according to the third place parameter.In this way, nothing Next stem by the stem of the first agreement described in the message received is the stem or described of the second protocol The stem of three agreements, the retransmission unit can get the stem of the second protocol (first described in the message When next stem of the stem of agreement is the stem of the second protocol) or the third agreement stem (when the report When next stem of the stem of first agreement described in text is the stem of the third agreement).
The association of the agreement of first stem in first message and the third stem in second message View is identical.The quantity of the bit of first stem is equal to the quantity of the bit of the third stem.First stem Format it is identical as the format of third stem.Position of the special field in first stem in first stem It is identical as position of the special field in the third stem in the third stem.Therefore, the retransmission unit can root According to the first position parameter from the special field obtained in first stem in first stem.Also, the forwarding Device can be according to the first position parameter from the special field obtained in the third stem in the third stem.
Second stem and the 4th stem are next head of the first stem described in first message respectively Next stem of third stem described in portion and second message.The agreement of second stem and the 4th stem Agreement be different.Therefore, the format of second stem and the format of the 4th stem are different.Described second is first Position of the special field in second stem in portion may be different from special field in the 4th stem described Position in 4th stem.The quantity of the bit of second stem may be not equal to the quantity of the bit of the 4th stem. The retransmission unit can obtain special word according to the third place parameter from the 4th stem of second message Section.But the third field that the retransmission unit is obtained according to the third place parameter from first message is not It is the special field of second stem.Even, as shown in fig. 6, the retransmission unit according to the third place parameter from institute It may not be the field in second stem to state the third field obtained in the first message.Same reason, described turn Transmitting apparatus can obtain special field according to the second position parameter from second stem of first message.But It is that the 5th field that the retransmission unit is obtained according to the second position parameter from second message is not described Special field in 4th stem.
It should be noted that the position of first stem shown in fig. 6 and second stem in first message It sets and position in second message of the third stem and the 4th stem is only to illustrate.
First stem can be with as shown in fig. 6, be the stem in first message payload, i.e., in described first message There are other stems, the initial position of the initial position of first stem and first message before first stem It is different.Alternatively, first stem can also be the stem in first message, i.e., the start bit of described first stem It sets identical as the initial position of the first message.
Similarly, the third stem can with as shown in fig. 6, be the stem in second message payload, i.e., described second There are other stems, the initial position of the third stem to be risen with second message in message before the third stem Beginning position is different.Alternatively, the third stem can also be the stem in second message, i.e., the described third stem Initial position is identical as the initial position of the second message.
S407, the retransmission unit by second search request, searched whether in first flow table exist with The matched list item of second search key.
Second search request carries second search key.Second search key includes the described 4th Field, the 5th field and the 6th field.
S408, the retransmission unit, which determines in first flow table, to be existed and second search key matched second After list item, the retransmission unit is handled second message according to second list item.
The matching domain of second list item includes the second Bit String and the second mask, and second Bit String includes the 4th Sub- Bit String, the 5th sub- Bit String and the 6th sub- Bit String, second mask include the 4th sub- mask, the 5th sub- mask with And the 6th sub- mask.
The quantity of second search request is 1.That is, only there are one second search requests.
The first sub- mask and the second sub- mask can be realized according to mode 1 or be realized according to mode 2.
Mode 1, the 4th sub- Bit String are equal to the described 4th with the 4th sub- mask into line position and the result of operation Field and the 4th sub- mask into line position and operation as a result, the 5th sub- Bit String and the 5th sub- mask into line position It is equal to the 5th field and the 5th sub- mask into line position and operation as a result, the 6th sub- bit with the result of operation String and the 6th sub- mask into line position and the result of operation be equal to the 6th field and the 6th sub- mask into line position with Operation as a result, each bit of the 4th sub- mask and the 6th sub- mask be 1, each ratio of the 5th sub- mask Specially for 0.
Mode 2, the 4th sub- Bit String are equal to the described 4th with the 4th sub- mask into line position or the result of operation Field and the 4th sub- mask into line position or operation as a result, the 5th sub- Bit String and the 5th sub- mask into line position Or the result of operation is equal to the 5th field and the 5th sub- mask into line position or operation as a result, the 6th sub- bit String and the 6th sub- mask into line position or the result of operation be equal to the 6th field and the 6th sub- mask into line position or Operation as a result, each bit of the 4th sub- mask and the 6th sub- mask be 0, each ratio of the 5th sub- mask Specially for 1.
For example, the 4th field, the 4th sub- Bit String and the 4th sub- mask-length are equal.Described Five fields, the 5th sub- Bit String and the 5th sub- mask-length are equal.6th field, the 6th sub- Bit String It is equal with the 6th sub- mask-length.
As shown in Figure 6, the third field is not the special field of second stem.If according to the third word Section parses first message, then mistake may occur.In mode 1 when S404 is implemented, third is covered Each bit of code is 0.In mode 2 when S404 is implemented, each bit of the sub- mask of third is 1.It is no matter described The value of third field is why, in the mode 1 when S404 is implemented, the sub- Bit String of third and the sub- mask of the third Into line position and operation as a result, can be equal to the third field carry out with the sub- mask of the third result positioned at operation; In mode 2 when S404 is implemented, the sub- Bit String of third and the sub- mask of the third are into line position or operation as a result, equal The third field and the sub- mask of the third can be equal into line position or the result of operation.Therefore, no matter the third field Whether why is value, all will not be to generate shadow with the result of the matched list item of the first search key to first list item It rings.
Same reason, the 5th field are not the special fields of the 4th stem.If according to the 5th word Section parses second message, then mistake may occur.In mode 1 when S408 is implemented, the 5th son is covered Each bit of code is 0.In mode 2 when S408 is implemented, each bit of the 5th sub- mask is 1.It is no matter described The value of 5th field is why, in the mode 1 when S408 is implemented, the 5th sub- Bit String and the 5th sub- mask Into line position and operation as a result, can be equal to the result of the 5th field and the 5th sub- masked bits and operation.In S408 In mode 2 when specific implementation, the 5th sub- Bit String and the 5th sub- mask are into line position or operation as a result, can wait In the 5th field and the 5th sub- mask into line position or the result of operation.Therefore, no matter the value of the 5th field Why, all whether had an impact with the result of the matched list item of the second search key to second list item.
According to S404 and S408, the retransmission unit is to having matched first message of first list item and having matched Second message of second list item carries out different processing.For example, the processing is with S304 to described first The specific implementation details for the processing that message carries out are similar.Accordingly, with respect to S404 and S408 to first message or described Two messages carry out the specific implementation of different disposal, and details are not described herein.
Fig. 7 is a kind of flow chart of flow table generation method provided in an embodiment of the present invention.Referring to Fig. 7, the method includes S601 and S602.Additionally it is possible that the method further comprises S603 and S604.
S601, processor obtain the first flow table and the second flow table.
First flow table includes the first list item, and first list item includes matching domain and jump instruction.First table Second flow table is directed toward in the jump instruction of item, and the quantity for being directed toward the jump instruction of second flow table is equal to 1.The second Table includes the second list item, and second list item includes matching domain.
Optionally, the processor also obtains the 4th flow table.4th flow table includes the 4th list item, the 4th list item Including matching domain.First flow table further includes the 5th list item, and the 5th list item includes matching domain and jump instruction.Described The 4th flow table is directed toward in the jump instruction of five list items, and the quantity for being directed toward the jump instruction of the 4th flow table is equal to 1.
Optionally, the quantity for being directed toward the jump instruction of first flow table is more than 1, or without described in jump instruction direction First flow table.
For example, multiple stream tableau formats such as first flow table, second flow table and described 4th flow table are It is defined by programming language using controller by engineer.For example, the programming language can be the unrelated net of agreement Network forwards high-level programming language (high-level language for programming protocol-independent Packet processors, P4 language).
One kind being achieved in that the processor is the processor in the controller of Fig. 1.By in controller Processor obtains multiple flow tables such as the first flow table, second flow table and described 4th flow table described in S601, and generates Third flow table in S602.The controller is connect with the retransmission unit by communication link.The controller The retransmission unit can be controlled by the communication link.The communication link can be control channel.About control Channel processed can refer to the OpenFlow Switch of open network alliance (Open Networking Foundation) publication Specification 1.3.3。
Another kind is achieved in that the processor is the processor in the retransmission unit of Fig. 1.In Fig. 1 Multiple flow tables such as first flow table, second flow table and the 4th flow table are sent to described turn by controller In transmitting apparatus.The processor of retransmission unit generates the third flow table in S602 according to the multiple flow table of acquisition.
In method as shown in Figure 3, first flow table, second flow table and the 4th flow table can be stored In retransmission unit, to realize the parsing of the message received to retransmission unit.Specifically, each flow table and stem Agreement corresponds to.For example, the first flow table corresponds to IPv4, for being parsed to IPv4 header in message;Second flow table corresponds to TCP, for being parsed to TCP header in message;4th flow table corresponds to UDP, for being carried out to UDP header in message Parsing.Each flow table includes matching domain and domain of instruction.The retransmission unit of the prior art can be by matching domain and from message The special field extracted in the stem of the corresponding agreement of some flow table is matched, and according to the domain of instruction in matching list item to report Text is handled.Specific matched process can refer in embodiment to the specific implementation of S202 in Fig. 3.
It should be noted that jump instruction can be when being directed toward the specific implementation of some flow table, it can according to the jump instruction To access the flow table.For example, the jump instruction includes the storage address of instruction block or the number of instruction block.Described instruction block Storage address or described instruction block the corresponding described instruction block of number include described in some flow table mark.The forwarding Device executes the jump instruction, including executes:The retransmission unit is according to some stream described in being obtained from described instruction block The mark of table obtains some described flow table.Further, the retransmission unit obtains location parameter from described instruction block.Root Search key is obtained from message according to the location parameter.It is searched and the search key in flow table by searching for request Matched list item.
It should be noted that the processor is in addition to obtaining first flow table, second flow table and the described 4th Except flow table, it is also possible to obtain more flow tables.The quantity for being directed toward the jump instruction of second flow table is equal to 1, is finger processor In the multiple flow tables obtained, the jump instruction in the first list item of first flow table is that only one is directed toward the second The jump instruction of table.Optionally, the quantity for being directed toward the jump instruction of the 4th flow table is equal to 1, is the more of finger processor acquisition In a flow table, the jump instruction in the 5th list item of first flow table is that only one is directed toward the 4th flow table Jump instruction.
For example, the format of the matching domain and domain of instruction of each above-mentioned flow table can use programming by engineer Language needs the format of the stem of the message received to define according to the retransmission unit.The programming language can be P4 language。
With reference to Fig. 8, the possible format of stem in the message received is needed to retransmission unit, with the processor Relationship between the flow table of acquisition is illustrated.
As shown in figure 8, in the retransmission unit needs the message received, next head of the stem of first agreement Portion, it may be possible to the stem of the second protocol.A upper stem for the stem of the second protocol is only possible to be first association The stem of view.It is when the retransmission unit needs the value of the special field in the stem of the first agreement described in the message received When the first value, indicate that next stem of the stem of first agreement is the stem of the second protocol.In S601, processor The matching domain of first list item of first flow table obtained, first list item is first value.Similarly, described Two flow tables include at least one list item.At least one list item can be the second list item.Second table item matching domain takes Value is identical as a kind of possible value of the special field in the stem of the second protocol.
Optionally, next stem of the stem of first agreement, it is also possible to the stem of third agreement, and described A upper stem for the stem of three agreements be only possible to be first agreement stem.The stem of the first agreement described in the message In the value of special field when being second value, indicate that next stem of the stem of first agreement is the third agreement Stem.In S601, the 5th list item for first flow table that the processor obtains.The matching domain of 5th list item For the second value.In S601, the 4th flow table of the processor acquisition.4th flow table includes at least one table .At least one list item can be the 4th list item.The value of 4th table item matching domain and the third agreement Stem in a kind of possible value of special field it is identical.
For example, first agreement is IPv4, and the second protocol is TCP, and the third agreement is UDP.Also It is to say, next stem of IPv4 header in the message that the retransmission unit may receive, it may be possible to TCP header, May be UDP header.A upper stem of the TCP header, is only possible to be IPv4 header.The UDP A upper stem of header, is only possible to be IPv4 header.Special field in the stem of first agreement is Protocol field, the first value are 0x06, second value 0x11.That is, the value when the protocol field is When 0x06 (hexadecimal), the agreement of next stem of IPv4 header is TCP in the message that the retransmission unit receives. When the value of the protocol field is 0x11 (hexadecimal), IPv4 in the message that the retransmission unit receives The agreement of next stem of header is UDP.
It should be noted that a upper stem for the stem of the second protocol and the third agreement is only possible to be institute The stem for stating the first agreement is that the format determination of the message received is needed by the retransmission unit.In turn, engineer is according to institute State the stem of second protocol and the third agreement a upper stem be only possible to be first agreement this feelings of stem Condition is defined by programming language convection current tableau format.Upper the one of the stem of the second protocol and the third agreement A stem be only possible to be first agreement stem, it is not intended to the second protocol described in the range of existing communication protocol Or third agreement be only possible to be first agreement stem, do not mean that described in the practical message received of retransmission unit yet A upper stem for the stem of second protocol or the third agreement be only possible to be first agreement stem.For example, working as In the practical message received of retransmission unit, a upper stem for the stem of the second protocol or the third agreement is not When the stem of one agreement, message described in the retransmission unit None- identified, then by the controller of the message up sending to Fig. 1 In, or abandon the message.
Optionally, the quantity for being directed toward the jump instruction of first flow table is more than 1, refer to obtained in the processor it is more In a flow table, there are two or more than two list items in jump instruction, be directed toward first flow table.For example, first association A upper stem for the stem of view is as shown in Figure 8, it may be possible to the stem of M agreements, it is also possible to the stem of N agreements. Further include the head of stem corresponding the M flow tables and the N agreements of the M agreements in the flow table that controller is generated The corresponding N flow tables in portion.The M flow tables and the N flow tables are all the upper level flow tables of first flow table.It is i.e. described The mark of first flow table, it is possible to be obtained by the retransmission unit by executing the jump instruction of matching list item in the M flow tables It arrives, it is also possible to be obtained by the retransmission unit by executing the jump instruction of matching list item in the N flow tables.The processor In acquisition first flow table, second flow table, the M flow tables and the N flow tables are also obtained.Therefore, described In multiple flow tables that processor obtains, the quantity for being directed toward the jump instruction of first flow table is more than 1.
Assuming that first agreement is IPv4, the M agreements are Ethernet agreements, and the N agreements are VLAN associations View.In the message that the i.e. described retransmission unit receives, a upper stem of IPv4 header, you can be Ethernet frame Header can also be VLAN tag.
Optionally, be directed toward first flow table without jump instruction, refer in multiple flow tables that the processor obtains, Jump instruction in the list item of all flow tables is all not pointed towards first flow table.The retransmission unit can be in the following way Access first flow table.Such as the corresponding agreement of first flow table is the agreement of the stem of the message, when the forwarding When device receives the message, the port by bootstrap and for receiving the message obtains first flow table Mark.First flow table described in identification access of the retransmission unit according to first flow table.
S602, the processor generate a third flow table, and the third flow table includes third list item.
The third list item includes matching domain, and the matching domain of the third list item includes the first sub- matching domain and the second son With domain.The first sub- matching domain includes the first sub- Bit String and the first sub- mask.The second sub- matching domain includes the second son Bit String and the second sub- mask.The matching domain of the first sub- Bit String and first list item is equal.The second sub- bit String is equal with the matching domain of the second list item.
Wherein, the described first sub- mask, the second sub- mask, the mask matches algorithm of the first sub- matching domain and The mask matches algorithm of the second sub- matching domain can be realized according to mode 1 or be realized according to mode 2.
Each bit of mode 1, the first sub- mask and the second sub- mask be 1, the first sub- matching domain and The mask matches algorithm of the second sub- matching domain is position and operation.
Each bit of mode 2, the first sub- mask and the second sub- mask be 0, the first sub- matching domain and The mask matches algorithm of the second sub- matching domain is position or operation.
For example, the described first sub- Bit String and the first sub- mask-length are equal.The second sub- Bit String and The second sub- mask-length is equal.
Optionally, when S601 includes that the processor obtains the 4th flow table, first flow table further includes described When five list items, the matching domain of the third list item further includes the sub- matching domain of third, and the sub- matching domain of third includes third Bit String and the sub- mask of third.
Wherein, the mask matches algorithm of the sub- mask of the third and the sub- matching domain of the third can be real according to mode 3 Now or according to mode 4 realize.
Each bit of mode 3, the sub- mask of third is 0, and the mask matches algorithm of the sub- matching domain of third is position With operation.
Each bit of mode 4, the sub- mask of third is 1, and the mask matches algorithm of the sub- matching domain of third is position Or operation.
For example, the sub- Bit String of the third and the sub- mask-length of the third are equal.
The third flow table further includes the 6th list item.6th list item includes matching domain.The matching of 6th list item Domain includes the 4th sub- matching domain, the 5th sub- matching domain and the 6th sub- matching domain.The 4th sub- matching domain includes the 4th sub- bit String and the 4th sub- mask.The 5th sub- matching domain includes the 5th sub- Bit String and the 5th sub- mask.The 6th sub- matching domain Including the 6th sub- Bit String and the 6th sub- mask.The 4th sub- Bit String is equal with the matching domain of the 5th list item.It is described 6th sub- Bit String is equal with the matching domain of the 4th list item.
Wherein, the 4th sub- mask, the 5th sub- mask, the 6th sub- mask, the 4th sub- matching domain Mask matches algorithm, the mask matches algorithm of the 5th sub- matching domain and the mask matches of the 6th sub- matching domain are calculated Method can be realized according to mode 5 or be realized according to mode 6.
Mode 5, each bit of the 4th sub- mask are 1, and each bit of the 5th sub- mask is 0, described the Each bit of six sub- masks is 1, and the 4th sub- matching domain, the 5th sub- matching domain and the 6th sub- matching domain are covered Code matching algorithm is position and operation.
Mode 6, each bit of the 4th sub- mask are 0, and each bit of the 5th sub- mask is 1, described the Each bit of six sub- masks is 0, and the 4th sub- matching domain, the 5th sub- matching domain and the 6th sub- matching domain are covered Code matching algorithm is position or operation.
For example, the 4th sub- Bit String and the 4th sub- mask-length are equal.The 5th sub- Bit String and The 5th sub- mask-length is equal.The 6th sub- Bit String and the 6th sub- mask-length are equal.
The third flow table generated by the above method, can be used for embodiment shown in Fig. 4 and implementation shown in fig. 5 Example.Specifically, the third flow table can be as the first flow table in embodiment shown in Fig. 4 and embodiment shown in fig. 5. Retransmission unit in embodiment shown in Fig. 4 and embodiment shown in fig. 5 can be according to the third flow table to reality shown in Fig. 4 The first message applied in example and embodiment shown in fig. 5 is handled.
For example, the third list item of the third flow table generated in S602 can be used as in embodiment shown in Fig. 4 When handling the first message, the first list item with matched first flow table of first search key.Wherein, S602 gives birth to At the third list item the described first sub- matching domain the described first sub- Bit String and the first sub- mask, can conduct The first of first list item Bit String and the first sub- mask in embodiment shown in Fig. 4;The third list item that S602 is generated Described second sub- Bit String of the second sub- matching domain and the second sub- mask can be used as in embodiment shown in Fig. 4 The the second sub- Bit String and the second sub- mask of first list item.
Optionally, when further including that processor obtains the 4th flow table, the third flow table generated in S602 in S601 First list item, can be used as in embodiment shown in fig. 5 when handling first message, be looked into described first Look for the first list item of the first flow table of keyword match;Second list item of the third flow table generated in S602, can be with When as being handled the second message in embodiment shown in fig. 5, with second search key matched described first Second list item of flow table.Described first sub- Bit String of the described first sub- matching domain of the third list item that S602 is generated and institute The first sub- mask is stated, it can be as the described first sub- Bit String of the first list item described in embodiment shown in fig. 5 and described One sub- mask.The described second sub- Bit String and described second of described second sub- matching domain of the third list item that S602 is generated Sub- mask can be covered as the described second sub- Bit String of the first list item described in embodiment shown in fig. 5 and second son Code.The sub- Bit String of the third and third of the sub- matching domain of the third for the third list item that S602 is generated are covered Code, can be as the sub- Bit String of the third and the sub- mask of the third of the first list item described in embodiment shown in fig. 5. The 4th sub- Bit String and the 4th sub- mask of the 4th sub- matching domain for the 6th list item that S602 is generated, can Using as the 4th sub- Bit String of the second list item described in embodiment shown in fig. 5 and the 4th sub- mask.S602 gives birth to At the 6th list item the 5th sub- matching domain the 5th sub- Bit String and the 5th sub- mask, can conduct 5th sub- Bit String of the 6th list item and the 5th sub- mask described in embodiment shown in fig. 5.S602 generate described the The 6th sub- Bit String and the 6th sub- mask of the 6th sub- matching domain of six list items, can be used as shown in fig. 5 The 6th sub- Bit String and the 6th sub- mask of second list item described in embodiment.
Optionally, can also include S603 in embodiment shown in Fig. 7.S603, the processor obtain first position ginseng Number and second position parameter.The first position parameter is for identifying the first field in the first message that retransmission unit receives Position, first field are the fields in the stem of the first agreement in first message, and first field is used for and institute The matching domain for stating the first list item is matched.The second position parameter is for identifying the second field in first message Position, second field are the fields in the stem of second protocol in first message, and second field is used for and institute The matching domain for stating the second list item is matched, and the stem of second protocol described in first message is institute in first message State next stem of the stem of the first agreement.Optionally, the method can also include S604.S604, the processor root According to the first position parameter and the second position parameter, the third place parameter and the 4th location parameter are generated, described the For three location parameters for identifying position of the third field in the second message that retransmission unit receives, the third field is described Field in the stem of first agreement described in second message, the third field are used for the first son with the third list item It being matched with domain, the 4th location parameter is for identifying position of the 4th field in second message, and the described 4th Field is the field in the stem of second protocol described in second message, and the 4th field is used for and the third list item The second sub- matching domain matched, the stem of second protocol described in second message is described in second message Next stem of the stem of one agreement;The initial position of the third field is away from the first agreement described in second message The offset of the initial position of stem is equal to the initial position of first field away from the first agreement described in first message The offset of the initial position of stem, the initial position of the 4th field is away from the stem of second protocol described in second message Initial position offset equal to second field initial position away from the stem of second protocol described in first message Initial position offset.
Be with the processor hereafter Fig. 1 controller in processor, the retransmission unit be open flows exchange Machine, and illustrated for the scenes that are communicated with the retransmission unit by control channel of the controller.
The controller generates first flow table and second flow table by S601.The controller is logical It crosses the control channel and sends first flow table and second flow table to the retransmission unit.The retransmission unit will be described First flow table and second flow table are stored in the Forwarding plane of the retransmission unit.For example, by first flow table and described Second flow table is stored in the line card of the retransmission unit.After the retransmission unit receives first message, implement according to fig. 3 Method handles first message shown in example.For example, first according to the first field described in the parameter acquiring of first position, when When first field is matched with the matching domain of first list item, according to first list item to first message at It manages and according to the second field described in the second position parameter acquiring.When the matching of second field and second list item When domain matches, first message is handled also according to second list item.
The controller generates the third flow table by S602.The controller passes through the control channel The third flow table is sent to the retransmission unit.The third flow table is stored in the retransmission unit by the retransmission unit Forwarding plane.For example, the third flow table is stored in the line card of the retransmission unit.The third flow table is to described first Flow table and second flow table are updated.Specifically, the third flow table is for replacing first flow table and described the Two flow tables.After the retransmission unit receives second message, according to method shown in Fig. 4 embodiments to second message into Row processing.For example, obtaining the third field and the 4th field according to the third place parameter and the 4th location parameter, work as institute State third field matched with the described first sub- matching domain of the third list item and the 4th field with it is described second son match When domain matches, second message is handled according to the third list item.
It should be noted that the retransmission unit of the retransmission unit and reception second message that receive first message can To be identical retransmission unit, retransmission unit can also be different.Message processing method shown in Fig. 4 is for shown in Fig. 3 Message processing method a kind of improvement.If receiving the retransmission unit of first message and receiving turning for second message Transmitting apparatus is identical retransmission unit, and the time that the retransmission unit receives first message receives earlier than the retransmission unit The time of second message.I.e. described first message is that the retransmission unit connects when using message processing method shown in Fig. 3 The message of receipts.The message that second message receives when being retransmission unit message processing method shown in Fig. 4.
Optionally, each location parameter in the first position parameter and the second position parameter respectively includes partially Shifting and length.Each location parameter in the third place parameter and the 4th location parameter respectively includes substantially partially Shifting, specific offset and length.Basic offset in the third place parameter is zero, specific inclined in the third place parameter Shifting is equal with the offset in the first position parameter, in the length and the first position parameter in the third place parameter Equal length, the basic offset of the 4th location parameter is equal to the length of the stem of the first agreement described in second message It spends, the specific offset in the 4th location parameter is equal with the offset in the second position parameter, the 4th position ginseng Length in number and the equal length in the second position parameter.
For example, the third place parameter can be in embodiment shown in Fig. 4 and embodiment shown in fig. 5 First position parameter.4th location parameter can be second in embodiment shown in Fig. 4 and embodiment shown in fig. 5 Location parameter.
Fig. 9 is a kind of structural schematic diagram of message process device provided in an embodiment of the present invention.
Referring to Fig. 9, message process device 700 includes receiving unit 701, acquiring unit 702, searching unit 703 and processing Unit 704.Message process device 700 can be realized by retransmission unit shown in Fig. 2.Message process device 700 can be used for Execute method shown in Fig. 4.Message process device 700 can be used to implement the retransmission unit in Fig. 4.
Receiving unit 701, for receiving the first message.First message includes the first stem and the second stem, described Second stem is next stem of first stem, and the agreement of first stem is the first agreement, second stem Agreement be second protocol
When specific implementation, receiving unit 701 can be realized by the interface circuit 201 in Fig. 2.Retransmission unit in Fig. 2 After receiving first message by interface circuit 201, the retransmission unit in Fig. 2 can deposit first packet storage In device 205.
For example, receiving unit 701 can be used for executing S301.
Acquiring unit 702, in first message for being received from the receiving unit 701 according to first position parameter First stem obtain the first field, according to second position parameter is received from the receiving unit 701 it is described first report Second stem in text obtains the second field.Whether first field is for identifying first message comprising described the Next stem of one stem and the First when first message includes next stem of first stem The agreement of next stem in portion, whether the second field is used to identify first message next comprising second stem Next stem of second stem described in when stem and first message include next stem of second stem Agreement.
When specific implementation, acquiring unit 702 can be realized by processor in Fig. 2 202.Processor 202 can be from storage Acquisition first field in register 205 and second field.
For example, acquiring unit 702 can be used for executing S302.
Searching unit 703 is looked into for by first search request, searching whether to exist in the first flow table with first The list item of keyword match is looked for, first search key is carried in first search request, described first searches key Word includes first field and second field that the acquiring unit 702 obtains.
When specific implementation, searching unit 703 can be realized by processor in Fig. 2 202.First flow table can store In TCAM203.Search whether exist and described the in first flow table that processor 202 can store in TCAM203 The matched list item of one search key.
For example, searching unit 703 can be used for executing S303.
Processing unit 704, for being found in first flow table according to the searching unit 703 and described first Matched first list item of search key, first message received to the receiving unit 701 are handled.Described first The matching domain of list item includes the first Bit String and the first mask, and first Bit String includes the first sub- Bit String and the second son Bit String, first mask include the first sub- mask and the second sub- mask.Wherein, the described first sub- Bit String and described first Sub- mask is equal to first field and the described first sub- mask into line position and operation as a result, institute into line position and the result of operation It states the second sub- Bit String and is equal to second field and second son into line position and the result of operation with the described second sub- mask Mask is into line position and operation as a result, each bit of the first sub- mask and the second sub- mask is 1.Or described One sub- Bit String is equal to first field and the described first sub- mask with the described first sub- mask into line position or the result of operation Into line position or operation as a result, the second sub- Bit String be equal into line position or the result of operation with the described second sub- mask it is described Second field and the described second sub- mask into line position or operation as a result, the first sub- mask and the second sub- mask it is every One bit is 0.
When specific implementation, processing unit 704 can be realized by processor in Fig. 2 202.
For example, processing unit 704 can be used for executing S304.
Above-mentioned each unit can be by pure hardware realization, can also being implemented in combination with by hardware and software.For example, CPU is by executing the computer program stored in memory, to realize above-mentioned each unit.
Optionally, acquiring unit 702 is additionally operable to, according to the third place parameter from described in the reception of the receiving unit 701 Third field is obtained in first message.First search key further includes the third field, and first Bit String is also Including the sub- Bit String of third, first mask further includes the sub- mask of third.Wherein, the sub- Bit String of the third and the third Sub- mask is equal to the third field into line position and the result of operation to carry out positioned at operation with the sub- mask of the third as a result, institute The each bit for stating the sub- mask of third is 0;Or the sub- Bit String of third and the sub- mask of the third are into line position or operation As a result it is equal to the third field and the sub- mask of the third into line position or operation as a result, each ratio of the sub- mask of third Specially for 1.
Optionally, receiving unit 701 is additionally operable to receive the second message.Second message includes that third stem and the 4th are first Portion, the 4th stem be the third stem next stem, the agreement of the third stem is first agreement, The agreement of 4th stem is third agreement.Acquiring unit 702 is additionally operable to according to the first position parameter from the reception The third stem for second message that unit 701 receives obtains the 4th field.It is connect from described according to the second position parameter It receives and obtains the 5th field in second message that unit 701 receives, according to the third place parameter from the receiving unit 4th stem of 701 second messages received obtains the 6th field.4th field is for identifying second message Whether comprising the third stem next stem and when second message includes next head of the third stem The agreement of next stem of third stem when portion, the 6th field is for identifying whether second message includes institute State next stem of the 4th stem and when second message includes next stem of the 4th stem described in the The agreement of next stem of four stems.
Searching unit 703 is additionally operable to through second search request, search whether to exist in first flow table with The matched list item of second search key carries second search key in second search request, and described second looks into It includes the 4th field, the 5th field and the 6th field that the acquiring unit 702 obtains to look for keyword.
Processing unit 704 be additionally operable to be found in first flow table according to the searching unit 703 with described Matched second list item of two search keies, the second message received to the receiving unit 701 are handled.Second table The matching domain of item includes the second Bit String and the second mask, and second Bit String includes the 4th sub- Bit String, the 5th sub- ratio Spy's string and the 6th sub- Bit String.Second mask includes the 4th sub- mask, the 5th sub- mask and the 6th sub- mask.
Wherein, the 4th sub- Bit String is equal to the 4th word with the 4th sub- mask into line position and the result of operation Section and the 4th sub- mask into line position and operation as a result, the 5th sub- Bit String and the 5th sub- mask into line position and The result of operation is equal to the 5th field and the 5th sub- mask into line position and operation as a result, the 6th sub- Bit String It is equal to the 6th field and the 6th sub- mask into line position and fortune into line position and the result of operation with the 6th sub- mask Calculate as a result, each bit of the 4th sub- mask and the 6th sub- mask be 1, each bit of the 5th sub- mask It is 0.
Alternatively, the 4th sub- Bit String is equal to the 4th word with the 4th sub- mask into line position or the result of operation Section and the 4th sub- mask into line position or operation as a result, the 5th sub- Bit String and the 5th sub- mask into line position or The result of operation is equal to the 5th field and the 5th sub- mask into line position or operation as a result, the 6th sub- Bit String It carries out being equal to the 6th field and the 6th sub- masked bits or fortune into line position or the result of operation with the 6th sub- mask Calculate as a result, each bit of the 4th sub- mask and the 6th sub- mask be 0, each bit of the 5th sub- mask It is 1.
Optionally, the first position parameter includes the first offset and the first length, and first offset is described first The offset of initial position of the initial position of field away from first stem, first length are the length of first field Degree.
Optionally, the second position parameter includes the second offset and the second length, and second offset is described second The offset of initial position of the initial position of field away from first stem, second length are the length of second field Degree.
Further, the first position parameter includes the first basic offset, the first specific offset and the first length, described First basic offset is zero, and the described first specific offset is the initial position of first field away from the starting of first stem The offset of position, first length are the length of first field;
Further, the second position parameter includes the second basic offset, the second specific offset and the second length, described Second length is the length of second field, and the described second basic offset is first stem initial position away from described second The offset of the initial position of stem, the described second specific offset are second field initial position rising away from second stem The offset of beginning position.
The message process device provided in the present embodiment can integrate in retransmission unit 200 shown in Fig. 2, be applied to Fig. 1 Shown in scene, realize the function of wherein retransmission unit.Other additional functions that message process device may be implemented, please refer to To the description of retransmission unit in the embodiment of the method for fig. 4 to fig. 6, repeat no more herein.
Figure 10 is a kind of structural schematic diagram of flow table generating means provided in an embodiment of the present invention.
Referring to Figure 10, flow table generating means 800 include first acquisition unit 801 and first processing units 802.Flow table generates Device 800 can be used for executing method shown in Fig. 7.Flow table generating means 800 can be used to implement the processor in Fig. 7.
First acquisition unit 801 is for obtaining the first flow table and the second flow table.First flow table includes the first list item, institute It includes matching domain and jump instruction to state the first list item.Second flow table is directed toward in the jump instruction of first list item, is directed toward institute The quantity for stating the jump instruction of the second flow table is equal to 1.Second flow table includes the second list item, and second list item includes matching Domain.
For example, first acquisition unit 801 can be used for executing S601.
First flow table and the second that first generation unit 802 is used to be obtained according to first acquisition unit 801 Table generates third flow table.The third flow table includes third list item.
The third list item includes matching domain, and the matching domain of the third list item includes the first sub- matching domain and the second son With domain.The first sub- matching domain includes the first sub- Bit String and the first sub- mask, and the second sub- matching domain includes the second son Bit String and the second sub- mask.The matching domain of the first sub- Bit String and first list item is equal, the second sub- bit String is equal with the matching domain of the second list item.Each bit of the wherein described first sub- mask and the second sub- mask is 1, The mask matches algorithm of the first sub- matching domain and the second sub- matching domain is position and operation;Or the first sub- mask Each bit with the described second sub- mask is 0, and the mask matches of the first sub- matching domain and the second sub- matching domain are calculated Method is position or operation.
For example, the first generation unit 802 can be used for executing S602.
Above-mentioned each unit can be by pure hardware realization, can also being implemented in combination with by hardware and software.For example, CPU is by executing the computer program stored in memory, to realize above-mentioned each unit.
Optionally, the first acquisition unit 801 is additionally operable to obtain the 4th flow table.4th flow table includes the 4th table , the 4th list item includes matching domain.First flow table further includes the 5th list item, the 5th list item include matching domain and The 4th flow table is directed toward in the jump instruction of jump instruction, the 5th list item, is directed toward the jump instruction of the 4th flow table Quantity is equal to 1.
The matching domain of the third list item further includes the sub- matching domain of third, and the sub- matching domain of third includes the sub- bit of third String and the sub- mask of third, wherein each bit of the sub- mask of third is 0, and the mask matches of the sub- matching domain of third are calculated Method is position and operation;Or each bit of the sub- mask of third is 1, the mask matches algorithm of the sub- matching domain of third is Position and operation.
The third flow table further includes the 6th list item, and the 6th list item includes matching domain.The matching of 6th list item Domain includes the 4th sub- matching domain, the 5th sub- matching domain and the 6th sub- matching domain, and the 4th sub- matching domain includes the 4th sub- bit String and the 4th sub- mask, the 5th sub- matching domain include the 5th sub- Bit String and the 5th sub- mask, the 6th sub- matching domain Including the 6th sub- Bit String and the 6th sub- mask, the 4th sub- Bit String is equal with the matching domain of the 5th list item, described 6th sub- Bit String is equal with the matching domain of the 4th list item.Wherein, each bit of the 4th sub- mask is 1, described Each bit of 5th sub- mask is 0, and each bit of the 6th sub- mask is 1, the 4th sub- matching domain, the described 5th The mask matches algorithm of sub- matching domain and the 6th sub- matching domain is position and operation;Or each ratio of the 4th sub- mask Specially for 0, each bit of the 5th sub- mask is 1, and each bit of the 6th sub- mask is 0, the 4th son matching The mask matches algorithm of domain, the 5th sub- matching domain and the 6th sub- matching domain is position or operation.
Optionally, flow table generating means 800 further include second acquisition unit 803 and the second generation unit 804.
Second acquisition unit 803 is for obtaining first position parameter and second position parameter.The first position parameter is used In identifying position of first field in the first message that retransmission unit receives, first field is the in first message Field in the stem of one agreement, first field with the matching domain of first list item for being matched.Described second For location parameter for identifying position of second field in first message, second field is the in first message Field in the stem of two agreements, second field with the matching domain of second list item for being matched, and described first The stem of second protocol described in message is next stem of the stem of the first agreement described in first message.
For example, second acquisition unit 803 can be used for executing S603.
The first position parameter that second generation unit 804 is used to be obtained according to second acquisition unit 803 and described the Two location parameters generate the third place parameter and the 4th location parameter.
The third place parameter is described for identifying position of the third field in the second message that retransmission unit receives Third field is the field in the stem of the first agreement described in second message, and the third field is used for and the third First sub- matching domain of list item is matched, and the 4th location parameter is for identifying the 4th field in second message Position, the 4th field are the fields in the stem of second protocol described in second message, and the 4th field is used for It is matched with the second sub- matching domain of the third list item, the stem of second protocol described in second message is described Next stem of the stem of first agreement described in two messages.The initial position of the third field is away from second message The offset of the initial position of the stem of first agreement is equal to the initial position of first field away from first message The offset of the initial position of the stem of first agreement, the initial position of the 4th field is away from described in second message The offset of the initial position of the stem of second protocol is equal to the initial position of second field away from described in first message The offset of the initial position of the stem of second protocol.
For example, the second generation unit 804 can be used for executing S604.Optionally, the first position parameter and institute It states each location parameter in the parameter of the second position and respectively includes offset and length, the third place parameter and the described 4th Each location parameter in location parameter respectively includes offset substantially, specific offset and length.In the third place parameter It is basic offset be zero, specific offset, the institute equal with the offset in the first position parameter in the third place parameter State length in the third place parameter and the equal length in the first position parameter, the 4th location parameter substantially partially The length for being equal to the stem of the first agreement described in second message is moved, the specific offset in the 4th location parameter and institute The offset stated in the parameter of the second position is equal, the length in the 4th location parameter and the length in the second position parameter It is equal.
Optionally, the quantity for being directed toward the jump instruction of first flow table is more than 1, or without described in jump instruction direction First flow table.
The flow table generating means provided in the present embodiment can be integrated in retransmission unit 200 shown in Fig. 2, be applied to In attached scene shown in FIG. 1.Other additional functions that flow table generating means may be implemented, please refer in embodiment shown in Fig. 7 Description to processor, repeats no more herein.
The message process device and flow table generating means that above-described embodiment provides, only being partitioned into above-mentioned each function module Row can be completed as needed and by above-mentioned function distribution by different function modules for example, in practical application, i.e., will be set Standby internal structure is divided into different function modules, to complete all or part of the functions described above.
Each embodiment in this specification is described in a progressive manner, identical similar portion between each embodiment Point just to refer each other, and each embodiment focuses on the differences from other embodiments.
Processor for executing the above-mentioned message process device of the present invention and flow table generating means function can be CPU, lead to With processor, DSP, ASIC, FPGA either other programmable logic device, transistor logic hardware component or its Meaning combination.It may be implemented or execute in conjunction with various illustrative logic blocks described in the disclosure of invention, module and Circuit.The processor can also be to realize the combination of computing function, such as combined comprising one or more microprocessors, DSP With the combination of microprocessor etc..
The step of method in conjunction with described in the disclosure of invention or algorithm, can be realized in a manner of hardware, also may be used It is realized in a manner of being to execute software instruction by processor.Software instruction can be made of corresponding software module, software mould Block can be stored on random access memory (random access memory, RAM), flash memory, read-only memory (read Only memory, ROM), Erasable Programmable Read Only Memory EPROM (erasable programmable read only Memory, EPROM), Electrically Erasable Programmable Read-Only Memory (electrically erasable programmable read- Only memory, EEPROM), register, hard disk, mobile hard disk, CD-ROM or any other form well known in the art In storage medium.A kind of illustrative storage medium is coupled to processor, to enable a processor to read from the storage medium Information, and information can be written to the storage medium.Certainly, storage medium can also be the component part of processor.Processor and Storage medium can be located in ASIC.In addition, the ASIC can be located in user equipment.Certainly, pocessor and storage media It can be present in user equipment as discrete assembly.
Those skilled in the art are it will be appreciated that in said one or multiple examples, work(described in the invention It can be realized with hardware, software, firmware or their arbitrary combination.It when implemented in software, can be by these functions Storage in computer-readable medium or as on computer-readable medium one or more instructions or code be transmitted. Computer-readable medium includes computer storage media and communication media, and wherein communication media includes convenient for from a place to another Any medium of one place transmission computer program.It is any that storage medium can be that general or specialized computer can access Usable medium.
Above-described specific implementation mode has carried out further the purpose of the present invention, technical solution and advantageous effect It is described in detail, it should be understood that the foregoing is merely the specific implementation mode of the present invention, is not intended to limit the present invention Protection domain.

Claims (10)

1. a kind of message processing method, which is characterized in that including:
Retransmission unit receives the first message, and first message includes the first stem and the second stem, and second stem is institute Next stem of the first stem is stated, the agreement of first stem is the first agreement, and the agreement of second stem is second Agreement;
The retransmission unit according to first position parameter from first stem obtain the first field, according to second position parameter from Second stem obtains the second field, and first field is for identifying whether first message includes first stem Next stem and when first message includes next stem of first stem described under the first stem The agreement of one stem, second field is for identifying the next head whether first message includes second stem Portion and when first message includes next stem of second stem described in the second stem next stem Agreement;
The retransmission unit searches whether exist and the first search key by first search request in the first flow table Matched list item, first search request carry first search key, and first search key includes described First field and second field;And
The retransmission unit determine in first flow table exist with after matched first list item of first search key, root First message is handled according to first list item, the matching domain of first list item includes the first Bit String and the One mask, first Bit String include the first sub- Bit String and the second sub- Bit String, and first mask is covered including the first son Code and the second sub- mask;Wherein
The first sub- Bit String and the described first sub- mask into line position and the result of operation be equal to first field with it is described First sub- mask into line position and operation as a result, the second sub- Bit String and the described second sub- mask into the knot of line position and operation Fruit is equal to second field and the described second sub- mask into line position and operation as a result, the first sub- mask and described second Each bit of sub- mask is 1;Or
The first sub- Bit String and the described first sub- mask into line position or the result of operation be equal to first field with it is described First sub- mask into line position or operation as a result, the second sub- Bit String and the described second sub- mask into line position or the knot of operation Fruit is equal to second field and the described second sub- mask into line position or operation as a result, the first sub- mask and described second Each bit of sub- mask is 0.
2. according to the method described in claim 1, it is characterized in that, after the retransmission unit receives first message, with And the retransmission unit is searched whether to exist and be searched with described first by first search request in first flow table Before the list item of keyword match, the method further includes:
The retransmission unit obtains third field according to the third place parameter from first message, and described first searches key Word further includes the third field, and first Bit String further includes the sub- Bit String of third, and first mask further includes third Sub- mask;Wherein
The sub- Bit String of third and the sub- mask of the third into line position and the result of operation be equal to the third field with it is described The sub- mask of third is into line position and operation as a result, each bit of the sub- mask of third is 0;Or
The sub- Bit String of third and the sub- mask of the third into line position or the result of operation be equal to the third field with it is described The sub- mask of third is into line position or operation as a result, each bit of the sub- mask of third is 1.
3. according to the method described in claim 2, it is characterized in that, the method further includes:
The retransmission unit receives the second message, and second message includes third stem and the 4th stem, the 4th stem It is next stem of the third stem, the agreement of the third stem is first agreement, the association of the 4th stem View is third agreement;
The retransmission unit obtains the 4th field according to the first position parameter from the third stem, according to the second It sets parameter and obtains the 5th field from second message, the 6th is obtained from the 4th stem according to the third place parameter Field, the 4th field are used to identify whether second message to include next stem of the third stem and work as institute State the agreement of next stem of third stem when the second message includes next stem of the third stem, described the Six fields be used for identify second message whether comprising the 4th stem next stem and work as second message Include the agreement of next stem of the 4th stem described in when next stem of the 4th stem;
The retransmission unit is searched whether to exist to search with second in first flow table and be closed by second search request The matched list item of key word carries second search key, the second search key packet in second search request Include the 4th field, the 5th field and the 6th field;And
The retransmission unit determine in first flow table exist with after matched second list item of second search key, root Second message is handled according to second list item, the matching domain of second list item includes the second Bit String and the Two masks, second Bit String include the 4th sub- Bit String, the 5th sub- Bit String and the 6th sub- Bit String, and described second covers Code includes the 4th sub- mask, the 5th sub- mask and the 6th sub- mask;Wherein
The 4th sub- Bit String and the 4th sub- mask into line position and the result of operation be equal to the 4th field with it is described 4th sub- mask into line position and operation as a result, the 5th sub- Bit String and the 5th sub- mask into the knot of line position and operation Fruit is equal to the 5th field and the 5th sub- mask into line position and operation as a result, the 6th sub- Bit String and described the Six sub- masks into line position and the result of operation be equal to the 6th field and the 6th sub- mask into line position and operation as a result, Each bit of the 4th sub- mask and the 6th sub- mask is 1, and each bit of the 5th sub- mask is 0;Or
The 4th sub- Bit String and the 4th sub- mask into line position or the result of operation be equal to the 4th field with it is described 4th sub- mask into line position or operation as a result, the 5th sub- Bit String and the 5th sub- mask into line position or the knot of operation Fruit is equal to the 5th field and the 5th sub- mask into line position or operation as a result, the 6th sub- Bit String and described the Six sub- masks into line position or the result of operation be equal to the 6th field and the 6th sub- mask into line position or operation as a result, Each bit of the 4th sub- mask and the 6th sub- mask is 0, and each bit of the 5th sub- mask is 1.
4. according to any method in claims 1 to 3, it is characterised in that:
The first position parameter includes the first offset and the first length, and first offset is the start bit of first field The offset of the initial position away from first stem is set, first length is the length of first field;
The second position parameter includes the second offset and the second length, and second offset is the start bit of second field The offset of the initial position away from first stem is set, second length is the length of second field.
5. according to any method in claims 1 to 3, it is characterised in that:
The first position parameter includes the first basic offset, the first specific offset and the first length, the described first basic offset It is zero, the described first specific offset is the initial position of first field away from the offset of the initial position of first stem, First length is the length of first field;
The second position parameter includes that the second basic offset, the second specific offset and the second length, second length are institute The length of the second field is stated, the described second basic offset is start bit of first stem initial position away from second stem The offset set, the described second specific offset is the inclined of initial position of second field initial position away from second stem It moves.
6. a kind of device of Message processing, which is characterized in that including receiving unit, acquiring unit, searching unit and processing unit:
The receiving unit, for receive the first message, first message include the first stem and the second stem, described second Stem is next stem of first stem, and the agreement of first stem is the first agreement, the association of second stem View is second protocol;
The acquiring unit, described for first message that is received from the receiving unit according to first position parameter One stem the first field of acquisition, described the second of first message received from the receiving unit according to second position parameter Stem obtains the second field, and whether first field is used to identify first message next comprising first stem Stem and when first message include first stem next stem when described in the first stem next stem Agreement, the second field be used to identify first message whether next stem comprising second stem and described the The agreement of next stem of second stem described in when one message includes next stem of second stem;
The searching unit is searched for by first search request, searching whether to exist in the first flow table with first The list item of keyword match, first search request carry first search key, the first search key packet Include first field and second field that the acquiring unit obtains;
The processing unit is closed for being found to search with described first in first flow table according to the searching unit Matched first list item of key word, first message received to the receiving unit are handled, of first list item Include the first Bit String and the first mask with domain, first Bit String includes the first sub- Bit String and the second sub- Bit String, First mask includes the first sub- mask and the second sub- mask, wherein
The first sub- Bit String and the described first sub- mask into line position and the result of operation be equal to first field with it is described First sub- mask into line position and operation as a result, the second sub- Bit String and the described second sub- mask into the knot of line position and operation Fruit is equal to second field and the described second sub- mask into line position and operation as a result, the first sub- mask and described second Each bit of sub- mask is 1;Or
The first sub- Bit String and the described first sub- mask into line position or the result of operation be equal to first field with it is described First sub- mask into line position or operation as a result, the second sub- Bit String and the described second sub- mask into line position or the knot of operation Fruit is equal to second field and the described second sub- mask into line position or operation as a result, the first sub- mask and described second Each bit of sub- mask is 0.
7. device according to claim 6, which is characterized in that the acquiring unit is additionally operable to, according to the third place parameter Third field is obtained from first message, first search key further includes the third field, first ratio Spy's string further includes the sub- Bit String of third, and first mask further includes the sub- mask of third, wherein
The sub- Bit String of third and the sub- mask of the third into line position and the result of operation be equal to the third field with it is described The sub- mask of third is into line position and operation as a result, each bit of the sub- mask of third is 0;Or
The sub- Bit String of third and the sub- mask of the third into line position or the result of operation be equal to the third field with it is described The sub- mask of third is into line position or operation as a result, each bit of the sub- mask of third is 1.
8. device according to claim 7, which is characterized in that the receiving unit is additionally operable to, and receives the second message, described Second message includes third stem and the 4th stem, and the 4th stem is next stem of the third stem, and described The agreement of three stems is first agreement, and the agreement of the 4th stem is third agreement;
The acquiring unit is additionally operable to, and the is obtained from the third stem of second message according to the first position parameter Four fields obtain the 5th field, root in second message received from the receiving unit according to the second position parameter The 4th stem of second message received from the receiving unit according to the third place parameter obtains the 6th field, 4th field be used to identify second message whether next stem comprising the third stem and when described the The agreement of two messages next stem of third stem when including next stem of the third stem, the 6th word Section for identify second message whether comprising the 4th stem next stem and when second message includes The agreement of next stem of 4th stem described in when next stem of the 4th stem;
The searching unit is additionally operable to, and by second search request, searches whether exist and the in first flow table The matched list item of two search keies carries second search key in second search request, and described second searches Keyword includes the 4th field, the 5th field and the 6th field that the acquiring unit obtains;
The processing unit is additionally operable to, and what is found in first flow table according to the searching unit searches with described second Second list item of keyword match, second message received to the receiving unit are handled, second list item Matching domain includes the second Bit String and the second mask, and second Bit String includes the 4th sub- Bit String, the 5th sub- Bit String And the 6th sub- Bit String, second mask include the 4th sub- mask, the 5th sub- mask and the 6th sub- mask, wherein
The 4th sub- Bit String and the 4th sub- mask into line position and the result of operation be equal to the 4th field with it is described 4th sub- mask into line position and operation as a result, the 5th sub- Bit String and the 5th sub- mask into the knot of line position and operation Fruit is equal to the 5th field and the 5th sub- mask into line position and operation as a result, the 6th sub- Bit String and described the Six sub- masks into line position and the result of operation be equal to the 6th field and the 6th sub- mask into line position and operation as a result, Each bit of the 4th sub- mask and the 6th sub- mask is 1, and each bit of the 5th sub- mask is 0;Or
The 4th sub- Bit String and the 4th sub- mask into line position or the result of operation be equal to the 4th field with it is described 4th sub- mask into line position or operation as a result, the 5th sub- Bit String and the 5th sub- mask into line position or the knot of operation Fruit is equal to the 5th field and the 5th sub- mask into line position or operation as a result, the 6th sub- Bit String and described the Six sub- masks into line position or the result of operation be equal to the 6th field and the 6th sub- mask into line position or operation as a result, Each bit of the 4th sub- mask and the 6th sub- mask is 0, and each bit of the 5th sub- mask is 1.
9. according to any device in claim 6 to 8, it is characterised in that:
The first position parameter includes the first offset and the first length, and first offset is the start bit of first field The offset of the initial position away from first stem is set, first length is the length of first field;
The second position parameter includes the second offset and the second length, and second offset is the start bit of second field The offset of the initial position away from first stem is set, second length is the length of second field.
10. according to any device in claim 6 to 8, it is characterised in that:
The first position parameter includes the first basic offset, the first specific offset and the first length, the described first basic offset It is zero, the described first specific offset is the initial position of first field away from the offset of the initial position of first stem, First length is the length of first field;
The second position parameter includes that the second basic offset, the second specific offset and the second length, second length are institute The length of the second field is stated, the described second basic offset is start bit of first stem initial position away from second stem The offset set, the described second specific offset is the inclined of initial position of second field initial position away from second stem It moves.
CN201510868876.2A 2015-12-01 2015-12-01 Message processing method and device Active CN105515995B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510868876.2A CN105515995B (en) 2015-12-01 2015-12-01 Message processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510868876.2A CN105515995B (en) 2015-12-01 2015-12-01 Message processing method and device

Publications (2)

Publication Number Publication Date
CN105515995A CN105515995A (en) 2016-04-20
CN105515995B true CN105515995B (en) 2018-09-21

Family

ID=55723648

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510868876.2A Active CN105515995B (en) 2015-12-01 2015-12-01 Message processing method and device

Country Status (1)

Country Link
CN (1) CN105515995B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108055202B (en) * 2017-12-07 2020-11-20 锐捷网络股份有限公司 Message processing equipment and method
TWI681656B (en) * 2018-07-06 2020-01-01 財團法人工業技術研究院 Software-defined radio system for package detection and package detection method
CN111222017A (en) * 2018-11-23 2020-06-02 恒为科技(上海)股份有限公司 System for realizing floating character string matching by using TCAM (ternary content addressable memory)
CN110311835B (en) * 2019-07-09 2021-05-14 国网甘肃省电力公司电力科学研究院 Electric power IEC protocol conformance verification method based on content template

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102946325A (en) * 2012-11-14 2013-02-27 中兴通讯股份有限公司 Network diagnosis method, system and equipment based on software defined network
US8949467B1 (en) * 2013-11-23 2015-02-03 William A Flanagan Systems and methods of header compression in a software defined network
CN104348716A (en) * 2013-07-23 2015-02-11 杭州华三通信技术有限公司 Message processing method and equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20150053620A (en) * 2013-11-08 2015-05-18 한국전자통신연구원 Apparatus and method for transmitting packet

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102946325A (en) * 2012-11-14 2013-02-27 中兴通讯股份有限公司 Network diagnosis method, system and equipment based on software defined network
CN104348716A (en) * 2013-07-23 2015-02-11 杭州华三通信技术有限公司 Message processing method and equipment
US8949467B1 (en) * 2013-11-23 2015-02-03 William A Flanagan Systems and methods of header compression in a software defined network

Also Published As

Publication number Publication date
CN105515995A (en) 2016-04-20

Similar Documents

Publication Publication Date Title
US10880214B2 (en) Service routing packet processing method and apparatus, and network system
US7680943B2 (en) Methods and apparatus for implementing multiple types of network tunneling in a uniform manner
EP3113426B1 (en) Data packet processing method and device
US8521905B2 (en) System for flexible and extensible flow processing in software-defined networks
CN101247308B (en) Tunnel packet processing method for implementing IPv6 traversing IPv4 based on network processor
EP2795874B1 (en) Controller for flexible and extensible flow processing in software-defined networks
EP2795873B1 (en) Forwarding element for flexible and extensible flow processing in software-defined networks
CN104380667B (en) The method for routing and equipment of a kind of data message
CN101087296B (en) Method for utilizing network processor to translate the IPv4/IPv6 network protocol
CN105024985B (en) A kind of message processing method and device
JP5880570B2 (en) Mapping server device, network system, packet transfer method and program
CN104579954B (en) The cross-domain retransmission method of message, device and communication equipment
CN104270475B (en) The system and method for IPv4 networks and IPv6 network interworkings is realized based on NAT64
CN105515995B (en) Message processing method and device
CN102938795B (en) The method of IPv6 address access IPv4 resource is realized by tunnel and address transition
EP1858205A1 (en) Tunneling device, tunnel frame sorting method used for the device, and its program
WO2008094730A2 (en) Optimized mobile-ipv6 encapsulation for wireless networks
RU2007109068A (en) WAYS AND DEVICES FOR SUPPORTING VPN WITH MOBILITY MANAGEMENT
Iannone et al. Implementing the locator/id separation protocol: Design and experience
FI119166B (en) Procedure and apparatus for making a routing decision depending on the service quality class
CN113271255A (en) Method and device for converting network address to loopback
CN1741502B (en) IPv6 and IPv4 internetwork mutual communicating method based on 4over6
CN109246016B (en) Cross-VXLAN message processing method and device
CN110022263B (en) Data transmission method and related device
JP2016523062A (en) Method and apparatus for generating input parameters

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20211224

Address after: 450046 Floor 9, building 1, Zhengshang Boya Plaza, Longzihu wisdom Island, Zhengdong New Area, Zhengzhou City, Henan Province

Patentee after: Super fusion Digital Technology Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd.

TR01 Transfer of patent right