WO2015010512A1 - Gre报文的封装方法、解封装方法及对应的装置 - Google Patents

Gre报文的封装方法、解封装方法及对应的装置 Download PDF

Info

Publication number
WO2015010512A1
WO2015010512A1 PCT/CN2014/080535 CN2014080535W WO2015010512A1 WO 2015010512 A1 WO2015010512 A1 WO 2015010512A1 CN 2014080535 W CN2014080535 W CN 2014080535W WO 2015010512 A1 WO2015010512 A1 WO 2015010512A1
Authority
WO
WIPO (PCT)
Prior art keywords
gre
header
bit
message
zero
Prior art date
Application number
PCT/CN2014/080535
Other languages
English (en)
French (fr)
Inventor
黎英
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Priority to US14/905,894 priority Critical patent/US10033842B2/en
Priority to EP14829826.8A priority patent/EP3026856B1/en
Publication of WO2015010512A1 publication Critical patent/WO2015010512A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/30Definitions, standards or architectural aspects of layered protocol stacks
    • H04L69/32Architecture of open systems interconnection [OSI] 7-layer type protocol stacks, e.g. the interfaces between the data link level and the physical level
    • H04L69/322Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions
    • H04L69/324Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions in the data link layer [OSI layer 2], e.g. HDLC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • H04L12/4633Interconnection of networks using encapsulation techniques, e.g. tunneling

Definitions

  • the present invention relates to the field of network technologies, and in particular, to a GRE packet encapsulation method, a decapsulation method, and a corresponding device. Background technique
  • GRE Generic Routing Encapsulation Protocol
  • Cisco and Net Smiths in 1994 under the numbers RFC 1701 and RFC 1702.
  • GRE V2 GRE V2
  • RFC 2784 RFC 1701 is not currently the main standard to follow, there are still devices using RFC 1701 in the current network.
  • the GRE tunnel encapsulates the original message and the GRE header into a GRE message, then "packages” it through the protocol message, and transmits it in the "data area" of the IP packet.
  • the receiver decapsulates the GRE packet according to the format of the GRE packet header, and restores the original packet.
  • the GRE packet header is parsed, the length of the entire GRE packet header is identified because there is no explicit field in the GRE header. If the sender of the packet uses the routing device of RFC2784, the length of the GRE packet header may be 32 to 64 bits. If the receiver of the packet uses the routing device of RFC1701, the length of the GRE packet header may be 32 to 160. Bits.
  • the main purpose of the present invention is to provide a GRE packet encapsulation method, a decapsulation method, and a corresponding device, which are designed to solve the problem that the router cannot be interconnected due to the inconsistency of the GRE header format.
  • a method for encapsulating a GRE packet includes: when performing GRE packet encapsulation on the original packet, performing attribute setting on a predetermined bit of the GRE packet header according to a preset encapsulation rule; The GRE packet header and the original packet are encapsulated in a GRE packet.
  • the predetermined bit includes a first bit to a sixteenth bit of the GRE header
  • the preset encapsulation rule includes: zero or one of the first bit of the GRE header Filling the second bit of the GRE header with zero; filling the third bit of the GRE header with zero or one; filling the fourth bit of the GRE header with zero or one; placing the GRE header
  • the fifth to thirteenth bits are filled with zeros; the fourteenth to sixteenth bits of the GRE header are filled with zeros.
  • a method for decapsulating a GRE message comprising: decapsulating a predetermined bit of a header of a received GRE message according to a preset decapsulation rule when receiving a GRE message According to the analysis result, the received GRE message is decapsulated to unblock the original message in the received GRE message.
  • the predetermined bit includes a first bit to a sixteenth bit of the GRE header
  • the preset decapsulation rule includes: when the first bit of the GRE header is zero Decapsulation is performed directly; when the first bit of the GRE header is one, the checksum is checked, the decapsulation is performed directly when passing the checksum check, and the GRE is discarded when the checksum check is not passed.
  • the step of decapsulating the received GRE packet according to the parsing result to de-encapsulate the original packet in the received GRE packet further includes: in the header of the received GRE packet When the predetermined bit is decapsulated and parsed, the offset corresponding to the predetermined bit is obtained; and the length of the GRE header is calculated according to the offset.
  • a device for encapsulating a GRE packet comprising: a setting module, configured to perform attribute setting on a predetermined bit of the GRE header according to a preset encapsulation rule when performing GRE encapsulation on the original packet; The module is configured to perform GRE packet encapsulation on the GRE packet header and the original packet after the attribute is set.
  • the predetermined bit includes a first bit to a sixteenth bit of the GRE header
  • the preset encapsulation rule includes: zero or one of the first bit of the GRE header Filling the second bit of the GRE header with zero; filling the third bit of the GRE header with zero or one; filling the fourth bit of the GRE header with zero or one; placing the GRE header
  • the fifth to thirteenth bits are filled with zeros; the fourteenth to sixteenth bits of the GRE header are filled with zeros.
  • a de-encapsulation device for a GRE message comprising: a parsing module, configured to: when receiving a GRE message, perform a solution on a predetermined bit of a header of the received GRE message according to a preset decapsulation rule
  • the encapsulation module is configured to decapsulate the received GRE message according to the parsing result to decapsulate the original message in the received GRE message.
  • the predetermined bit includes a first bit to a sixteenth bit of the GRE header
  • the preset decapsulation rule includes: when the first bit of the GRE header is zero Decapsulation is performed directly; when the first bit of the GRE header is one, the checksum is checked, the decapsulation is performed directly when passing the checksum check, and the GRE is discarded when the checksum check is not passed.
  • the parsing module further includes: an obtaining unit, configured to: obtain an offset corresponding to the predetermined bit when performing decapsulation parsing on the predetermined bit of the header of the received GRE packet;
  • the calculating unit is configured to calculate a length of the GRE packet header according to the offset.
  • a computer storage medium having stored therein computer executable instructions for performing the methods described above.
  • the GRE packet headers of different protocols are set and encapsulated by using a preset encapsulation rule, and the headers of the received GRE packets are decapsulated and parsed by using a preset corresponding decapsulation rule.
  • the original packet in the received GRE packet is decapsulated, ensuring interconnection and interworking between network devices that comply with different protocols.
  • FIG. 1 is a schematic flow chart of an embodiment of a method for packaging a GRE file according to the present invention
  • FIG. 2 is a schematic flowchart of a first embodiment of a method for decapsulating a GRE packet according to the present invention
  • FIG. 3 is a schematic flowchart of a second embodiment of a method for decapsulating a GRE packet according to the present invention
  • FIG. 5 is a schematic structural diagram of a first embodiment of a decapsulation apparatus for a GRE message according to the present invention
  • FIG. 6 is a schematic structural diagram of an embodiment of a parsing module in a decapsulation apparatus for a GRE message according to the present invention.
  • FIG. 1 it is a schematic flowchart of an embodiment of a method for encapsulating a GRE message according to the present invention. It should be emphasized that the flowchart shown in FIG. 1 is only a preferred embodiment, and those skilled in the art will recognize that any embodiment constructed around the inventive concept should not be excluded from the scope of the following technical solutions:
  • the predetermined bit of the GRE header is set according to a preset encapsulation rule; the GRE header after the attribute is set and the original obsolation GRE encapsulation is performed.
  • the following is a process of setting and encapsulating the attributes of the GRE headers that comply with different protocols in combination with the present embodiment.
  • the GRE packets are implemented in the RFC2784 protocol and the RFC2890 protocol.
  • the package is an example).
  • Step S10 When performing GRE packet encapsulation on the original packet, perform attribute setting on the first to sixteenth bits of the GRE packet header according to a preset encapsulation rule;
  • the original packet refers to a data packet that needs to be encapsulated and routed.
  • the first to the sixteenth bits of the GRE header are performed according to a preset encapsulation rule.
  • the GRE tunnel adheres to the corresponding encapsulation protocol as a standard for encapsulation when encapsulating GRE messages. For example, common protocols such as RFC2784, RFC2890, and RFC1701.
  • the first bit of the GRE header is set to the (Checksum Insurance and) attribute, and the attribute value of the attribute can be selected by the user to fill in zero or one according to his own needs. If the checksum is invalid, there is no need to check the checksum during decapsulation; When the checksum is selected to be valid, the checksum check is required at the time of decapsulation. In the will
  • the attribute value is set to zero.
  • the third bit of the GRE packet header is set to the (Key Present Key) attribute according to the RFC2890 protocol, and the attribute value of the attribute can be selectively set by the user.
  • the attribute value of the attribute is zero-filled, the key is invalid, that is, no key authentication is required when decapsulating; when the attribute value is selected, the key is valid, and the key authentication is required when decapsulating, only through GRE packets can be decapsulated after keyword authentication.
  • the fourth bit of the GRE header is set to the (Sequence Number Present) attribute
  • the attribute value of the attribute can also be optionally set to zero or one.
  • the attribute value of the fourth bit attribute is one, the GRE message sequence number is checked during decapsulation. The GRE message can be decapsulated only after the sequence number is checked; the attribute of the fourth bit attribute When the value is zero, it is not necessary to check the GRE serial number when decapsulating.
  • the fifth to thirteenth bits of the GRE header are set to the (ReservedO Reserved) attribute according to the RFC2784 protocol, and the attribute value is set to zero.
  • the first to the sixteenth bit of the GRE packet header are set according to the preset encapsulation rule, and the GRE packet header after the attribute is set is used as the encapsulation format of the GRE packet.
  • GRE packet encapsulation is performed with the original packet.
  • FIG. 2 it is a schematic flowchart of a first embodiment of a method for decapsulating a GRE message according to the present invention. It should be emphasized that the flowchart shown in FIG. 2 is only a preferred embodiment, and those skilled in the art will recognize that any embodiment constructed around the inventive concept should not be deviated from the scope of the following technical solutions:
  • the pre-determined bit of the received packet header of the GRE packet is decapsulated and parsed according to the preset decapsulation rule; and the received GRE packet is decapsulated according to the parsing result, to Unpack the original text in the received GRE header.
  • the following is a process of decapsulating and parsing the header of the received GRE message by using the preset corresponding decapsulation rule in combination with the preset decapsulation rule to unblock the original message in the received GRE message.
  • Step S110 when receiving the GRE message, according to the preset decapsulation rule, the received
  • Predetermined bits of the header of the GRE message are decapsulated and parsed;
  • the GRE packet includes: a raw data packet and a GRE packet header.
  • the first to sixteenth bits of the header of the received GRE message are decapsulated and parsed according to the preset decapsulation rule during parsing.
  • the first bit of the GRE header is used as
  • (Checksum checksum) attribute when the attribute value of the attribute is zero, direct decapsulation; when the attribute value of the attribute is one, the checksum is calculated for the received GRE message, and the calculated school is calculated Checking and checking the checksum with the original checksum in the GRE message, if the calculated checksum is completely consistent with the original checksum in the GRE message, it indicates that the checksum is verified. The check of the GRE packet is decapsulated. If the calculated checksum is inconsistent with the original checksum in the GRE packet, it indicates that the checksum does not pass the checksum. GRE essay. When parsing the second bit, the second bit of the GRE header is used as the (ReservedO reserved) attribute, and the attribute value of the attribute is directly decapsulated when it is zero.
  • the router of the RFC2784 protocol is compatible with the router of the RFC1701 protocol and the router of the RFC1701 protocol parses the second bit, when the attribute value of the bit is zero, Decapsulation is performed; when the attribute value of the bit is 1, the decapsulation is performed directly, and the offset generated by the bit is added when calculating the length of the GRE header.
  • the third bit of the GRE header is used as the (Key Present Key) attribute, and the GRE is decapsulated directly when the attribute value of the attribute is zero; If the attribute value of the attribute is one, the keyword verification can only pass the verification and decapsulate the GRE message if the identifier recognized by the receiver of the router and the sender of the router are completely identical, otherwise the GRE packets are discarded.
  • the encapsulation is directly decapsulated when the attribute value of the attribute is zero; the serial number is required when the attribute value of the attribute is one
  • the GRE packet decapsulation is performed only when the receiver of the router and the sender of the router are completely identical in the sequence number. When the serial number of the receiver and the sender of the router are inconsistent. Discard the GRE text.
  • the attribute value of the attribute is zero or non-zero, and the direct decapsulation is ignored; the fourteenth to the GRE header
  • the attribute value of the attribute is zero when the attribute value of the attribute is zero; the attribute value of any of the fourteenth to sixteenth bits of the GRE header is not At zero hour, the GRE ⁇ message is discarded.
  • Step S120 Decapsulate the received GRE message according to the parsing result, and unblock the original message in the received GRE message.
  • the received GRE packet header is parsed, the received GRE packet is decapsulated according to the parsing result, and the original packet in the received GRE packet is decapsulated.
  • the received GRE message is decapsulated according to the length of the GRE header.
  • the packet header of the received GRE packet is decapsulated and parsed by the preset corresponding decapsulation rule to decapsulate the original message in the received GRE message, thereby ensuring that the network devices complying with different protocols are Interconnection.
  • a second embodiment of the decapsulation method of the GRE packet of the present invention is provided based on the foregoing embodiment.
  • the method includes:
  • Step S140 Acquire an offset corresponding to the predetermined bit when performing decapsulation parsing on the predetermined bit of the received header of the GRE message.
  • Step S150 Calculate a length of the GRE packet header according to the offset.
  • the offset refers to the number of bits in the GRE header when the attribute value of the bit attribute is one.
  • the offset is explained by taking the first bit as an example. For example, when the attribute value of the first bit is one, the verification of the checksum is required, that is, the checksum (optional) part and the offset (optional) part of the total of 32 bits appear in the GRE header. When performing the GRE header length calculation, the 32 bits are added.
  • FIG. 4 it is a schematic structural diagram of an embodiment of a device for encapsulating a GRE message according to the present invention.
  • the package device 1 for the GRE message provided in this example includes:
  • the setting module 10 is configured to perform attribute setting on the first to the sixteenth bits of the GRE packet header according to a preset encapsulation rule when performing GRE packet encapsulation on the original packet;
  • the original packet refers to a data packet that needs to be encapsulated and routed.
  • the setting module 10 compares the bits of the GRE packet header to the first to the sixteenth of the GRE packet header according to a preset encapsulation rule. The bit is set for the attribute.
  • the GRE tunnel complies with the corresponding encapsulation protocol when encapsulating GRE packets as the standard for encapsulation. Such as common protocols such as RFC2784, RFC2890 and RFC1701 and many more.
  • the setting module 10 sets the first bit of the GRE header according to the RFC2784 protocol to a (Checksum checksum) attribute, and the attribute value of the attribute may be selected by the user according to his own needs to fill in zero or one, and select zero in the selection.
  • Checksum checksum When the checksum is invalid, there is no need to check the checksum when decapsulating; when the checksum is selected, the checksum is valid, that is, the checksum check is required at the time of decapsulation.
  • the setting module 10 sets the attribute value to zero when the second bit of the GRE header is set to the ( ReservedO Reserved) attribute.
  • the setting module 10 sets the third bit of the GRE packet header to a (Key Present Key) attribute according to the RFC2890 protocol, and the attribute value of the attribute can be selectively set by the user.
  • the attribute value of the attribute is zero-filled, the key is invalid, that is, no key authentication is required when decapsulating; when the attribute value is selected, the key is valid, and the key authentication is required when decapsulating, only through GRE packets can be decapsulated after keyword authentication.
  • the setting module 10 sets the fourth bit of the GRE header to the (Sest Number Present Sequence) attribute
  • the attribute value of the attribute can also be selectively set to zero or one.
  • the attribute value of the fourth bit attribute is one, the GRE message sequence number is checked during decapsulation. The GRE message can be decapsulated only after the sequence number is checked; the attribute of the fourth bit attribute When the value is zero, it is not necessary to check the serial number of the GRE message during decapsulation.
  • the setting module 10 sets the fifth to thirteenth bits of the GRE packet header to a (ReservedO Reserved) attribute according to the RFC2784 protocol, and sets the attribute value to zero.
  • the setting module 10 sets the attribute value to zero when the fourteenth to sixteenth bits of the GRE header are set to the (Version Version Number) attribute.
  • the encapsulating module 20 is configured to perform GRE encapsulation on the GRE file and the original message after the attribute setting.
  • the setting module 10 performs attribute setting on the first to the sixteenth bit of the GRE header according to a preset encapsulation rule, and the encapsulation module 20 sets the GRE report after the attribute is set.
  • the header is encapsulated in the GRE packet and encapsulated with the original packet.
  • the embodiments of the present invention perform attribute setting and encapsulation on GRE headers that comply with different protocols by using preset encapsulation rules, and ensure interconnection and interworking between network devices that comply with different protocols.
  • FIG. 5 it is a schematic structural diagram of a first embodiment of a decapsulation apparatus for a GRE message according to the present invention.
  • the decapsulation device 2 of the GRE message provided in this example includes:
  • the parsing module 30 is configured to perform decapsulation and parsing on a predetermined bit of the header of the received GRE packet according to a preset decapsulation rule when receiving the GRE message;
  • the GRE packet includes: a raw data packet and a GRE packet header.
  • the parsing module 30 decapsulates the first to sixteenth bits of the header of the received GRE message according to a preset decapsulation rule during the parsing.
  • the parsing module 30 when parsing the first bit, uses the first bit of the GRE packet header as a (Checksum checksum) attribute, and directly decapsulates when the attribute value of the attribute is zero; When the attribute value is one, the checksum is calculated for the received GRE message, and the calculated checksum is checked with the original checksum in the GRE message, if it is calculated If the checksum is exactly the same as the original checksum in the GRE packet, it indicates that the GRE packet is decapsulated by the checksum check; if the calculated checksum and the GRE are If the original checksums in the packets are inconsistent, it indicates that the GRE ⁇ message is discarded without passing the checksum check.
  • Checksum checksum the first bit of the GRE packet header
  • the parsing module 30 takes the second bit of the GRE header as the (ReservedO Reserved) attribute, and the attribute value of the attribute is directly decapsulated when it is zero.
  • the parsing module 30 directly performs decapsulation when the attribute value of the bit is zero;
  • the attribute value of the bit is 1, the decapsulation is performed directly, and the calculation unit 32 needs to add the offset generated by the bit when calculating the length of the GRE header.
  • the parsing module 30, when parsing the third bit, uses the third bit of the GRE header as a (Key Present Key) attribute, and directly performs GRE packet decapsulation when the attribute value of the attribute is zero.
  • the attribute value of the attribute is one
  • the keyword check is performed only when the identifier recognized by the receiver of the router and the sender of the router are identical, and the GRE message can be decapsulated. Otherwise, The GRE packet is discarded.
  • the parsing module 30 directly decapsulates when the attribute value of the attribute is zero; when the attribute value of the attribute is one, it needs to be performed. The serial number is checked.
  • the GRE packet is decapsulated only when the receiver of the router and the sender of the router are completely identical.
  • the receiver of the router and the sender of the router are at the serial number. Discard the GRE message if it is inconsistent.
  • the parsing module 30 performs a (ReservedO reservation) attribute on the fifth to thirteenth bits of the GRE header, and ignores the direct decapsulation when the attribute value of the attribute is zero or non-zero; the parsing module 30 pairs the GRE message.
  • the encapsulation is directly decapsulated when the attribute value of the attribute is zero; any of the fourteenth to sixteenth bits of the GRE header The GRE packet is discarded when the attribute value of the bit is not zero.
  • the decapsulation module 40 is configured to decapsulate the received GRE packet according to the parsing result, and decapsulate the original packet in the received GRE packet.
  • the decapsulation module 40 decapsulates the received GRE message according to the parsing result to decapsulate the original message in the received GRE message.
  • the received GRE message is decapsulated according to the length of the GRE header.
  • FIG. 6 is a schematic structural diagram of an embodiment of a parsing module in a decapsulation apparatus for a GRE message according to the present invention.
  • An embodiment of the parsing module in the decapsulation apparatus of the GRE packet of the present invention is provided based on the foregoing embodiment, where the parsing module 30 includes:
  • the obtaining unit 31 is configured to obtain an offset corresponding to the predetermined bit when performing decapsulation and parsing on a predetermined bit of the header of the received GRE packet.
  • the calculating unit 32 is configured to calculate a length of the GRE packet header according to the offset.
  • the offset refers to the number of bits in the GRE header when the attribute value of the bit attribute is one.
  • the offset is explained by taking the first bit as an example. For example, when the attribute value of the first bit is one, the verification of the checksum is required, that is, the checksum (optional) part and the offset (optional) part of the total of 32 bits appear in the GRE header. When performing the GRE header length calculation, the 32 bits are added.
  • the obtaining unit 31 obtains each offset generated when each bit attribute value is one, and the calculating unit 32 calculates the entire GER packet header according to the respective offsets.
  • the length, according to the length of the GER packet header, can more accurately deblock the original packet in the received GRE packet.
  • the embodiment of the present invention further provides a computer storage medium, wherein the computer executable instructions are stored, and the computer executable instructions are used to execute the method described in any one of the foregoing method embodiments.
  • Each of the above modules or units may be implemented by a central processing unit (CPU), a digital signal processor (DSP) or a Field-Programmable Gate Array (FPGA) in the electronic device.
  • CPU central processing unit
  • DSP digital signal processor
  • FPGA Field-Programmable Gate Array
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware aspects. Moreover, the invention can take the form of a computer program product embodied on one or more computer usable storage media (including but not limited to disk storage and optical storage, etc.) in which computer usable program code is embodied.
  • the present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG.
  • These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明涉及一种GRE报文的封装方法、解封装方法及对应的装置,该封装方法包括:在对原始报文进行GRE报文封装时,按照预设的封装规则对GRE报文头的预先确定的比特位进行属性设置;将属性设置后的所述 GRE报文头与所述原始报文进行GRE报文封装。该解封装方法包括:在接收到GRE报文时,按照预设的解封装规则对接收的GRE报文的报文头的预先确定的比特位进行解封装解析;根据解析结果将接收的GRE报文进行解封装,以解封出接收的GRE报文中的原始报文。相应的,该封装装置包括设置模块和封装模块;该解封装装置包括解析模块和解封装模块。

Description

GRE报文的封装方法、 解封装方法及对应的装置 技术领域
本发明涉及网络技术领域, 尤其涉及一种 GRE 艮文的封装方法、 解封 装方法及对应的装置。 背景技术
GRE ( Generic Routing Encapsulation, 通用路由封装协议 )是一种封装 协议, 它提供了将一种协议的报文封装在另一种协议报文中的机制, 使艮 文能够在异种网络中传输。 GRE由 Cisco和 Net Smiths公司于 1994年提交 给 IETF, 标号为 RFC 1701、 RFC 1702。 2000年, Cisco等公司又对 GRE 协议进行了修订, 称为 GRE V2, 标号为 RFC 2784。 目前 RFC 1701虽然不 作为遵循的主要标准, 但现网中仍然存在使用 RFC 1701的设备。
在艮文发送方, GRE隧道将原始艮文和 GRE 艮文头进行封装成 GRE 报文后通过协议报文进行 "包装", 放在 IP报文的 "数据区" 中进行传输。 接收方在接收到 GRE报文后, 根据 GRE报文头的格式进行 GRE报文的解 封装, 对原始报文进行复原。 在解析 GRE报文头部时, 由于在 GRE报文 头中没有一个显式的字段来标识整个 GRE报文头的长度。 如果报文发送方 采用 RFC2784的路由设备时,其 GRE报文头部长度可能是 32至 64个比特 位, 如果报文接收方采用 RFC1701的路由设备, GRE报文头部长度可能是 32至 160个比特位。由于 GRE报文头中的格式及比特位的长度不统一无法 正确识别相应的字段以解析完整的报文头, 从而导致路由器无法互联互通。 因此如何解决以上问题已成为业界亟待的技术问题。 发明内容
本发明的主要目的是提供一种 GRE报文的封装方法、 解封装方法及对 应的装置, 旨在解决因 GRE 艮文头格式的不一致而导致路由器无法互联互 通。
一种 GRE报文的封装方法, 该方法包括: 在对原始报文进行 GRE报 文封装时, 按照预设的封装规则对 GRE报文头的预先确定的比特位进行属 性设置; 将属性设置后的所述 GRE报文头与所述原始报文进行 GRE报文 封装。
优选地, 所述预先确定的比特位包括 GRE 艮文头的第一位至第十六位 比特位,所述预设的封装规则包括:将 GRE 艮文头的第一比特位填零或一; 将 GRE 艮文头的第二比特位填零; 将 GRE 艮文头的第三比特位填零或一; 将 GRE 艮文头的第四比特位填零或一; 将 GRE 艮文头的第五至第十三比 特位填零; 将 GRE 艮文头的第十四至第十六比特位填零。
一种 GRE 艮文的解封装方法, 该方法包括: 在接收到 GRE ^艮文时, 按照预设的解封装规则对接收的 GRE报文的报文头的预先确定的比特位进 行解封装解析; 根据解析结果将接收的 GRE报文进行解封装, 以解封出接 收的 GRE 艮文中的原始艮文。
优选地, 所述预先确定的比特位包括 GRE 艮文头的第一位至第十六位 比特位,所述预设的解封装规则包括:在 GRE报文头的第一比特位为零时, 直接进行解封装;在 GRE 艮文头的第一比特位为一时,进行校验和的检查, 在通过校验和检查时直接进行解封装, 在未通过校验和检查时丟弃该 GRE 报文; 在 GRE 艮文头的第二比特位为零时, 直接解封装; 在 GRE ^艮文头 的第三比特位为零时, 直接解封装; 在 GRE 艮文头的第三比特位为一时, 进行关键字校验并根据校验的结果判断是否直接进行解封装; 在 GRE报文 头的第四比特位为零时,直接解封装;在 GRE 艮文头的第四比特位为一时, 进行序列号的检查根据检查的结果判断是否直接进行解封装; 对 GRE报文 头的第五至第十三比特位进行忽略, 直接解封装; 在 GRE报文头的第十四 至第十六比特位为零时, 直接进行解封装; 在 GRE报文头的第十四至第十 六比特位任一位不为零时, 丟弃该 GRE ^艮文。
优选地, 所述根据解析结果将接收的 GRE报文进行解封装, 以解封出 接收的 GRE报文中的原始报文的步骤之前还包括: 在对接收的 GRE报文 的报文头的预先确定的比特位进行解封装解析时, 获取预先确定的比特位 对应的偏移量; 根据所述偏移量计算所述 GRE报文头的长度。 一种 GRE报文的封装装置, 包括: 设置模块, 配置为在对原始报文进 行 GRE 艮文封装时, 按照预设的封装规则对 GRE 艮文头的预先确定的比 特位进行属性设置; 封装模块, 配置为将属性设置后的所述 GRE报文头与 所述原始艮文进行 GRE 艮文封装。
优选地, 所述预先确定的比特位包括 GRE 艮文头的第一位至第十六位 比特位,所述预设的封装规则包括:将 GRE 艮文头的第一比特位填零或一; 将 GRE 艮文头的第二比特位填零; 将 GRE 艮文头的第三比特位填零或一; 将 GRE 艮文头的第四比特位填零或一; 将 GRE 艮文头的第五至第十三比 特位填零; 将 GRE 艮文头的第十四至第十六比特位填零。
一种 GRE 艮文的解封装装置, 包括: 解析模块, 配置为在接收到 GRE 报文时, 按照预设的解封装规则对接收的 GRE报文的报文头的预先确定的 比特位进行解封装解析; 解封装模块, 配置为根据解析结果将接收的 GRE 艮文进行解封装, 以解封出接收的 GRE 艮文中的原始艮文。
优选地, 所述预先确定的比特位包括 GRE 艮文头的第一位至第十六位 比特位,所述预设的解封装规则包括:在 GRE报文头的第一比特位为零时, 直接进行解封装;在 GRE 艮文头的第一比特位为一时,进行校验和的检查, 在通过校验和检查时直接进行解封装, 在未通过校验和检查时丟弃该 GRE 报文; 在 GRE 艮文头的第二比特位为零时, 直接解封装; 在 GRE ^艮文头 的第三比特位为零时, 直接解封装; 在 GRE 艮文头的第三比特位为一时, 进行关键字校验并根据校验的结果判断是否直接进行解封装; 在 GRE报文 头的第四比特位为零时,直接解封装;在 GRE 艮文头的第四比特位为一时, 进行序列号的检查根据检查的结果判断是否直接进行解封装; 对 GRE报文 头的第五至第十三比特位进行忽略, 直接解封装; 在 GRE报文头的第十四 至第十六比特位为零时, 直接进行解封装; 在 GRE报文头的第十四至第十 六比特位任一位不为零时, 丟弃该 GRE ^艮文。
优选地, 所述解析模块还包括: 获取单元, 配置为在对接收的 GRE报 文的报文头的预先确定的比特位进行解封装解析时, 获取预先确定的比特 位对应的偏移量; 计算单元, 配置为根据所述偏移量计算所述 GRE报文头 的长度。 一种计算机存储介质, 其中存储有计算机可执行指令, 所述计算机可 执行指令用于执行上述的方法。
本发明实施例通过预设的封装规则对遵守不同协议的 GRE报文头进行 属性设置并进行封装, 并通过预设的对应解封装规则对接收的 GRE报文的 报文头进行解封装解析以解封出接收的 GRE报文中的原始报文, 保证了遵 守不同协议的网络设备之间的互联互通。 附图说明
图 1为本发明 GRE 艮文的封装方法实施例流程示意图;
图 2为本发明 GRE报文的解封装方法第一实施例流程示意图; 图 3为本发明 GRE报文的解封装方法第二实施例流程示意图; 图 4为本发明 GRE报文的封装装置实施例结构示意图;
图 5为本发明 GRE报文的解封装装置第一实施例结构示意图; 图 6为本发明 GRE报文的解封装装置中解析模块实施例结构示意图。 具体实施方式
下面结合附图及具体实施例就本发明的技术方案做进一步的说明。 应 当理解, 此处所描述的具体实施例仅仅用以解释本发明, 并不用于限定本 发明。
参照图 1所示, 为本发明 GRE报文的封装方法实施例流程示意图。 需要强调的是: 图 1 所示流程图仅为一个较佳实施例, 本领域的技术 人员当知, 任何围绕本发明思想构建的实施例都不应脱离于如下技术方案 涵盖的范围:
在对原始报文进行 GRE报文封装时, 按照预设的封装规则对 GRE报 文头的预先确定的比特位进行属性设置; 将属性设置后的所述 GRE报文头 与所述原始艮文进行 GRE 艮文封装。
以下是结合本实施例逐步实现对遵守不同协议的 GRE 艮文头进行属性 设置并进行封装的过程(本实施例中以 RFC2784协议及 RFC2890协议中对 报文头的封装规则来实现对 GRE报文的封装为例)。
步骤 S10, 在对原始报文进行 GRE报文封装时, 按照预设的封装规则 对 GRE报文头的第一至第十六比特位进行属性设置;
所述原始报文是指需要封装和路由的数据报文。 本实施例中在对所述 原始报文进行 GRE报文头封装时, 对所述 GRE报文头的比特位按照预设 的封装规则对 GRE报文头的第一至第十六比特位进行属性设置。 GRE隧道 在封装 GRE 艮文时都遵守着相应的封装协议以此作为封装的标准。 比如常 见的协议如, RFC2784协议、 RFC2890协议及 RFC1701协议等等。
具体地, 根据 RFC2784 协议将 GRE 艮文头的第一比特位设置为 (Checksum校险和)属性, 该属性的属性值用户可根据自己的需求选择填零 或一, 在选择填零时所述校验和无效即在解封装时无需进行校验和的检查; 在选择填一时所述校验和有效即在解封装时需进行校验和的检查。 在将
GRE报文头的第二比特位设置为(ReservedO预留)属性时, 将该属性值设 置为零。
可选的, 根据 RFC2890协议将 GRE报文头的第三比特位设置为(Key Present密钥)属性, 该属性的属性值用户可以选择性设置。 在该属性的属 性值选择填零时所述密钥无效即在解封装时无需进行关键字认证; 在属性 值选择填一时所述密钥有效即在解封装时需进行关键字认证, 只有通过关 键字认证之后才能对 GRE报文进行解封装。 在将 GRE报文头的第四比特 位设置为 (Sequence Number Present序列号)属性时, 该属性的属性值用 户也可以选择性的设置为零或一。 在第四比特位属性的属性值为一时, 在 解封装时需进行 GRE报文序列号的检查, 只有通过序列号的检查之后才能 对 GRE报文进行解封装; 在第四比特位属性的属性值为零时, 在解封装时 无需进行 GRE 艮文序列号的检查。
可选的,根据 RFC2784协议将 GRE 艮文头的第五至第十三比特位设置 为 (ReservedO预留 )属性, 并设置该属性值为零。 在将 GRE报文头的第 十四至第十六比特位设置为 (Version版本号)属性时设置该属性值为零。 报文封装。
本实例中按照预设的封装规则对 GRE报文头的第一位至第十六位比特 位进行属性设置, 将属性设置后的所述 GRE报文头作为所述 GRE报文的 封装格式并与所述原始报文进行 GRE报文封装。
本发明实施例通过预设的封装规则对遵守不同协议的 GRE报文头进行 属性设置并进行封装, 保证了遵守不同协议的网络设备之间的互联互通。 参照图 2所示, 为本发明 GRE报文的解封装方法第一实施例流程示意 图。 需要强调的是: 图 2所示流程图仅为一个较佳实施例, 本领域的技术 人员当知, 任何围绕本发明思想构建的实施例都不应脱离于如下技术方案 涵盖的范围:
在接收到 GRE报文时, 按照预设的解封装规则对接收的 GRE报文的 报文头的预先确定的比特位进行解封装解析; 根据解析结果将接收的 GRE 艮文进行解封装, 以解封出接收的 GRE 艮文中的原始艮文。
以下是结合本实施例逐步通过预设的对应解封装规则对接收的 GRE报 文的艮文头进行解封装解析以解封出接收的 GRE 艮文中的原始艮文的过 程。
步骤 S110, 在接收到 GRE 艮文时, 按照预设的解封装规则对接收的
GRE报文的报文头的预先确定的比特位进行解封装解析;
所述 GRE报文包括: 原始数据报文及 GRE报文头。 在解析时按照预 设的解封装规则对接收的 GRE报文的报文头的第一至第十六比特位进行解 封装解析。
具体地, 在解析第一比特位时, 将 GRE 艮文头的第一比特位作为
(Checksum校验和)属性, 在该属性的属性值为零时, 直接解封装; 在该属 性的属性值为一时, 对接收到的 GRE报文计算校验和, 并将计算得出的校 验和与所述 GRE报文中的原始校验和进行校验和的检查, 如果计算得出的 校验和与所述 GRE报文中的原始校验和完全一致时, 则表明通过校验和的 检查对所述 GRE报文进行解封装; 如果计算得出的校验和与所述 GRE报 文中的原始校验和不一致时, 则表明没有通过校验和的检查需丟弃所述 GRE 艮文。 在解析第二比特位时, 将 GRE 艮文头的第二比特位作为 ( ReservedO预留)属性, 该属性的属性值是零时直接解封装。 其中, 如果 是 RFC2784协议的路由器兼容 RFC1701协议的路由器并由 RFC1701协议 的路由器对所述第二比特位进行解析, 在所述比特位的属性值为零时, 直 接进行解封装; 在所述比特位的属性值为 1 时, 直接进行解封装同时在计 算 GRE报文头的长度时需加上所述比特位产生的偏移量。
可选的,在解析第三比特位时,将 GRE 艮文头的第三比特位作为(Key Present密钥)属性, 在该属性的属性值是零时直接进行 GRE 艮文解封装; 在该属性的属性值是一时, 进行关键字校验只有在路由器的接受方和路由 器的发送方两端识别的关键字完全一致时才能通过验证并对所述 GRE 艮文 进行解封装, 否则将所述 GRE报文丟弃。 在对 GRE报文头的第四比特位 作为 (Sequence Number Present序歹号)属性进行解析时, 在该属性的属 性值是零时直接解封装; 在该属性的属性值是一时需进行序列号的检查, 只有在路由器的接受方和路由器的发送方两端在所述序列号完全一致时才 进行 GRE报文解封装, 路由器的接受方和路由器的发送方两端在所述序列 号不一致时将所述 GRE 艮文丟弃。 对 GRE 艮文头的第五至第十三比特位 作(ReservedO预留)属性时, 该属性的属性值为零或者非零时进行忽略直 接解封装; 对 GRE报文头的第十四至第十六比特位作为 (Version版本号) 属性时, 在该属性的属性值为零时直接解封装; 在 GRE报文头的第十四至 第十六比特位任一位的属性值不为零时, 丟弃该 GRE ^艮文。
步骤 S120,根据解析结果将接收的 GRE报文进行解封装, 以解封出接 收的 GRE 艮文中的原始艮文。
在对接收到的 GRE报文头进行解析后, 根据解析结果将接收的 GRE 报文进行解封装, 以解封出接收的 GRE报文中的原始报文。 本实施例中根 据所述 GRE 艮文头的长度对接收的 GRE 艮文进行解封装。
本发明实施例通过预设的对应解封装规则对接收的 GRE报文的报文头 进行解封装解析以解封出接收的 GRE 艮文中的原始艮文, 保证了遵守不同 协议的网络设备之间的互联互通。 图。
基于上述实施例提出本发明 GRE报文的解封装方法第二实施例, 在上 述实施例中步骤 S120之前包括:
步骤 S140,在对接收的 GRE 艮文的艮文头的预先确定的比特位进行解 封装解析时, 获取预先确定的比特位对应的偏移量;
步骤 S150, 根据所述偏移量计算所述 GRE报文头的长度。
其中, 所述偏移量是指所述比特位属性的属性值为一时, 所述比特位 在所述 GRE报文头中所占的比特位位数。 本实施中以解析第一比特位为例 来说明所述偏移量。 例如, 在第一比特位的属性值为一时, 需进行校验和 的验证即校验和 (可选 )部分以及偏离 (可选 )部分共 32个比特位出现在 GRE 艮文头中同时在进行 GRE 艮文头长度计算时, 需加上所述 32个比特 位。
通过对整个 GRE报文头的比特位进行解析之后, 获取各个比特位属性 值为一时产生的各个偏移量, 根据所述各个偏移量计算出整个 GER报文头 的长度, 根据 GER报文头的长度能更准确的解封出接收的 GRE报文中的 原始艮文。 参照图 4所示, 为本发明 GRE报文的封装装置实施例结构示意图。 本实例所提供的 GRE报文的封装装置 1, 包括:
设置模块 10, 配置为在对原始报文进行 GRE报文封装时,按照预设的 封装规则对 GRE报文头的第一至第十六比特位进行属性设置;
所述原始报文是指需要封装和路由的数据报文。 本实施例中在对所述 原始报文进行 GRE报文头封装时, 设置模块 10对所述 GRE报文头的比特 位按照预设的封装规则对 GRE报文头的第一至第十六比特位进行属性设 置。 GRE隧道在封装 GRE报文时都遵守着相应的封装协议以此作为封装的 标准。 比如常见的协议如, RFC2784协议、 RFC2890协议及 RFC1701协议 等等。
具体地, 设置模块 10根据 RFC2784协议将 GRE 艮文头的第一比特位 设置为 (Checksum校验和)属性, 该属性的属性值用户可根据自己的需求选 择填零或一, 在选择填零时所述校验和无效即在解封装时无需进行校验和 的检查; 在选择填一时所述校验和有效即在解封装时需进行校验和的检查。 设置模块 10在将 GRE报文头的第二比特位设置为 ( ReservedO预留 )属性 时, 将该属性值设置为零。
可选的, 设置模块 10根据 RFC2890协议将 GRE报文头的第三比特位 设置为 (Key Present密钥)属性, 该属性的属性值用户可以选择性设置。 在该属性的属性值选择填零时所述密钥无效即在解封装时无需进行关键字 认证; 在属性值选择填一时所述密钥有效即在解封装时需进行关键字认证, 只有通过关键字认证之后才能对 GRE报文进行解封装。 设置模块 10在将 GRE 艮文头的第四比特位设置为 ( Sequence Number Present序列号)属性 时, 该属性的属性值用户也可以选择性的设置为零或一。 在第四比特位属 性的属性值为一时, 在解封装时需进行 GRE报文序列号的检查, 只有通过 序列号的检查之后才能对 GRE报文进行解封装; 在第四比特位属性的属性 值为零时, 在解封装时无需进行 GRE报文序列号的检查。
可选的, 设置模块 10根据 RFC2784协议将 GRE报文头的第五至第十 三比特位设置为 (ReservedO预留)属性, 并设置该属性值为零。 设置模块 10在将 GRE报文头的第十四至第十六比特位设置为 ( Version版本号 )属 性时设置该属性值为零。
封装模块 20,配置为将属性设置后的所述 GRE 4艮文头与所述原始 4艮文 进行 GRE 艮文封装。
本实例中设置模块 10按照预设的封装规则对 GRE 艮文头的第一位至 第十六位比特位进行属性设置, 封装模块 20将属性设置后的所述 GRE报 文头作为所述 GRE报文的封装格式并与所述原始报文进行 GRE报文封装。 本发明实施例通过预设的封装规则对遵守不同协议的 GRE报文头进行 属性设置并进行封装, 保证了遵守不同协议的网络设备之间的互联互通。 参照图 5所示, 为本发明 GRE报文的解封装装置第一实施例结构示意 图。
本实例所提供的 GRE报文的解封装装置 2, 包括:
解析模块 30,配置为在接收到 GRE ^艮文时, 按照预设的解封装规则对 接收的 GRE报文的报文头的预先确定的比特位进行解封装解析;
所述 GRE报文包括: 原始数据报文及 GRE报文头。 解析模块 30在解 析时按照预设的解封装规则对接收的 GRE 艮文的艮文头的第一至第十六比 特位进行解封装解析。
具体地, 解析模块 30在解析第一比特位时, 将 GRE报文头的第一比 特位作为 (Checksum校验和)属性,在该属性的属性值为零时,直接解封装; 在该属性的属性值为一时, 对接收到的 GRE报文计算校验和, 并将计算得 出的校验和与所述 GRE报文中的原始校验和进行校验和的检查, 如果计算 得出的校验和与所述 GRE报文中的原始校验和完全一致时, 则表明通过校 验和的检查对所述 GRE报文进行解封装; 如果计算得出的校验和与所述 GRE报文中的原始校验和不一致时, 则表明没有通过校验和的检查需丟弃 所述 GRE ^艮文。 在解析第二比特位时, 解析模块 30将 GRE 艮文头的第二 比特位作为 (ReservedO预留)属性, 该属性的属性值是零时直接解封装。 其中, 如果是 RFC2784 协议的路由器兼容 RFC1701 协议的路由器并由 RFC1701协议的路由器对所述第二比特位进行解析,解析模块 30在所述比 特位的属性值为零时, 直接进行解封装; 在所述比特位的属性值为 1 时, 直接进行解封装同时计算单元 32在计算 GRE报文头的长度时需加上所述 比特位产生的偏移量。 可选的, 解析模块 30在解析第三比特位时, 将 GRE 艮文头的第三比 特位作为( Key Present密钥)属性,在该属性的属性值是零时直接进行 GRE 报文解封装; 在该属性的属性值是一时, 进行关键字校验只有在路由器的 接受方和路由器的发送方两端识别的关键字完全一致时才能通过验证并对 所述 GRE报文进行解封装, 否则将所述 GRE报文丟弃。 解析模块 30在对 GRE 艮文头的第四比特位作为 ( Sequence Number Present序列号)属性进 行解析时, 在该属性的属性值是零时直接解封装; 在该属性的属性值是一 时需进行序列号的检查, 只有在路由器的接受方和路由器的发送方两端在 所述序列号完全一致时才进行 GRE报文解封装, 路由器的接受方和路由器 的发送方两端在所述序列号不一致时将所述 GRE 艮文丟弃。 解析模块 30 对 GRE 艮文头的第五至第十三比特位作 (ReservedO预留 )属性时, 该属 性的属性值为零或者非零时进行忽略直接解封装; 解析模块 30对 GRE报 文头的第十四至第十六比特位作为 (Version版本号)属性时, 在该属性的 属性值为零时直接解封装; 在 GRE报文头的第十四至第十六比特位任一位 的属性值不为零时, 丟弃该 GRE报文。
解封装模块 40, 配置为根据解析结果将接收的 GRE报文进行解封装, 以解封出接收的 GRE报文中的原始报文。
在对接收到的 GRE报文头进行解析后, 解封装模块 40根据解析结果 将接收的 GRE ^艮文进行解封装, 以解封出接收的 GRE 艮文中的原始艮文。 本实施例中根据所述 GRE 艮文头的长度对接收的 GRE 艮文进行解封装。
本发明实施例通过预设的对应解封装规则对接收的 GRE报文的报文头 进行解封装解析以解封出接收的 GRE 艮文中的原始艮文, 保证了遵守不同 协议的网络设备之间的互联互通。 参照图 6所示, 为本发明 GRE报文的解封装装置中解析模块实施例结 构示意图。 基于上述实施例提出本发明 GRE报文的解封装装置中解析模块实施 例, 所述解析模块 30包括:
获取单元 31,配置为在对接收的 GRE报文的报文头的预先确定的比特 位进行解封装解析时, 获取预先确定的比特位对应的偏移量;
计算单元 32, 配置为根据所述偏移量计算所述 GRE报文头的长度。 其中, 所述偏移量是指所述比特位属性的属性值为一时, 所述比特位 在所述 GRE报文头中所占的比特位位数。 本实施中以解析第一比特位为例 来说明所述偏移量。 例如, 在第一比特位的属性值为一时, 需进行校验和 的验证即校验和 (可选 )部分以及偏离 (可选 )部分共 32个比特位出现在 GRE 艮文头中同时在进行 GRE 艮文头长度计算时, 需加上所述 32个比特 位。
通过对整个 GRE报文头的比特位进行解析之后, 获取单元 31获取各 个比特位属性值为一时产生的各个偏移量, 计算单元 32根据所述各个偏移 量计算出整个 GER报文头的长度, 根据 GER报文头的长度能更准确的解 封出接收的 GRE报文中的原始报文。
本发明实施例还提供了一种计算机存储介质, 其中存储有计算机可执 行指令, 所述计算机可执行指令用于执行上述任一方法实施例所述的方法。
上述各模块或单元可以由电子设备中的中央处理器( Central Processing Unit, CPU ), 数字信号处理器(Digital Signal Processor, DSP )或可编程逻 辑阵列 (Field - Programmable Gate Array, FPGA ) 实现。
本领域内的技术人员应明白, 本发明的实施例可提供为方法、 系统、 或计算机程序产品。 因此, 本发明可采用硬件实施例、 软件实施例、 或结 合软件和硬件方面的实施例的形式。 而且, 本发明可采用在一个或多个其 中包含有计算机可用程序代码的计算机可用存储介质 (包括但不限于磁盘 存储器和光学存储器等)上实施的计算机程序产品的形式。 本发明是参照根据本发明实施例的方法、 设备(系统)、 和计算机程序 产品的流程图和 /或方框图来描述的。 应理解可由计算机程序指令实现流程 图和 /或方框图中的每一流程和 /或方框、以及流程图和 /或方框图中的流程和 /或方框的结合。 可提供这些计算机程序指令到通用计算机、 专用计算机、 嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器, 使得 通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现 在流程图一个流程或多个流程和 /或方框图一个方框或多个方框中指定的功 能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理 设备以特定方式工作的计算机可读存储器中, 使得存储在该计算机可读存 储器中的指令产生包括指令装置的制造品, 该指令装置实现在流程图一个 流程或多个流程和 /或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备 上, 使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机 实现的处理, 从而在计算机或其他可编程设备上执行的指令提供用于实现 在流程图一个流程或多个流程和 /或方框图一个方框或多个方框中指定的功 能的步骤。
以上所述仅为本发明的优选实施例, 并非因此限制本发明的专利范围, 凡是利用本发明说明书及附图内容所作的等效结构变换, 或直接或间接运 用在其他相关的技术领域, 均同理包括在本发明的专利保护范围内。

Claims

权利要求书
1、 一种 GRE 艮文的封装方法, 其中, 该方法包括:
在对原始报文进行 GRE报文封装时, 按照预设的封装规则对 GRE报 文头的预先确定的比特位进行属性设置;
2、 根据权利要求 1 所述的方法, 其中, 所述预先确定的比特位包括 GRE 艮文头的第一位至第十六位比特位, 所述预设的封装规则包括:
将 GRE 艮文头的第一比特位填零或一;
将 GRE 艮文头的第二比特位填零;
将 GRE 艮文头的第三比特位填零或一;
将 GRE 艮文头的第四比特位填零或一;
将 GRE报文头的第五至第十三比特位填零;
将 GRE 艮文头的第十四至第十六比特位填零。
3、 一种 GRE 艮文的解封装方法, 其中, 该方法包括:
在接收到 GRE报文时, 按照预设的解封装规则对接收的 GRE报文的 报文头的预先确定的比特位进行解封装解析;
根据解析结果将接收的 GRE报文进行解封装, 以解封出接收的 GRE 艮文中的原始艮文。
4、 根据权利要求 3 所述的方法, 其中, 所述预先确定的比特位包括 GRE 艮文头的第一位至第十六位比特位, 所述预设的解封装规则包括: 在 GRE报文头的第一比特位为零时, 直接进行解封装;
在 GRE 艮文头的第一比特位为一时, 进行校验和的检查, 在通过校验 和检查时直接进行解封装, 在未通过校验和检查时丟弃该 GRE报文; 在 GRE报文头的第二比特位为零时, 直接解封装;
在 GRE报文头的第三比特位为零时, 直接解封装;
在 GRE报文头的第三比特位为一时, 进行关键字校验并根据校验的结 果判断是否直接进行解封装;
在 GRE 艮文头的第四比特位为零时, 直接解封装;
在 GRE报文头的第四比特位为一时, 进行序列号的检查根据检查的结 果判断是否直接进行解封装;
对 GRE报文头的第五至第十三比特位进行忽略, 直接解封装; 在 GRE报文头的第十四至第十六比特位为零时, 直接进行解封装; 在 GRE报文头的第十四至第十六比特位任一位不为零时,丟弃该 GRE 报文。
5、 根据权利要求 3 所述的方法, 其中, 所述根据解析结果将接收的 GRE ^艮文进行解封装,以解封出接收的 GRE 艮文中的原始艮文的步骤之前 还包括:
在对接收的 GRE报文的报文头的预先确定的比特位进行解封装解析 时, 获取预先确定的比特位对应的偏移量;
根据所述偏移量计算所述 GRE报文头的长度。
6、 一种 GRE报文的封装装置, 其中, 包括:
设置模块, 配置为在对原始报文进行 GRE报文封装时, 按照预设的封 装规则对 GRE报文头的预先确定的比特位进行属性设置;
封装模块, 配置为将属性设置后的所述 GRE报文头与所述原始报文进 行 GRE 艮文封装。
7、 根据权利要求 6 所述的装置, 其中, 所述预先确定的比特位包括 GRE 艮文头的第一位至第十六位比特位, 所述预设的封装规则包括:
将 GRE 艮文头的第一比特位填零或一;
将 GRE 艮文头的第二比特位填零;
将 GRE 艮文头的第三比特位填零或一;
将 GRE 艮文头的第四比特位填零或一;
将 GRE报文头的第五至第十三比特位填零;
将 GRE 艮文头的第十四至第十六比特位填零。
8、 一种 GRE报文的解封装装置, 其中, 包括:
解析模块, 配置为在接收到 GRE报文时, 按照预设的解封装规则对接 收的 GRE报文的报文头的预先确定的比特位进行解封装解析;
解封装模块, 配置为根据解析结果将接收的 GRE报文进行解封装, 以 解封出接收的 GRE报文中的原始报文。
9、 根据权利要求 8 所述的装置, 其中, 所述预先确定的比特位包括 GRE 艮文头的第一位至第十六位比特位, 所述预设的解封装规则包括: 在 GRE报文头的第一比特位为零时, 直接进行解封装;
在 GRE 艮文头的第一比特位为一时, 进行校验和的检查, 在通过校验 和检查时直接进行解封装, 在未通过校验和检查时丟弃该 GRE报文; 在 GRE报文头的第二比特位为零时, 直接解封装;
在 GRE报文头的第三比特位为零时, 直接解封装;
在 GRE报文头的第三比特位为一时, 进行关键字校验并根据校验的结 果判断是否直接进行解封装;
在 GRE 艮文头的第四比特位为零时, 直接解封装;
在 GRE报文头的第四比特位为一时, 进行序列号的检查根据检查的结 果判断是否直接进行解封装; 对 GRE报文头的第五至第十三比特位进行忽略, 直接解封装; 在 GRE报文头的第十四至第十六比特位为零时, 直接进行解封装; 在 GRE报文头的第十四至第十六比特位任一位不为零时,丟弃该 GRE 报文。
10、 根据权利要求 8所述的装置, 其中, 所述解析模块还包括: 获取单元, 配置为在对接收的 GRE报文的报文头的预先确定的比特位 进行解封装解析时, 获取预先确定的比特位对应的偏移量;
计算单元, 配置为根据所述偏移量计算所述 GRE报文头的长度。
11、 一种计算机存储介质, 其中存储有计算机可执行指令, 所述计算 机可执行指令用于执行所述权利要求 1至 2、权利要求 3至 5任一项所述的 方法。
PCT/CN2014/080535 2013-07-23 2014-06-23 Gre报文的封装方法、解封装方法及对应的装置 WO2015010512A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US14/905,894 US10033842B2 (en) 2013-07-23 2014-06-23 GRE message encapsulation method, decapsulation method, and corresponding devices
EP14829826.8A EP3026856B1 (en) 2013-07-23 2014-06-23 Gre packet encapsulation method, decapsulation method, and corresponding apparatuses

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310312219.0 2013-07-23
CN201310312219.0A CN104348759B (zh) 2013-07-23 2013-07-23 Gre报文的封装方法、解封装方法及对应的装置

Publications (1)

Publication Number Publication Date
WO2015010512A1 true WO2015010512A1 (zh) 2015-01-29

Family

ID=52392683

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/080535 WO2015010512A1 (zh) 2013-07-23 2014-06-23 Gre报文的封装方法、解封装方法及对应的装置

Country Status (4)

Country Link
US (1) US10033842B2 (zh)
EP (1) EP3026856B1 (zh)
CN (1) CN104348759B (zh)
WO (1) WO2015010512A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017124693A1 (zh) * 2016-01-21 2017-07-27 中兴通讯股份有限公司 一种报文解封装处理、数据写入方法及装置
CN111385257A (zh) * 2018-12-28 2020-07-07 致茂电子(苏州)有限公司 网络封包处理方法及其装置

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108075991B (zh) 2016-11-18 2020-09-08 新华三技术有限公司 报文转发方法及装置
FR3092461A1 (fr) * 2019-02-05 2020-08-07 Orange Procédé d’émission à deux protocoles, procédé de réception et dispositifs et signal correspondants.
US11297037B2 (en) * 2019-07-22 2022-04-05 Arista Networks, Inc. Method and network device for overlay tunnel termination and mirroring spanning datacenters
CN111212060A (zh) * 2019-12-31 2020-05-29 盛科网络(苏州)有限公司 一种剥离可变长gre头部的方法及装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1942000A (zh) * 2005-09-30 2007-04-04 北京三星通信技术研究有限公司 在无线通信系统中传递用户数据的方法
CN101848171A (zh) * 2010-07-01 2010-09-29 杭州华三通信技术有限公司 一种基于gre隧道的数据传输方法、设备和系统
CN102164090A (zh) * 2011-05-13 2011-08-24 杭州华三通信技术有限公司 基于通用路由封装隧道的报文转发的方法、系统及设备

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7899060B2 (en) * 2004-04-01 2011-03-01 Nortel Networks Limited Method for providing bearer specific information for wireless networks
KR100918435B1 (ko) 2005-01-31 2009-09-24 삼성전자주식회사 무선 통신 시스템에서 데이터 트래픽 제어 시스템 및 방법
KR100694209B1 (ko) 2005-03-22 2007-03-14 삼성전자주식회사 IPv4망과 IPv6망간의 ISATAP 터널링 시스템 및그 방법
US8483113B2 (en) * 2007-11-14 2013-07-09 Samsung Electronics Co., Ltd. Apparatus and method for multicast and broadcast service in a broadband wireless access system
US8493851B2 (en) * 2010-05-07 2013-07-23 Broadcom Corporation Method and system for offloading tunnel packet processing in cloud computing
US20120099602A1 (en) * 2010-10-25 2012-04-26 Brocade Communications Systems, Inc. End-to-end virtualization
US8837300B2 (en) * 2012-06-05 2014-09-16 Cisco Technology, Inc. Managing trace requests over tunneled links

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1942000A (zh) * 2005-09-30 2007-04-04 北京三星通信技术研究有限公司 在无线通信系统中传递用户数据的方法
CN101848171A (zh) * 2010-07-01 2010-09-29 杭州华三通信技术有限公司 一种基于gre隧道的数据传输方法、设备和系统
CN102164090A (zh) * 2011-05-13 2011-08-24 杭州华三通信技术有限公司 基于通用路由封装隧道的报文转发的方法、系统及设备

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017124693A1 (zh) * 2016-01-21 2017-07-27 中兴通讯股份有限公司 一种报文解封装处理、数据写入方法及装置
CN111385257A (zh) * 2018-12-28 2020-07-07 致茂电子(苏州)有限公司 网络封包处理方法及其装置
CN111385257B (zh) * 2018-12-28 2022-03-15 致茂电子(苏州)有限公司 网络封包处理方法及其装置

Also Published As

Publication number Publication date
CN104348759B (zh) 2019-04-02
US10033842B2 (en) 2018-07-24
US20160156752A1 (en) 2016-06-02
EP3026856A1 (en) 2016-06-01
EP3026856A4 (en) 2016-07-27
CN104348759A (zh) 2015-02-11
EP3026856B1 (en) 2018-12-26

Similar Documents

Publication Publication Date Title
WO2015010512A1 (zh) Gre报文的封装方法、解封装方法及对应的装置
KR102253086B1 (ko) 업링크 데이터 압축 해제 및 압축 방법과 그 장치
EP3603001A1 (en) Hardware-accelerated payload filtering in secure communication
JP2014508458A5 (zh)
TW201352050A (zh) 網路卸載方法與系統
CN107046495B (zh) 用于构建虚拟专用网络的方法、装置和系统
WO2017088557A1 (zh) 数据报文发送接收的处理方法及装置
CN110771116B (zh) 一种加密数据流的识别方法、设备、存储介质及系统
CN105516139A (zh) 一种网络数据的传输方法、装置及系统
US20180176230A1 (en) Data packet transmission method, apparatus, and system, and node device
US10311005B2 (en) Message translator
US20130136145A1 (en) Time message processing method, apparatus and system
US20180131609A1 (en) Protocol frame transmission method, apparatus, and system, and node device
US20150086015A1 (en) Cryptographically Protected Redundant Data Packets
CN110149242B (zh) 一种支持srio与以太网的协议转换功能验证装置及方法
WO2018068191A1 (zh) 一种通信方法、安全节点网元和终端
WO2017008401A1 (zh) 一种协议帧传输方法、装置、节点设备以及系统
WO2016180161A1 (zh) 终端注册方法及装置
TWI765687B (zh) 用於單向傳輸的通訊系統及通訊方法
CN113765851B (zh) 一种数据处理方法及其设备
TWI767673B (zh) 用於單向傳輸的通訊系統及通訊方法
WO2023197610A1 (zh) 一种双模物联网设备的配网方法、装置及存储介质
WO2017206845A1 (zh) 报文发送、接收方法及装置
AU2016277747B2 (en) Method and device for transmitting verification information
WO2012107074A1 (en) Device and method for securing ethernet communication

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14829826

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 14905894

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 2014829826

Country of ref document: EP