WO2020057436A1 - 发送报文的方法、接收报文的方法及网络设备 - Google Patents

发送报文的方法、接收报文的方法及网络设备 Download PDF

Info

Publication number
WO2020057436A1
WO2020057436A1 PCT/CN2019/105673 CN2019105673W WO2020057436A1 WO 2020057436 A1 WO2020057436 A1 WO 2020057436A1 CN 2019105673 W CN2019105673 W CN 2019105673W WO 2020057436 A1 WO2020057436 A1 WO 2020057436A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
protocol
header
field
packet
Prior art date
Application number
PCT/CN2019/105673
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 EP19862767.1A priority Critical patent/EP3771170A4/en
Priority to JP2021515271A priority patent/JP7228030B2/ja
Publication of WO2020057436A1 publication Critical patent/WO2020057436A1/zh
Priority to US17/087,138 priority patent/US11888904B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/20Network architectures or network communication protocols for network security for managing network security; network security policies in general
    • H04L63/205Network architectures or network communication protocols for network security for managing network security; network security policies in general involving negotiation or determination of the one or more network security mechanisms to be used, e.g. by negotiation between the client and the server or between peers or by selection according to the capabilities of the entities involved
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • 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
    • 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/4641Virtual LANs, VLANs, e.g. virtual private networks [VPN]
    • H04L12/4645Details on frame tagging
    • H04L12/465Details on frame tagging wherein a single frame includes a plurality of VLAN tags
    • 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/4641Virtual LANs, VLANs, e.g. virtual private networks [VPN]
    • H04L12/4645Details on frame tagging
    • H04L12/4666Operational details on the addition or the stripping of a tag in a frame, e.g. at a provider edge node
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/16Implementing security features at a particular protocol layer
    • H04L63/164Implementing security features at a particular protocol layer at the network layer
    • 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/03Protocol definition or specification 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • 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/4604LAN interconnection over a backbone network, e.g. Internet, Frame Relay
    • H04L2012/4629LAN interconnection over a backbone network, e.g. Internet, Frame Relay using multilayer switching, e.g. layer 3 switching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/50Routing or path finding of packets in data switching networks using label swapping, e.g. multi-protocol label switch [MPLS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • H04L63/123Applying verification of the received information received data contents, e.g. message integrity
    • 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/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields

Definitions

  • Embodiments of the present application relate to the field of communications technologies, and in particular, to a method for sending a message, a method for receiving a message, and a network device.
  • This application provides a method for sending a message, a method for receiving a message, and a network device.
  • the above technical solution is more scalable and can support more types of protection protocols.
  • a method for sending a message includes a network device generating a first message, and sending the first message.
  • the first packet includes a first packet header, a second packet header, and protection data.
  • the first packet header includes an indication field, and the indication field is used to indicate that the first packet includes the first packet.
  • an Ethernet frame includes an Ethernet frame header and a payload.
  • the Ethernet frame header includes the ethernet type.
  • the ethernet type is used to indicate the protocol of the message in the payload. For example, when the value of the ethernet type in the Ethernet frame header is 0x0800, the payload includes an Internet Protocol version 4 (IPv4) message.
  • IPv4 Internet Protocol version 4
  • the payload includes an Address Resolution Protocol (ARP) message. Therefore, in theory, the ethernet type can indicate a 2 to 16 power protocol. Since some values of the ethernet type have been defined, when the product is implemented, the available values of the ethernet type are less than 2 to the power of 16.
  • ARP Address Resolution Protocol
  • the second packet header further includes an offset field, where the offset field is used to indicate a position of the protection data.
  • the receiving device may determine a position of the protection data in the first message according to the first protection protocol indicated by a type field. For example, when the first protection protocol is an Encapsulating Security Payload (ESP) protocol, the receiving device may determine that the protection data is located behind an ESP header of the first message. However, when the receiving device determines the position of the protected data in the first message based on the first protection protocol, the receiving device needs to perform more complicated processing to determine that the protected data The position in a message needs more time. It is relatively easy to determine the position of the protection data based on the offset field, and the time consumed is relatively short.
  • ESP Encapsulating Security Payload
  • the second packet header further includes a length field, and the length field indicates a length of the second packet header.
  • the receiving device receiving the first message may determine a position of a protection protocol header according to the length field. For example, when the first protection protocol is an ESP protocol, the receiving device may determine a position of an ESP header in the first packet according to the length field. Further, the receiving device may analyze the ESP header according to the provisions of the ESP protocol.
  • the first protection protocol is an ESP protocol
  • the receiving device may analyze the ESP header according to the provisions of the ESP protocol.
  • the receiving device receiving the first message may determine that the first message includes the offset field according to the flag field. Further, the receiving device may obtain the offset field. The position of the protection data is determined according to the offset field.
  • the second packet header further includes a length field, and the length field indicates a length of the second packet header.
  • the second packet header further includes a flag field, where the flag field indicates that the second packet header includes the offset field.
  • a network device in a fourth aspect, includes a processor and a memory coupled to the processor.
  • the memory stores a computer program.
  • the network device is caused to execute the method provided by the second aspect or any possible design of the second aspect.
  • the present application provides a computer-readable storage medium, where the computer-readable storage medium stores instructions, and when the computer-readable storage medium is run on a computer, causes the computer to execute the second aspect or any of the second aspect Design provided by the method.
  • the computer-readable storage medium is a non-transitory computer-readable storage medium.
  • the present application provides a computer program product.
  • the computer program product includes instructions that, when executed on a computer, cause the computer to perform the method of the first aspect or any possible design of the first aspect.
  • the computer is caused to execute the method provided by the second aspect or any possible design of the second aspect.
  • the first packet header is a Multi-Protocol Label Switching (MPLS) header
  • the indication field is the first packet MPLS Label field in the header.
  • MPLS Multi-Protocol Label Switching
  • the first packet header is an ethernet header
  • the indication field is an ethernet type field in the first packet header.
  • the first packet header is a Transmission Control Protocol (TCP) header
  • the indication field is a reserved field or an option ( options) field.
  • the first packet header is a HyperText Transfer Protocol (HTTP) header
  • the type field is an extension field
  • FIG. 3 is a schematic structural diagram of an IP packet provided by this application.
  • FIG. 6 is a schematic structural diagram of an IP packet provided by this application.
  • FIG. 15 is a schematic structural diagram of a network device provided by this application.
  • Router 1 shows two outgoing ports (a first outgoing port and a second outgoing port) in router 1 and two outgoing ports (a third outgoing port and fourth outgoing port) in router 2.
  • Router 1 is connected to router 2 through the first outgoing port.
  • Router 1 is connected to router 3 through the second outgoing port.
  • Router 2 is connected to router 4 through the third outgoing port.
  • Router 2 is connected to router 5 through the fourth outgoing port.
  • Router 1 After Router 1 receives a packet, Router 1 determines the egress port used to forward the packet, such as the first egress port, and forwards the packet from the first egress port. After Router 2 receives the packet forwarded by Router 1, Router 2 determines the outbound port, such as the third outbound port, and forwards the packet out of the third outbound port.
  • FIG. 2 is a schematic diagram of a possible structure of the router 2 in FIG. 1.
  • the other routers in FIG. 1 may also adopt the structure diagram shown in FIG. 2.
  • the router 2 in FIG. 1 may include more than two interface boards.
  • Router 2 includes only one interface board and does not include a switching network board
  • the IP packets received through the ingress port of the interface board are processed by the interface board and then can go out through the egress port of the interface board.
  • Router 2 includes multiple interface boards and includes a switching network board
  • the IP packets received through the ingress port of one interface board of Router 2 can be processed by the switching network board and can be sent from the outgoing port of another interface board of Router Go out.
  • This application does not limit the specific structures of router 2 and other routers in FIG. 1.
  • the interface board 1230 can forward IP packets by looking up the routing table.
  • the interface board 1230 includes a central processing unit 1231, a network processor 1232, a physical interface card 1233, and a memory 1234. It should be noted that FIG. 2 does not show all the components that the interface board 1230 can contain.
  • the interface board 1230 may further include other components. For example, to enable the interface board 1230 to have queue scheduling and management functions, the interface board 1230 may further include a traffic manager.
  • the interface board 1230 may further include an ingress switching interface interface chip (iFIC).
  • iFIC ingress switching interface interface chip
  • the network processor 1232 can obtain the destination IP address in the IP packet.
  • the network processor 1232 may find a routing entry matching the IP packet in the routing table according to the longest prefix matching algorithm, and determine the port according to the routing entry matching the IP packet.
  • the routing entry matching the IP packet contains the identification of the outbound port.
  • the interface board 1230 can queue and manage the IP packets.
  • the interface board 1240 can forward IP packets by looking up the routing table.
  • the interface board 1240 includes a central processing unit 1241, a network processor 1242, a physical interface card 1243, and a memory 1244.
  • FIG. 2 does not show all the components that the interface board 1240 can contain.
  • the interface board 1240 may further include other components.
  • the interface board 1240 may further include a traffic manager.
  • the interface board 1240 may further include an egress switching interface interface chip (eFIC).
  • eFIC egress switching interface interface chip
  • the central processing unit 1241 may receive the routing table sent by the central processing unit 1211 and save the routing table to the memory 1244.
  • the network processor 1242 may be configured to receive an IP packet from the switching network board 1220.
  • the IP packet from the switching network board 1220 may be an IP packet sent by the router 1 received by the physical interface card 1233.
  • the network processor 1242 may look up a routing table entry matching the IP packet from the switching network board 1220 in the routing table of the memory 1244, and send an IP packet to the physical interface card 1243 according to the matching routing table entry.
  • the physical interface card 1243 can be used to send an IP packet to the router 4. Before the IP packet sent by the network processor 1242 to the physical interface card 1243 reaches the physical interface card 1243, the interface board 1240 can queue and manage the IP packets.
  • the data to be transmitted may need to be protected.
  • the data to be transmitted is encrypted.
  • the data to be transmitted may be integrity protected or not integrity protected.
  • the data to be transmitted may be encrypted or not encrypted.
  • the transmitting device may protect the data to be transmitted according to a certain protection protocol to generate protected data.
  • the data to be transmitted needs to be protected, but not yet protected. Therefore, the data to be transmitted can be referred to as data to be protected.
  • the sending device sends protection data to the receiving device.
  • the receiving device After receiving the integrity protection data, the receiving device checks the integrity protection data according to the integrity protection protocol, so as to determine that the integrity of the data is not damaged. Data transmitted between any two devices in the network shown in Figure 1 may need to be protected. The process of protecting data transmitted between Router 2 and Router 4 is exemplified below.
  • the host 1 may be a personal computer or a virtual machine running in a server (not shown in FIG. 1).
  • the server may be connected to the router 2 through a switch.
  • the host 2 may be connected to the router 4 through a switch (not shown in FIG. 1).
  • the host 2 may be a personal computer or a virtual machine running in a server (not shown in FIG. 1).
  • the server may be connected to the router 4 through a switch.
  • FIG. 3 is a schematic diagram of a possible structure of message 1.
  • the packet 1 includes an IP header, a TCP header, and data.
  • the IP header may be an IPv4 header.
  • the source IP address in the IP header can be the IP address of host 1.
  • the destination address in the IP header can be the IP address of host 2.
  • the TCP header includes a source port and a destination port.
  • the source port can be a port assigned by host 1.
  • the destination port can be the port assigned by host 2.
  • the content behind the IP header in packet 1 includes the TCP header and data.
  • the content behind the IP header in packet 1 is the data to be encrypted.
  • the IP header includes a protocol field.
  • the value of the protocol field is 0x06.
  • the protocol field is used to indicate that the protocol of the packet header following the IP header of packet 1 is TCP.
  • the packet 1 may not include a TCP header.
  • the value of the protocol field in message 1 may be 0xFF.
  • the network processor 1232 can process the message 1 by executing a computer program in the memory 1234. Specifically, the network processor 1232 may add an extended packet header, an ESP header, an ESP trailer, and an ESP integrity check value (ICV) to the packet 1 to generate the packet 2. For example, after the network interface card 1333 receives the message 1, the network processor 1232 may parse the message 1 to obtain the version field of the message 1. The version field is the first 4 bits of message 1. The network processor 1232 may determine that the message 1 is an IPv4 message according to the value of the version field.
  • FIG. 4 is a schematic diagram of a possible structure of the message 2. Referring to Figure 4, the extended packet header is located behind the IP header.
  • router 2 may set the value of the protocol field in the IP header in packet 1 to 0x8F or 0xFD.
  • the value of the protocol field is 0x8F or 0xFD, it indicates that the extended packet header is included in the message 2.
  • a computer program for generating the extended message header shown in FIG. 5 is stored in the router 2.
  • the processor in the router 2 may generate an extended packet header shown in FIG. 5 according to a computer program. Specifically, after the router 2 receives the message 1, when the router 2 determines that the content of the message 1 needs to be protected by using the ESP protocol, the processor in the router 2 can determine that the extension shown in FIG. 5 needs to be generated according to a computer program. Message header.
  • the router 4 stores a computer program for analyzing the extended message header shown in FIG. 5.
  • the processor in the router 4 may analyze the extended packet header shown in FIG. 5 included in the packet 2 according to the computer program. Specifically, after receiving the message 2 by the router 4, the router 4 can obtain the protocol field from the IP header. According to the value of the protocol field, it is determined that the extended packet header is included in the message 2. Further, the processor in router 2 can obtain the extended packet header from packet 2 according to the computer program, and parse the extended packet header according to the structure shown in FIG. 5 to obtain the extended packet shown in FIG. Field in the header.
  • the extended message header includes a type field.
  • the extended packet header further includes a flag field, an offset field, and a length field.
  • FIG. 5 is a schematic diagram of a possible structure of an extended packet header.
  • the type field is used to indicate a protection protocol.
  • the protection protocol is specifically an encryption protocol.
  • the encryption protocol is specifically the ESP protocol. Therefore, the type field can be used to indicate the ESP protocol.
  • the protection protocol involved in the structure shown in FIG. 5 is the ESP protocol.
  • the message 2 may also use other protection protocols, for example, the MACsec protocol or the Internet Authentication Header (AH) protocol.
  • AH Internet Authentication Header
  • Router 2 can use the ESP protocol to protect the contents of Message 1, or it can use the Media Access Control Security (MACsec) protocol to protect Message 1. Content is protected.
  • MACsec Media Access Control Security
  • AH protocol please refer to RFC4302.
  • MACsec you can refer to IEEE802.1AE issued by the Institute of Electrical and Electronics Engineers (Electronics and Electronics Engineers, IEEE).
  • the type field includes 8 bits. That is, the length of the type field can be 8 bits.
  • the type field in the extended packet header may indicate 256 protection protocols. For example, when the value of the type field is 0x00, the type field is used to indicate the ESP protocol. When the value of the type field is 0x01, the type field is used to indicate the MACsec protocol. When the value of the type field is 0x02, the type field is used to indicate the AH protocol.
  • the extended packet header is a packet header newly defined in this application.
  • the type field in the extended message header is a newly defined field in this application. Therefore, the value of the type field has not been assigned.
  • the number of values that can be used to indicate the type field of a protection protocol (such as an encryption protocol) may be greater than the number of values that can be used to indicate the type field of a protection protocol (such as an encryption protocol) in other technical solutions. For example, some values of the protocol field in the IP header have been assigned. Therefore, the number of values of the protocol field that can be used to indicate the protection protocol may be relatively small.
  • the extended packet header may further include an offset field.
  • the offset field is used to indicate a position of the encrypted data.
  • the encrypted data is not adjacent to the extended message header.
  • the encrypted data is adjacent to the ESP header, and the encrypted data is located behind the ESP header.
  • the offset field is used to indicate a starting position of the encrypted data.
  • the first bit after the extended packet header may be used as a reference, and the value of the offset field may be set to indicate the starting position of the encrypted data. For example, assuming that the length of the ESP header is 100 bits, the value of the offset field may be 100 bits.
  • the encrypted data includes a TCP header.
  • the encrypted data includes the data shown in FIG. 4 and the ESP tracker, excluding the TCP header.
  • the TCP header is plain text and the data is cipher text.
  • the offset field can be used to determine the starting position of the encrypted data.
  • the first bit after the ESP header can be used as a reference to indicate the starting position of the encrypted data by setting the value of the offset field.
  • the value of the offset field may be 160.
  • a receiving device for example, router 4 in FIG. 1) receiving the message 2 may determine that the start position of the encrypted data is the first bit of the data shown in FIG.
  • the router 4 can obtain the encrypted data from FIG. 4 and obtain the original data according to the decryption algorithm corresponding to the encryption protocol.
  • the raw data includes the data shown in FIG. 3. It can be understood that the original data is not encrypted by the encryption protocol.
  • the original data is data before encryption is performed according to an encryption protocol.
  • the offset field is used to indicate a position of protected data (for example, encrypted data).
  • the encryption protocol is the ESP protocol
  • the encrypted data is not adjacent to the extended packet header.
  • the receiver of message 2 for example, router 4
  • the offset field may not be included in the message 2.
  • Router 2 can obtain protection data (such as encrypted data) from message 2 according to the default location (such as the first bit after the extended message header).
  • the extended packet header further includes a length field.
  • the length field indicates the length of the extended packet header.
  • the length of the extended packet header may be 50 bits.
  • the value of the length field may be 50.
  • FIG. 12 is a schematic flowchart of a method 1200 for sending a message according to an embodiment.
  • the method 1200 includes S1202 and S1204.
  • the network device sends the first message.
  • the method shown in FIG. 12 can be applied to the network structure shown in FIG. 1. Specifically, UE1 in site1 needs to communicate with UE2 in site2. The message sent by UE1 needs to reach UE2 via router 2 and router 4.
  • router 2 may use the method provided in FIG. 12 to protect the original message. For example, the router 2 may use the method provided in FIG. 12 to encrypt the original message to obtain an encrypted message. After receiving the encrypted message, router 4 can decrypt the encrypted message to obtain the original message. Furthermore, router 4 sends an original message to UE2. As another example, router 2 may use the method provided in FIG. 12 to perform integrity protection on the original message, thereby obtaining an integrity protection message. After receiving the integrity protection message, router 4 can perform an integrity check on the integrity protection message to obtain the original message. Furthermore, router 4 sends an original message to UE2.
  • the receiving device may determine the AH protocol according to a type field in the extension header.
  • the receiving device may check the integrity of the IP data based on the integrity algorithm of the AH protocol, so as to determine to determine whether the integrity of the IP data is damaged. If the integrity of the IP data is not damaged, the receiving device (such as router 4 in FIG. 1) can generate an original IP message based on the new IP message and send the original IP message to the host 2 (such as UE2).
  • the first packet header may be MPLS header 1.
  • the second message header may be an extended header.
  • the protected data can be an MPLS payload.
  • the indication field may be a Label field in the MPLS header 3.
  • the new MPLS packet further includes an AH header.
  • the AH header is located between the extension header and the MPLS payload.
  • the second message header may be an extended header.
  • the protection data may include the Ethernet frame payload.
  • the protected data includes ETYPE.
  • the indication field may be a Protocol field in the IP header.
  • the value of the Protocol field may be 0xFC.
  • the Protocol field is used to indicate that the new IP packet includes the extension header.
  • the extension header includes a type field.
  • the type field is used to indicate the MACsec protocol. It can be understood that after the Ethernet frame payload in the original IP packet is protected by the first protection protocol (for example, the MACsec protocol), the Ethernet frame payload in the new IP packet is obtained. Specifically, the Ethernet frame payload in the original IP packet is processed based on the encryption algorithm of the MACsec protocol, so as to obtain the Ethernet frame payload in the new IP packet.
  • the value of the Ethernet frame payload in the original IP packet is not equal to the value of the Ethernet frame payload in the new IP packet.
  • MACsec protocol you can refer to IEEE802.1AE.
  • the receiving device may determine that the new IP packet includes the extended header according to the Protocol field. Further, the receiving device may determine the MACsec protocol according to a type field in the extension header. The receiving device can decrypt the new IP packet based on the decryption algorithm of the MACsec protocol. Specifically, the ETYPE and the Ethernet frame payload in the new IP packet are decrypted to obtain the original IP packet.
  • the receiving device (such as router 4 in FIG. 1) can send the original IP packet to host 2 (such as UE2).
  • the first protection protocol may be an encryption protocol.
  • the first protection protocol may be a MACsec protocol.
  • the network device may be router 2 in FIG. 1.
  • the first message may be a new VXLAN message in FIG. 9. Specifically, after receiving the original layer 2 frame (original L2 frame) in FIG. 10, router 2 may perform VXLAN encapsulation on the original layer 2 frame to obtain the original VXLAN packet. Router 2 can encrypt the original VXLAN packet according to the encryption algorithm specified by the MACsec protocol, thereby obtaining a new VXLAN packet.
  • the VXLAN header in FIG. 10 may specifically be a VXLAN GPE.
  • the first packet header may be a VXLAN header.
  • the second message header may be an extended header.
  • the protection data may include the Ethernet frame payload.
  • the protected data includes ETYPE.
  • the indication field may be a next protocol (Next Protocol) field in the VXLAN header.
  • the next protocol field is used to indicate that the new VXLAN packet includes the extension header.
  • the extension header includes a type field.
  • the type field is used to indicate the MACsec protocol. It can be understood that after the Ethernet frame payload in the original layer 2 frame is protected by the first protection protocol (for example, the MACsec protocol), the Ethernet frame payload in the new VXLAN packet is obtained.
  • the Ethernet frame payload in the original layer 2 frame is processed based on the encryption algorithm of the MACsec protocol, so as to obtain the Ethernet frame payload in the new VXLAN packet. Therefore, the value of the Ethernet frame payload in the original Layer 2 frame is not equal to the value of the Ethernet frame payload in the new VXLAN packet.
  • the receiving device may determine that the new VXLAN packet includes the extension header according to the next protocol field. Further, the receiving device may determine the MACsec protocol according to a type field in the extension header. The receiving device can decrypt the new VXLAN packet based on the decryption algorithm of the MACsec protocol. Specifically, the ETYPE and the Ethernet frame payload in the new VXLAN packet are decrypted to obtain the original layer 2 frame.
  • the receiving device (such as router 4 in FIG. 1) may send the original layer 2 frame to the host 2 (such as UE2).
  • the second packet header further includes an offset field, where the offset field is used to indicate a position of the protection data.
  • FIG. 13 is a schematic flowchart of a method 1300 for receiving a packet according to an embodiment. Referring to FIG. 13, the method includes S1302 and S1304.
  • the network device receives a first message.
  • the original data is not protected by the first protection protocol.
  • the method 1300 shown in FIG. 13 may be applied to the network structure shown in FIG. 1. Specifically, UE1 in site1 needs to communicate with UE2 in site2. The message sent by UE1 needs to reach UE2 via router 2 and router 4. During the transmission of the original message sent by UE1 to UE2 in the network, router 2 can use method 1200 to protect the original message. For example, router 2 may use method 1200 to encrypt the original message to obtain an encrypted message. Router 4 can use method 1300 to obtain the original message. Specifically, after receiving the encrypted message, the router 4 can decrypt the encrypted message to obtain the original message. Furthermore, router 4 sends an original message to UE2. As another example, router 2 may use the method provided in FIG.
  • Router 4 can use method 1300 to obtain the original message. Specifically, after receiving the integrity protection message, the router 4 may perform an integrity check on the integrity protection message to obtain the original message. Furthermore, router 4 sends an original message to UE2.
  • the first protection protocol may be an encryption protocol.
  • the first protection protocol may be a MACsec protocol.
  • the network device involved in the method 1300 may be the router 4 in FIG. 1.
  • the first message may be a new IP message in FIG. 9.
  • router 2 may generate a new IP packet based on the original IP packet.
  • the original IP packet includes the IP header and the IP payload.
  • the IP payload includes Ethernet frames.
  • the Ethernet frame includes an Ethernet frame header and an Ethernet frame payload.
  • the Ethernet frame header includes a destination MAC address (DMAC), a source MAC address (SMAC), and an Ethernet type (ETYPE).
  • DMAC destination MAC address
  • SMAC source MAC address
  • ETYPE Ethernet type
  • the first packet header may be an IP header.
  • the second message header may be an extended header.
  • the protection data may include the Ethernet frame payload.
  • the protected data includes ETYPE.
  • the indication field may be a Protocol field in the IP header.
  • the value of the Protocol field may be 0xFC.
  • the Protocol field is used to indicate that the new IP packet includes the extension header.
  • the extension header includes a type field.
  • the type field is used to indicate the MACsec protocol. It can be understood that after the Ethernet frame payload in the original IP packet is protected by the first protection protocol (for example, the MACsec protocol), the Ethernet frame payload in the new IP packet is obtained.
  • the execution body of the method 1200 may be the router 2.
  • the execution body of the method 1300 may be the router 4. Therefore, regarding the specific implementation of the method 1300 shown in FIG. 13, reference may be made to the description of the method 1200 shown in FIG. 12 in the embodiment.
  • FIG. 14 is a schematic diagram of a network device 1400 provided in the present application.
  • the network device 1400 may be applied to the network architecture shown in FIG. 1, and may be, for example, the router 1 in the network architecture shown in FIG. 1.
  • the network device 1400 may be used to perform the method 1200 shown in FIG. 12.
  • the network device 1400 may include a processor 810, a memory 820 coupled to the processor 810 and a transceiver 830.
  • the processor 810 may be a central processing unit (English: central processing unit, abbreviation: CPU), a network processor (English: network processor, abbreviation: NP), or a combination of CPU and NP.
  • the memory 820 may include volatile memory (English: volatile memory), such as random access memory (English: random-access memory, abbreviation: RAM); the memory may also include non-volatile memory (English: non-volatile memory) , Such as read-only memory (English: read-only memory, abbreviation: ROM), flash memory (English: flash memory), hard disk (English: hard disk drive, abbreviation: HDD) or solid state drive (English: solid-state drive , Abbreviation: SSD).
  • the memory 820 may also include a combination of the above-mentioned types of memories.
  • the memory 820 may refer to one memory, and may also include multiple memories.
  • the computer readable instructions are stored in the memory 820.
  • the computer readable instructions include multiple software modules, such as a sending module 821, a processing module 822, and a receiving module 823.
  • the processor 810 executes each software module, it can perform corresponding operations according to the instructions of each software module.
  • an operation performed by a software module actually refers to an operation performed by the processor 810 according to an instruction of the software module.
  • the receiving module 823 is configured to receive a message 1 from the UE1.
  • the processing module 822 is configured to generate the first message mentioned in the method 1200 according to the message 1.
  • the sending module 821 is configured to send the first packet to the router 4.
  • FIG. 15 is a schematic diagram of a network device 1500 provided in the present application.
  • the network device 1500 may be applied to the network architecture shown in FIG. 1, and may be, for example, the router 4 in the network architecture shown in FIG. 1.
  • the network device 1500 may be configured to execute the method 1300 shown in FIG. 13.
  • the network device 1500 may include a processor 910, a memory 920 coupled to the processor 910, and a transceiver 930.
  • the processor 910 may be a CPU, an NP, or a combination of a CPU and an NP.
  • the processor may further include a hardware chip.
  • the above hardware chip may be an ASIC, a PLD, or a combination thereof.
  • the processor 910 executes each software module, it can perform corresponding operations according to the instructions of each software module.
  • an operation performed by a software module actually refers to an operation performed by the processor 910 according to an instruction of the software module.
  • the receiving module 923 is configured to receive a first message from the router 2.
  • the processing module 922 is configured for the device to generate raw data according to the first message.
  • the original IP message in FIG. 9 contains the original data.
  • the sending module 921 is configured to send the original IP packet shown in FIG. 9 to the UE2.
  • the application also provides a non-volatile computer-readable storage medium.
  • the non-transitory computer-readable storage medium is used to store a computer program.
  • the processor may be caused to execute the method shown in FIG. 12 or FIG. 13. For details, refer to the description of the embodiment shown in FIG. 12 or FIG. 13, and details are not described herein again.
  • the first protection protocol is an encryption protocol or an integrity protection protocol.
  • the first protection protocol is an AH protocol, an ESP protocol, a MACsec protocol, a TLS protocol, or an SSL protocol.
  • the first packet header is an MPLS header
  • the indication field is an MPLS label field in the first packet header
  • the first packet header is an IP header
  • the indication field is a protocol field in the first packet header
  • the first packet header is a TCP header
  • the indication field is a reserved field or an options field.
  • the first packet header is an http header
  • the type field is an extended field
  • the software may be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of the present application are generated.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be from a website site, computer, server, or data center Transmission by wire (for example, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (for example, infrared, wireless, microwave, etc.) to another website site, computer, server, or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, and the like that includes one or more available medium integration.

Landscapes

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

Abstract

一种发送报文的方法。该方法包括网络设备生成第一报文,以及发送所述第一报文。所述第一报文包括第一报文头、第二报文头以及保护数据。所述第一报文头包括指示字段。所述指示字段用于指示所述第一报文中包括所述第二报文头。所述第二报文头包括类型字段。所述类型字段用于指示第一保护协议。所述保护数据是被所述第一保护协议保护的数据。上述技术方案中,第二报文头是本申请定义的报文头。第二报文头中的类型字段的取值没有被现有的协议定义。因此,类型字段可以指示更多种保护协议。因此,上述方案的可扩展性好,能够支持更多种类的保护协议。

Description

发送报文的方法、接收报文的方法及网络设备
本申请要求于2018年9月17日提交中国国家知识产权局、申请号为CN 201811083093.3、发明名称为“发送报文的方法、接收报文的方法及网络设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及通信技术领域,特别涉及发送报文的方法、接收报文的方法及网络设备。
背景技术
为了增强数据的安全性,现有的网络中传输的数据可以被某个协议保护。下文将被某个协议保护的数据简称为保护数据。将对数据进行保护的协议称为保护协议。
在网络中传输的保护数据可以具体被携带在报文中。具体地,报文头中可以包含用于指示保护数据对应的保护协议的字段。例如,以太网帧的报文头(以太网帧头)包含以太网类型(Ethernet type)字段。当Ethernet type字段的取值为0x88E5时,Ethernet type字段指示保护数据对应的保护协议是媒体访问控制安全(Media Access Control Security,MACsec)协议。
上述方案中,能够支持的保护协议的数量相对较少,可扩展性较差。
发明内容
本申请提供了发送报文的方法、接收报文的方法及网络设备。上述技术方案的可扩展性更好,能够支持更多种类的保护协议。
第一方面,提供了一种发送报文的方法。该方法包括网络设备生成第一报文,以及发送所述第一报文。所述第一报文包括第一报文头、第二报文头以及保护数据,所述第一报文头包括指示字段,所述指示字段用于指示所述第一报文中包括所述第二报文头,所述第二报文头包括类型字段,所述类型字段用于指示第一保护协议,所述保护数据是被所述第一保护协议保护的数据。
现有技术的方案中,使用报文头中的一个字段指示保护协议。下文将现有技术中,报文头中用于指示保护协议的字段称为特殊字段。特殊字段的某些取值可能已被某个协议定义。因此,特殊字段的可用取值范围可能受到了限制。例如,以太网帧包括以太网帧头以及净荷。以太网帧头包括ethernet type。ethernet type用于指示净荷中的报文的协议。例如,当以太网帧头中的ethernet type的取值为0x0800时,净荷中包含网际协议版本4(Internet Protocol version 4,IPv4)报文。当以太网帧头中的ethernet  type的取值为0x0806时,净荷中包含地址解析协议(Address Resolution Protocol,ARP)报文。因此,理论上ethernet type可以指示2的16次方种协议。由于ethernet type的某些值已被定义,产品实现时,ethernet type的可用的取值小于2的16次方。
本申请的方案中,第一报文的第一报文头中包含指示字段。所述指示字段指示所述第一报文中包括第二报文头。所述第二报文头包括类型字段,所述类型字段指示第一保护协议。以上意味着,本申请的方案只需要利用指示字段的一个可用取值,就可以实现指示字段指示所述第一报文包括所述第二报文头。第二报文头是本申请定义的报文头。第二报文头中的类型字段的可用取值范围没有受到限制。例如,当第二报文头的类型字段具有16个比特时,理论上第二报文头的类型字段可以指示2的16次方种保护协议。
因此,本申请的方案中,报文中的字段可以指示更多种保护协议。因此,本申请的方案的可扩展性更好,能够支持更多种类的保护协议。
在一种可能的设计中,所述第二报文头还包括偏移字段,所述偏移字段用于指示所述保护数据的位置。
接收到所述第一报文的接收设备可以根据偏移字段,确定保护数据的位置。进而,接收设备可以对保护数据进行去保护,从而得到原始数据。原始数据是没有被所述第一保护协议保护的数据。
所述接收设备可以根据类型字段指示的所述第一保护协议确定所述保护数据在所述第一报文中的位置。例如,当所述第一保护协议是封装安全载荷(Encapsulating Security Payload,ESP)协议时,所述接收设备可以确定所述保护数据位于所述第一报文的ESP头的后面。但是,所述接收设备基于所述第一保护协议确定所述保护数据在所述第一报文中的位置时,所述接收设备需要进行比较复杂的处理,确定所述保护数据在所述第一报文中的位置需要消耗较多的时长。基于所述偏移字段确定所述保护数据的位置比较容易实现,消耗的时长比较短。
在一种可能的设计中,所述第二报文头还包括长度字段,所述长度字段指示所述第二报文头的长度。
接收到所述第一报文的接收设备可以根据所述长度字段,确定保护协议头的位置。例如,当所述第一保护协议是ESP协议时,所述接收设备可以根据所述长度字段,确定ESP头在所述第一报文中的位置。进而,所述接收设备可以根据ESP协议的规定,对ESP头进行解析。
在一种可能的设计中,所述第二报文头还包括旗帜字段,所述旗帜字段指示所述第二报文头中包含所述偏移字段。
接收到所述第一报文的接收设备可以根据所述旗帜字段,确定所述第一报文中包含所述偏移字段。进而,所述接收设备可以获取所述偏移字段。并根据所述偏移字段,确定保护数据的位置。
第二方面,提供了一种接收报文的方法。所述方法包括:网络设备接收第一报文。所述第一报文包 括第一报文头、第二报文头以及保护数据,所述第一报文头包括指示字段,所述指示字段用于指示所述第一报文中包括所述第二报文头,所述第二报文头包括类型字段,所述类型字段用于指示第一保护协议,所述保护数据是被所述第一保护协议保护的数据。
所述方法还包括:所述网络设备根据所述第一保护协议和所述保护数据,获得原始数据,所述原始数据没有被所述第一保护协议保护。
上述技术方案中,第一报文可以是第一方面提及的网络设备发送的第一报文。
在一种可能的设计中,所述第二报文头还包括偏移字段,所述偏移字段用于指示所述保护数据的位置。
在一种可能的设计中,所述第二报文头还包括长度字段,所述长度字段指示所述第二报文头的长度。
在一种可能的设计中,所述第二报文头还包括旗帜字段,所述旗帜字段指示所述第二报文头中包含所述偏移字段。
第三方面,提供了一种网络设备。所述网络设备包括处理器以及与所述处理器耦合的存储器。所述存储器存储计算机程序。当所述计算机程序被所述处理器执行时,使得所述网络设备执行第一方面或者第一方面的任一可能的设计提供的方法。
第四方面,提供一种网络设备。所述网络设备包括处理器以及与所述处理器耦合的存储器。所述存储器存储计算机程序。当所述计算机程序被所述处理器执行时,使得所述网络设备执行第二方面或者第二方面的任一可能的设计提供的方法。
第五方面,提供一种通信系统,包括第三方面提供的网络设备和第四方面提供的网络设备。其中,第三方面提供的网络设备用于执行第一方面或者第一方面的任一可能的设计提供的方法。第四方面提供的网络设备用于执行第二方面或者第二方面的任一可能的设计提供的方法。
第六方面,本申请提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行第一方面或者第一方面的任一可能的设计提供的方法。
第七方面,本申请提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行第二方面或者第二方面的任一可能的设计提供的方法。
在一种可能的设计中,所述计算机可读存储介质是非易失性(non-transitory)计算机可读存储介质。
第八方面,本申请提供了一种计算机程序产品。所述计算机程序产品包括指令,当其在计算机上运行时,使得计算机执行第一方面或者第一方面的任一可能的设计提供的方法。或者,使得计算机执行第二方面或者第二方面的任一可能的设计提供的方法。
根据第一方面至第八方面提供的技术方案,在一种可能的设计中,所述第一保护协议是加密协议或者完整性保护协议。
根据第一方面至第八方面提供的技术方案,在一种可能的设计中,所述第一保护协议是认证头(Authentication Header,AH)协议、ESP协议、MACsec协议、传输层安全(Transport Layer Security,TLS)协议或者安全套接层(Secure Sockets Layer,SSL)协议。
根据第一方面至第八方面提供的技术方案,在一种可能的设计中,第一报文头为多协议标签交换(Multi-Protocol Label Switching,MPLS)header,所述指示字段为第一报文头中的MPLS Label字段。
根据第一方面至第八方面提供的技术方案,在一种可能的设计中,第一报文头为ethernet header,指示字段为第一报文头中的ethernet type字段。
根据第一方面至第八方面提供的技术方案,在一种可能的设计中,第一报文头为IP header,指示字段为第一报文头中的protocol字段。
根据第一方面至第八方面提供的技术方案,在一种可能的设计中,第一报文头为传输控制协议(Transmission Control Protocol,TCP)header,指示字段为保留(reserved)字段或者选项(options)字段。
根据第一方面至第八方面提供的技术方案,在一种可能的设计中,第一报文头为超文本传输协议(HyperText Transfer Protocol,HTTP)头,类型字段为扩展字段。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍。显而易见地,下面描述中的附图仅仅是本申请的一些实施例。
图1为本申请提供的一个组网结构图;
图2为本申请提供的路由器的结构示意图;
图3为本申请提供的一个IP报文的结构示意图;
图4为本申请提供的一个IP报文的结构示意图;
图5为本申请提供的一个报文头的结构示意图;
图6为本申请提供的IP报文的结构示意图;
图7为本申请提供的MPLS报文的结构示意图;
图8为本申请提供的MPLS头的结构示意图;
图9为本申请提供的IP报文的结构示意图;
图10为本申请提供的原始二层帧以及VXLAN报文的结构示意图;
图11为本申请提供的VXLAN GPE的结构示意图;
图12为本申请提供的一种方法的流程示意图;
图13为本申请提供的一种方法的流程示意图;
图14为本申请提供的一种网络设备的结构示意图;
图15为本申请提供的一种网络设备的结构示意图。
具体实施方式
在数据通信领域,报文有可能需要经过多台转发装置转发后才能到达目的地。转发装置可以是路由器。路由器可以对因特网协议(internet protocol,IP)报文进行转发。转发装置可以是网络交换机。网络交换机可以对以太网帧进行转发。图1为本申请提供的一个组网结构图。参见图1,组网结构图中包含路由器1至路由器7以及多个以太网虚拟专用网(Ethernet virtual private network,EVPN)站点(site)。所述多个EVPN站点包括site1和site2。site1和site2属于同一个EVPN实例(例如EVPN1)。每个site可以包括用户边缘(custom edge,CE)设备以及主机。所述主机可以是用户设备(user equipment,UE)。每个路由器可以包含多个物理接口卡。每个物理接口卡可以包含多个端口。图1中示出了路由器1中的2个出端口(第一出端口、第二出端口),以及路由器2中的2个出端口(第三出端口、第四出端口)。路由器1通过所述第一出端口与路由器2相连。路由器1通过所述第二出端口与路由器3相连。路由器2通过所述第三出端口与路由器4相连。路由器2通过所述第四出端口与路由器5相连。
路由器1接收到一个报文后,路由器1确定用于转发该报文的出端口,例如第一出端口,并将该报文从第一出端口转发出去。路由器2接收到路由器1转发的报文后,路由器2确定用于转发该报文的出端口,例如第三出端口,并将该报文从第三出端口转发出去。
图1中的路由器2可以是PE。路由器4可以是PE。路由器2可以连接CE1。Site1内的主机(例如UE1)可以经由CE1与site1外部的主机(例如UE2)通信。路由器4可以连接CE2。Site2内的主机(例如UE2)可以经由CE2与site2外部的主机(例如UE1)通信。
图2为图1中的路由器2的一种可能的结构示意图。图1中的其他路由器(例如路由器4、CE1以及CE2)也可以采用图2所示的结构示意图。
参见图2,路由器2包括控制板1210、交换网板1220、接口板1230以及接口板1240。控制板1210包括中央处理器1211。控制板1210可以用于执行路由协议。路由协议可以是边界网关协议(Border Gateway Protocol,BGP)或者内部网关协议(Interior Gateway Protocol,IGP)。控制板1210可以通过执行路由协议生成路由表,并向接口板1230和1240发送路由表。需要说明的是,图1中的路由器2也可以采用与图2所示的结构不同的结构。例如,图1中的路由器2可以只包括一个控制板和一个接口板,不包括交换网板。当然,图1中的路由器2可以包括两个以上的接口板。当路由器2只包括一个接口板,不包括交换网板时,经由该接口板的入端口接收的IP报文经该接口板处理后,可以从该接口板的出端口出去。当路由器2包括多个接口板,并包括交换网板时,经由路由器2的一个接口板的入端口接收的IP报文经交换网板处理后,可以从路由器2的另一个接口板的出端口出去。本申请对路由器2以及图1中的其他路由器的具体结构不做限定。
接口板1230可以通过查找路由表,对IP报文进行转发。具体来说,接口板1230包括中央处理器1231、网络处理器1232、物理接口卡1233以及存储器1234。需要说明的是,图2并没有示出接口板1230能够包含的所有部件。具体实现时,接口板1230还可以包含其他部件。例如,为使得接口板1230 具备队列调度和管理的功能,接口板1230还可以包含流量管理器。另外,为使得来自接口板1230的报文能够经由交换网板1220被交换到接口板1240,接口板1230还可以包含入口交换网接口芯片(ingress fabric interface chip,iFIC)。中央处理器1231可以接收中央处理器1211发送的路由表,并将路由表保存至存储器1234。物理接口卡1233可以用于接收路由器1发送的IP报文。网络处理器1232可以在存储器1234的路由表中查找与物理接口卡1233接收的IP报文匹配的路由表项,并根据匹配的路由表项,向交换网板1220发送IP报文。交换网板1220可以用于将来自一个接口板的IP报文交换到另一接口板。例如,交换网板1220可以将来自接口板1230的IP报文交换到接口板1240。具体地,交换网板1220可以以信元交换的方式将来自接口板1230的IP报文交换到接口板1240。举例来说,网络处理器1232可以获取IP报文中的目的IP地址。网络处理器1232可以根据最长前缀匹配算法在路由表中查找与IP报文匹配的路由表项,并根据与IP报文匹配的路由表项确定出端口。与IP报文匹配的路由表项中包含了出端口的标识。网络处理器1232向交换网板1220发送的IP报文到达交换网板1220前,接口板1230可以对IP报文进行队列调度和管理。
接口板1240可以通过查找路由表,对IP报文进行转发。接口板1240包括中央处理器1241、网络处理器1242、物理接口卡1243以及存储器1244。图2并没有示出接口板1240能够包含的所有部件。具体实现时,接口板1240还可以包含其他部件。例如,为使得接口板1240具备队列调度和管理的功能,接口板1240还可以包含流量管理器。另外,为使得接口板1240能够正确经由交换网板1220接收来自接口板1230的报文,接口板1240还可以包含出口交换网接口芯片(egress fabric interface chip,eFIC)。中央处理器1241可以接收中央处理器1211发送的路由表,并将路由表保存至存储器1244。网络处理器1242可以用于接收来自交换网板1220的IP报文。来自交换网板1220的IP报文可以是物理接口卡1233接收的路由器1发送的IP报文。网络处理器1242可以在存储器1244的路由表中查找与来自交换网板1220的IP报文匹配的路由表项,并根据匹配的路由表项,向物理接口卡1243发送IP报文。物理接口卡1243可以用于向路由器4发送的IP报文。网络处理器1242向物理接口卡1243发送的IP报文到达物理接口卡1243前,接口板1240可以对IP报文进行队列调度和管理。
图1所示的网络中的设备进行通信时,可能需要对待传输的数据进行保护。例如,对待传输的数据进行加密。或者,对待传输的数据进行完整性保护。可以理解,对待传输的数据进行加密时,可以对待传输的数据进行完整性保护或者不进行完整性保护。对待传输的数据进行完整性保护时,可以对待传输的数据进行加密或者不进行加密。在一种可能的设计中,发送设备向接收设备传输数据前,发送设备可以根据某种保护协议对待传输的数据进行保护,生成保护数据。待传输的数据需要进行保护,但尚未被保护。因此,可以将待传输的数据称为待保护数据。发送设备向接收设备发送保护数据。接收设备接收到保护数据后,根据该保护协议,对保护数据进行处理,从而获得待传输的数据。例如,发送设备可以根据加密协议对待传输的数据进行加密,生成加密数据。待传输的数据需要进行加密,但尚未被加密。因此,可以将待传输的数据称为待加密数据。接收设备收到加密数据后,根据加密协议对加密数据进行解密,从而获得所述数据。再例如,发送设备可以根据完整性保护协议对待传输的数据进行完整性保护,生成完整性保护数据。待传输的数据需要进行完整性保护,但尚未被完整性保护。因此,可以将待传输的数据称为待完整性保护数据。接收设备收到完整性保护数据后,根据完整性保护协议对完整性保护数据进行检查,从而确定所述数据的完整性没有被破坏。图1所示的网络中的任意两个设备之间传输的数据可能需要进行保护。下文对路由器2和路由器4之间传输的数据进行保护的过程进行举例说明。
在一种可能的设计中,路由器2和路由器4都支持IPsec协议。例如,存储器1234中保存了用于执行IPsec协议的计算机程序。网络处理器1232通过执行所述计算机程序,执行IPsec协议。IPsec 协议可以包括封装安全净荷(Encapsulating Security Payload,ESP)协议。路由器2经由CE1连接到主机1(例如UE1)。路由器4经由CE2连接到主机2(例如UE2)。主机1向主机2发送的报文经由路由器2和路由器4转发。路由器2对接收到的报文1使用ESP协议进行加密。报文1可以是IP报文。报文1也可以来自于主机1。主机1可以通过交换机(图1中未示出)连接到路由器2。主机1可以是个人电脑,也可以是运行在服务器(图1中未示出)中的虚拟机。所述服务器可以通过交换机连接到路由器2。主机2可以通过交换机(图1中未示出)连接到路由器4。主机2可以是个人电脑,也可以是运行在服务器(图1中未示出)中的虚拟机。所述服务器可以通过交换机连接到路由器4。
图3为报文1的一种可能的结构示意图。参见图3,报文1包括IP头、TCP头以及数据。例如,IP头可以是IPv4头。IP头中的源IP地址可以是主机1的IP地址。IP头中的目的地址可以是主机2的IP地址。TCP头包括源端口和目的端口。源端口可以是主机1分配的端口。目的端口可以是主机2分配的端口。报文1中IP头后的内容包括TCP头以及数据。报文1中IP头后的内容为待加密数据。IP头包括协议(protocol)字段。协议字段的值为0x06。协议字段用于指示报文1的IP头后面的报文头的协议是TCP。在一种的可能的实现方式中,报文1可以不包含TCP头。报文1中的协议字段的值可以是0xFF。
路由器2接收到报文1后,网络处理器1232可以通过执行存储器1234中的计算机程序,对报文1进行处理。具体地,网络处理器1232可以在报文1中增加扩展报文头、ESP头、ESP追踪者(trailer)以及ESP完整性检查值(Integrity Check Value,ICV),从而生成报文2。例如,网络接口卡1333接收到报文1后,网络处理器1232可以对报文1进行解析,从而获取报文1的版本(version)字段。版本字段是报文1的前4个比特。网络处理器1232可以根据版本字段的值确定报文1是IPv4报文。图4为报文2的一种可能的结构示意图。参见图4,扩展报文头位于IP头的后面。ESP头位于TCP头的前面。ESP头包括安全参数索引(Security Parameters Index,SPI)、序列号(Sequence Number),净荷数据(payload data)。ESP追踪者包括填充(padding),填充长度(pad length)以及下一个头域(next header fields)。净荷数据是使用加密算法(encryption algorithm)对待加密数据进行处理得到的。净荷数据可以具有子结构(substructure)。路由器2根据报文1生成报文2的过程中,路由器2可以使用某种加密协议(例如ESP协议)对报文1中的待加密数据(参见图3中的TCP头以及数据)进行加密,从而得到加密数据。参见图4,加密数据可以包括TCP头以及数据。此外,加密数据还可以包括ESP追踪者。关于图4所示的报文2涉及的字段的含义以及具体实现方式,可以参考网际工程任务组(Internet Engineering Task Force,IETF)发布的请求评论(Request for Comments,RFC)4303中的描述,此处不再赘述。
路由器2根据报文1生成报文2的过程中,网络处理器1232可以将报文1中的IP头中的协议字段的值设置为未分配的(unassigned)值,或者用于实验和测试的(Use for experimentation and testing)值。本领域的技术人员可以理解,一些协议字段的值已被分配。例如,0x06已被分配。具体地,0x06用于指示传输控制协议(Transmission Control Protocol,TCP)。再例如,0x02已被分配。具体地,0x02用于指示因特网组管理协议(Internet Group Management Protocol,IGMP)。0x8F至0xFC尚未被分配。0xFD和0xFE是用于实验和测试的值。在一种可能的设计中,路由器2可以将报文1中的IP头中的协议字段的值设置为0x8F或者0xFD。当协议字段的值为0x8F或者0xFD时,指示报文2中包含扩展报文头。
路由器2中保存了用于生成图5所示的扩展报文头的计算机程序。路由器2中的处理器可以根据计 算机程序,生成图5所示的扩展报文头。具体地,路由器2接收到报文1后,当路由器2确定需要使用ESP协议对报文1中的内容进行保护时,路由器2中的处理器可以根据计算机程序确定需要生成图5所示的扩展报文头。
路由器4中保存了用于解析图5所示的扩展报文头的计算机程序。路由器4中的处理器可以根据计算机程序,对报文2中包含的图5所示的扩展报文头进行解析。具体地,路由器4接收到报文2后,路由器4可以从IP头中获取协议字段。根据协议字段的值确定报文2中包含扩展报文头。进而,路由器2中的处理器可以根据计算机程序从报文2中获取扩展报文头,并根据图5所示的结构,对扩展报文头进行解析,从而获取图5所示的扩展报文头中的字段。
扩展报文头包括类型字段。在一种可能的设计中,扩展报文头还包括旗帜字段、偏移字段以及长度字段。图5为扩展报文头的一种可能的结构示意图。所述类型字段用于指示一种保护协议。本实施例中,保护协议具体为加密协议。加密协议具体为ESP协议。因此,所述类型字段可以用于指示ESP协议。图5所示的结构中涉及的保护协议是ESP协议。报文2也可以采用其他保护协议,例如,MACsec协议或者因特网认证头(IP Authentication Header,AH)协议。也就是说,路由器2接收到报文1后,路由器2可以采用ESP协议对报文1中的内容进行保护,也可以采用媒体访问控制安全(Media Access Control Security,MACsec)协议对报文1中的内容进行保护。关于AH协议,可以参考RFC4302。关于MACsec,可以参考电气和电子工程师协会(Institute of Electrical and Electronics Engineers,IEEE)发布的IEEE802.1AE。
在一种可能的设计中,类型字段包括8个比特。也就是说,类型字段的长度可以是8个比特。在上述场景中,扩展报文头中的类型字段可以指示256种保护协议。例如,当类型字段的值为0x00时,类型字段用于指示ESP协议。当类型字段的值为0x01时,类型字段用于指示MACsec协议。当类型字段的值为0x02时,类型字段用于指示AH协议。
根据上述技术方案可以看出,扩展报文头是本申请新定义的报文头。扩展报文头中的类型字段是本申请新定义的字段。因此,类型字段的值尚未被分配过。能够用于指示保护协议(例如加密协议)的类型字段的值的数量可以大于其他技术方案中,能够用于指示保护协议(例如加密协议)的类型字段的值的数量。例如,IP头中的协议字段的一些值已被分配过。因此,能够用于指示保护协议的协议字段的值的数量可能相对较少。
参见图5,扩展报文头还可以包括偏移字段。所述偏移字段用于指示所述加密数据的位置。图4所示的报文2中,加密数据与扩展报文头不相邻。具体地,加密数据与ESP头相邻,并且加密数据位于ESP头的后面。具体来说,所述偏移字段用于指示所述加密数据的起始位置。在一种可能的实现方式中,可以以扩展报文头之后的首个比特为基准,通过设置所述偏移字段的值,从而指示所述加密数据的起始位置。例如,假设ESP头的长度为100比特,则所述偏移字段的值可以是100比特。在一种可能的实现方式中,可以以扩展报文头的首个比特为基准,通过设置所述偏移字段的值,从而指示所述加密数据的起始位置。例如,假设扩展报文头的长度为50比特,ESP头的长度为100比特,则所述偏移字段的值可以是150。在一种可能的实现方式中,可以以ESP头之后的首个比特为基准,通过设置所述偏移字段的值,从而指示所述加密数据的起始位置。根据图4,ESP头之后的首个比特是TCP头的第一个比特。TCP头的第一个比特是加密数据的起始位置。因此,所述偏移字段的值可以是0。
图4所示的报文2中,加密数据包括TCP头。在一种可能的实现方式中,加密数据包括图4所示的数据以及ESP追踪者,不包括TCP头。TCP头为明文,数据为密文。在上述场景中,可以利用偏移字段确定加密数据的起始位置。例如,可以以ESP头之后的首个比特为基准,通过设置所述偏移字段的值,从而指示所述加密数据的起始位置。当TCP头的长度为160比特时,所述偏移字段的值可以是160。接 收到报文2的接收设备(例如图1中的路由器4)可以根据所述偏移字段的值,确定所述加密数据的起始位置为图4所示的数据的第一个比特。进而,路由器4可以从图4中获取加密数据,并根据加密协议对应的解密算法,获取原始数据。原始数据包括图3所示的数据。可以理解,所述原始数据没有被所述加密协议加密。所述原始数据是根据加密协议执行加密前的数据。
上述技术方案中,偏移字段用于指示保护数据(例如加密数据)的位置。当加密协议是ESP协议时,加密数据没有与扩展报文头相邻。这种情况下,如果没有偏移字段,报文2的接收者(例如路由器4)可能难以确定加密数据在报文2中的位置。在一种可能的实现方式中,当路由器2采用其他加密协议对报文1进行加密时,加密数据可能与扩展协议头相邻,并且位于扩展协议头的后面。这种情况下,报文2中可以不包含偏移字段。路由器2可以根据默认的位置(例如扩展报文头之后的首个比特),从报文2中获取保护数据(例如加密数据)。
参见图5,所述扩展报文头还包括长度字段。所述长度字段指示所述扩展报文头的长度。举例来说,所述扩展报文头的长度可以是50比特。所述长度字段的值可以是50。
参见图5,所述扩展报文头还包括旗帜字段,所述旗帜字段指示所述扩展报文头中包含所述偏移字段。例如,旗帜字段包括1个比特。当旗帜字段的值为1时,指示所述扩展报文头中包含所述偏移字段。当旗帜字段的值为0时,指示所述扩展报文头中不包含所述偏移字段。报文2的接收者(例如路由器4)接收到报文2时,可以根据旗帜字段的值确定报文2中是否包含偏移字段。当确定报文2中包含偏移字段时,可以根据偏移字段的值确定所述加密数据的位置。进而,路由器4可以从报文2中获取所述加密数据,并根据加密协议(例如ESP协议)对加密数据进行处理。具体地,路由器4可以根据ESP协议以及报文2中的ESP头,对加密数据进行解密,从而获得待加密的数据。具体地,路由器4可以根据图4中的报文2,获得图3中的TCP头以及数据。路由器4向主机2发送报文1。例如,路由器4根据报文1中的目的IP地址,在路由器4中的路由表中查找与目的IP地址匹配的表项。所述表项中包含出端口的标识。路由器4经由所述出端口向所述主机发送报文1。
图12为实施例提供的一种发送报文的方法1200的流程示意图。参见图12,方法1200包括S1202以及S1204。
S1202,网络设备生成第一报文。
所述第一报文包括第一报文头、第二报文头以及保护数据。所述第一报文头包括指示字段。所述指示字段用于指示所述第一报文中包括所述第二报文头。所述第二报文头包括类型字段。所述类型字段用于指示第一保护协议。所述保护数据是被所述第一保护协议保护的数据。
S1204,所述网络设备发送所述第一报文。
图12所示的方法可以应用于图1所示的网络结构中。具体地,site1中的UE1需要和site2中的UE2通信。UE1发送的报文需要经由路由器2以及路由器4到达UE2。UE1向UE2发送的原始报文在网络中传输过程中,路由器2可以利用图12提供的方法对原始报文进行保护。例如,路由器2可以利用图12提供的方法对原始报文进行加密,从而得到加密报文。路由器4接收到加密报文后,可以对加密报文进行解密,从而获得原始报文。进而,路由器4向UE2发送原始报文。再例如,路由器2可以利用图12提供的方法对原始报文进行完整性保护,从而得到完整性保护报文。路由器4接收到完整性保护报文后,可以对完整性保护报文进行完整性检查,从而获得原始报文。进而,路由器4向UE2发送原始报文。
举例来说,方法1200涉及的网络设备可以是图1中的路由器2。路由器2可以向路由器4发送所述第一报文。第一报文可以是图4所示的报文2。第一报文头可以是图4所示的IP头。第二报文头可 以是扩展报文头。保护数据可以包括图4所示的TCP头以及数据。另外,保护数据还可以包括图4中的ESP追踪者。第一保护协议可以是加密协议。所述加密协议可以是ESP协议。所述类型字段可以是图4所示的IP头中的Protocol字段。可以理解,图3中的TCP头被所述第一保护协议(例如ESP协议)保护后,获得图4中的TCP头。图3中的TCP头被ESP协议加密,从而得到图4中的TCP头。因此,图3中的TCP头的值可能不等于图4中的TCP头的值。基于相同的原理,图3中的数据的值可能不等于图4中的数据的值。
在一种可能的设计中,所述第一保护协议可以是完整性保护协议。例如,第一保护协议可以是AH协议。下面结合图6对第一保护协议是AH协议的场景进行举例说明。网络设备可以是图1中的路由器2。所述第一报文可以是图6中的新的IP报文。具体地,路由器2收到图6中的原始IP报文后,可以根据原始IP报文,生成新的IP报文。第一报文头可以是IP头。第二报文头可以是扩展头。保护数据可以是IP数据。所述指示字段可以是IP头中的Protocol字段。例如,所述Protocol字段的值可以是0xFC。所述Protocol字段用于指示所述新的IP报文中包含所述扩展头。所述扩展头包括类型字段。所述类型字段用于指示AH协议。可以理解,原始IP报文中的IP数据被所述第一保护协议(例如AH协议)保护后,获得新的IP报文中的IP数据。具体地,原始IP报文中的IP数据基于AH协议的完整性算法被处理,从而得到新的IP报文中的IP数据。因此,原始IP报文中的IP数据的值等于新的IP报文中的IP数据的值。关于AH协议,可以参考RFC4302。所述新的IP报文被接收设备(例如图1中的路由器4)接收后,接收设备可以根据所述Protocol字段确定所述新的IP报文中包含所述扩展头。进一步的地,接收设备可以根据所述扩展头中的类型字段确定AH协议。接收设备可以基于AH协议的完整性算法对IP数据的完整性进行检查,从而确定从而确定所述IP数据的完整性是否被破坏。如果IP数据的完整性没有被破坏,则接收设备(例如图1中的路由器4)可以将根据新的IP报文生成原始IP报文,并向主机2(例如UE2)发送原始IP报文。
在一种可能的设计中,图1中的路由器2和路由器4都支持MPLS协议。网络设备可以是图1中的路由器2。所述第一报文可以是图7中的新的MPLS报文。具体地,路由器2收到主机1(例如UE1)发送的原始IP报文后,可以对原始IP报文进行封装,从而生成图7所示的原始MPLS报文。原始MPLS报文中的MPLS净荷包含原始IP报文。进一步地,路由器2可以根据原始MPLS报文,生成新的MPLS报文。参见图7,原始MPLS报文包括MPLS头1以及MPLS净荷。相对于原始MPLS报文,新的MPLS报文还包含MPLS头2、MPLS头3以及扩展头。关于原始MPLS报文中的MPLS头1以及新的MPLS报文中的MPLS头1、MPLS头2以及MPLS头3的结构可以参考图8。需要说明的是,原始MPLS报文中的MPLS头1中的S字段的值为1。新的MPLS报文中的MPLS头1中的S字段的值为0。另外,MPLS头2中的S字段的值为0,Label字段的值为15。MPLS头3中的S字段的值为0,Label字段的值为252。第一报文头可以是MPLS头1。第二报文头可以是扩展头。保护数据可以是MPLS净荷。所述指示字段可以是MPLS头3中的Label字段。例如,MPLS头3中的Label字段的值可以是252。MPLS头3中的Label字段用于指示所述新的MPLS报文中包含所述扩展头。所述扩展头包括类型字段。所述类型字段用于指示保护协议。保护协议用于对MPLS净荷进行保护。所述保护协议可以是加密协议或者完整性保护协议。在一种可能的设计中,所述保护协议可以是ESP协议。当所述保护协议是ESP协议时,新的MPLS报文还包括ESP头。该ESP头位于扩展头和MPLS净荷之间。关于所述保护协议是ESP协议的具体实现方式,可以参考图4对应的实施例。在一种可能的设计中,所述保护协议可以是AH协议。当所述保护协议是AH协议时,新的MPLS报文还包括AH头。该AH头位于扩展头和MPLS净荷之间。关于所述保护协议是AH协议的具体实现方式,可以参考图6对应的实施例。
在一种可能的设计中,所述第一保护协议可以是加密协议。例如,第一保护协议可以是MACsec协 议。下面结合图9对第一保护协议是MACsec协议的场景进行举例说明。网络设备可以是图1中的路由器2。所述第一报文可以是图9中的新的IP报文。具体地,路由器2收到图9中的原始IP报文后,可以根据原始IP报文,生成新的IP报文。原始IP报文包括IP头以及IP净荷。IP净荷包括以太网帧。以太网帧包括以太网帧头以及以太网帧净荷。以太网帧头包括目的MAC地址(DMAC)、源MAC地址(SMAC)以及以太网类型(ETYPE)。第一报文头可以是IP头。第二报文头可以是扩展头。保护数据可以包括以太网帧净荷。此外,保护数据还包括ETYPE。所述指示字段可以是IP头中的Protocol字段。例如,所述Protocol字段的值可以是0xFC。所述Protocol字段用于指示所述新的IP报文中包含所述扩展头。所述扩展头包括类型字段。所述类型字段用于指示MACsec协议。可以理解,原始IP报文中的以太网帧净荷被所述第一保护协议(例如MACsec协议)保护后,获得新的IP报文中的以太网帧净荷。具体地,原始IP报文中的以太网帧净荷基于MACsec协议的加密算法被处理,从而得到新的IP报文中的以太网帧净荷。因此,原始IP报文中的以太网帧净荷的值不等于新的IP报文中的以太网帧净荷的值。关于MACsec协议,可以参考IEEE802.1AE。所述新的IP报文被接收设备(例如图1中的路由器4)接收后,接收设备可以根据所述Protocol字段确定所述新的IP报文中包含所述扩展头。进一步的地,接收设备可以根据所述扩展头中的类型字段确定MACsec协议。接收设备可以基于MACsec协议的解密算法对新的IP报文进行解密。具体地,对新的IP报文中的ETYPE以及以太网帧净荷进行解密,从而获得原始IP报文。接收设备(例如图1中的路由器4)可以向主机2(例如UE2)发送原始IP报文。
在一种可能的设计中,所述第一保护协议可以是加密协议。例如,第一保护协议可以是MACsec协议。下面结合图10和图11对第一保护协议是MACsec协议的场景进行举例说明。网络设备可以是图1中的路由器2。所述第一报文可以是图9中的新的VXLAN报文。具体地,路由器2收到图10中的原始二层帧(original L2 frame)后,可以对原始二层帧进行VXLAN封装,得到原始VXLAN报文。路由器2可以根据MACsec协议规定的加密算法对原始VXLAN报文进行加密,从而得到新的VXLAN报文。图10中的VXLAN头具体可以是VXLAN GPE。关于图10中的VXLAN头的结构,可以参见图11中的VXLAN GPE。具体地,VXLAN GPE包括旗帜字段、保留1字段、下一个协议字段、VNI字段以及保留2字段。其中,旗帜字段为一个字节。保留1字段为2个字节。下一个协议字段为1个字节。VNI字段为3个字节。保留2字段为1个字节。关于图11中的各个字段的取值和功能,请参考draft-quinn-vxlan-gpe-03。原始二层帧包括以太网帧头以及以太网帧净荷。以太网帧头包括目的MAC地址(DMAC)、源MAC地址(SMAC)以及以太网类型(ETYPE)。第一报文头可以是VXLAN头。第二报文头可以是扩展头。保护数据可以包括以太网帧净荷。此外,保护数据还包括ETYPE。所述指示字段可以是VXLAN头中的下一个协议(Next Protocol)字段。所述下一个协议字段用于指示所述新的VXLAN报文中包含所述扩展头。所述扩展头包括类型字段。所述类型字段用于指示MACsec协议。可以理解,原始二层帧中的以太网帧净荷被所述第一保护协议(例如MACsec协议)保护后,获得新的VXLAN报文中的以太网帧净荷。具体地,原始二层帧中的以太网帧净荷基于MACsec协议的加密算法被处理,从而得到新的VXLAN报文中的以太网帧净荷。因此,原始二层帧中的以太网帧净荷的值不等于新的VXLAN报文中的以太网帧净荷的值。所述新的VXLAN报文被接收设备(例如图1中的路由器4)接收后,接收设备可以根据所述下一个协议字段确定所述新的VXLAN报文中包含所述扩展头。进一步的地,接收设备可以根据所述扩展头中的类型字段确定MACsec协议。接收设备可以基于MACsec协议的解密算法对新的VXLAN报文进行解密。具体地,对新的VXLAN报文中的ETYPE以及以太网帧净荷进行解密,从而获得原始二层帧。接收设备(例如图1中的路由器4)可以向主机2(例如UE2)发送原始二层帧。
在一种可能的设计中,所述第二报文头还包括偏移字段,所述偏移字段用于指示所述保护数据的位置。
图13为实施例提供的一种接收报文的方法1300的流程示意图。参见图13,所述方法包括S1302以及S1304。
S1302,网络设备接收第一报文。
所述第一报文包括第一报文头、第二报文头以及保护数据,所述第一报文头包括指示字段,所述指示字段用于指示所述第一报文中包括所述第二报文头,所述第二报文头包括类型字段,所述类型字段用于指示第一保护协议,所述保护数据是被所述第一保护协议保护的数据。
S1304,所述网络设备根据所述第一保护协议和所述保护数据,获得原始数据。
所述原始数据没有被所述第一保护协议保护。
图13所示的方法1300可以应用于图1所示的网络结构中。具体地,site1中的UE1需要和site2中的UE2通信。UE1发送的报文需要经由路由器2以及路由器4到达UE2。UE1向UE2发送的原始报文在网络中传输过程中,路由器2可以利用方法1200对原始报文进行保护。例如,路由器2可以利用方法1200对原始报文进行加密,从而得到加密报文。路由器4可以利用方法1300获得原始报文。具体地,路由器4接收到加密报文后,可以对加密报文进行解密,从而获得原始报文。进而,路由器4向UE2发送原始报文。再例如,路由器2可以利用图12提供的方法对原始报文进行完整性保护,从而得到完整性保护报文。路由器4可以利用方法1300获得原始报文。具体地,路由器4接收到完整性保护报文后,可以对完整性保护报文进行完整性检查,从而获得原始报文。进而,路由器4向UE2发送原始报文。
在一种可能的设计中,所述第一保护协议可以是加密协议。例如,第一保护协议可以是MACsec协议。下面结合图9对第一保护协议是MACsec协议的场景进行举例说明。方法1300涉及的网络设备可以是图1中的路由器4。所述第一报文可以是图9中的新的IP报文。具体地,路由器2收到图9中的原始IP报文后,可以根据原始IP报文,生成新的IP报文。原始IP报文包括IP头以及IP净荷。IP净荷包括以太网帧。以太网帧包括以太网帧头以及以太网帧净荷。以太网帧头包括目的MAC地址(DMAC)、源MAC地址(SMAC)以及以太网类型(ETYPE)。第一报文头可以是IP头。第二报文头可以是扩展头。保护数据可以包括以太网帧净荷。此外,保护数据还包括ETYPE。所述指示字段可以是IP头中的Protocol字段。例如,所述Protocol字段的值可以是0xFC。所述Protocol字段用于指示所述新的IP报文中包含所述扩展头。所述扩展头包括类型字段。所述类型字段用于指示MACsec协议。可以理解,原始IP报文中的以太网帧净荷被所述第一保护协议(例如MACsec协议)保护后,获得新的IP报文中的以太网帧净荷。具体地,原始IP报文中的以太网帧净荷基于MACsec协议的加密算法被处理,从而得到新的IP报文中的以太网帧净荷。因此,原始IP报文中的以太网帧净荷的值不等于新的IP报文中的以太网帧净荷的值。关于MACsec协议,可以参考IEEE802.1AE。所述新的IP报文被路由器4接收后,路由器4可以根据所述Protocol字段确定所述新的IP报文中包含所述扩展头。进一步的地,路由器4可以根据所述扩展头中的类型字段确定MACsec协议。路由器4可以基于MACsec协议的解密算法对新的IP报文进行解密。具体地,对新的IP报文中的ETYPE以及以太网帧净荷进行解密,从而获得原始IP报文。方法1300涉及的原始数据可以包括原始IP报文中的以太网帧净荷。路由器4可以向主机2(例如UE2)发送原始IP报文。可以理解,原始IP报文中的以太网帧净荷是没有被加密的数据。原始IP报文中的以太网帧净荷是根据MACsec协议的加密算法进行加密前的数据。
可以看出,方法1300涉及的第一报文与方法1200涉及的第一报文可以是同一报文。方法1200的执行主体可以是路由器2。方法1300的执行主体可以是路由器4。因此,关于图13所示的方法1300的具体实现方式,可以参考实施例对图12所示的方法1200的描述。
图14是本申请提供的一种网络设备1400的示意图。该网络设备1400可以应用于图1所示的网络架构中,例如可以是图1所示的网络架构中的路由器1。网络设备1400可以用于执行图12所示的方法1200。如图14所示,网络设备1400可以包括处理器810,与所述处理器810耦合连接的存储器820,收发器830。处理器810可以是中央处理器(英文:central processing unit,缩写:CPU),网络处理器(英文:network processor,缩写:NP)或者CPU和NP的组合。处理器还可以是专用集成电路(英文:application-specific integrated circuit,缩写:ASIC),可编程逻辑器件(英文:programmable logic device,缩写:PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(英文:complex programmable logic device,缩写:CPLD),现场可编程逻辑门阵列(英文:field-programmable gate array,缩写:FPGA),通用阵列逻辑(英文:generic array logic,缩写:GAL)或其任意组合。处理器810可以是指一个处理器,也可以包括多个处理器。存储器820可以包括易失性存储器(英文:volatile memory),例如随机存取存储器(英文:random-access memory,缩写:RAM);存储器也可以包括非易失性存储器(英文:non-volatile memory),例如只读存储器(英文:read-only memory,缩写:ROM),快闪存储器(英文:flash memory),硬盘(英文:hard disk drive,缩写:HDD)或固态硬盘(英文:solid-state drive,缩写:SSD)。存储器820还可以包括上述种类的存储器的组合。存储器820可以是指一个存储器,也可以包括多个存储器。在一个实施方式中,存储器820中存储有计算机可读指令,所述计算机可读指令包括多个软件模块,例如发送模块821,处理模块822和接收模块823。处理器810执行各个软件模块后可以按照各个软件模块的指示进行相应的操作。在本实施例中,一个软件模块所执行的操作实际上是指处理器810根据所述软件模块的指示而执行的操作。例如,接收模块823用于接收来自UE1的报文1。处理模块822用于根据报文1生成方法1200提及的第一报文。发送模块821用于向路由器4发送所述第一报文。
图15是本申请提供的一种网络设备1500的示意图。该网络设备1500可以应用于图1所示的网络架构中,例如可以是图1所示的网络架构中的路由器4。网络设备1500可以用于执行图13所示的方法1300。如图15所示,网络设备1500可以包括处理器910,与所述处理器910耦合连接的存储器920,收发器930。处理器910可以是CPU,NP或者CPU和NP的组合。处理器还可以进一步包括硬件芯片。上述硬件芯片可以是ASIC,PLD或其组合。上述PLD可以是CPLD,FPGA,GAL或其任意组合。处理器910可以是指一个处理器,也可以包括多个处理器。存储器920可以包括易失性存储器(英文:volatile memory),例如RAM;存储器也可以包括非易失性存储器(英文:non-volatile memory),例如ROM,快闪存储器(英文:flash memory),HDD或SSD;存储器还可以包括上述种类的存储器的组合。存储器920可以是指一个存储器,也可以包括多个存储器。在一个实施方式中,存储器920中存储有计算机可读指令,所述计算机可读指令可以包括多个软件模块,例如发送模块921,处理模块922和接收模块923。处理器910执行各个软件模块后可以按照各个软件模块的指示进行相应的操作。在本实施例中,一个软件模块所执行的操作实际上是指处理器910根据所述软件模块的指示而执行的操作。例如,接收模块923用于接收来自路由器2的第一报文。处理模块922用于设备根据所述第一报文生成原始数据。例如,图9中的原始IP报文包含所述原始数据。发送模块921用于向UE2发送图9所示的原始IP报文。
本申请实施例还提供了一种通信系统。通信系统包括图14提供的一种网络设备1400以及图15提供的一种网络设备1500。
本申请还提供一种非易失计算机可读存储介质。所述非易失计算机可读存储介质用于保存计算机程序。当所述计算机程序被处理器执行时,可以使得所述处理器执行图12或者图13所示的方法。具体请参见图12或者图13所示的实施例的描述,此处不再赘述。
在上述各个实施例的一种可能的设计中,所述第一保护协议是加密协议或者完整性保护协议。
在上述各个实施例的一种可能的设计中,所述第一保护协议是AH协议、ESP协议、MACsec协议、TLS协议或者SSL协议。
在上述各个实施例的一种可能的设计中,第一报文头为MPLS header,所述指示字段为第一报文头中的MPLS Label字段。
在上述各个实施例的一种可能的设计中,第一报文头为ethernet header,指示字段为第一报文头中的ethernet type字段。
在上述各个实施例的一种可能的设计中,第一报文头为IP header,指示字段为第一报文头中的protocol字段。
在上述各个实施例的一种可能的设计中,第一报文头为TCP header,指示字段为保留(reserved)字段或者选项(options)字段。
在上述各个实施例的一种可能的设计中,第一报文头为http头,类型字段为扩展字段。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的模块及方法操作,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在上述实施例中,可以全部或部分地通过硬件、固件或者其任意组合来实现。当实施例涉及软件时。所述软件可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。
本说明书的各个部分均采用递进的方式进行描述,各个实施方式之间相同相似的部分互相参见即可,每个实施方式重点介绍的都是与其他实施方式不同之处。尤其,对于装置和系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的说明即可。

Claims (20)

  1. 一种发送报文的方法,其特征在于,包括:
    网络设备生成第一报文,所述第一报文包括第一报文头、第二报文头以及保护数据,所述第一报文头包括指示字段,所述指示字段用于指示所述第一报文中包括所述第二报文头,所述第二报文头包括类型字段,所述类型字段用于指示第一保护协议,所述保护数据是被所述第一保护协议保护的数据;
    所述网络设备发送所述第一报文。
  2. 根据权利要求1所述的方法,其特征在于,所述第二报文头还包括偏移字段,所述偏移字段用于指示所述保护数据的位置。
  3. 根据权利要求2所述的方法,其特征在于,所述第二报文头还包括旗帜字段,所述旗帜字段指示所述第二报文头中包含所述偏移字段。
  4. 根据权利要求1至3中任一所述的方法,其特征在于,所述第二报文头还包括长度字段,所述长度字段指示所述第二报文头的长度。
  5. 根据权利要求1至4中任一所述的方法,其特征在于,所述第一保护协议是加密协议或者完整性保护协议。
  6. 一种接收报文的方法,其特征在于,包括:
    网络设备接收第一报文,所述第一报文包括第一报文头、第二报文头以及保护数据,所述第一报文头包括指示字段,所述指示字段用于指示所述第一报文中包括所述第二报文头,所述第二报文头包括类型字段,所述类型字段用于指示第一保护协议,所述保护数据是被所述第一保护协议保护的数据;
    所述网络设备根据所述第一保护协议和所述保护数据,获得原始数据,所述原始数据没有被所述第一保护协议保护。
  7. 根据权利要求6所述的方法,其特征在于,所述第二报文头还包括偏移字段,所述偏移字段用于指示所述保护数据的位置。
  8. 根据权利要求7所述的方法,其特征在于,所述第二报文头还包括旗帜字段,所述旗帜字段指示所述第二报文头中包含所述偏移字段。
  9. 根据权利要求6至8中任一所述的方法,其特征在于,所述第二报文头还包括长度字段,所述长度字段指示所述第二报文头的长度。
  10. 根据权利要求6至9中任一所述的方法,其特征在于,所述第一保护协议是加密协议或者完整性保护协议。
  11. 一种网络设备,其特征在于,包括处理器以及与所述处理器耦合的存储器,所述存储器存储计算机程序,当所述计算机程序被所述处理器执行时,使得所述网络设备:
    生成第一报文,所述第一报文包括第一报文头、第二报文头以及保护数据,所述第一报文头包括指示字段,所述指示字段用于指示所述第一报文中包括所述第二报文头,所述第二报文头包括类型字段,所述类型字段用于指示第一保护协议,所述保护数据是被所述第一保护协议保护的数据;
    发送所述第一报文。
  12. 根据权利要求11所述的网络设备,其特征在于,所述第二报文头还包括偏移字段,所述偏移字段用于指示所述保护数据的位置。
  13. 根据权利要求12所述的网络设备,其特征在于,所述第二报文头还包括旗帜字段,所述旗帜字段指示所述第二报文头中包含所述偏移字段。
  14. 根据权利要求11至13中任一所述的网络设备,其特征在于,所述第二报文头还包括长度字段,所述长度字段指示所述第二报文头的长度。
  15. 根据权利要求11至14中任一所述的网络设备,其特征在于,所述第一保护协议是加密协议或者完整性保护协议。
  16. 一种网络设备,其特征在于,包括处理器以及与所述处理器耦合的存储器,所述存储器存储计算机程序,当所述计算机程序被所述处理器执行时,使得所述网络设备:
    接收第一报文,所述第一报文包括第一报文头、第二报文头以及保护数据,所述第一报文头包括指示字段,所述指示字段用于指示所述第一报文中包括所述第二报文头,所述第二报文头包括类型字段,所述类型字段用于指示第一保护协议,所述保护数据是被所述第一保护协议保护的数据;
    根据所述第一保护协议和所述保护数据,获得原始数据,所述原始数据没有被所述第一保护协议保护。
  17. 根据权利要求16所述的网络设备,其特征在于,所述第二报文头还包括偏移字段,所述偏移字段用于指示所述保护数据的位置。
  18. 根据权利要求17所述的网络设备,其特征在于,所述第二报文头还包括旗帜字段,所述旗帜字段指示所述第二报文头中包含所述偏移字段。
  19. 根据权利要求16至18所述的网络设备,其特征在于,所述第二报文头还包括长度字段,所述长度字段指示所述第二报文头的长度。
  20. 根据权利要求16至19中任一所述的网络设备,其特征在于,所述第一保护协议是加密协议或者完整性保护协议。
PCT/CN2019/105673 2018-09-17 2019-09-12 发送报文的方法、接收报文的方法及网络设备 WO2020057436A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP19862767.1A EP3771170A4 (en) 2018-09-17 2019-09-12 MESSAGE SENDING METHOD, MESSAGE RECEIVING METHOD, AND NETWORK DEVICE
JP2021515271A JP7228030B2 (ja) 2018-09-17 2019-09-12 パッケージ送信方法、パッケージ受信方法及びネットワークデバイス
US17/087,138 US11888904B2 (en) 2018-09-17 2020-11-02 Packet sending method, packet receiving method, and network device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811083093.3 2018-09-17
CN201811083093.3A CN110912859B (zh) 2018-09-17 2018-09-17 发送报文的方法、接收报文的方法及网络设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/087,138 Continuation US11888904B2 (en) 2018-09-17 2020-11-02 Packet sending method, packet receiving method, and network device

Publications (1)

Publication Number Publication Date
WO2020057436A1 true WO2020057436A1 (zh) 2020-03-26

Family

ID=69813119

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/105673 WO2020057436A1 (zh) 2018-09-17 2019-09-12 发送报文的方法、接收报文的方法及网络设备

Country Status (5)

Country Link
US (1) US11888904B2 (zh)
EP (1) EP3771170A4 (zh)
JP (1) JP7228030B2 (zh)
CN (1) CN110912859B (zh)
WO (1) WO2020057436A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP4135280A4 (en) * 2020-04-30 2023-04-19 Huawei Technologies Co., Ltd. MESSAGE ANALYSIS METHOD AND APPARATUS
CN114244917B (zh) * 2020-08-31 2023-06-02 华为技术有限公司 一种数据传输方法、装置及系统
US20230133729A1 (en) * 2021-10-29 2023-05-04 Nokia Solutions And Networks Oy Security for communication protocols
CN117915398A (zh) * 2022-10-12 2024-04-19 上海朗帛通信技术有限公司 一种被用于无线通信的通信节点中的方法和装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2384667A (en) * 2002-01-04 2003-07-30 Sun Microsystems Inc Transmitting Security Data in Network Addressing Information over a Supernet
CN105592030A (zh) * 2014-11-18 2016-05-18 华为技术有限公司 Ip报文处理方法及装置
WO2016150205A1 (zh) * 2015-03-23 2016-09-29 华为技术有限公司 用于处理vxlan报文的方法、装置及系统
CN107306198A (zh) * 2016-04-20 2017-10-31 华为技术有限公司 报文转发方法、设备和系统
CN107342964A (zh) * 2016-04-28 2017-11-10 华为技术有限公司 一种报文解析方法及设备

Family Cites Families (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10126406A (ja) * 1996-10-23 1998-05-15 Toyo Commun Equip Co Ltd ネットワークにおけるデータの暗号方式
DE19906432C1 (de) 1999-02-16 2000-06-21 Fraunhofer Ges Forschung Verfahren und Vorrichtung zum Erzeugen eines Datenstroms und Verfahren und Vorrichtung zum Abspielen eines Datenstroms
JP3816689B2 (ja) 1999-03-31 2006-08-30 株式会社東芝 情報配信装置、情報受信装置及び通信方法
US7248582B2 (en) * 2002-02-13 2007-07-24 Sun Microsystems, Inc. Method and system for labeling data in a communications system
US7797411B1 (en) 2005-02-02 2010-09-14 Juniper Networks, Inc. Detection and prevention of encapsulated network attacks using an intermediate device
DE602005010252D1 (de) * 2005-09-20 2008-11-20 Matsushita Electric Ind Co Ltd Vefahren und Vorrichtung zur Packetsegmentierung und Verknüpfungssignalisierung in einem Kommunikationssystem
US7853691B2 (en) * 2006-11-29 2010-12-14 Broadcom Corporation Method and system for securing a network utilizing IPsec and MACsec protocols
US8638795B2 (en) 2010-08-12 2014-01-28 Citrix Systems, Inc. Systems and methods for quality of service of encrypted network traffic
CN102271086B (zh) 2011-07-25 2015-07-22 华为技术有限公司 发送报文的方法和装置
US9185130B2 (en) 2012-05-29 2015-11-10 Panasonic Intellectual Property Management Co., Ltd. Transmission apparatus, reception apparatus, communication system, transmission method, and reception method
WO2014000307A1 (zh) * 2012-06-30 2014-01-03 华为技术有限公司 数据传输方法、网元设备及通信系统
US9338172B2 (en) * 2013-03-13 2016-05-10 Futurewei Technologies, Inc. Enhanced IPsec anti-replay/anti-DDOS performance
JP6523249B2 (ja) * 2013-04-17 2019-05-29 トムソン ライセンシングThomson Licensing パケットヘッダを圧縮する方法及び装置
CN104184645B (zh) 2013-05-27 2018-05-04 华为技术有限公司 一种生成操作请求的方法、设备及系统
CN105794172B (zh) * 2013-10-17 2019-02-15 马维尔国际贸易有限公司 网络设备和用于在网络设备中处理报文的方法
CN103873464B (zh) * 2014-02-27 2017-05-10 华为技术有限公司 报文处理的方法及转发设备
US9762488B2 (en) * 2014-03-06 2017-09-12 Cisco Technology, Inc. Segment routing extension headers
CN105721359B (zh) * 2014-12-04 2019-11-15 中兴通讯股份有限公司 Vxlan报文传输方法及装置
US9998542B2 (en) 2014-12-18 2018-06-12 Yokogawa Electric Corporation System and method for determining routing information
CN107547508B (zh) * 2017-06-29 2021-07-30 新华三信息安全技术有限公司 一种报文发送、接收方法、装置及网络设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2384667A (en) * 2002-01-04 2003-07-30 Sun Microsystems Inc Transmitting Security Data in Network Addressing Information over a Supernet
CN105592030A (zh) * 2014-11-18 2016-05-18 华为技术有限公司 Ip报文处理方法及装置
WO2016150205A1 (zh) * 2015-03-23 2016-09-29 华为技术有限公司 用于处理vxlan报文的方法、装置及系统
CN107306198A (zh) * 2016-04-20 2017-10-31 华为技术有限公司 报文转发方法、设备和系统
CN107342964A (zh) * 2016-04-28 2017-11-10 华为技术有限公司 一种报文解析方法及设备

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3771170A4

Also Published As

Publication number Publication date
EP3771170A4 (en) 2021-06-09
JP7228030B2 (ja) 2023-02-22
CN110912859B (zh) 2021-12-14
CN110912859A (zh) 2020-03-24
US20210075829A1 (en) 2021-03-11
JP2021524217A (ja) 2021-09-09
EP3771170A1 (en) 2021-01-27
US11888904B2 (en) 2024-01-30

Similar Documents

Publication Publication Date Title
WO2020057436A1 (zh) 发送报文的方法、接收报文的方法及网络设备
JP6288802B2 (ja) 盗聴に対するIPsec通信のパフォーマンス及びセキュリティの向上
US9992310B2 (en) Multi-hop Wan MACsec over IP
US10404588B2 (en) Path maximum transmission unit handling for virtual private networks
US9979711B2 (en) Authentication for VLAN tunnel endpoint (VTEP)
US9712504B2 (en) Method and apparatus for avoiding double-encryption in site-to-site IPsec VPN connections
US9369550B2 (en) Protocol for layer two multiple network links tunnelling
WO2014040411A1 (zh) 一种数据报文处理方法、系统及设备
US10044841B2 (en) Methods and systems for creating protocol header for embedded layer two packets
US20150150073A1 (en) Smart Virtual Private Network
WO2021009554A1 (en) Method and system for secured information exchange between intermediate and endpoint nodes in a communications network
JP2021525047A (ja) 仮想プライベートネットワークを管理するための方法およびデバイス
US20190124055A1 (en) Ethernet security system and method
WO2016165277A1 (zh) 一种实现IPsec分流的方法和装置
CN117254976B (zh) 基于VPP的国标IPsec VPN实现方法、装置、系统及电子设备
US11095619B2 (en) Information exchange for secure communication
Zhang et al. Application research of MPLS VPN all-in-one campus card network based on IPSec
WO2014107905A1 (zh) 集群以及转发方法
NIXON et al. CONFIGURING IPSEC TO ENCRYPT GRE TUNNELS TO PROVIDE NETWORK LAYER SECURITY FOR NON− IP TRAFFIC SUCH AS IPX USING GNS3
CN114567450A (zh) 一种协议报文处理方法及装置
CN113300998A (zh) 实现数据加密传输的方法及装置、通信系统
WO2023159346A1 (en) Communication devices and methods therein for facilitating ipsec communications
Cunjiang et al. Authentication analysis in an IPV6-based environment
Nagashima et al. A repeater encryption unit for 1pv4 and 1pv6
Eastlake 3rd et al. Transparent Interconnection of Lots of Links (TRILL): RBridge Channel Header Extension

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: 19862767

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2019862767

Country of ref document: EP

Effective date: 20201020

ENP Entry into the national phase

Ref document number: 2021515271

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE