WO2018099046A1 - 报文转发方法和装置 - Google Patents

报文转发方法和装置 Download PDF

Info

Publication number
WO2018099046A1
WO2018099046A1 PCT/CN2017/088532 CN2017088532W WO2018099046A1 WO 2018099046 A1 WO2018099046 A1 WO 2018099046A1 CN 2017088532 W CN2017088532 W CN 2017088532W WO 2018099046 A1 WO2018099046 A1 WO 2018099046A1
Authority
WO
WIPO (PCT)
Prior art keywords
address
ipv6
node
mac address
layer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2017/088532
Other languages
English (en)
French (fr)
Inventor
吴悦峰
吴亦凡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to EP17876095.5A priority Critical patent/EP3537669B1/en
Publication of WO2018099046A1 publication Critical patent/WO2018099046A1/zh
Priority to US16/426,808 priority patent/US11109269B2/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/14Routing performance; Theoretical aspects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/741Routing in networks with a plurality of addressing schemes, e.g. with both IPv4 and IPv6
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/66Layer 2 routing, e.g. in Ethernet based MAN's
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/02Traffic management, e.g. flow control or congestion control
    • H04W28/06Optimizing the usage of the radio link, e.g. header compression, information sizing, discarding information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W72/00Local resource management
    • H04W72/04Wireless resource allocation
    • H04W72/044Wireless resource allocation based on the type of the allocated resource
    • H04W72/0446Resources in time domain, e.g. slots or frames
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W80/00Wireless network protocols or protocol adaptations to wireless operation
    • H04W80/02Data link layer protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/659Internet protocol version 6 [IPv6] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/18Self-organising networks, e.g. ad-hoc networks or sensor networks
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a packet forwarding method and apparatus.
  • Low-speed wireless mesh network is one of the most influential Internet of Things technologies, and is widely used in smart meter reading, smart home and other fields.
  • Low-speed wireless networks are usually built using the IEEE 802.15.4 protocol in conjunction with the Internet Protocol Version 6 (IPv6) over the IPv6 Over Low-Power Wireless Personal Area Network (6LoWPAN) protocol. Shape net.
  • IPv6 Internet Protocol Version 6
  • 6LoWPAN IPv6 Over Low-Power Wireless Personal Area Network
  • LR-WPAN low-rate wireless personal area network
  • IEEE 802.15.4 stipulates that each frame does not exceed 127 bytes, the IPv6 header compression and packet fragmentation mechanism developed by the 6LoWPAN protocol can carry IPv6 seamlessly based on IEEE for carrying IPv6 minimum 1280 bytes of packets. Above the LR-WPAN of 802.15.4.
  • IPv6 packets in the low-speed wireless mesh network may be encrypted and transmitted.
  • the Link Layer Advanced Encryption Standard (AES)-128 encryption mechanism developed by IEEE802.15.4 is also widely used in low-speed wireless mesh networks. Therefore, the format of the encapsulated data frame of the IPv6 packet exchanged in the low-speed wireless mesh network is as shown in FIG. 1 .
  • the media access control (MAC) header is a link layer header defined by the IEEE 802.15.4 protocol, and includes a frame control field, a sequence number, and an address field.
  • the additional security header is a header attached to the message encrypted according to the data link layer encryption mechanism provided by the IEEE 802.15.4 protocol, including a security level, a frame counter, and a key index.
  • the 6LoWPAN compression header is a header that is appended to the IPv6 message according to the 6LoWPAN compression mechanism.
  • the inner IP field (field) is an uncompressed field in the IPv6 header.
  • the minimum value is 0 bytes.
  • the message integrity code (MIC) is a message integrity check code defined by IEEE 802.15.4, which can be 0 bytes.
  • the MIC is used to carry authentication information, and the receiver performs authentication calculation on the same data. And compared with the MIC value to determine whether the data frame has been tampered with.
  • a frame check sequence (FCS) is a frame check sequence defined by IEEE 802.15.4.
  • the IPv6 packet is encapsulated into a data frame after being compressed and encrypted in the low-speed wireless mesh network.
  • the node After receiving the data frame, the node needs to perform decryption and decompression processing to obtain an IPv6 packet. Then, the Layer 3 routing table is searched according to the destination IPv6 address of the IPv6 packet, and the next hop is obtained. Then, the packet is compressed and encrypted, and then encapsulated into a data frame and sent to the next hop.
  • MCUs microcontrollers
  • the present application provides a packet forwarding method and apparatus.
  • a network node in a low-speed wireless mesh network encapsulates an IPv6 packet into a data frame including a Layer 2 forwarding header, and the intermediate forwarding node can directly forward the data frame according to the Layer 2 forwarding header.
  • the Layer 2 forwarding is performed directly, instead of performing Layer 3 routing based on the destination IPv6 address of the IPv6 packet, which improves the forwarding efficiency and avoids the processing required by the hop-by-hop decompression to obtain the destination IPv6 address and then the compression processing. Resources and power.
  • a packet forwarding method for use in a low speed wireless mesh network, the method comprising:
  • the network node obtains the originating MAC address according to the source IPv6 address of the IPv6 packet, and obtains the terminating MAC address according to the destination IPv6 address of the IPv6 packet, where the originating MAC address is the MAC address of the network node.
  • Said terminating MAC address is the MAC address of the terminating node;
  • the network node generates a data frame according to the IPv6 packet, that is, the network node performs encapsulation processing on the IPv6 packet to generate the data frame.
  • the data frame includes a MAC header and a Layer 2 forwarding header, where the Layer 2 forwarding header includes the originating MAC address and the terminating MAC address, and the MAC header includes a source MAC address and a destination MAC address.
  • the source MAC address is a MAC address of the network node
  • the destination MAC address is a MAC address of the next hop node
  • the data frame further includes a 6LoWPAN compressed IPv6 packet
  • the MAC header and The layer 2 forwarding header is an outer layer of the 6LoWPAN compressed IPv6 packet (even the 6LoWPAN compressed IPv6 packet after the IEEE 802.15.4 data link layer encryption);
  • the source MAC address in the MAC header and The destination MAC address is changed hop by hop in the forwarding process, and the originating MAC address and the terminating MAC address in the layer 2 forwarding header remain unchanged during the forwarding process;
  • the destination IPv6 address forwards the data frame.
  • the originating node in the low-speed wireless mesh network obtains the corresponding originating MAC address and terminating MAC address according to the source IPv6 address and the destination IPv6 address in the IPv6 packet, and places the outer layer of the IPv6 packet uncompressed (even Encrypted) processed in the Layer 2 forwarding header.
  • the intermediate node can directly obtain the final MAC address in the Layer 2 forwarding header to perform Layer 2 forwarding without decompressing the data frame (optional and decryption) to obtain the destination IPv6 address of the IPv6 packet.
  • Layer 3 routing improves the forwarding efficiency and avoids the large amount of resources consumed by the decompression (or decryption and decompression) and recompression (or compression and encryption) processing of IPv6 packets in the forwarding process.
  • the MAC header may further include a Layer 2 forwarding header identifier, configured to indicate whether the Layer 2 forwarding header is included in the data frame.
  • the node in the low-speed wireless mesh network can correctly obtain the Layer 2 forwarding header according to the identifier, so that the data frame is forwarded in Layer 2 according to the Layer 2 forwarding header.
  • the network node by using the IPv6 packet, to generate a data frame, includes:
  • the network node compresses the IPv6 packet according to the 6LoWPAN protocol, and encapsulates a 6LoWPAN compression header to obtain the 6LoWPAN compressed IPv6 packet, where the 6LoWPAN compression header includes a source address compression identifier and a destination address compression identifier.
  • the source address compression identifier is used to indicate whether the source IPv6 address is compressed
  • the destination address compression identifier is used to indicate whether the destination IPv6 address is compressed.
  • the network node encapsulates the Layer 2 forwarding in the outer layer of the IPv6 packet compressed by the 6LoWPAN.
  • the header and the MAC header get the data frame.
  • the compressing, by the network node, the IPv6 packet according to the 6LoWPAN protocol includes:
  • the network node compresses the IPv6 packet Source IPv6 An address and the destination IPv6 address, and the source address compression identifier indicates that the source IPv6 address is compressed, and the destination address compression identifier indicates that the destination IPv6 address is compressed;
  • the network node compresses the IPv6 packet Deriving the source IPv6 address, and the source address compression identifier indicates that the source IPv6 address is compressed, and the destination address compression identifier indicates that the destination IPv6 address is uncompressed, and the IPv6 packet compressed by the 6LoWPAN further includes an inner IPv6 field.
  • the inner IPv6 field includes the destination IPv6 address;
  • the network node compresses the IPv6 packet
  • the IPv6 address is described, and the source address compression identifier indicates that the source IPv6 address is uncompressed, and the destination address compression identifier indicates that the destination IPv6 address is compressed, and the IPv6 packet compressed by the 6LoWPAN further includes an inner IPv6 field.
  • the source IPv6 address is included in the inner IPv6 field.
  • the node can directly obtain the packet, which makes it easier and faster to obtain the final MAC address for Layer 2 forwarding, which improves the forwarding efficiency.
  • the Layer 2 forwarding header includes an originating MAC address obtained according to the source IPv6 address and a terminating MAC address obtained according to the destination IPv6 address
  • the IPv6 packet is processed according to a compression mechanism defined by the 6LoWPAN protocol. After compression, the inner IPv6 field can be compressed to 0 bytes (that is, the IPv6 field in the 6LoWPAN compressed IPv6 field can be free), thereby achieving better compression and improving the compression ratio.
  • the network node acquires a MAC address of a next hop node according to the terminating MAC address include:
  • the network node queries the Layer 2 forwarding table of the network node according to the terminating MAC address, and obtains the MAC address of the next hop node, where the Layer 2 forwarding table includes the terminating MAC address and the next The correspondence between the MAC addresses of the hop nodes.
  • the Layer 2 forwarding table includes one or more forwarding entries, where one forwarding entry includes a correspondence between the terminating MAC address and a MAC address of the next hop node.
  • the network node before the network node queries the layer 2 forwarding table of the network node according to the terminating MAC address, the network node is configured according to an IP address and a MAC address of each node in the low-speed wireless mesh network.
  • the relationship is: converting the layer 3 routing table of the network node to generate the layer 2 forwarding table. After the conversion, the network node has both a Layer 3 routing table and a Layer 2 forwarding table.
  • the network node may save the correspondence between the IP address and the MAC address of each node through a correspondence relationship table.
  • the network node that enables the Layer 2 forwarding function in the low-speed wireless mesh network needs to convert the Layer 3 routing table into a Layer 2 forwarding table that performs Layer 2 forwarding according to the MAC address, so that the data including the Layer 2 forwarding header is received.
  • the Layer 2 forwarding table can be queried according to the terminating MAC address in the Layer 2 forwarding header to obtain the MAC address of the next hop node, and the Layer 2 forwarding is completed.
  • the network node before the network node obtains the terminating MAC address according to the destination IPv6 address, acquires a correspondence between an IP address and a MAC address.
  • the network node may obtain the correspondence between the IP address and the MAC address in any of the following manners:
  • the neighbor discovery protocol is extended, and the neighboring cache table is synchronized with the other nodes in the low-speed wireless mesh network to obtain the correspondence between the IPv6 address and the MAC address of all the nodes in the low-speed wireless mesh network.
  • the first method is to extend the Layer 3 routing protocol, and each node in the low-speed wireless mesh network advertises its own MAC address in the process of establishing a route, that is, each node in the low-speed wireless mesh network is in the message when the route is established. Not only include your own IP address, but also your own MAC address;
  • the low-speed wireless mesh network that generates the IPv6 address by using the stateless address autoconfiguration (SLAAC) method can obtain the corresponding MAC address directly according to the IPv6 address because the IPv6 address and the MAC address can be mutually converted. Thus, the correspondence between the IP address and the MAC address is obtained.
  • SLAAC stateless address autoconfiguration
  • the network node may obtain the mapping between the IP address and the MAC address, so that the conversion between the source IPv6 address and the destination IPv6 address in the IPv6 packet to the originating MAC address and the terminating MAC address may be completed.
  • the conversion from the Layer 3 routing table to the Layer 2 forwarding table is completed.
  • the foregoing manner 1 includes:
  • DAO destination advertisement object
  • DODAG target-oriented directed acyclic graph
  • DODAG Information Obtaining, by the first DAO packet or the first DIO packet, the correspondence between the IPv6 address of the termination node and the MAC address of the termination node;
  • the network node may further send a third DAO message or a third DIO message, where the third DAO message or the third DIO message includes an IPv6 address and a MAC address of the network node, so as to receive the The node of the third DAO message or the third DIO message acquires a correspondence between the IPv6 address of the network node and the MAC address of the network node.
  • each node in the low-speed wireless mesh network sends a DAO message or a DIO message carrying a MAC address when the route is established (into the network or its parent node is switched), so that the DAO message or the DIO message is received.
  • the other node can obtain the correspondence between the IPv6 address and the MAC address of the node, so as to obtain the correspondence between the IPv6 address and the MAC address of all the nodes in the low-speed wireless mesh network.
  • a packet forwarding method for use in a low speed wireless mesh network, the method comprising:
  • the network node receives a data frame, a MAC header and a Layer 2 forwarding header in the data frame, where the MAC header includes a source MAC address and a destination MAC address, and the Layer 2 forwarding header includes an originating MAC address and a terminating MAC address.
  • the data frame further includes a 6LoWPAN compressed IPv6 packet, and the MAC header and the Layer 2 forwarding header compress the IPv6 packet in the 6LoWPAN (even the 6LoWPAN compression after the IEEE 802.15.4 data link layer encryption)
  • the outer layer of the IPv6 message ; the network node enables the layer 2 forwarding function; when the terminating MAC address is not the MAC address of the network node (the network node can compare the terminating MAC address with the Determining the MAC address of the network node to determine whether the terminating MAC address is the network section
  • the MAC address of the point the network node acquires the MAC address of the next hop node according to the terminating MAC address; the network node updates the source MAC address to the MAC address of the network node, the destination MAC The address is updated to the MAC address of the next hop node, and the data frame is sent to the next hop node.
  • the intermediate forwarding node can directly perform Layer 2 forwarding according to the Layer 2 forwarding header when receiving the data frame with the Layer 2 forwarding header.
  • the data frame is decompressed (or decrypted and decompressed) to obtain the destination IPv6 address of the IPv6 packet for three-layer routing, and then compressed (or compressed and encrypted) into data frames, which improves forwarding efficiency and avoids understanding compression ( Or decrypt and decompress) recompress (or compress and encrypt) the resources and power consumed by the processing.
  • the method further includes:
  • the network node When the terminating MAC address is the MAC address of the network node, that is, when the network node determines that the network node is a terminating node of the data frame, the network node decapsulates the data frame to obtain IPv6 packet.
  • the network node decapsulates the data frame to obtain an IPv6 packet, including: removing, by the network node, a link layer encapsulation of the data frame (removing a MAC header and a Layer 2 forwarding header, and optionally The data link layer decryption process is performed to obtain the 6LoWPAN compressed IPv6 packet, where the 6LoWPAN compressed IPv6 packet includes a 6LoWPAN compression header, and the 6LoWPAN compression header includes a source address compression identifier and a destination address compression identifier.
  • the source address compression identifier is used to indicate whether the source IPv6 address is compressed, and the destination address compression identifier is used to indicate whether the destination IPv6 address is compressed; and the network node is configured according to the layer 2 forwarding header and the 6LoWPAN compression header.
  • the compressed IPv6 packet is decompressed to obtain an IPv6 packet.
  • the network node decompresses the IPv6 packet compressed by the 6LoWPAN according to the layer 2 forwarding header and the 6LoWPAN compression header, including:
  • the network node obtains the IPv6 according to the originating MAC address in the layer 2 mesh header.
  • the source IPv6 address of the packet, and the destination IPv6 address of the IPv6 packet is obtained according to the terminating MAC address in the Layer 2 mesh header;
  • the network node obtains the IPv6 according to the originating MAC address in the layer 2 mesh header. Obtaining, by the source IPv6 address of the packet, the destination IPv6 address of the IPv6 packet from the inner IPv6 field of the IPv6 packet compressed by the 6LoWPAN;
  • the network node obtains the IPv6 report according to the terminating MAC address in the Layer 2 mesh header. Obtaining the source IPv6 address of the IPv6 packet from the IPv6 field of the IPv6 packet compressed by the 6LoWPAN.
  • the data frame with the Layer 2 forwarding header in the low-speed wireless mesh network performs Layer 2 forwarding according to the Layer 2 forwarding header at the intermediate node, and does not need to be decompressed (or decrypted and decompressed) and then compressed (or compressed and encrypted).
  • the decompression (or decryption and decompression) processing of the data frame only at the terminating node not only achieves the purpose of energy saving, but also improves the performance of the network (message forwarding and processing).
  • the second possible implementation in the second aspect obtains the MAC address of the next hop node according to the terminating MAC address, including:
  • the network node queries the layer 2 forwarding table of the network node according to the terminating MAC address to obtain a MAC address of the next hop node, where the layer 2 forwarding table includes the terminating MAC address and the next The correspondence between the MAC addresses of the hop nodes.
  • the Layer 2 forwarding table includes one or more forwarding entries, where one forwarding entry includes a correspondence between the terminating MAC address and a MAC address of the next hop node.
  • the network node before the network node queries the layer 2 forwarding table of the network node according to the terminating MAC address, the network node is configured according to an IP address and a MAC address of each node in the low-speed wireless mesh network. Relationship: converting the layer 3 routing table of the network node into the layer 2 forwarding table. After the conversion, the network node has both a Layer 3 routing table and a Layer 2 forwarding table. The network node may save the correspondence between the IP address and the MAC address of each node through a correspondence relationship table.
  • the network node that is enabled with the Layer 2 forwarding function in the low-speed wireless mesh network needs to convert the Layer 3 routing table into a Layer 2 forwarding table that performs Layer 2 forwarding according to the MAC address, and receives the Layer 2 forwarding header.
  • the Layer 2 forwarding table is queried according to the terminating MAC address in the Layer 2 forwarding header to obtain the MAC address of the next hop node, and the Layer 2 forwarding is performed, which not only improves the forwarding efficiency, but also saves processing resources and power.
  • the method further includes: the network node acquiring the low speed wireless mesh network The correspondence between the IP address and the MAC address of each node.
  • the network node may obtain the correspondence between the IP address and the MAC address of each node in the low-speed wireless mesh network by any of the following methods:
  • the first method is to extend the Layer 3 routing protocol, and each node in the low-speed wireless mesh network advertises its own MAC address in the process of establishing a route, that is, each node in the low-speed wireless mesh network is in the message when the route is established. Not only include your own IP address, but also your own MAC address;
  • the neighbor discovery protocol is extended, and the network node synchronizes with the other nodes in the low-speed wireless mesh network to obtain a correspondence between the IPv6 address and the MAC address of all the nodes in the low-speed wireless mesh network.
  • the foregoing manner 1 includes:
  • the network node sends a first DAO message or a first DIO message, where the first DAO message or the first DIO message includes an IPv6 address and a MAC address of the network node, so that the first a node of a DAO message or a first DIO message acquires a correspondence between an IPv6 address of the network node and a MAC address of the network node;
  • the mapping between the IPv6 address and the MAC address of all the nodes in the network is required to convert the Layer 3 routing table into a Layer 2 forwarding table. Layer 2 forwarding.
  • a network node is provided to implement the foregoing packet forwarding method.
  • Network node package Includes processor and communication interface.
  • the processor is configured to support a network node to perform a corresponding function in the above method.
  • the communication interface is used to support communication between network nodes, to send and receive data frames in the above methods, and to the information or instructions involved.
  • the network node further includes a memory coupled to the processor to store data necessary for the network node (eg, a Layer 2 forwarding table, a Layer 3 routing table, a correspondence between an IPv6 address and a MAC address, etc.).
  • the memory can also be used to store instructions.
  • the processor executes the instructions stored in the memory to implement the packet forwarding method according to the first aspect and the second aspect.
  • a message forwarding device for a network node of a low-speed wireless mesh network, and the message forwarding device includes a module for implementing the packet forwarding method of the first aspect and the second aspect.
  • a fifth aspect provides a computer storage medium storing program code for implementing the message forwarding method of the first aspect and the second aspect, wherein the program code includes an instruction.
  • the network node or the message forwarding device executes the program code to implement the message forwarding method in the first aspect and the second aspect.
  • a low speed wireless mesh network (message forwarding system) comprising a plurality of network nodes.
  • Each of the network nodes may be as described in the third aspect above or include the message forwarding device as described in the fourth aspect above.
  • the technical solution provided by the present application avoids the hop-by-hop decompression (or decryption and decompression) in the packet forwarding process by adding a Layer 2 forwarding header to the data frame and performing Layer 2 forwarding according to the terminating MAC address in the Layer 2 forwarding header.
  • Recompression (or compression and encryption) processing not only improves packet forwarding efficiency, but also saves power (energy saving).
  • FIG. 1 is a schematic diagram of a data frame format in a conventional low-speed wireless mesh network
  • FIG. 2 is a schematic diagram of a data frame format of a Layer 2 forwarding header according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a format of a frame control field in a layer 2 forwarding header according to an embodiment of the present disclosure
  • FIG. 4 is a schematic structural diagram of a low-speed wireless mesh network according to an embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a packet forwarding method according to an embodiment of the present disclosure
  • FIG. 6 is a schematic flowchart of another packet forwarding method according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic structural diagram of a packet forwarding apparatus according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram of another packet forwarding apparatus according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic structural diagram of a network node according to an embodiment of the present application.
  • the embodiment of the invention provides a packet forwarding method, and the low-speed wireless mesh network constructed based on the IEEE 802.14.5 protocol and the 6LoWPAN protocol can be based on a three-layer routing protocol, for example, for a low-power and lossy network.
  • the IPv6 routing protocol IPv6 Routing Protocol for Low-Power and Lossy Network, RPL
  • RPL IPv6 Routing Protocol for Low-Power and Lossy Network
  • the "layer 3" in the embodiment of the present invention is a network layer defined in an Open System Interconnection Communication Reference Model (OSI), and "layer 2" is a data link layer defined in the OSI.
  • OSI Open System Interconnection Communication Reference Model
  • FIG. 2 is a schematic diagram of a format of an extended packet including a Layer 2 forwarding header according to an embodiment of the present invention. Its The Layer 2 forwarding header includes a frame control field, an initial MAC address (iMAC), and a final MAC address (fMAC).
  • iMAC initial MAC address
  • fMAC final MAC address
  • the frame control field includes the protocol version number, the originating MAC address mode, the terminating MAC address mode, and the remaining hop count.
  • the originating MAC address mode and the terminating MAC address mode are used to indicate the mode of the MAC address, where 0 indicates that the address is 8 bytes, and 1 indicates that the address is 2 bytes.
  • the number of hops (Hop Left) is decremented by one each time to prevent packets from being cyclically forwarded in the network.
  • the originating node may set the remaining hops according to the size of the low-speed wireless mesh network, for example, a maximum of 32 hops; the originating node may also set the remaining hops to the hop count in the IPv6 header.
  • the data frame received by the node with the remaining hop count of 0 shall be discarded.
  • the frame control field may further include a routing protocol option for carrying control information of the Layer 3 route forwarding in the packet.
  • a routing protocol option for carrying control information of the Layer 3 route forwarding in the packet.
  • FIG. 3 it is a schematic diagram of a format of a frame control field in a Layer 2 forwarding header according to an embodiment of the present invention, where an RPL routing protocol option is included as an example.
  • RPL routing protocol option is included as an example.
  • the downlink flag (Down Flag) is used to indicate whether the packet is sent down by the root node. It is usually used for loop detection in the RPL protocol. When the message is sent down by the root node (ie, BR), the Down Flag is set to 1, otherwise it is set to 0.
  • the Rank Error flag is used when the Down Flag is 1 (ie, the message is sent down from the root). If the sender Rank is greater than the Rank of the node, the Rank error flag is 1, indicating that there is a loop. Otherwise, the Rank error flag is 0.
  • the sender Rank Presence (SRE) flag is used to indicate whether there is a Sender Rank field after the Layer 2 forwarding header. For example, the flag bit is 1, indicating that there is a sender Rank field (2 bytes) after the layer 2 forwarding header. If the Rank error flag bit is 0, there is no sender Rank field.
  • the sender Rank field is used for RPL loop detection.
  • the RPL Instance Presence (RIIE) flag bit is used to indicate whether an RPL Instance Identifier (ID) field exists after the Layer 2 forwarding header. For example, the flag bit is 1, indicating that there is an RPL instance ID (1 byte) after the Layer 2 forwarding header. The flag bit is 0, indicating that there is no RPL instance ID field.
  • the RPL instance identification (ID) is used to distinguish different instances in the RPL network.
  • the reserved field may be empty, or may include a sender Rank field when the SRE flag bit is 1, and an RPL instance ID when the RIIE flag bit is 1.
  • RPL is an IPv6 routing protocol based on the distance vector. It supports the establishment of a mesh network and implements routing and forwarding of IPv6 packets.
  • the mesh network based on RPL is a three-layer mesh network, and its network topology is a directed acyclic graph, also called a Destination Oriented Directed Acyclic Graph (DODAG).
  • DODAG Destination Oriented Directed Acyclic Graph
  • RPL is a common routing protocol for low-speed wireless mesh networks.
  • the RPL is used as a Layer 3 routing protocol as an example to describe the packet forwarding method of the present invention.
  • other routing protocols may also be used, for example, a wireless ad hoc network on-demand plane distance vector (Ad hoc On-Demand). Distance Vector, AODV) Routing protocol, Routing Information Protocol next generation (RIPng), etc.
  • the invention is not limited thereto.
  • the initial MAC address is obtained according to the source IPv6 address of the packet, and is the MAC address of the originating node in the low-speed wireless mesh network.
  • Final MAC address (Final Address)
  • the destination IPv6 address is obtained, which is the MAC address of the terminating node in the low-speed wireless mesh network to which the message is to be delivered.
  • FIG. 4 is a schematic structural diagram of a low-speed wireless mesh network according to an embodiment of the present invention.
  • the low-speed wireless mesh network includes a plurality of nodes, wherein a border router (BR) is used to connect the low-speed wireless mesh network with other networks or user terminals.
  • BR border router
  • the source IPv6 address is the IPv6 address of node A
  • the destination IPv6 address is node F.
  • IPv6 address
  • the originating MAC address in the Layer 2 forwarding header is the MAC address of Node A
  • the terminating MAC address is the MAC address of Node F.
  • the inner IPv6 field is 0 bytes, that is, there is no inner IPv6 field
  • the 6LoWPAN compression header indicates that the source address is compressed and the destination address is compressed.
  • the source IPv6 The address is the IPv6 address of node X
  • the destination IPv6 address is the IPv6 address of node F.
  • the originating node of the IPv6 packet in the low-speed wireless mesh network is the BR of the low-speed wireless mesh network.
  • the originating MAC address in the Layer 2 forwarding header is the MAC address of the BR
  • the terminating MAC address is the MAC address of the Node F.
  • the inner IPv6 field includes the source IPv6 address, that is, the IPv6 address of the node X, and the 6LoWPAN compression header indicates that the source address is uncompressed and the destination address is compressed.
  • the source IPv6 address is The IPv6 address of node A
  • the destination IPv6 address is the IPv6 address of node X.
  • the terminating node of the IPv6 packet in the low-speed wireless mesh network is the BR of the low-speed wireless mesh network.
  • the originating MAC address in the Layer 2 forwarding header is the MAC address of Node A
  • the terminating MAC address is the MAC address of the BR.
  • the inner IPv6 field includes the destination IPv6 address, that is, the IPv6 address of the node X, and the source address compression and the destination address are uncompressed in the 6LoWPAN compression header.
  • a Layer 2 forwarding header identifier may be extended in the MAC header to indicate whether the Layer 2 forwarding header is included in the data frame.
  • one bit reserved in the frame of the MAC header such as bit 7, may be used as the layer 2 forwarding header identifier. For example, if bit 7 is set to 1, the packet contains a Layer 2 forwarding header, and the bit 7 is set to 0 to indicate that the Layer 2 forwarding header is not included.
  • bit 7 is set to 1
  • the packet contains a Layer 2 forwarding header
  • the bit 7 is set to 0 to indicate that the Layer 2 forwarding header is not included.
  • each node in the low-speed wireless mesh network maps the Layer 3 routing table into a Layer 2 forwarding table, and the originating node compresses and encrypts (optional) the IPv6 packet, and then The Layer 2 forwarding header and the MAC header are encapsulated to obtain a data frame.
  • the originating MAC address and the terminating MAC address in the Layer 2 forwarding header remain unchanged during the forwarding process.
  • the intermediate node only needs to perform Layer 2 forwarding according to the Layer 2 forwarding header.
  • the terminating node performs decryption (optional) and decompression processing to obtain the IPv6 packet and parse the IPv6 packet.
  • the IPv6 packet is compressed and encrypted (optional) only at the originating node, and decrypted (optional) and decompressed at the terminating node.
  • the intermediate node only needs to be based on the second layer.
  • the forwarding header performs Layer 2 forwarding, which avoids hop-by-hop encryption/decryption (optional) and compression/decompression in the packet forwarding process, thereby improving forwarding efficiency.
  • the nodes in the low-speed wireless mesh network can enable or disable Layer 2 forwarding.
  • the node can map the Layer 3 routing table to the Layer 2 forwarding table and forward the packets to Layer 2 according to the Layer 2 forwarding header.
  • the node can still process packets in the traditional way.
  • the link layer forwarding table (the Layer 2 forwarding table) is obtained based on the conversion of the Layer 3 routing table, and the correspondence between the IPv6 address and the MAC address is required.
  • the IPv6 address is generated based on Stateless address autoconfiguration (SLAAC), so the IPv6 address and the MAC address can be converted to each other.
  • SLAAC Stateless address autoconfiguration
  • the IPv6 address generated based on the SLAAC method consists of a 64-bit network prefix and a 64-bit interface identifier.
  • the interface identifier is generated according to a 64-bit MAC address, also called a 64-bit extended unique identifier (EUI-64). Specifically, the 64-bit number of the global/local (U/L) bits in the EUI-64 is taken as the last 64 bits of the IPv6 address, and the network prefix is used as the first 64 bits to obtain the 128-bit IPv6 address.
  • EUI-64 extended unique identifier
  • the MAC address can be obtained according to the IPv6 address, so that the L3 routing table can be mapped to the L2 forwarding table. Specifically, the 64-bit network prefix of the IPv6 address is removed, and the 64-bit interface identifier is obtained, and the U/L bit is inverted, and the MAC address can be obtained.
  • each node in the low-speed wireless mesh network can convert the Layer 3 routing table according to the correspondence between the IPv6 address and the MAC address to obtain a link layer forwarding table.
  • the neighbor discovery protocol can be extended, so that each node in the low-speed wireless mesh network synchronizes the neighbor cache table with each other, and the correspondence between the IPv6 address and the MAC address of each node in the network is obtained.
  • the Layer 3 routing protocol can be extended to advertise the MAC address during the routing process.
  • a field may be extended in a Destination Advertisement Object (DAO) message or a DODAG Information Object (DIO) message to carry a MAC address (because of a DAO message or
  • DIO DODAG Information Object
  • the DIO message originally contains the IPv6 address of the node.
  • DAO Destination Advertisement Object
  • DIO DODAG Information Object
  • a node sends a DAO packet or a DIO packet carrying a MAC address when the network is connected to the network or the parent node is switched, so that other nodes that receive the DAO packet or the DIO packet can obtain the IPv6 address and the MAC address of the node.
  • the route reply message can be extended to carry the MAC address.
  • the MAC address is carried in the flooding process.
  • the technical solution provided by the embodiment of the present invention is applicable to a low-speed wireless mesh network that needs to compress and/or encrypt an IPv6 packet.
  • the data frame in the embodiment of the present invention is a data frame that meets the definition of the IEEE 802.15.4 standard.
  • IPv6 message is required to be compressed and encrypted, but is not intended to limit the present invention.
  • FIG. 5 is a schematic diagram of a process interaction of a packet forwarding method according to an embodiment of the present invention, which is used in a low-speed wireless mesh network, and the method includes:
  • the first node (originating node) generates a data frame according to the IPv6 packet, and sends the data frame to the second node, where the data frame includes a MAC header and a layer 2 forwarding header.
  • the Layer 2 forwarding header includes an originating MAC address and a terminating MAC address, where the originating MAC address is The MAC address of the first node, and the terminating MAC address is a MAC address of the terminating node.
  • the Layer 2 forwarding header may further include a remaining hop count, and the first node may set the remaining hop count according to the size of the low-speed wireless mesh network. The first node may also set the remaining hop count to the hop count in the header of the IPv6 packet.
  • the Layer 2 forwarding header further includes a routing protocol option, where the routing protocol option includes information related to hop-by-hop forwarding in the extended header of the IPv6 packet, for example, as shown in FIG. 3 .
  • the MAC header includes a source MAC address (SMAC) and a destination MAC address (DMAC).
  • SMAC source MAC address
  • DMAC destination MAC address
  • the source MAC address is a MAC address of the first node
  • the destination MAC address is a MAC address of the second node.
  • the second node is a next hop of the first node.
  • the MAC header further includes a Layer 2 forwarding header identifier, which is used to indicate whether the Layer 2 forwarding header is included in the data frame.
  • a Layer 2 forwarding header identifier which is used to indicate whether the Layer 2 forwarding header is included in the data frame.
  • the data frame further includes a 6LoWPAN compressed IPv6 packet, and the MAC header and the Layer 2 forwarding header compress the IPv6 packet in the 6LoWPAN (even the 6LoWPAN compression after the IEEE 802.15.4 data link layer encryption) The outer layer of the IPv6 message).
  • the first node enables the Layer 2 forwarding function.
  • the first node Before the first node (originating node) generates a data frame according to the IPv6 packet, the first node obtains the originating MAC address and the terminating MAC address according to the source IPv6 address and the destination IPv6 address of the IPv6 packet. And obtaining a MAC address of the next hop node (ie, the second node) according to the terminating MAC address.
  • the MAC address of the next hop node according to the terminating MAC address including:
  • the first node queries the Layer 2 forwarding table of the first node according to the terminating MAC address, and obtains a MAC address of the next hop node (that is, the second node), where the Layer 2 forwarding table includes Corresponding relationship between the terminating MAC address and the MAC address of the second node.
  • the Layer 2 forwarding table includes one or more forwarding entries, where one forwarding entry includes a correspondence between the terminating MAC address and a MAC address of the second node.
  • the first node before the first node queries the Layer 2 forwarding table according to the terminating MAC address, the first node is configured according to a correspondence between an IP address and a MAC address of each node in the low-speed wireless mesh network. And converting the Layer 3 routing table of the first node into the Layer 2 forwarding table. After the conversion, the first node may have both a Layer 3 routing table and a Layer 2 forwarding table. The network node may save a correspondence between an IP address and a MAC address of each node in the low-speed wireless mesh network through a correspondence relationship table.
  • the acquiring, by the first node, the correspondence between the IP address and the MAC address of each node in the low-speed wireless mesh network may include: the first node receiving the first DAO packet or the first DIO sent by the termination node Receiving, by the first DAO message or the first DIO message, the correspondence between the IPv6 address of the terminating node and the MAC address of the terminating node; receiving the second DAO message sent by the second node Corresponding relationship between the IPv6 address and the MAC address of the next hop node is obtained from the second DIO packet or the second DIO packet.
  • the first node may further send a third DAO message or a third DIO message, where the third DAO message or the third DIO message includes an IPv6 address and a MAC address of the first node, so as to receive Obtaining, by the node of the third DAO message or the third DIO message, the IPv6 address of the first node and the network node Correspondence of MAC addresses.
  • the first node generates a data frame according to the IPv6 packet, that is, the first node processes and encapsulates the IPv6 packet, and generates the data frame, including:
  • the first node compresses the IPv6 packet (specifically, the packet header of the IPv6 packet) by using a compression mechanism specified by the 6LoWPAN protocol, and encapsulates the 6LoWPAN compression header to obtain the IPv6 packet compressed by the 6LoWPAN.
  • the 6LoWPAN compression header includes a source address compression identifier and a destination address compression identifier, where the source address compression identifier is used to indicate whether the source IPv6 address is compressed, and the destination address compression identifier is used to indicate whether the destination IPv6 address is compressed;
  • the first node encapsulates the Layer 2 forwarding header and the MAC header in an outer layer of the IPv6 packet compressed by the 6LoWPAN to obtain the data frame.
  • the first node compresses the IPv6 packet by using a compression mechanism specified by the 6LoWPAN protocol, including:
  • the first node compresses the IPv6 packet.
  • the source IPv6 address and the destination IPv6 address, and the source address compression identifier indicates that the source IPv6 address is compressed, and the destination address compression identifier indicates that the destination IPv6 address is compressed; the 6LoWPAN compressed IPv6 packet does not exist.
  • the inner IPv6 field that is, the inner IPv6 field is 0 bytes;
  • the first node compresses the IPv6 packet.
  • the source IPv6 address, and the source address compression identifier indicates that the source IPv6 address is compressed, and the destination address compression identifier indicates that the destination IPv6 address is uncompressed, and the IPv6 packet compressed by the 6LoWPAN further includes an inner IPv6 field.
  • the inner IPv6 field includes the destination IPv6 address;
  • the first node compresses the IPv6 packet.
  • the destination IPv6 address, and the source address compression identifier indicates that the source IPv6 address is uncompressed
  • the destination address compression identifier indicates that the destination IPv6 address is compressed
  • the IPv6 packet compressed by the 6LoWPAN further includes an inner IPv6 field.
  • the inner IPv6 field includes the source IPv6 address.
  • the first node further includes: before the outer layer encapsulating the layer 2 forwarding header and the MAC header in the outer layer of the 6LoWPAN compressed IPv6 packet:
  • the first node encrypts the 6LoWPAN compressed IPv6 packet according to the data link layer encryption mechanism provided by the IEEE 802.15.4 protocol, and adds an additional security header. Then, the outer layer of the additional security header of the first node sequentially encapsulates the layer 2 forwarding header and the MAC header to obtain a data frame structured as shown in FIG. 2 .
  • the Layer 2 forwarding header is encapsulated in the outer layer of the encrypted and compressed IPv6 packet, and the node that receives the data frame can directly obtain the Layer 2 forwarding header, thereby obtaining the final MAC address more easily and faster. Layer 2 forwarding improves forwarding efficiency.
  • the second node receives the data frame, and determines, according to a MAC header of the data frame, whether the data frame includes a layer 2 forwarding header.
  • the second node enables the Layer 2 forwarding function. After receiving the data frame, the second node first acquires a Layer 2 forwarding header identifier in the MAC header of the data frame, and determines the number according to the Layer 2 forwarding header identifier. According to whether the frame contains a Layer 2 forwarding header. When the Layer 2 forwarding header identifier indicates that the data frame includes a Layer 2 forwarding header, proceed to Step 503; when the Layer 2 forwarding header identifier indicates that the data frame does not include a Layer 2 forwarding header, according to a conventional manner Processing the data frame and ending the process.
  • the second node acquires a terminating MAC address from a Layer 2 forwarding header of the data frame, and determines whether the terminating MAC address is a MAC address of the terminal.
  • the second node When the data frame includes a Layer 2 forwarding header, the second node obtains a terminating MAC address from a Layer 2 forwarding header of the data frame, and determines whether the terminating MAC address is its own MAC address (the first The two nodes can determine whether the terminating MAC address is its own MAC address by comparing the terminating MAC address with its own MAC address. In other words, the second node determines whether to terminate the node according to the layer 2 forwarding header.
  • step 504 When the terminating MAC address is the MAC address of the second node, that is, when the second node is the terminating node of the data frame, step 504 is performed; when the terminating MAC address is not the second node When the MAC address is the end node of the data frame, the step 505 is performed.
  • the second node determines that the remaining hop count in the layer 2 forwarding header is not 0.
  • the second node checks the routing protocol option. For example, check the various parameters in the RPL routing protocol options shown in Figure 3.
  • the terminating MAC address is the MAC address of the second node
  • the second node decapsulates the data frame to obtain the IPv6 packet.
  • the method includes: removing a link layer encapsulation of the data frame (removing a MAC header and a Layer 2 forwarding header, and an optional data link layer)
  • the decryption process is performed to obtain the 6LoWPAN compressed IPv6 packet, where the 6LoWPAN compressed IPv6 packet includes a 6LoWPAN compression header, and the 6LoWPAN compression header includes a source address compression identifier and a destination address compression identifier, and the source address is compressed.
  • the identifier is used to indicate whether the source IPv6 address is compressed, and the destination address compression identifier is used to indicate whether the destination IPv6 address is compressed.
  • the second node further compresses the 6LoWPAN according to the layer 2 forwarding header and the 6LoWPAN compression header.
  • the IPv6 packet is decompressed to obtain the IPv6 packet.
  • Removing the link layer encapsulation of the data frame to obtain the 6LoWPAN compressed IPv6 packet including: removing the MAC header and the Layer 2 forwarding header, and performing data link layer decryption according to the additional security header ( According to the IEEE 802.15.4 protocol, the 6LoWPAN compressed IPv6 packet is obtained.
  • the second node decompresses the 6LoWPAN compressed IPv6 packet according to the layer 2 forwarding header and the 6LoWPAN compression header, including: adopting a decompression mechanism specified by the 6LoWPAN protocol, according to the source in the 6LoWPAN compression header
  • the address compression identifier and the destination address compression identifier, the layer 2 forwarding header (the originating MAC address and/or the terminating MAC address), and the memory IPv6 field decompress the compressed IPv6 packet. specifically,
  • the second node obtains the according to the originating MAC address in the layer 2 mesh header.
  • the source IPv6 address of the IPv6 packet, and the destination IPv6 address of the IPv6 packet is obtained according to the terminating MAC address in the Layer 2 mesh header;
  • the second node obtains the location according to the originating MAC address in the layer 2 mesh header. Obtaining, by the source IPv6 address of the IPv6 packet, the destination IPv6 address of the IPv6 packet from the inner IPv6 field of the IPv6 packet compressed by the 6LoWPAN;
  • the second node obtains the IPv6 according to the terminating MAC address in the Layer 2 mesh header. Obtaining the source IPv6 address of the IPv6 packet from the IPv6 field of the IPv6 packet compressed by the 6LoWPAN.
  • the second node decapsulates the data frame, and after obtaining the IPv6 packet, sends the IPv6 packet to the IPv6 protocol stack of the second node for parsing.
  • the second node acquires a MAC address of a next hop node according to the terminating MAC address, and forwards the data frame to the next hop node. ;
  • the second node queries the second-layer forwarding table of the second node according to the terminating MAC address to obtain a MAC address of the next hop node.
  • the second node then updates the MAC header of the data frame.
  • the second node updates the source MAC address in the MAC header to the MAC address of the second node, and the destination MAC address is updated to The MAC address of the next hop node.
  • the second node further reduces the remaining hop count in the layer 2 forwarding header by one. Then, the second node forwards the data frame to the next hop node.
  • the second node acquires a correspondence between an IP address and a MAC address of each node in the low-speed wireless mesh network before receiving the data frame. Specifically include:
  • the second node receives the fourth DAO message or the fourth DIO message sent by the next hop node, and obtains the IPv6 of the next hop node from the fourth DAO message or the fourth DIO message.
  • the second node may save the correspondence between the IP address and the MAC address of each node through a correspondence relationship table.
  • the originating node obtains the corresponding originating MAC address and the terminating MAC address according to the source IPv6 address and the destination IPv6 address in the IPv6 packet, and places the outer layer of the IPv6 packet.
  • the intermediate node can obtain the final MAC address in the Layer 2 forwarding header and perform Layer 2 forwarding without the need to solve the data frame. Compression (optional and decryption) processes the destination IPv6 address of the IPv6 packet for Layer 3 routing, which improves forwarding efficiency.
  • the data frame arrives at the terminating node for decompression (and optional decryption) processing, which avoids hop-by-hop decompression (or decryption and decompression) and recompression (or compression and encryption) of resources consumed during IPv6 packet forwarding. Power, which can improve the performance of the entire network.
  • the packet forwarding method shown in Figure 6 includes:
  • the node A generates a data frame according to the IPv6 packet, where the data frame includes a 6LoWPAN compressed IPv6 packet, and a MAC header and a Layer 2 forwarding header of the outer layer of the IPv6 packet compressed by the 6LoWPAN, where the Layer 2
  • the forwarding header includes an originating MAC address and a terminating MAC address
  • the node A obtains a next hop node, that is, a MAC address of the node B, according to the terminating MAC address, and sends the data frame to the node B.
  • the source IPv6 address of the IPv6 packet is the IPv6 address of the node A
  • the destination IPv6 address is the IPv6 address of the node F.
  • the originating MAC address is the MAC address of the node A
  • the terminating MAC address is the MAC address of the node F.
  • the MAC header includes a source MAC address and a destination MAC address, where the source MAC address is a MAC address of the node A, and the destination MAC address is a MAC address of the node B.
  • the MAC header further includes a Layer 2 forwarding header identifier, where the Layer 2 forwarding header identifier indicates that the data frame includes a Layer 2 forwarding header.
  • the 6LoWPAN compressed IPv6 packet includes a 6LoWPAN compression header, and the 6LoWPAN compression header includes a source address compression identifier and a destination address compression identifier.
  • the source address compression identifier indicates that the source address is compressed
  • the destination address compression identifier indicates that the destination address is compressed.
  • the Layer 2 forwarding function is enabled on the node A.
  • the Layer 2 forwarding table can be translated according to the Layer 3 routing table.
  • the data frame containing the Layer 2 forwarding header can be forwarded in Layer 2 according to the Layer 2 forwarding table.
  • the node A obtains the originating MAC address and the terminating MAC address in the layer 2 forwarding header according to the correspondence between the IPv6 address and the MAC address according to the source IPv6 address and the destination IPv6 address of the IPv6 packet.
  • the node A queries its own Layer 2 forwarding table according to the terminating MAC address to obtain the MAC address of the next hop node, that is, the Node B.
  • the node A compresses the header of the IPv6 packet according to the compression mechanism specified by the 6LoWPAN protocol, and encapsulates the 6LoWPAN compression header to obtain the IPv6 packet compressed by the 6LoWPAN.
  • the terminating MAC address and the source MAC address are associated with the originating MAC address and the terminating MAC address, and the terminating MAC address is associated with the The destination IPv6 address has a corresponding relationship. Therefore, the node A can compress the source IPv6 address and the destination IPv6 address in the IPv6 packet, thereby improving the compression effect.
  • the source address compression identifier in the 6LoWPAN compression header indicates that the source address is compressed
  • the destination address compression identifier indicates that the destination address is compressed
  • the inner IPv6 field is 0 bytes.
  • the node A encrypts the compressed IPv6 packet of the 6LoWPAN and encapsulates the security header, and encapsulates the Layer 2 forwarding header and the MAC header to obtain the data frame, as shown in FIG. 6.
  • the Layer 2 forwarding header may further include a Hop Left. As shown in FIG. 6, the Hop Left may be set to a maximum number of hops supported by the low-speed wireless mesh network, for example, 64.
  • the Node B receives the data frame.
  • the Node B obtains the next hop node, that is, the MAC address of the Node C, according to the terminating MAC address, and sends the MAC address to the Node C.
  • the data frame ;
  • the Node B obtains the terminating MAC address from the Layer 2 forwarding header, and determines whether the terminating MAC address is its own MAC address. When determining that the terminating MAC address is not its own MAC address, the Node B searches its own Layer 2 forwarding table according to the terminating MAC address to obtain the next hop node, that is, the MAC address of the node C. Node B then updates the MAC header of the data frame (the update source MAC address is the MAC address of Node B and the destination MAC address is the MAC address of Node C). Optionally, the Node B decrements the remaining hops in the Layer 2 forwarding header by one. Node B then sends the data frame to node C.
  • the Node B determines, according to the Layer 2 forwarding header identifier in the MAC header, that the data frame includes a Layer 2 forwarding header.
  • the node C receives the data frame.
  • the node C acquires the next hop node, that is, the MAC address of the node F, according to the terminating MAC address, and sends the data frame to the node F.
  • the node C obtains the terminating MAC address from the layer 2 forwarding header, and determines whether the terminating MAC address is its own MAC address. When determining that the terminating MAC address is not its own MAC address, the node C searches for its own Layer 2 forwarding table according to the terminating MAC address, and obtains the next hop node, that is, the MAC address of the node F. Node C then updates the MAC header of the data frame (the update source MAC address is the MAC address of node C and the destination MAC address is the MAC address of node F). Optionally, node C decrements the remaining hop count in the layer 2 forwarding header by one. Node C then sends the data frame to node F.
  • the node C determines that the data frame includes a Layer 2 forwarding header according to the Layer 2 forwarding header identifier in the MAC header.
  • the node F receives the data frame.
  • the terminating MAC address is the MAC address of the node F
  • the node F decapsulates the data frame to obtain the IPv6 packet.
  • the node F obtains the terminating MAC address from the layer 2 forwarding header, and determines whether the terminating MAC address is its own MAC address.
  • the node F decapsulates the data frame to obtain the IPv6 packet.
  • the node F removes the MAC header and the Layer 2 forwarding header, performs decryption processing according to the security header, and obtains the IPv6 packet compressed by the 6LoWPAN; and further compresses the header according to the 6LoWPAN (source address compression identifier and destination address). Compressing the IPv6 packet compressed by the 6LoWPAN to obtain the IPv6 packet, and compressing the IPv6 packet that is compressed by the 6LoWPAN.
  • the node F then parses the IPv6 packet, specifically, sending the IPv6 packet to its own IPv6 protocol stack for parsing.
  • the node F determines, according to the Layer 2 forwarding header identifier in the MAC header, that the data frame includes a Layer 2 forwarding header.
  • the node enabled with the Layer 2 forwarding function in the low-speed wireless mesh network shown in FIG. 4 has obtained the correspondence between the IPv6 address and the MAC address of each node, and converts the Layer 3 routing table into a Layer 2 forwarding table.
  • the node A to the node F respectively send DAO packets or DIO packets including an IPv6 address and a MAC address, and advertise the correspondence between the respective IPv6 addresses and the MAC addresses.
  • the originating node A compresses and encrypts the IPv6 packet, and then obtains the data frame in the outer layer encapsulating layer 2 forwarding header and the MAC header, and the intermediate node B and C receive the data frame.
  • the terminal MAC address of the Layer 2 forwarding header is directly forwarded to the Layer 2 forwarding packet, and the data packet is decrypted and decompressed by the terminating node F. This improves the packet forwarding efficiency and prevents IPv6 packets from being forwarded.
  • the hop by hop decryption and decompression and then the compression and encryption process consume a large amount of resources, thereby improving the performance of the entire network.
  • FIG. 7 is a packet forwarding apparatus 700, which is deployed in a network node 70 of a low-speed wireless mesh network, and is used to implement a packet forwarding method as shown in FIG. 5 and FIG. 6 of the present application.
  • the message forwarding device 700 includes:
  • the address conversion module 701 is configured to obtain the first originating MAC address according to the source IPv6 address of the first IPv6 packet. Addressing, and obtaining a first terminating MAC address according to the destination IPv6 address of the first IPv6 packet, where the first originating MAC address is a MAC address of the network node 70, and the first terminating MAC address is The MAC address of the terminating node;
  • the forwarding processing module 702 is configured to obtain a MAC address of the first next hop node according to the first terminating MAC address.
  • the encapsulating module 703 is configured to encapsulate the first IPv6 packet to generate a first data frame, where the first data frame includes a first IPv6 packet compressed by 6LoWPAN, and a first IPv6 packet compressed in the 6LoWPAN a first MAC header and a first Layer 2 forwarding header of the outer layer, where the first Layer 2 forwarding header includes the first originating MAC address and the first terminating MAC address, the first MAC header
  • the first source MAC address is the MAC address of the network node 70
  • the first destination MAC address is the MAC address of the first next hop node.
  • the sending module 704 is configured to send the first data frame to the first next hop node, so that the first next hop node is directly according to the first layer 2 forwarding header (specifically according to the first Terminating the MAC address) forwarding the first data frame.
  • the MAC header of the first data frame further includes a Layer 2 forwarding header identifier, configured to indicate whether the Layer 2 forwarding header is included in the first data frame.
  • the encapsulating module 703 compresses the first IPv6 packet according to the 6LoWPAN protocol, and encapsulates the first 6LoWPAN compression header to obtain the first IPv6 packet compressed by the 6LoWPAN, where the first 6LoWPAN compression header is used.
  • the method includes a first source address compression identifier and a first destination address compression identifier, where the first source address compression identifier is used to indicate whether the source IPv6 address is compressed, and the first destination address compression identifier is used to indicate whether the destination IPv6 address is compressed.
  • the encapsulating module 703 encrypts the first IPv6 packet compressed by the 6LoWPAN according to an encryption mechanism of IEEE 802.15.4, and adds an additional Safety head (additional safety head is on the outer layer of the first 6LoWPAN compression head). Finally, the encapsulating module 703 encapsulates the first layer 2 forwarding header and the first MAC header in an outer layer of the encrypted first IPv6 packet compressed by the 6LoWPAN, that is, in an outer layer of the additional security header. Obtaining the first data frame. The structure of the first data frame can be seen in FIG. 2.
  • the encapsulation module 703 is specifically configured to:
  • the first source IPv6 address is an address of a node in the low-speed wireless mesh network
  • the first destination IPv6 address is an address of a node in the low-speed wireless mesh network
  • compressing the first source IPv6 address And the first destination IPv6 address, and the source address compression identifier in the first 6LoWPAN compression header indicates that the source IPv6 address is compressed
  • the destination address compression identifier indicates that the destination IPv6 address is compressed
  • the first source IPv6 address is an address of a node in the low-speed wireless mesh network
  • the first destination IPv6 address is not an address of a node in the low-speed wireless mesh network
  • the source address compression identifier in the first 6LoWPAN compression header indicates that the source IPv6 address is compressed
  • the destination address compression identifier indicates that the destination IPv6 address is uncompressed
  • the first IPv6 packet compressed by the 6LoWPAN is further included.
  • An inner IPv6 field where the inner IPv6 field includes the first destination IPv6 address
  • the IPv6 packet is compressed. Describe the destination IPv6 address, and the source address compression identifier in the 6LoWPAN compression header indicates that the source IPv6 address is not compressed.
  • the destination address compression identifier indicates that the destination IPv6 address is compressed, and the IPv6 packet compressed by the 6LoWPAN further includes an inner IPv6 field, where the inner IPv6 field includes the first source IPv6 address.
  • the forwarding processing module 702 is specifically configured to query the layer 2 forwarding table of the network node 70 according to the first terminating MAC address, and obtain the MAC address of the first next hop node.
  • the Layer 2 forwarding table includes one or more entries, where each entry is a correspondence between a terminating MAC address and a MAC address of a next hop node.
  • the mapping between the first terminating MAC address and the MAC address of the first next hop node is stored in an entry of the Layer 2 forwarding table.
  • the device further includes an entry conversion module, configured to convert the three-layer routing table of the network node into the network node according to the correspondence between the IPv6 address and the MAC address of each node in the low-speed wireless mesh network.
  • the second layer forwarding table is described.
  • the packet forwarding device 700 further includes an address learning module, configured to receive the first DAO packet or the first DIO packet sent by the termination node, from the first DAO packet or the first DIO Obtaining a correspondence between the IPv6 address of the terminating node and the MAC address of the terminating node, and receiving a second DAO message or a second DIO message sent by the first next hop node, from the The correspondence between the IPv6 address of the first next hop node and the MAC address of the first next hop node is obtained in the second DAO message or the second DIO message.
  • an address learning module configured to receive the first DAO packet or the first DIO packet sent by the termination node, from the first DAO packet or the first DIO Obtaining a correspondence between the IPv6 address of the terminating node and the MAC address of the terminating node, and receiving a second DAO message or a second DIO message sent by the first next hop node, from the The correspondence between the IPv6 address of the first next hop node and the
  • the packet forwarding device 700 further includes a route advertisement module, configured to send a third DAO message or a third DIO message, where the third DAO message or the third DIO message includes the network The IPv6 address and the MAC address of the node, so that the node that receives the third DAO message or the third DIO message acquires the correspondence between the IPv6 address of the network node and the MAC address of the network node.
  • a route advertisement module configured to send a third DAO message or a third DIO message, where the third DAO message or the third DIO message includes the network The IPv6 address and the MAC address of the node, so that the node that receives the third DAO message or the third DIO message acquires the correspondence between the IPv6 address of the network node and the MAC address of the network node.
  • the message forwarding device 700 further includes a receiving module 705 and a decapsulation module 706;
  • the receiving module 705 is configured to receive a second data frame, where the second data frame includes a second IPv6 packet compressed by the 6LoWPAN, and a second MAC header that is outside the second IPv6 packet compressed by the 6LoWPAN. And a second layer 2 forwarding header, where the second MAC header includes a second source MAC address and a second destination MAC address, where the second layer 2 forwarding header includes a second originating MAC address and a second terminating MAC address. ;
  • the forwarding processing module 702 is further configured to: when the second terminating MAC address is not the MAC address of the network node 70, acquire a MAC address of the second next hop node according to the second terminating MAC address; The second source MAC address is updated to the MAC address of the network node 70, and the second destination MAC address is updated to the MAC address of the second next hop node;
  • the sending module 704 is further configured to send the second data frame to the second next hop node.
  • the decapsulating module 706 is configured to decapsulate the second data frame to obtain a second IPv6 packet when the second terminating MAC address is a MAC address of the network node 70. Specifically, the decapsulation module 706 removes the link layer encapsulation of the second data frame, and obtains the second IPv6 packet compressed by the 6LoWPAN, where the second IPv6 packet compressed by the 6LoWPAN includes the second 6LoWPAN compression.
  • the second 6LoWPAN compression header includes a second source address compression identifier and a second destination address compression identifier, where the second source address compression identifier is used to indicate whether the source IPv6 address is compressed, and the second destination address compression identifier is used. Used to indicate whether the destination IPv6 address is compressed.
  • the decapsulation module 706 decompresses the compressed second IPv6 packet according to the second layer 2 forwarding header and the second 6LoWPAN compression header to obtain a second IPv6 packet.
  • the decapsulating module 706 removes the link layer encapsulation of the second data frame, and obtains the second IPv6 packet compressed by the 6LoWPAN, including: removing the second MAC header and the second Layer 2 forwarding header. And performing data link layer decryption according to the additional security header (according to the IEEE 802.15.4 protocol) to obtain the second IPv6 packet compressed by the 6LoWPAN.
  • the decapsulating module 706 decompresses the compressed second IPv6 packet according to the second layer 2 forwarding header and the second 6LoWPAN compression header to obtain the second IPv6 packet, including: adopting the 6LoWPAN protocol. a predetermined decompression mechanism, according to the source address compression identifier and the destination address compression identifier in the second 6LoWPAN compression header, the second originating MAC address in the second layer 2 forwarding header, and/or the And the second IPv6 packet compressed by the 6LoWPAN is decompressed to obtain the second IPv6 packet. Specifically,
  • the decapsulation module 706 is configured according to the second layer 2 mesh header.
  • the second originating MAC address obtains the second source IPv6 address of the second IPv6 packet, and the second destination of the second IPv6 packet is obtained according to the second terminating MAC address in the second layer 2 mesh header IPv6 address;
  • the decapsulation module 706 is configured according to the second layer 2 mesh header.
  • the second originating MAC address obtains the second source IPv6 address of the second IPv6 packet, and obtains the second destination of the second IPv6 packet from the inner IPv6 field of the second IPv6 packet compressed by the 6LoWPAN IPv6 address;
  • the decapsulation module 706 is configured according to the second layer 2 mesh header. Obtaining, by the second terminating MAC address, the second destination IPv6 address of the second IPv6 packet, and obtaining the second source IPv6 of the second IPv6 packet from the inner IPv6 field of the second IPv6 packet compressed by the 6LoWPAN address.
  • the address learning module is further configured to receive a fourth DAO message or a fourth DIO message sent by the second next hop node, and obtain the fourth DAO message or the fourth DIO message. Correspondence between the IPv6 address and the MAC address of the second next hop node.
  • the packet forwarding device provided by the embodiment of the present invention is deployed in a network node of a low-speed wireless mesh network, and can encapsulate an IPv6 packet into a data frame including a Layer 2 forwarding header, and perform the data frame according to the Layer 2 forwarding header.
  • Layer 2 forwarding which does not require hop-by-hop decryption (optional) and decompression processing to obtain the destination IPv6 address for Layer 3 routing, and then perform compression and encryption processing, which not only improves forwarding efficiency, but also reduces network node processing overhead and power consumption. , to extend the life of the power supply, thereby improving network performance.
  • a network node 800 is provided for implementing a packet forwarding method in the embodiment shown in FIG. 5 and FIG. 6 of the present invention in a low-speed wireless mesh network.
  • the network node 800 includes: a processor 801, a memory 802, and a communication interface 803;
  • the processor 801, the memory 802 and the communication interface 803 can be connected to each other through a bus 804; the bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in Figure 8, but it does not mean that there is only one bus or one type of bus.
  • the communication interface 803 is an interface that the network node 800 communicates with other nodes.
  • the communication interface 803 Including wireless communication interface, also known as radio frequency (RF) interface, operating in the 160 megahertz (MHz) to 1 GHz band, and 2.4 GHz band.
  • the wireless communication interface includes an antenna for transmitting and receiving radio frequency signals.
  • the wireless communication interface can be a WLAN interface, a cellular network communication interface, a Bluetooth interface, a ZigBee interface, or a combination thereof.
  • the communication interface 803 may also include a wired communication interface, such as an Ethernet interface.
  • the Ethernet interface can be an optical interface, an electrical interface, or a combination thereof.
  • the present application is represented by a communication interface 803, and is not intended to limit the technical solution of the present application.
  • the processor 801 can be a central processing unit (CPU), a network processor (NP), a microcontroller (MCU), or a combination thereof.
  • the processor 601 may further include a hardware chip.
  • the hardware chip described above may be an application specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof.
  • the PLD may be a Complex Programmable Logic Device (CPLD), a Field Programmable Logic Gate Array (FPGA), a General Array Logic (GAL), or any combination thereof.
  • the processor 801 is configured to perform one or more steps in FIG. 5 or 6 to implement a packet forwarding method provided by an embodiment of the present invention.
  • the processor 801 is configured to:
  • the MAC address is a media access control MAC address of the network node
  • the first terminating MAC address is a MAC address of the terminating node
  • the first data frame includes a first IPv6 packet that is compressed by the IPv6 bearer in the low-power wireless personal area network 6LoWPAN, and the first compressed in the 6LoWPAN a first MAC header and a first Layer 2 forwarding header of the outer layer of the IPv6 packet, where the first Layer 2 forwarding header includes the first originating MAC address and the first terminating MAC address, where a MAC address includes a first source MAC address and a first destination MAC address, where the first source MAC address is a MAC address of the network node, and the first destination MAC address is the first next hop node MAC address;
  • the MAC address forwards the first data frame.
  • the processor 801 queries the Layer 2 forwarding table of the network node according to the first terminating MAC address, and obtains the MAC address of the first next hop, where the Layer 2 forwarding table includes the Corresponding relationship between the terminating MAC address and the MAC address of the first next hop node.
  • the processor 801 is further configured to convert the Layer 3 routing table of the network node 800 into the Layer 2 forwarding table according to the correspondence between the IPv6 address and the MAC address of each node in the low-speed wireless mesh network.
  • the memory 802 is configured to store the Layer 3 routing table and the Layer 2 forwarding table.
  • the memory 802 can also be used to store a correspondence between an IPv6 address and a MAC address.
  • the memory 802 may include a volatile memory, such as a random access memory (RAM); the memory 602 may also include a non-volatile memory, such as a flash memory.
  • RAM random access memory
  • the memory 602 may also include a non-volatile memory, such as a flash memory.
  • Hard disk drive English: hard disk drive, abbreviated: HDD
  • solid state drive English: solid-state drive, abbreviated: SSD
  • the memory 802 may also include a combination of the above types of memory.
  • the processor 801 is further configured to:
  • a second data frame where the second data frame includes a second IPv6 packet compressed by 6LoWPAN, and a second MAC header and a second outer layer of the second IPv6 packet compressed by the 6LoWPAN a Layer 2 forwarding header, where the second MAC header includes a second source MAC address and a second destination MAC address, where the second Layer 2 forwarding header includes a second originating MAC address and a second terminating MAC address.
  • the second terminating MAC address is not the MAC address of the network node, acquiring a MAC address of the second next hop node according to the second terminating MAC address; updating the second source MAC address to the network a MAC address of the node, the second destination MAC address is updated to a MAC address of the second next hop node; and the second data frame is sent by the communication interface 803 to the second next hop node.
  • the IPv6 packet includes a second 6LoWPAN compression header, where the second 6LoWPAN compression header includes a second source address compression identifier and a second destination address compression identifier, where the second source address compression identifier is used to indicate whether the source IPv6 address is compressed.
  • the second destination address compression identifier is used to indicate whether the destination IPv6 address is compressed.
  • the second IPv6 packet compressed by the 6LoWPAN is decompressed according to the second layer 2 forwarding header and the second 6LoWPAN compression header. , get the second IPv6 message.
  • the memory 802 is further configured to store program instructions.
  • the processor 801 may invoke program instructions stored in the memory 802 for performing one or more steps in FIG. 5 or 6 to implement the embodiments of the present invention. Message forwarding method.

Landscapes

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

Abstract

公开了一种用于低速无线网状网中的报文转发方法。网络节点将IPv6报文封装成包括二层转发头和MAC头的数据帧,所述数据帧中包括6LoWPAN压缩的IPv6报文,所述二层转发头和所述MAC头位于所述6LoWPAN压缩的IPv6报文的外层,根据所述二层转发头中的终结MAC地址获取下一跳节点的MAC地址,并向所述下一跳节点发送所述数据帧,以使所述下一跳节点直接根据所述二层转发头转发所述数据帧。这样,对于低速无线网状网中经过压缩(甚至加密)处理的IPv6报文,中间转发节点直接根据二层转发头进行二层转发,无需进行解压缩后获取目的IPv6地址进行三层路由,提高了报文转发效率,且节省了节点的处理资源和电源。

Description

报文转发方法和装置 技术领域
本发明涉及通信技术领域,尤其涉及一种报文转发方法和装置。
背景技术
低速无线网状(mesh)网是当前较具影响力的物联网技术之一,被广泛应用于智能抄表、智能家居等领域。通常用电子和电气电工协会(IEEE)802.15.4协议结合互联网协议第六版(IPv6)承载于低功耗无线个域网(IPv6over Low-Power Wireless Personal Area Network,6LoWPAN)协议来构建低速无线网状网。IEEE 802.15.4协议中定义了低速无线个域网(low-rate wireless personal area network,LR-WPAN)的物理层和链路层的规范。由于IEEE 802.15.4规定每帧不超过127字节,为承载IPv6最小1280字节的报文,6LoWPAN协议制定的IPv6报文头压缩和报文分片机制,能够让IPv6无缝运行在基于IEEE 802.15.4的LR-WPAN之上。
此外,为了实现网络安全,低速无线网状网中的IPv6报文可能会加密传输。IEEE802.15.4制定的链路层高级加密标准(AES)-128加密机制,也被广泛用于低速无线网状网中。因此低速无线网状网中交互的IPv6报文,其封装后的数据帧格式如图1所示。其中,媒体访问控制(media access control,MAC)头是IEEE 802.15.4协议定义的链路层帧头,包含了帧控制域、序列号和地址域。附加安全头是按照IEEE 802.15.4协议提供的数据链路层加密机制对报文加密后附加的头部,其中包含安全等级、帧计数器和密钥索引等。6LoWPAN压缩头是按照6LoWPAN压缩机制对IPv6报文压缩后附加的头部。内层IP字段(field)是IPv6报文头中未压缩的字段,最小可以是0字节。消息完整码(message integrity code,MIC)是由IEEE 802.15.4定义的消息完整性校验码,可以为0字节;MIC用于携带鉴权信息,接收方通过对相同数据进行鉴权计算,并与MIC值比较,以确定数据帧是否被篡改过。帧校验序列(frame check sequence,FCS)是由IEEE 802.15.4定义的帧校验序列。
由于低速无线网状网中的将IPv6报文进行压缩和加密后封装成数据帧,因此节点收到数据帧后,需要先进行解密和解压缩处理,得到IPv6报文。然后根据IPv6报文的目的IPv6地址查找三层路由表,得到下一跳,再对报文进行压缩和加密后封装成数据帧,发送给下一跳。但是,低速无线网状网中很多节点是采用微控制器(MCU)的低成本设备,频繁的加密/解密,以及压缩/解压缩会消耗大量的计算资源;并且对采用电池供电的节点,也会快速消耗电源,缩短电源使用寿命。
发明内容
本申请提供了一种报文转发方法和装置,低速无线网状网中的网络节点将IPv6报文封装成包含二层转发头的数据帧,中间转发节点可以直接根据二层转发头对数据帧直接进行二层转发,而非根据IPv6报文的目的IPv6地址进行三层路由,提高了转发效率,并且可以避免报文转发过程中逐跳解压缩获取目的IPv6地址再进行压缩处理所消耗的处理资源和电源。
第一方面,提供了一种报文转发方法,用于低速无线网状网中,该方法包括:
网络节点根据IPv6报文的源IPv6地址得到始发MAC地址,并根据所述IPv6报文的目的IPv6地址得到终结MAC地址,其中,所述始发MAC地址为所述网络节点的MAC地址,所述终结MAC地址为终结节点的MAC地址;
所述网络节点根据所述终结MAC地址获取下一跳节点的MAC地址;
所述网络节点根据所述IPv6报文生成数据帧,即,所述网络节点对所述IPv6报文进行封装处理,生成所述数据帧。所述数据帧中包括MAC头和二层转发头,其中,所述二层转发头中包括所述始发MAC地址和所述终结MAC地址,所述MAC头中包括源MAC地址和目的MAC地址,所述源MAC地址为所述网络节点的MAC地址,所述目的MAC地址为所述下一跳节点的MAC地址;所述数据帧中还包括6LoWPAN压缩的IPv6报文,所述MAC头和所述二层转发头在所述6LoWPAN压缩的IPv6报文(甚至是IEEE 802.15.4数据链路层加密后的6LoWPAN压缩的IPv6报文)的外层;所述MAC头中的源MAC地址和目的MAC地址在转发过程中逐跳改变,所述二层转发头中的所述始发MAC地址和所述终结MAC地址在转发过程中保持不变;
所述网络节点向所述下一跳节点发送所述数据帧,以使所述下一跳节点直接根据所述二层转发头中的所述终结MAC地址而非经过压缩(甚至加密)处理后的所述目的IPv6地址转发所述数据帧。这样,低速无线网状网中始发节点根据IPv6报文中的源IPv6地址和目的IPv6地址,得到对应的始发MAC地址和终结MAC地址,并放在IPv6报文外层未经压缩(甚至加密)处理的二层转发头中。中间节点收到数据帧时,可以直接获取二层转发头中的终结MAC地址进行二层转发,而无需对数据帧进行解压缩(可选还有解密)处理得到IPv6报文的目的IPv6地址进行三层路由,提高了转发效率,还避免了IPv6报文在转发过程中逐跳进行解压缩(或解密和解压缩)再压缩(或压缩和加密)处理所消耗的大量资源。
在第一方面的第一种可能的实现中,所述MAC头中还可以包括二层转发头标识,用于指示所述数据帧中是否包括二层转发头。这样,低速无线网状网中的节点收到所述数据帧后,可以根据该标识正确获取二层转发头,从而根据二层转发头对所述数据帧进行二层转发。
结合第一方面或第一方面的第一种可能的实现,在第一方面的第二种可能的实现中,所述网络节点将所述IPv6报文封装生成数据帧,包括:
所述网络节点根据6LoWPAN协议对所述IPv6报文进行压缩,并封装6LoWPAN压缩头,得到所述6LoWPAN压缩的IPv6报文,所述6LoWPAN压缩头中包括源地址压缩标识和目的地址压缩标识,所述源地址压缩标识用于指示源IPv6地址是否压缩,所述目的地址压缩标识用于指示目的IPv6地址是否压缩;所述网络节点在所述6LoWPAN压缩的IPv6报文外层封装所述二层转发头和所述MAC头,得到所述数据帧。
结合第一方面的第二种可能的实现,在第一方面的第三种可能的实现中,所述网络节点根据6LoWPAN协议对所述IPv6报文进行压缩包括:
当所述源IPv6地址是所述低速无线网状网中节点的地址,所述目的IPv6地址是所述低速无线网状网中节点的地址时,所述网络节点压缩所述IPv6报文的所述源IPv6 地址和所述目的IPv6地址,并使所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址已压缩;
当所述源IPv6地址是所述低速无线网状网中节点的地址,所述目的IPv6地址不是所述低速无线网状网中节点的地址时,所述网络节点压缩所述IPv6报文的所述源IPv6地址,并使所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址未压缩,所述6LoWPAN压缩的IPv6报文中还包括内层IPv6字段,所述内层IPv6字段中包括所述目的IPv6地址;
当所述源IPv6地址不是所述低速无线网状网中节点的地址,所述目的IPv6地址是所述低速无线网状网中节点的地址时,所述网络节点压缩所述IPv6报文的所述目的IPv6地址,并使所述源地址压缩标识指示源IPv6地址未压缩,所述目的地址压缩标识指示目的IPv6地址已压缩,所述6LoWPAN压缩的IPv6报文中还包括内层IPv6字段,所述内层IPv6字段中包括所述源IPv6地址。
由于二层转发头封装在6LoWPAN压缩的IPv6报文的外层,节点可以直接获取,从而更容易、更快获取终结MAC地址做二层转发,提高了转发效率。此外,由于所述二层转发头中包括根据所述源IPv6地址得到的始发MAC地址和根据所述目的IPv6地址得到的终结MAC地址,因此根据6LoWPAN协议定义的压缩机制对所述IPv6报文压缩后,内层IPv6字段可以压缩至0字节(即,所述6LoWPAN压缩的IPv6报文中可以没有内存IPv6字段),从而达到更好的压缩效果,提高了压缩率。
结合第一方面和第一方面上述可能的实现中的任一种,在第一方面的第四种可能的实现中,所述网络节点根据所述终结MAC地址获取下一跳节点的MAC地址,包括:
所述网络节点根据所述终结MAC地址查询所述网络节点的二层转发表,获取所述下一跳节点的MAC地址,所述二层转发表中包括所述终结MAC地址与所述下一跳节点的MAC地址的对应关系。具体来说,所述二层转发表中包括一条或多条转发表项,其中一条转发表项包括所述终结MAC地址和所述下一跳节点的MAC地址的对应关系。
可选地,在所述网络节点根据所述终结MAC地址查询所述网络节点的二层转发表之前,所述网络节点根据所述低速无线网状网中各个节点的IP地址和MAC地址的对应关系,对所述网络节点的三层路由表进行转换,生成所述二层转发表。转换后,所述网络节点既有三层路由表也有二层转发表。所述网络节点可以通过一张对应关系表保存各个节点的IP地址和MAC地址的对应关系。
所述低速无线网状网中使能二层转发功能的网络节点,需要将三层路由表转换为根据MAC地址做二层转发的二层转发表,这样在收到包含二层转发头的数据帧时,就可以根据二层转发头中的终结MAC地址查询二层转发表获取下一跳节点的MAC地址,完成二层转发。
结合第一方面和第一方面上述可能的实现中的任一种,在第一方面的第五种可能的实现中,在所述网络节点根据所述目的IPv6地址得到所述终结MAC地址之前,所述网络节点获取IP地址和MAC地址的对应关系。所述网络节点可以通过如下任一方式获取IP地址与MAC地址的对应关系:
方式二,扩展邻居发现协议,所述网络节点与低速无线网状网中其他节点间相互同步邻居缓存表,获得所述低速无线网状网中所有节点的IPv6地址与MAC地址的对应关系;
方式一,扩展三层路由协议,所述低速无线网状网中各个节点在建立路由过程中通告自己的MAC地址,即,所述低速无线网状网中各个节点在建立路由时,报文中不仅包括自己的IP地址,还包括自己的MAC地址;
方式三,对采用无状态地址自动配置(Stateless address autoconfiguration,SLAAC)方式生成IPv6地址的低速无线网状网,由于IPv6地址与MAC地址可以相互转换,因此,可以直接根据IPv6地址获得对应的MAC地址,从而获得IP地址与MAC地址的对应关系。
通过上述任一种方式,所述网络节点可以获取IP地址与MAC地址的对应关系,从而可以完成IPv6报文中源IPv6地址和目的IPv6地址到始发MAC地址和终结MAC地址的转换,还可以完成三层路由表到二层转发表的转换。
结合第一方面的第五种可能的实现,在第一方面的第六种可能的实现中,上述方式一包括:
所述网络节点接收所述终结节点发送的第一目标公告对象(Destination Advertisement Object,DAO)报文或第一目标导向的有向无环图(Destination Oriented Directed Acyclic Graph,DODAG)信息对象(DODAG Information Object,DIO)报文,从所述第一DAO报文或第一DIO报文中获取所述终结节点的IPv6地址与所述终结节点的MAC地址的对应关系;
所述网络节点接收所述下一跳节点发送的第二DAO报文或第二DIO报文,从所述第二DAO报文或第二DIO报文中获取所述下一跳节点的IPv6地址与MAC地址的对应关系。
所述网络节点还可以发送第三DAO报文或第三DIO报文,所述第三DAO报文或第三DIO报文中包括所述网络节点的IPv6地址和MAC地址,以使收到所述第三DAO报文或第三DIO报文的节点获取所述网络节点的IPv6地址与所述网络节点的MAC地址的对应关系。
这样,所述低速无线网状网中各个节点在建立路由(入网或者其父节点切换)时,发送携带MAC地址的DAO报文或DIO报文,使得收到该DAO报文或DIO报文的其他节点都能获得该节点的IPv6地址和MAC地址的对应关系,从而获得所述低速无线网状网中所有节点的IPv6地址与MAC地址的对应关系。
第二方面,提供了一种报文转发方法,用于低速无线网状网中,所述方法包括:
网络节点接收数据帧,所述数据帧中MAC头和二层转发头,所述MAC头中包括源MAC地址和目的MAC地址,所述二层转发头中包括始发MAC地址和终结MAC地址;所述数据帧中还包括6LoWPAN压缩的IPv6报文,所述MAC头和所述二层转发头在所述6LoWPAN压缩的IPv6报文(甚至是IEEE 802.15.4数据链路层加密后的6LoWPAN压缩的IPv6报文)的外层;所述网络节点使能了二层转发功能;当所述终结MAC地址不是所述网络节点的MAC地址(所述网络节点可以通过比较所述终结MAC地址与所述网络节点的MAC地址,来确定所述终结MAC地址是否所述网络节 点的MAC地址)时,所述网络节点根据所述终结MAC地址获取下一跳节点的MAC地址;所述网络节点将所述源MAC地址更新为所述网络节点的MAC地址,所述目的MAC地址更新为所述下一跳节点的MAC地址,并向所述下一跳节点发送所述数据帧。
所述数据帧在低速无线网状网中传输过程中,中间转发节点(非终结节点)在收到带有二层转发头的数据帧时,可以直接根据二层转发头进行二层转发,而无需对数据帧进行解压缩(或解密和解压缩)处理得到IPv6报文的目的IPv6地址进行三层路由,再压缩(或压缩和加密)处理为数据帧,提高了转发效率,还避免了解压缩(或解密和解压缩)再压缩(或压缩和加密)处理所消耗的资源和电源。
在第二方面的第一种可能的实现中,所述方法还包括:
当所述终结MAC地址是所述网络节点的MAC地址时,即所述网络节点确定所述网络节点是所述数据帧的终结节点时,所述网络节点对所述数据帧进行解封装,得到IPv6报文。
具体地,所述网络节点对所述数据帧进行解封装,得到IPv6报文,包括:所述网络节点去除所述数据帧的链路层封装(去除MAC头和二层转发头,及可选的数据链路层解密处理),得到所述6LoWPAN压缩的IPv6报文,所述6LoWPAN压缩的IPv6报文中包括6LoWPAN压缩头,所述6LoWPAN压缩头中包括源地址压缩标识和目的地址压缩标识,所述源地址压缩标识用于指示源IPv6地址是否压缩,所述目的地址压缩标识用于指示目的IPv6地址是否压缩;所述网络节点根据所述二层转发头和所述6LoWPAN压缩头,对所述压缩的IPv6报文进行解压缩,得到IPv6报文。
所述网络节点根据所述二层转发头和所述6LoWPAN压缩头,对所述6LoWPAN压缩的IPv6报文进行解压缩,包括:
当所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址已压缩时,所述网络节点根据所述二层网状头中的始发MAC地址得到所述IPv6报文的源IPv6地址,根据所述二层网状头中的终结MAC地址得到所述IPv6报文的目的IPv6地址;
当所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址未压缩时,所述网络节点根据所述二层网状头中的始发MAC地址得到所述IPv6报文的源IPv6地址,从所述6LoWPAN压缩的IPv6报文的内层IPv6字段中获取所述IPv6报文的目的IPv6地址;
当所述源地址压缩标识指示源IPv6地址未压缩,所述目的地址压缩标识指示目的IPv6地址已压缩时,所述网络节点根据所述二层网状头中的终结MAC地址得到所述IPv6报文的目的IPv6地址,从所述6LoWPAN压缩的IPv6报文的内层IPv6字段中获取所述IPv6报文的源IPv6地址。
这样,低速无线网状网中带有二层转发头的数据帧,在中间节点根据二层转发头进行二层转发,无需进行解压(或解密和解压)再压缩(或压缩和加密)处理,只在终结节点对该数据帧进行解压(或解密和解压)处理,既达到了节能的目的,又提高了网络的(报文转发和处理)性能。
结合第二方面或第二方面的第一种可能的实现,在第二方面的第二种可能的实 现中,所述网络节点根据所述终结MAC地址获取下一跳节点的MAC地址,包括:
所述网络节点根据所述终结MAC地址查询所述网络节点的二层转发表,得到所述下一跳节点的MAC地址,所述二层转发表中包括所述终结MAC地址和所述下一跳节点的MAC地址的对应关系。具体来说,所述二层转发表中包括一条或多条转发表项,其中一条转发表项包括所述终结MAC地址和所述下一跳节点的MAC地址的对应关系。
可选地,在所述网络节点根据所述终结MAC地址查询所述网络节点的二层转发表之前,所述网络节点根据所述低速无线网状网中各个节点的IP地址和MAC地址的对应关系,将所述网络节点的三层路由表转换为所述二层转发表。转换后,所述网络节点既有三层路由表也有二层转发表。所述网络节点可以通过一张对应关系表保存各个节点的IP地址和MAC地址的对应关系。
这样,所述低速无线网状网中使能二层转发功能的网络节点,需要将三层路由表转换为根据MAC地址做二层转发的二层转发表,并在收到包含二层转发头的数据帧时,根据二层转发头中的终结MAC地址查询二层转发表,获取下一跳节点的MAC地址,进行二层转发,不仅可以提高转发效率,还节约了处理资源和电源。
结合第二方面和第二方面的上述可能的实现中的任一种,在第二方面的第三种可能的实现中,所述方法还包括:所述网络节点获取所述低速无线网状网中各个节点的IP地址和MAC地址的对应关系。
所述网络节点可以通过如下任一方式所述低速无线网状网中各个节点的获取IP地址与MAC地址的对应关系:
方式一,扩展三层路由协议,所述低速无线网状网中各个节点在建立路由过程中通告自己的MAC地址,即,所述低速无线网状网中各个节点在建立路由时,报文中不仅包括自己的IP地址,还包括自己的MAC地址;
方式二,扩展邻居发现协议,所述网络节点与低速无线网状网中其他节点间相互同步邻居缓存表,获得所述低速无线网状网中所有节点的IPv6地址与MAC地址的对应关系。
结合第二方面的第三种可能的实现,在第一方面的第四种可能的实现中,上述方式一包括:
所述网络节点发送第一DAO报文或第一DIO报文,所述第一DAO报文或第一DIO报文中包括所述网络节点的IPv6地址和MAC地址,以使收到所述第一DAO报文或第一DIO报文的节点获取所述网络节点的IPv6地址与所述网络节点的MAC地址的对应关系;
所述网络节点接收所述下一跳节点发送的第二DAO报文或第二DIO报文,从所述第二DAO报文或第二DIO报文中获取所述下一跳节点的IPv6地址与所述下一跳节点的MAC地址的对应关系。
所述低速无线网状网中的各个节点在使能二层转发功能后,需要获取网络中所有节点的IPv6地址与MAC地址的对应关系,以便将三层路由表转换为二层转发表,进行二层转发。
第三方面,提供了一种网络节点,用于实现上述报文转发方法。所述网络节点包 括处理器和通信接口。所述处理器被配置为支持网络节点执行上述方法中相应的功能。所述通信接口用于支持网络节点之间的通信,发送和接收上述方法中的数据帧,以及所涉及的信息或指令。所述网络节点还包括存储器,所述存储器与所述处理器耦合,保存所述网络节点必要的数据(例如,二层转发表,三层路由表,IPv6地址与MAC地址的对应关系等)。所述存储器还可用于存储指令。所述处理器执行所述存储器中存储的指令,实现上述第一方面和第二方面所述的报文转发方法。
第四方面,提供了一种报文转发装置,用于低速无线网状网的网络节点中,所述报文转发装置包括实现上述第一方面和第二方面的报文转发方法的模块。
第五方面,提供了一种计算机存储介质,存储有实现上述第一方面和第二方面的报文转发方法的程序代码,所述程序代码中包括指令。网络节点或报文转发装置执行所述程序代码可以实现上述第一方面和第二方面中的报文转发方法。
第六方面,提供了一种低速无线网状网(报文转发系统),包括多个网络节点。各个网络节点可以如上述第三方面所述,或者包括如上述第四方面所述的报文转发装置。
本申请提供的技术方案,通过在数据帧中增加二层转发头,并根据二层转发头中的终结MAC地址做二层转发,避免了报文转发过程中逐跳进行解压(或解密和解压)再压缩(或压缩和加密)处理,不仅提高了报文转发效率,且节约了电源(节能)。
附图说明
图1为现有低速无线网状网中数据帧格式示意图;
图2为本发明实施例提供的含二层转发头的数据帧格式示意图;
图3为本申请实施例提供的二层转发头中帧控制域的格式示意图;
图4为本申请实施例提供的低速无线网状网的结构示意图;
图5为本申请实施例提供的一种报文转发方法的流程示意图;
图6为本申请实施例提供的另一报文转发方法的流程示意图;
图7为本申请实施例提供的一种报文转发装置的结构示意图;
图8为本申请实施例提供的另一种报文转发装置的结构示意图;
图9为本申请实施例提供的网络节点的结构示意图。
具体实施方式
本发明实施例提供了一种报文转发方法,对基于IEEE 802.14.5协议和6LoWPAN协议构建的低速无线网状网,可以将基于三层路由协议,例如,用于低功耗和有损网络的IPv6路由协议(IPv6Routing Protocol for Low-Power and Lossy Network,RPL),生成的三层路由表,根据IPv6地址与MAC地址之间的对应关系,转换得到链路层转发表,也称为二层转发表。并且对低速无线网状网中的数据帧进行扩展,在报文的MAC头之后添加二层转发头,与链路层转发表配合实现报文的二层转发。
本发明实施例中的“三层(layer 3)”是开放式系统互联通信参考模型(OSI)中定义的网络层,“二层(layer 2)是OSI中定义的数据链路层。
如图2所示,为本发明实施例提供的含二层转发头的扩展报文的格式示意图。其 中,二层转发头中包括帧控制域,始发MAC地址(initial MAC Address,iMAC)和终结MAC地址(final MAC Address,fMAC)。
帧控制域包括协议版本号,始发MAC地址模式,终结MAC地址模式,以及剩余跳数。其中,始发MAC地址模式和终结MAC地址模式用于指示MAC地址的模式,0表示地址为8字节,1表示地址为2字节。剩余跳数(Hop Left)每转发一次减1,用于防止报文在网络中循环转发。始发节点可以根据低速无线网状网的规模设置剩余跳数,例如最大32跳;始发节点也可以将剩余跳数设置为IPv6报文头中的跳数。节点收到剩余跳数为0的数据帧应丢弃。
帧控制域还可以进一步包括路由协议选项,用于携带报文中三层路由转发的控制信息。例如图3所示,为本发明实施例提供的二层转发头中帧控制域的格式示意图,其中以包括RPL路由协议选项为例。当然实际应用中,帧控制域中也可以没有路由协议选项。
在图3所示的RPL路由协议选项中:
下行标记位(Down Flag),用于指示报文是否由根节点向下发送,通常用于RPL协议中的环路检测功能。当报文是由根节点(也就是BR)向下发送时,Down Flag置1,反之置0。
Rank出错(Rank Error)标记位,是在Down Flag为1(即报文由根向下发送)时使用。如果发送者Rank大于本节点Rank时,Rank出错标记位为1,指示存在环路。否则,Rank出错标记位为0。
发送者Rank存在(SRE)标记位,用于指示在二层转发头之后是否存在发送者Rank字段。例如,该标记位为1,指示在二层转发头之后存在发送者Rank字段(2字节),该Rank出错标记位为0,则无发送者Rank字段。发送者Rank字段用于RPL环路检测。
RPL实例存在(RIIE)标记位,用于指示在二层转发头之后是否存在RPL实例标识(ID)字段。例如,该标记位为1,表示在二层转发头之后存在RPL实例ID(1字节)。该标记位为0,表示没有RPL实例ID字段。RPL实例标识(ID)用于区分RPL网络中的不同实例。
预留字段,可以为空,也可以在SRE标记位为1时包括发送者Rank字段,在RIIE标记位为1时包括RPL实例ID。
RPL是一种基于距离向量的IPv6路由协议,支持组建网状网并实现IPv6报文的路由转发。基于RPL组建的网状网是三层网状网络,其网络拓扑是一种有向无环图,也称为目标导向的有向无环图(Destination Oriented Directed Acyclic Graph,DODAG)。考虑到低速无线网状网的低功耗和有损特性,RPL是低速无线网状网的常用路由协议。
本发明实施例中,以RPL作为三层路由协议为例,说明本发明的报文转发方法,当然也可以采用其他路由协议,例如,无线自组网按需平面距离向量(Ad hoc On-Demand Distance Vector,AODV)路由协议,下一代路由信息协议(Routing Information Protocol next generation,RIPng)等,实现。本发明对此不做限定。
本发明实施例中,始发MAC地址(Initial Address)根据报文的源IPv6地址得到,是低速无线网状网中始发节点的MAC地址。终结MAC地址(Final Address)根据报 文的目的IPv6地址得到,是报文要送达的低速无线网状网中的终结节点的MAC地址。
参见图4,为本发明实施例提供的低速无线网状网的结构示意图。该低速无线网状网中包括若干节点,其中边界路由器(BR)用于连接该低速无线网状网与其他的网络或用户终端。
当IPv6报文是由低速无线网状网中一个节点发送给另一节点时,例如图4中节点A发送给节点F时,源IPv6地址是节点A的IPv6地址,目的IPv6地址是节点F的IPv6地址。相应地,二层转发头中的始发MAC地址是节点A的MAC地址,终结MAC地址是节点F的MAC地址。并且,根据6LoWPAN定义的压缩机制,内层IPv6字段为0字节,即没有内层IPv6字段,并且6LoWPAN压缩头中指示了源地址已压缩、目的地址已压缩。
当IPv6报文是该低速无线网状网之外的节点,例如节点X(图4中未示出),发送给该低速无线网状网中一个节点,例如图4中节点F时,源IPv6地址是节点X的IPv6地址,目的IPv6地址是节点F的IPv6地址。则该IPv6报文在该低速无线网状网中的始发节点为该低速无线网状网的BR。相应地,二层转发头中的始发MAC地址是BR的MAC地址,终结MAC地址是节点F的MAC地址。并且,根据6LoWPAN定义的压缩机制,内层IPv6字段中包括源IPv6地址,即节点X的IPv6地址,并且6LoWPAN压缩头中指示了源地址未压缩、目的地址已压缩。
当IPv6报文是由该低速无线网状网中的节点,例如节点A,发送给该低速无线网状网之外的节点,例如节点X(图4中未示出)时,源IPv6地址是节点A的IPv6地址,目的IPv6地址是节点X的IPv6地址。则该IPv6报文在该低速无线网状网中的终结节点为该低速无线网状网的BR。相应地,二层转发头中的始发MAC地址是节点A的MAC地址,终结MAC地址是BR的MAC地址。并且,根据6LoWPAN定义的压缩机制,内层IPv6字段中包括目的IPv6地址,即节点X的IPv6地址,并且6LoWPAN压缩头中指示了源地址压缩、目的地址未压缩。
进一步地,可以在MAC头中扩展一个二层转发头标识,用于指示数据帧中是否包含二层转发头。具体地,可以用MAC头的帧控制域中预留的一个比特位(bit),例如bit 7,作为所述二层转发头标识。例如,该bit7置1表示报文中包含二层转发头,该bit7置0表示不包含二层转发头。节点收到没有二层转发头的数据帧时,可以仍然按传统方式处理。当然可以扩展MAC头中其他字段作为该二层转发头标识,对此本发明不做限定。
采用本发明实施例提供的报文转发方法,低速无线网状网中各个节点将三层路由表映射为二层转发表,始发节点对IPv6报文进行压缩和加密(可选)处理,然后封装二层转发头和MAC头得到数据帧。二层转发头中的始发MAC地址和终结MAC地址在转发过程中保持不变,中间节点只需根据二层转发头进行二层转发。终结节点才会进行解密(可选)和解压缩处理,得到所述IPv6报文,再解析该IPv6报文。这样,IPv6报文在低速无线网状网中,仅在始发节点进行一次压缩和加密(可选)处理,在终结节点进行一次解密(可选)和解压缩处理,中间节点只需根据二层转发头进行二层转发,避免了报文转发过程中逐跳加/解密(可选)和压缩/解压缩,从而提高了转发效率。
可选地,低速无线网状网中节点可以使能或去使能二层转发。当节点使能二层转发时,节点可以将三层路由表映射为二层转发表,并根据二层转发头对报文进行二层转发。当节点不使能二层转发时,节点可以仍按传统方式处理报文。
本发明实施例中,基于三层路由表转换得到链路层转发表(二层转发表),需要根据IPv6地址与MAC地址之间的对应关系。
一种可能的实现中,IPv6地址是基于无状态地址自动配置(Stateless address autoconfiguration,SLAAC)方式生成的,因此IPv6地址与MAC地址可以相互转换。
基于SLAAC方式生成的IPv6地址,由64位的网络前缀和64位的接口标识组成。其中,接口标识是根据64位的MAC地址,也称为64-位扩展唯一标识(EUI-64),生成。具体地,将EUI-64中全局/本地(U/L)位取反后的64位数作为IPv6地址的后64位,网络前缀作为前64位,得到128位的IPv6地址。
因而也可以反过来,根据IPv6地址得到MAC地址,从而可以将L3路由表映射为L2转发表。具体地,去除IPv6地址前64位的网络前缀,得到64位的接口标识,将其中的U/L位取反,就可以得到MAC地址。
另一种可能的实现中,低速无线网状网中每个节点可以根据IPv6地址与MAC地址的对应关系,对三层路由表进行转换,得到链路层转发表。
可以扩展邻居发现协议,使得低速无线网状网中各个节点间相互同步邻居缓存表,得到网络中各个节点的IPv6地址与MAC地址的对应关系。
或者,可以扩展三层路由协议,在建立路由过程中通告MAC地址。例如,RPL协议中,可以在目标公告对象(Destination Advertisement Object,DAO)报文,或者DODAG信息对象(DODAG Information Object,DIO)报文中扩展一个字段,用于携带MAC地址(因为DAO报文或DIO报文原本就包含节点的IPv6地址),当然也可以携带IPv6地址与MAC地址的对应关系。例如,节点在入网或者其父节点切换时发送携带MAC地址的DAO报文或DIO报文,使得收到该DAO报文或DIO报文的其他节点都能获得该节点的IPv6地址和MAC地址的对应关系。再例如,AODV路由协议中,可以扩展路由回复报文,携带MAC地址。在RIPng中,在洪泛过程中携带MAC地址。
本发明实施例提供的技术方案,适用于需要对IPv6报文进行压缩和/或加密传输的低速无线网状网。
本发明实施例中的数据帧为满足IEEE 802.15.4标准定义的数据帧。
下面结合附图说明本发明实施例提供的低速无线网状网中的报文转发方法和装置。以下实施例中以IPv6报文需要压缩并加密传输来说明,但并不作为对本发明的限定。
参见图5所示,为本发明实施例提供的一种报文转发方法的流程交互示意图,用于低速无线网状网中,所述方法包括:
501、第一节点(始发节点)根据IPv6报文生成数据帧,并向第二节点发送所述数据帧,所述数据帧中包括MAC头和二层转发头;
所述二层转发头中包括始发MAC地址和终结MAC地址,所述始发MAC地址为 所述第一节点的MAC地址,所述终结MAC地址为终结节点的MAC地址。
所述二层转发头中还可以包括剩余跳数,所述第一节点可以根据所述低速无线网状网的规模设置所述剩余跳数。所述第一节点也可以将所述剩余跳数设置为所述IPv6报文的头部中的跳数。
可选的,所述二层转发头中还包括路由协议选项,所述路由协议选项中包括所述IPv6报文的扩展头中逐跳转发相关的信息,例如图3所示。
所述MAC头中包括源MAC地址(SMAC)和目的MAC地址(DMAC)。所述源MAC地址为所述第一节点的MAC地址,所述目的MAC地址为所述第二节点的MAC地址。所述第二节点为所述第一节点的下一跳。
所述MAC头中还包括二层转发头标识,用于指示所述数据帧中是否包括二层转发头。这样,低速无线网状网中的节点收到所述数据帧后,可以根据该标识正确获取二层转发头,从而根据二层转发头对所述数据帧进行二层转发。
所述数据帧中还包括6LoWPAN压缩的IPv6报文,所述MAC头和所述二层转发头在所述6LoWPAN压缩的IPv6报文(甚至是IEEE 802.15.4数据链路层加密后的6LoWPAN压缩的IPv6报文)的外层。
所述第一节点使能了二层转发功能。
在第一节点(始发节点)根据IPv6报文生成数据帧之前,所述第一节点根据所述IPv6报文的源IPv6地址和目的IPv6地址得到所述始发MAC地址和所述终结MAC地址,并根据所述终结MAC地址获取下一跳节点(即所述第二节点)的MAC地址。
所述第一节点根据所述终结MAC地址获取下一跳节点的MAC地址,包括:
所述第一节点根据所述终结MAC地址查询所述第一节点的二层转发表,获取所述下一跳节点(即所述第二节点)的MAC地址,所述二层转发表中包括所述终结MAC地址与所述第二节点的MAC地址的对应关系。具体来说,所述二层转发表中包括一条或多条转发表项,其中一条转发表项包括所述终结MAC地址和所述第二节点的MAC地址的对应关系。
可选地,在所述第一节点根据所述终结MAC地址查询所述二层转发表之前,所述第一节点根据所述低速无线网状网中各个节点的IP地址和MAC地址的对应关系,将所述第一节点的三层路由表转换为所述二层转发表。转换后,所述第一节点可以既有三层路由表也有二层转发表。所述网络节点可以通过一张对应关系表保存所述低速无线网状网中各个节点的IP地址和MAC地址的对应关系。
所述第一节点获取所述低速无线网状网中各个节点的IP地址和MAC地址的对应关系,可以包括:所述第一节点接收所述终结节点发送的第一DAO报文或第一DIO报文,从所述第一DAO报文或第一DIO报文中获取所述终结节点的IPv6地址与所述终结节点的MAC地址的对应关系;接收所述第二节点发送的第二DAO报文或第二DIO报文,从所述第二DAO报文或第二DIO报文中获取所述下一跳节点的IPv6地址与MAC地址的对应关系。
所述第一节点还可以发送第三DAO报文或第三DIO报文,所述第三DAO报文或第三DIO报文中包括所述第一节点的IPv6地址和MAC地址,以使收到所述第三DAO报文或第三DIO报文的节点获取所述第一节点的IPv6地址与所述网络节点的 MAC地址的对应关系。
所述第一节点根据IPv6报文生成数据帧,即所述第一节点对所述IPv6报文进行处理和封装,生成所述数据帧,包括:
所述第一节点采用6LoWPAN协议规定的压缩机制,对所述IPv6报文(具体是对所述IPv6报文的报文头)进行压缩,并封装6LoWPAN压缩头,得到所述6LoWPAN压缩的IPv6报文,所述6LoWPAN压缩头中包括源地址压缩标识和目的地址压缩标识,所述源地址压缩标识用于指示源IPv6地址是否压缩,所述目的地址压缩标识用于指示目的IPv6地址是否压缩;然后,所述第一节点在所述6LoWPAN压缩的IPv6报文外层封装所述二层转发头和所述MAC头,得到所述数据帧。
所述第一节点采用6LoWPAN协议规定的压缩机制对所述IPv6报文进行压缩,包括:
当所述源IPv6地址是所述低速无线网状网中节点的地址,所述目的IPv6地址是所述低速无线网状网中节点的地址时,所述第一节点压缩所述IPv6报文的所述源IPv6地址和所述目的IPv6地址,并使所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址已压缩;所述6LoWPAN压缩的IPv6报文中没有内层IPv6字段,即内层IPv6字段为0字节;
当所述源IPv6地址是所述低速无线网状网中节点的地址,所述目的IPv6地址不是所述低速无线网状网中节点的地址时,所述第一节点压缩所述IPv6报文的所述源IPv6地址,并使所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址未压缩,所述6LoWPAN压缩的IPv6报文中还包括内层IPv6字段,所述内层IPv6字段中包括所述目的IPv6地址;
当所述源IPv6地址不是所述低速无线网状网中节点的地址,所述目的IPv6地址是所述低速无线网状网中节点的地址时,所述第一节点压缩所述IPv6报文的所述目的IPv6地址,并使所述源地址压缩标识指示源IPv6地址未压缩,所述目的地址压缩标识指示目的IPv6地址已压缩,所述6LoWPAN压缩的IPv6报文中还包括内层IPv6字段,所述内层IPv6字段中包括所述源IPv6地址。
可选地,若报文需要进行加密传输,则在所述第一节点在所述6LoWPAN压缩的IPv6报文外层封装所述二层转发头和所述MAC头之前,还包括:
所述第一节点按照IEEE 802.15.4协议提供的数据链路层加密机制,对所述6LoWPAN压缩的IPv6报文进行加密,并增加附加安全头。然后,所述第一节点所述附加安全头的外层依次封装所述二层转发头和所述MAC头,得到如图2所示结构的数据帧。
由于所述二层转发头封装在加密和压缩处理后的IPv6报文的外层,收到该数据帧的节点可以直接获取所述二层转发头,从而更容易、更快获取终结MAC地址做二层转发,提高了转发效率。
502、所述第二节点接收所述数据帧,根据所述数据帧的MAC头判断所述数据帧中是否包括二层转发头;
所述第二节点使能了二层转发功能。所述第二节点收到所述数据帧后,首先获取所述数据帧的MAC头中的二层转发头标识,并根据所述二层转发头标识确定所述数 据帧中是否包含二层转发头。当所述二层转发头标识指示所述数据帧中包括二层转发头时,继续步骤503;当所述二层转发头标识指示所述数据帧中未包括二层转发头时,按照传统方式处理所述数据帧,并结束流程。
503、所述第二节点从所述数据帧的二层转发头中获取终结MAC地址,并判断所述终结MAC地址是否是自己的MAC地址;
当所述数据帧中包括二层转发头时,所述第二节点从所述数据帧的二层转发头中获取终结MAC地址,并判断所述终结MAC地址是否自己的MAC地址(所述第二节点可以通过比较所述终结MAC地址与自己的MAC地址,来确定所述终结MAC地址是否自己的MAC地址)。换言之,所述第二节点要根据二层转发头确定自己是否终结节点。当所述终结MAC地址是所述第二节点的MAC地址时,即所述第二节点是所述数据帧的终结节点时,执行步骤504;当所述终结MAC地址不是所述第二节点的MAC地址时,即所述第二节点不是所述数据帧的终结节点时,执行步骤505。
可选地,所述第二节点在判断所述终结MAC地址是否是自己的MAC地址之前,所述第二节点确定所述二层转发头中的剩余跳数不为0。
可选地,若所述二层转发头中还包括路由协议选项,所述第二节点检查所述路由协议选项。例如,检查如图3所示的RPL路由协议选项中各个参数。
504、若所述终结MAC地址是所述第二节点的MAC地址,所述第二节点解封装所述数据帧,得到所述IPv6报文。
所述第二节点解封装所述数据帧,得到所述IPv6报文,具体包括:去除所述数据帧的链路层封装(去除MAC头和二层转发头,及可选的数据链路层解密处理),得到所述6LoWPAN压缩的IPv6报文,所述6LoWPAN压缩的IPv6报文中包括6LoWPAN压缩头,所述6LoWPAN压缩头中包括源地址压缩标识和目的地址压缩标识,所述源地址压缩标识用于指示源IPv6地址是否压缩,所述目的地址压缩标识用于指示目的IPv6地址是否压缩;所述第二节点再根据所述二层转发头和所述6LoWPAN压缩头,对所述6LoWPAN压缩的IPv6报文解压缩,得到所述IPv6报文。
去除所述数据帧的链路层封装,得到所述6LoWPAN压缩的IPv6报文,包括:去除所述MAC头和所述二层转发头,并根据所述附加安全头进行数据链路层解密(按照IEEE 802.15.4协议),得到所述6LoWPAN压缩的IPv6报文。
所述第二节点根据所述二层转发头和所述6LoWPAN压缩头对所述6LoWPAN压缩的IPv6报文解压缩,包括:采用6LoWPAN协议规定的解压缩机制,根据所述6LoWPAN压缩头中的源地址压缩标识和目的地址压缩标识,所述二层转发头(所述始发MAC地址和/或所述终结MAC地址),以及内存IPv6字段解压缩所述压缩的IPv6报文。具体地,
当所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址已压缩时,所述第二节点根据所述二层网状头中的始发MAC地址得到所述IPv6报文的源IPv6地址,根据所述二层网状头中的终结MAC地址得到所述IPv6报文的目的IPv6地址;
当所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址未压缩时,所述第二节点根据所述二层网状头中的始发MAC地址得到所 述IPv6报文的源IPv6地址,从所述6LoWPAN压缩的IPv6报文的内层IPv6字段中获取所述IPv6报文的目的IPv6地址;
当所述源地址压缩标识指示源IPv6地址未压缩,所述目的地址压缩标识指示目的IPv6地址已压缩时,所述第二节点根据所述二层网状头中的终结MAC地址得到所述IPv6报文的目的IPv6地址,从所述6LoWPAN压缩的IPv6报文的内层IPv6字段中获取所述IPv6报文的源IPv6地址。
所述第二节点解封装所述数据帧,得到所述IPv6报文之后,将所述IPv6报文发送到所述第二节点的IPv6协议栈进行解析。
505、若所述终结MAC地址不是所述第二节点的MAC地址,所述第二节点根据所述终结MAC地址获取下一跳节点的MAC地址,并向该下一跳节点转发所述数据帧;
具体地,所述第二节点根据所述终结MAC地址查询所述第二节点的二层转发表,得到下一跳节点的MAC地址。然后所述第二节点更新所述数据帧的MAC头,具体地,所述第二节点将所述MAC头中的源MAC地址更新为所述第二节点的MAC地址,目的MAC地址更新为所述下一跳节点的MAC地址。可选地,所述第二节点还将所述二层转发头中的剩余跳数减1。然后,所述第二节点向所述下一跳节点转发所述数据帧。
可选地,所述第二节点在收到所述数据帧之前,获取所述低速无线网状网中各个节点的IP地址和MAC地址的对应关系。具体包括:
所述第二节点接收所述下一跳节点发送的第四DAO报文或第四DIO报文,从所述第四DAO报文或第四DIO报文中获取所述下一跳节点的IPv6地址与所述下一跳节点的MAC地址的对应关系。
所述第二节点可以通过一张对应关系表保存各个节点的IP地址和MAC地址的对应关系。
本发明实施例提供的报文转发方法,始发节点根据IPv6报文中的源IPv6地址和目的IPv6地址,得到对应的始发MAC地址和终结MAC地址,并放在IPv6报文外层未经压缩(甚至加密)处理的二层转发头中,中间节点收到数据帧后,可以更容易、更快获取到二层转发头中的终结MAC地址做二层转发,而无需对数据帧进行解压缩(可选还有解密)处理得到IPv6报文的目的IPv6地址进行三层路由,提高了转发效率。数据帧到达终结节点才进行解压缩(和可选的解密)处理,避免了IPv6报文转发过程中逐跳进行解压缩(或解密和解压缩)再压缩(或压缩和加密)所消耗的资源和电源,从而可以提高整个网络的性能。
下面以图4所示的低速无线网状网中节点A给节点F发送报文为例,说明本发明实施例提供的报文转发方法。如图6所示的报文转发方法包括:
601、节点A根据IPv6报文生成数据帧,所述数据帧中包括6LoWPAN压缩的IPv6报文,以及在所述6LoWPAN压缩的IPv6报文外层的MAC头和二层转发头,所述二层转发头中包括始发MAC地址和终结MAC地址,节点A根据所述终结MAC地址得到下一跳节点,即节点B的MAC地址,并向节点B发送所述数据帧;
所述IPv6报文的源IPv6地址为节点A的IPv6地址,目的IPv6地址为节点F的IPv6地址。
所述二层转发头中,所述始发MAC地址为节点A的MAC地址,所述终结MAC地址为节点F的MAC地址。
所述MAC头包括源MAC地址和目的MAC地址,其中,所述源MAC地址为节点A的MAC地址,所述目的MAC地址为节点B的MAC地址。所述MAC头中还包括二层转发头标识,该二层转发头标识指示了所述数据帧中包括二层转发头。
所述6LoWPAN压缩的IPv6报文中包括6LoWPAN压缩头,所述6LoWPAN压缩头中包括源地址压缩标识和目的地址压缩标识。所述源地址压缩标识指示源地址已压缩,所述目的地址压缩标识指示目的地址已压缩。
节点A使能了二层转发功能,可以根据三层路由表转换得到二层转发表,并可以根据二层转发表对包含二层转发头的数据帧进行二层转发。
具体地,节点A根据所述IPv6报文的源IPv6地址和目的IPv6地址,基于IPv6地址和MAC地址的对应关系,分别得到所述二层转发头中的始发MAC地址和终结MAC地址。节点A再根据所述终结MAC地址查询自己的二层转发表,得到下一跳节点,即节点B,的MAC地址。然后节点A按照6LoWPAN协议规定的压缩机制,对IPv6报文的头部进行压缩,并封装6LoWPAN压缩头,得到所述6LoWPAN压缩后的IPv6报文。本实施例中,由于二层转发头中包括所述始发MAC地址和所述终结MAC地址,且所述始发MAC地址与所述源IPv6地址存在对应关系,所述终结MAC地址与所述目的IPv6地址存在对应关系,因此节点A可以对所述IPv6报文中的所述源IPv6地址和所述目的IPv6地址均进行压缩,提升了压缩效果。压缩后,所述6LoWPAN压缩头中源地址压缩标识指示源地址已压缩,目的地址压缩标识指示目的地址已压缩,内层IPv6字段为0字节。然后,节点A对所述6LoWPAN压缩后的IPv6报文进行加密处理并封装安全头,再封装二层转发头和MAC头,得到所述数据帧,如图6所示。
所述二层转发头中还可以包括剩余跳数(Hop Left),如图6中所示,剩余跳数(Hop Left)可以设为该低速无线网状网支持的最大跳数,例如64。
602、节点B接收所述数据帧,当所述终结MAC地址不是节点B的MAC地址时,节点B根据所述终结MAC地址得到下一跳节点,即节点C的MAC地址,并向节点C发送所述数据帧;
具体地,节点B从所述二层转发头中获取终结MAC地址,判断所述终结MAC地址是否是自己的MAC地址。节点B在确定所述终结MAC地址不是自己的MAC地址时,根据所述终结MAC地址查找自己的二层转发表,得到下一跳节点,即节点C的MAC地址。然后节点B更新所述数据帧的MAC头(更新源MAC地址为节点B的MAC地址,目的MAC地址为节点C的MAC地址)。可选地,节点B将所述二层转发头中的剩余跳数减1。然后节点B向节点C发送所述数据帧。
可选地,节点B在从所述二层转发头中获取终结MAC地址之前,根据所述MAC头中的二层转发头标识,确定所述数据帧中包括二层转发头。
603、节点C接收所述数据帧,当所述终结MAC地址不是节点C的MAC地址时, 节点C根据所述终结MAC地址获取下一跳节点,即节点F的MAC地址,并向节点F发送所述数据帧;
具体地,节点C从所述二层转发头中获取终结MAC地址,判断所述终结MAC地址是否是自己的MAC地址。节点C在确定所述终结MAC地址不是自己的MAC地址时,根据所述终结MAC地址查找自己的二层转发表,得到下一跳节点,即节点F的MAC地址。然后节点C更新所述数据帧的MAC头(更新源MAC地址为节点C的MAC地址,目的MAC地址为节点F的MAC地址)。可选地,节点C将所述二层转发头中的剩余跳数减1。然后节点C向节点F发送所述数据帧。
可选地,节点C在从所述二层转发头中获取终结MAC地址之前,根据所述MAC头中的二层转发头标识,确定所述数据帧中包括二层转发头。
604、节点F接收所述数据帧,当所述终结MAC地址是节点F的MAC地址时,节点F解封装所述数据帧,得到所述IPv6报文;
具体地,节点F从所述二层转发头中获取终结MAC地址,并判断所述终结MAC地址是否是自己的MAC地址。节点F在确定所述终结MAC地址是自己的MAC地址时,解封装所述数据帧,得到所述IPv6报文。具体地,节点F去除所述MAC头和所述二层转发头,根据安全头进行解密处理,得到所述6LoWPAN压缩的IPv6报文;再根据所述6LoWPAN压缩头(源地址压缩标识和目的地址压缩标识)和所述二层转发头中的所述始发MAC地址和所述终结MAC地址,对所述6LoWPAN压缩的IPv6报文进行解压缩,得到所述IPv6报文。
然后节点F解析所述IPv6报文,具体就是将所述IPv6报文发送到自己的IPv6协议栈进行解析。
可选地,节点F在从所述二层转发头中获取终结MAC地址之前,根据所述MAC头中的二层转发头标识,确定所述数据帧中包括二层转发头。
在步骤601之前,图4所示的低速无线网状网中使能二层转发功能的节点已获得各个节点的IPv6地址与MAC地址的对应关系,并将三层路由表转换为二层转发表。例如,在通过RPL协议建立路由的过程中,节点A~节点F分别发送包括IPv6地址和MAC地址的DAO报文或DIO报文中,通告各自的IPv6地址和MAC地址的对应关系。
本发明实施例提供的报文转发方法,始发节点A对IPv6报文进行压缩和加密处理后在外层封装二层转发头和MAC头得到数据帧,中间节点B和C收到该数据帧后直接获取二层转发头中的终结MAC地址对该数据帧进行二层转发,终结节点F才对该数据帧进行解密和解压缩处理,不仅提高了报文转发效率,且避免了IPv6报文在转发过程中逐跳进行解密和解压缩再进行压缩和加密处理所消耗的大量资源,从而提高整个网络的性能。
参见图7,为本发明实施例提供的一种报文转发装置700,部署在低速无线网状网的网络节点70中,用于实现如本申请图5和图6所示的报文转发方法。所述报文转发装置700包括:
地址转换模块701,用于根据第一IPv6报文的源IPv6地址得到第一始发MAC地 址,并根据所述第一IPv6报文的目的IPv6地址得到第一终结MAC地址,其中,所述第一始发MAC地址为所述网络节点70的MAC地址,所述第一终结MAC地址为终结节点的MAC地址;
转发处理模块702,用于根据所述第一终结MAC地址获取第一下一跳节点的MAC地址;
封装模块703,用于将所述第一IPv6报文封装生成第一数据帧,所述第一数据帧中包括6LoWPAN压缩的第一IPv6报文,以及在所述6LoWPAN压缩的第一IPv6报文外层的第一MAC头和第一二层转发头,其中,所述第一二层转发头中包括所述第一始发MAC地址和所述第一终结MAC地址,所述第一MAC头中包括第一源MAC地址和第一目的MAC地址,所述第一源MAC地址为所述网络节点70的MAC地址,所述第一目的MAC地址为所述第一下一跳节点的MAC地址;
发送模块704,用于向所述第一下一跳节点发送所述第一数据帧,以使所述第一下一跳节点直接根据所述第一二层转发头(具体根据所述第一终结MAC地址)转发所述第一数据帧。
可选地,所述第一数据帧的MAC头中还包括二层转发头标识,用于指示所述第一数据帧中是否包括二层转发头。
具体地,所述封装模块703根据6LoWPAN协议对所述第一IPv6报文进行压缩,并封装第一6LoWPAN压缩头,得到所述6LoWPAN压缩的第一IPv6报文,所述第一6LoWPAN压缩头中包括包括第一源地址压缩标识和第一目的地址压缩标识,所述第一源地址压缩标识用于指示源IPv6地址是否压缩,所述第一目的地址压缩标识用于指示目的IPv6地址是否压缩。可选地,在需要进行IEEE 802.15.4链路层加密的情况下,所述封装模块703按照IEEE 802.15.4的加密机制,对所述6LoWPAN压缩的第一IPv6报文进行加密,并增加附加安全头(附加安全头在所述第一6LoWPAN压缩头外层)。最后,所述封装模块703在加密后的所述6LoWPAN压缩的第一IPv6报文外层(即,在附加安全头外层)封装所述第一二层转发头和所述第一MAC头,得到所述第一数据帧。所述第一数据帧的结构可参见图2所示。
所述封装模块703,具体用于:
当所述第一源IPv6地址是所述低速无线网状网中节点的地址,所述第一目的IPv6地址是所述低速无线网状网中节点的地址时,压缩所述第一源IPv6地址和所述第一目的IPv6地址,并使所述第一6LoWPAN压缩头中所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址已压缩;
当所述第一源IPv6地址是所述低速无线网状网中节点的地址,所述第一目的IPv6地址不是所述低速无线网状网中节点的地址时,压缩所述第一源IPv6地址,并使所述第一6LoWPAN压缩头中所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址未压缩,所述6LoWPAN压缩的第一IPv6报文中还包括内层IPv6字段,所述内层IPv6字段中包括所述第一目的IPv6地址;
当所述第一源IPv6地址不是所述低速无线网状网中节点的地址,所述第一目的IPv6地址是所述低速无线网状网中节点的地址时,压缩所述IPv6报文的所述目的IPv6地址,并使所述6LoWPAN压缩头中所述源地址压缩标识指示源IPv6地址未压缩,所 述目的地址压缩标识指示目的IPv6地址已压缩,所述6LoWPAN压缩的IPv6报文中还包括内层IPv6字段,所述内层IPv6字段中包括所述第一源IPv6地址。
所述转发处理模块702,具体用于根据所述第一终结MAC地址查询所述网络节点70的二层转发表,获取所述第一下一跳节点的MAC地址。所述二层转发表中包括一条或多条表项,每一条表项为终结MAC地址与下一跳节点的MAC地址的对应关系。所述二层转发表的一条表项中存储所述第一终结MAC地址与所述第一下一跳节点的MAC地址的对应关系。
可选地,所述装置还包括表项转换模块,用于根据所述低速无线网状网中各个节点的IPv6地址与MAC地址的对应关系,将所述网络节点的三层路由表转换为所述二层转发表。
可选地,所述报文转发装置700还包括地址学习模块,用于接收所述终结节点发送的第一DAO报文或第一DIO报文,从所述第一DAO报文或第一DIO报文中获取所述终结节点的IPv6地址与所述终结节点的MAC地址的对应关系;接收所述第一下一跳节点发送的第二DAO报文或第二DIO报文,从所述第二DAO报文或第二DIO报文中获取所述第一下一跳节点的IPv6地址与所述第一下一跳节点的MAC地址的对应关系。
可选地,所述报文转发装置700还包括路由通告模块,用于发送第三DAO报文或第三DIO报文,所述第三DAO报文或第三DIO报文中包括所述网络节点的IPv6地址和MAC地址,以使收到所述第三DAO报文或第三DIO报文的节点获取所述网络节点的IPv6地址与所述网络节点的MAC地址的对应关系。
进一步地,如图8所示,所述报文转发装置700还包括接收模块705和解封装模块706;
所述接收模块705,用于接收第二数据帧,所述第二数据帧中包括6LoWPAN压缩的第二IPv6报文,以及在所述6LoWPAN压缩的第二IPv6报文外层的第二MAC头和第二二层转发头,所述第二MAC头中包括第二源MAC地址和第二目的MAC地址,所述第二二层转发头中包括第二始发MAC地址和第二终结MAC地址;
所述转发处理模块702,还用于当所述第二终结MAC地址不是所述网络节点70的MAC地址时,根据所述第二终结MAC地址获取第二下一跳节点的MAC地址;将所述第二源MAC地址更新为所述网络节点70的MAC地址,所述第二目的MAC地址更新为所述第二下一跳节点的MAC地址;
所述发送模块704,还用于向所述第二下一跳节点发送所述第二数据帧;
所述解封装模块706,用于当所述第二终结MAC地址是所述网络节点70的MAC地址时,解封装所述第二数据帧,得到第二IPv6报文。具体地,所述解封装模块706去除所述第二数据帧的链路层封装,得到所述6LoWPAN压缩的第二IPv6报文,所述6LoWPAN压缩的第二IPv6报文中包括第二6LoWPAN压缩头,所述第二6LoWPAN压缩头中包括第二源地址压缩标识和第二目的地址压缩标识,所述第二源地址压缩标识用于指示源IPv6地址是否压缩,所述第二目的地址压缩标识用于指示目的IPv6地址是否压缩。所述解封装模块706再根据所述第二二层转发头和第二6LoWPAN压缩头,对所述压缩的第二IPv6报文进行解压缩,得到第二IPv6报文。
所述解封装模块706去除所述第二数据帧的链路层封装,得到所述6LoWPAN压缩的第二IPv6报文,包括:去除所述第二MAC头和所述第二二层转发头,并根据所述附加安全头进行数据链路层解密(按照IEEE 802.15.4协议),得到所述6LoWPAN压缩的第二IPv6报文。
所述解封装模块706根据所述第二二层转发头和第二6LoWPAN压缩头,对所述压缩的第二IPv6报文进行解压缩,得到所述第二IPv6报文,包括:采用6LoWPAN协议规定的解压缩机制,根据所述第二6LoWPAN压缩头中的源地址压缩标识和目的地址压缩标识,所述第二二层转发头中的所述第二始发MAC地址和/或所述第二终结MAC地址,以及内层IPv6字段,对所述6LoWPAN压缩的第二IPv6报文进行解压缩,得到所述第二IPv6报文。具体他,
当所述第二源地址压缩标识指示源IPv6地址已压缩,所述第二目的地址压缩标识指示目的IPv6地址已压缩时,所述解封装模块706根据所述第二二层网状头中的第二始发MAC地址得到所述第二IPv6报文的第二源IPv6地址,根据所述第二二层网状头中的第二终结MAC地址得到所述第二IPv6报文的第二目的IPv6地址;
当所述第二源地址压缩标识指示源IPv6地址已压缩,所述第二目的地址压缩标识指示目的IPv6地址未压缩时,所述解封装模块706根据所述第二二层网状头中的第二始发MAC地址得到所述第二IPv6报文的第二源IPv6地址,从所述6LoWPAN压缩的第二IPv6报文的内层IPv6字段中获取所述第二IPv6报文的第二目的IPv6地址;
当所述第二源地址压缩标识指示源IPv6地址未压缩,所述第二目的地址压缩标识指示目的IPv6地址已压缩时,所述解封装模块706根据所述第二二层网状头中的第二终结MAC地址得到所述第二IPv6报文的第二目的IPv6地址,从所述6LoWPAN压缩的第二IPv6报文的内层IPv6字段中获取所述第二IPv6报文的第二源IPv6地址。
所述地址学习模块,还用于接收所述第二下一跳节点发送的第四DAO报文或第四DIO报文,从所述第四DAO报文或第四DIO报文中获取所述第二下一跳节点的IPv6地址与MAC地址的对应关系。
本实施例中未尽之细节可参考图5或6所示方法实施例中的描述。
本发明实施例提供的报文转发装置,部署在低速无线网状网的网络节点中,可将IPv6报文封装成包含二层转发头的数据帧,并根据二层转发头对该数据帧进行二层转发,无需逐跳进行解密(可选)和解压处理后获取目的IPv6地址进行三层路由,再进行压缩和加密处理,不仅提高了转发效率,还可以降低网络节点的处理开销和电源消耗,延长电源使用寿命,从而提升网络性能。
参见图9,为本发明实施例提供的网络节点800,用于实现低速无线网状网中如本发明图5和6所示实施例中的报文转发方法。所述网络节点800包括:处理器801,存储器802和通信接口803;
处理器801,存储器802和通信接口803之间可以通过总线804相互连接;所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图8中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
所述通信接口803是所述网络节点800与其他节点通信的接口。所述通信接口803 包括无线通信接口,也称射频(RF)接口,工作在160兆赫兹(MHz)~1吉赫兹(GHz)频段,以及2.4GHz频段。所述无线通信接口包括天线,用于收发射频信号。无线通信接口可以为WLAN接口,蜂窝网络通信接口,蓝牙接口,ZigBee接口或其组合等。当所述网络节点800为所述低速无线网状网的边界路由器(BR)时,所述通信接口803还可以包括有线通信接口,例如以太网接口。以太网接口可以是光接口,电接口或其组合。为便于表述,本申请中用通信接口803表示,并不作为对本申请技术方案的限定。
所述处理器801可以是中央处理器(CPU),网络处理器(NP),微控制器(MCU)或其组合。处理器601还可以进一步包括硬件芯片。上述硬件芯片可以是专用集成电路(ASIC),可编程逻辑器件(PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(CPLD),现场可编程逻辑门阵列(FPGA),通用阵列逻辑(GAL)或其任意组合。
所述处理器801用于执行图5或6中一个或多个步骤,实现本发明实施例提供的报文转发方法。
具体地,所述处理器801用于:
根据第一IPv6报文的第一源IPv6地址得到第一始发MAC地址,并根据所述第一IPv6报文的第一目的IPv6地址得到第一终结MAC地址,其中,所述第一始发MAC地址为所述网络节点的媒体访问控制MAC地址,所述第一终结MAC地址为终结节点的MAC地址;
根据所述第一终结MAC地址获取第一下一跳节点的MAC地址;
根据所述第一IPv6报文生成第一数据帧,所述第一数据帧中包括IPv6承载于低功耗无线个域网6LoWPAN压缩的第一IPv6报文,以及在所述6LoWPAN压缩的第一IPv6报文外层的第一MAC头和第一二层转发头,其中,所述第一二层转发头中包括所述第一始发MAC地址和所述第一终结MAC地址,所述第一MAC头中包括第一源MAC地址和第一目的MAC地址,所述第一源MAC地址为所述网络节点的MAC地址,所述第一目的MAC地址为所述第一下一跳节点的MAC地址;
通过所述通信接口803向所述第一下一跳节点发送所述第一数据帧,以使所述第一下一跳节点直接根据所述第一二层转发头中的所述第一终结MAC地址转发所述第一数据帧。
具体地,所述处理器801根据所述第一终结MAC地址查询所述网络节点的二层转发表,获取所述第一下一跳的MAC地址,所述二层转发表中包括所述第一终结MAC地址与所述第一下一跳节点的MAC地址的对应关系。
所述处理器801还用于根据所述低速无线网状网中各个节点的IPv6地址与MAC地址的对应关系,将所述网络节点800的三层路由表转换为所述二层转发表。
所述存储器802,用于存储所述三层路由表和所述二层转发表。所述存储器802还可用于存储IPv6地址与MAC地址的对应关系。
所述存储器802可以包括易失性存储器(英文:volatile memory),例如随机存取存储器(RAM);存储器602也可以包括非易失性存储器(英文:non-volatile memory),例如快闪存储器,硬盘(英文:hard disk drive,缩写:HDD)或固态硬盘(英文:solid-state drive,缩写:SSD);存储器802还可以包括上述种类的存储器的组合。
所述处理器801还用于:
通过所述通信接口803接收第二数据帧,所述第二数据帧中包括6LoWPAN压缩的第二IPv6报文,以及在所述6LoWPAN压缩的第二IPv6报文外层的第二MAC头和第二二层转发头,所述第二MAC头中包括第二源MAC地址和第二目的MAC地址,所述第二二层转发头中包括第二始发MAC地址和第二终结MAC地址;
当所述第二终结MAC地址不是所述网络节点的MAC地址时,根据所述第二终结MAC地址获取第二下一跳节点的MAC地址;将所述第二源MAC地址更新为所述网络节点的MAC地址,将所述第二目的MAC地址更新为所述第二下一跳节点的MAC地址;通过所述通信接口803向所述第二下一跳节点发送所述第二数据帧。
当所述第二终结MAC地址是所述网络节点的MAC地址时,去除所述第二数据帧的链路层封装,得到所述6LoWPAN压缩的第二IPv6报文,所述6LoWPAN压缩的第二IPv6报文中包括第二6LoWPAN压缩头,所述第二6LoWPAN压缩头中包括第二源地址压缩标识和第二目的地址压缩标识,所述第二源地址压缩标识用于指示源IPv6地址是否压缩,所述第二目的地址压缩标识用于指示目的IPv6地址是否压缩;根据所述第二二层转发头和所述第二6LoWPAN压缩头,对所述6LoWPAN压缩的第二IPv6报文进行解压缩,得到第二IPv6报文。
可选地,所述存储器802还用于存储程序指令;所述处理器801可以调用存储器802中存放的程序指令,用于执行图5或6中一个或多个步骤,实现本发明实施例提供的报文转发方法。
本实施例中未尽之细节可参考图5或6所示方法实施例中的描述。
以上所述,仅为本发明较佳的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应该以权利要求的保护范围为准。

Claims (23)

  1. 一种报文转发方法,用于低速无线网状网中,其特征在于,所述方法包括:
    网络节点根据互联网协议第六版IPv6报文的源IPv6地址得到始发MAC地址,并根据所述IPv6报文的目的IPv6地址得到终结MAC地址,其中,所述始发MAC地址为所述网络节点的媒体访问控制MAC地址,所述终结MAC地址为终结节点的MAC地址;
    所述网络节点根据所述终结MAC地址获取下一跳节点的MAC地址;
    所述网络节点根据所述IPv6报文生成数据帧,所述数据帧中包括IPv6承载于低功耗无线个域网6LoWPAN压缩的IPv6报文,以及在所述6LoWPAN压缩的IPv6报文外层的MAC头和二层转发头,其中,所述二层转发头中包括所述始发MAC地址和所述终结MAC地址,所述MAC头中包括源MAC地址和目的MAC地址,所述源MAC地址为所述网络节点的MAC地址,所述目的MAC地址为所述下一跳节点的MAC地址;
    所述网络节点向所述下一跳节点发送所述数据帧,以使所述下一跳节点直接根据所述二层转发头中的所述终结MAC地址转发所述数据帧。
  2. 如权利要求1所述的方法,其特征在于,所述网络节点根据所述IPv6报文生成数据帧,包括:
    所述网络节点根据6LoWPAN协议对所述IPv6报文进行压缩,并封装6LoWPAN压缩头,得到所述6LoWPAN压缩的IPv6报文,所述6LoWPAN压缩头中包括源地址压缩标识和目的地址压缩标识,所述源地址压缩标识用于指示源IPv6地址是否压缩,所述目的地址压缩标识用于指示目的IPv6地址是否压缩;
    所述网络节点在所述6LoWPAN压缩的IPv6报文外层封装所述二层转发头和所述MAC头,得到所述数据帧。
  3. 如权利要求2所述的方法,其特征在于,所述网络节点根据6LoWPAN协议对所述IPv6报文进行压缩包括:
    当所述源IPv6地址是所述低速无线网状网中节点的地址,所述目的IPv6地址是所述低速无线网状网中节点的地址时,所述网络节点压缩所述IPv6报文的所述源IPv6地址和所述目的IPv6地址,并使所述6LoWPAN压缩头中所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址已压缩;
    当所述源IPv6地址是所述低速无线网状网中节点的地址,所述目的IPv6地址不是所述低速无线网状网中节点的地址时,所述网络节点压缩所述IPv6报文的所述源IPv6地址,并使所述6LoWPAN压缩头中所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址未压缩,所述6LoWPAN压缩的IPv6报文中还包括内层IPv6字段,所述内层IPv6字段中包括所述目的IPv6地址;
    当所述源IPv6地址不是所述低速无线网状网中节点的地址,所述目的IPv6地址是所述低速无线网状网中节点的地址时,所述网络节点压缩所述IPv6报文的所述目的IPv6地址,并使所述6LoWPAN压缩头中所述源地址压缩标识指示源IPv6地址未压缩,所述目的地址压缩标识指示目的IPv6地址已压缩,所述6LoWPAN压缩的IPv6报文中还包括内层IPv6字段,所述内层IPv6字段中包括所述源IPv6地址。
  4. 如权利要求1至3任一项所述的方法,其特征在于,所述网络节点根据所述终结MAC地址获取下一跳节点的MAC地址,包括:
    所述网络节点根据所述终结MAC地址查询所述网络节点的二层转发表,获取所述下一跳的MAC地址,所述二层转发表中包括所述终结MAC地址与所述下一跳节点的MAC地址的对应关系。
  5. 如权利要求4所述的方法,其特征在于,在所述网络节点根据所述终结MAC地址查询所述网络节点的二层转发表之前,所述方法还包括:
    所述网络节点根据所述低速无线网状网中各个节点的IPv6地址与MAC地址的对应关系,将所述网络节点的三层路由表转换为所述二层转发表。
  6. 如权利要求1至5任一项所述的方法,其特征在于,在所述网络节点根据所述IPv6报文的目的IPv6地址得到终结MAC地址之前,所述方法还包括:
    所述网络节点接收所述终结节点发送的第一目标公告对象DAO报文或第一目标导向的有向无环图信息对象DIO报文,从所述第一DAO报文或第一DIO报文中获取所述终结节点的IPv6地址与所述终结节点的MAC地址的对应关系;
    所述网络节点接收所述下一跳节点发送的第二DAO报文或第二DIO报文,从所述第二DAO报文或第二DIO报文中获取所述下一跳节点的IPv6地址与所述下一跳节点的MAC地址的对应关系。
  7. 如权利要求1至6任一项所述的方法,其特征在于,还包括:
    所述网络节点发送第三DAO报文或第三DIO报文,所述第三DAO报文或第三DIO报文中包括所述网络节点的IPv6地址和MAC地址,以使收到所述第三DAO报文或第三DIO报文的节点获取所述网络节点的IPv6地址与所述网络节点的MAC地址的对应关系。
  8. 一种报文转发方法,用于低速无线网状网中,其特征在于,所述方法包括:
    网络节点接收数据帧,所述数据帧中包括互联网协议第六版IPv6承载于低功耗无线个域网6LoWPAN压缩的IPv6报文,以及在所述6LoWPAN压缩的IPv6报文外层的媒体访问控制MAC头和二层转发头,所述MAC头中包括源MAC地址和目的MAC地址,所述二层转发头中包括始发MAC地址和终结MAC地址;
    当所述终结MAC地址不是所述网络节点的MAC地址时,所述网络节点根据所述终结MAC地址获取下一跳节点的MAC地址;
    所述网络节点将所述源MAC地址更新为所述网络节点的MAC地址,将所述目的MAC地址更新为所述下一跳节点的MAC地址;
    所述网络节点向所述下一跳节点发送所述数据帧。
  9. 如权利要求8所述的方法,其特征在于,还包括:
    当所述终结MAC地址是所述网络节点的MAC地址时,所述网络节点去除所述数据帧的链路层封装,得到所述6LoWPAN压缩的IPv6报文,所述6LoWPAN压缩的IPv6报文中包括6LoWPAN压缩头,所述6LoWPAN压缩头中包括源地址压缩标识和目的地址压缩标识,所述源地址压缩标识用于指示源IPv6地址是否压缩,所述目的地址压缩标识用于指示目的IPv6地址是否压缩;
    所述网络节点根据所述二层转发头和所述6LoWPAN压缩头,对所述6LoWPAN 压缩的IPv6报文进行解压缩,得到IPv6报文。
  10. 如权利要求9所述的方法,其特征在于,所述网络节点根据所述二层转发头和所述6LoWPAN压缩头,对所述6LoWPAN压缩的IPv6报文进行解压缩,包括:
    当所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址已压缩时,所述网络节点根据所述二层网状头中的始发MAC地址得到所述IPv6报文的源IPv6地址,根据所述二层网状头中的终结MAC地址得到所述IPv6报文的目的IPv6地址;
    当所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址未压缩时,所述网络节点根据所述二层网状头中的始发MAC地址得到所述IPv6报文的源IPv6地址,从所述6LoWPAN压缩的IPv6报文的内层IPv6字段中获取所述IPv6报文的目的IPv6地址;
    当所述源地址压缩标识指示源IPv6地址未压缩,所述目的地址压缩标识指示目的IPv6地址已压缩时,所述网络节点根据所述二层网状头中的终结MAC地址得到所述IPv6报文的目的IPv6地址,从所述6LoWPAN压缩的IPv6报文的内层IPv6字段中获取所述IPv6报文的源IPv6地址。
  11. 如权利要求8至10任一项所述的方法,其特征在于,所述网络节点根据所述终结MAC地址获取下一跳节点的MAC地址,包括:
    所述网络节点根据所述终结MAC地址查询所述网络节点的二层转发表,得到所述下一跳节点的MAC地址,所述二层转发表中包括所述终结MAC地址和所述下一跳节点的MAC地址的对应关系。
  12. 如权利要求8至11任一项所述的方法,其特征在于,在所述网络节点接收所述数据帧之前,所述方法还包括:
    所述网络节点根据根据所述低速无线网状网中各个节点的IP地址和MAC地址的对应关系,将所述网络节点的三层路由表转换为所述二层转发表。
  13. 如权利要求12所述的方法,其特征在于,在将所述网络节点的三层路由表转换为所述二层转发表之前,所述方法还包括:
    所述网络节点发送第一目标公告对象DAO报文或第一目标导向的有向无环图信息对象DIO报文,所述第一DAO报文或第一DIO报文中包括所述网络节点的IPv6地址和MAC地址,以使收到所述第一DAO报文或第一DIO报文的节点获取所述网络节点的IPv6地址与所述网络节点的MAC地址的对应关系;
    所述网络节点接收所述下一跳节点发送的第二DAO报文或第二DIO报文,从所述第二DAO报文或第二DIO报文中获取所述下一跳节点的IPv6地址与所述下一跳节点的MAC地址的对应关系。
  14. 一种报文转发装置,用于低速无线网状网的网络节点中,其特征在于,所述装置包括:
    地址转换模块,用于根据第一互联网协议第六版IPv6报文的第一源IPv6地址得到第一始发MAC地址,并根据所述第一IPv6报文的第一目的IPv6地址得到第一终结MAC地址,其中,所述第一始发MAC地址为所述网络节点的媒体访问控制MAC地址,所述第一终结MAC地址为终结节点的MAC地址;
    转发处理模块,用于根据所述第一终结MAC地址获取第一下一跳节点的MAC地址;
    封装模块,用于根据所述第一IPv6报文生成第一数据帧,所述第一数据帧中包括IPv6承载于低功耗无线个域网6LoWPAN压缩的第一IPv6报文,以及在所述6LoWPAN压缩的第一IPv6报文外层的第一MAC头和第一二层转发头,其中,所述第一二层转发头中包括所述第一始发MAC地址和所述第一终结MAC地址,所述第一MAC头中包括第一源MAC地址和第一目的MAC地址,所述第一源MAC地址为所述网络节点的MAC地址,所述第一目的MAC地址为所述第一下一跳节点的MAC地址;
    发送模块,用于向所述第一下一跳节点发送所述第一数据帧,以使所述第一下一跳节点直接根据所述第一二层转发头中的所述第一终结MAC地址转发所述第一数据帧。
  15. 如权利要求14所述的装置,其特征在于,所述封装模块,具体用于根据6LoWPAN协议对所述第一IPv6报文进行压缩,并封装第一6LoWPAN压缩头,得到所述6LoWPAN压缩的第一IPv6报文,所述第一6LoWPAN压缩头中包括第一源地址压缩标识和第一目的地址压缩标识,所述第一源地址压缩标识用于指示源IPv6地址是否压缩,所述第一目的地址压缩标识用于指示目的IPv6地址是否压缩;在所述6LoWPAN压缩的第一IPv6报文外层封装所述第一二层转发头和所述第一MAC头,得到所述第一数据帧。
  16. 如权利要求15所述的装置,其特征在于,所述封装模块,具体用于:
    当所述第一源IPv6地址是所述低速无线网状网中节点的地址,所述第一目的IPv6地址是所述低速无线网状网中节点的地址时,所述网络节点压缩所述第一源IPv6地址和所述第一目的IPv6地址,并使所述第一6LoWPAN压缩头中所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址已压缩;
    当所述第一源IPv6地址是所述低速无线网状网中节点的地址,所述第一目的IPv6地址不是所述低速无线网状网中节点的地址时,所述网络节点压缩所述第一源IPv6地址,并使所述第一6LoWPAN压缩头中所述源地址压缩标识指示源IPv6地址已压缩,所述目的地址压缩标识指示目的IPv6地址未压缩,所述6LoWPAN压缩的第一IPv6报文中还包括内层IPv6字段,所述内层IPv6字段中包括所述第一目的IPv6地址;
    当所述第一源IPv6地址不是所述低速无线网状网中节点的地址,所述第一目的IPv6地址是所述低速无线网状网中节点的地址时,所述网络节点压缩所述IPv6报文的所述目的IPv6地址,并使所述6LoWPAN压缩头中所述源地址压缩标识指示源IPv6地址未压缩,所述目的地址压缩标识指示目的IPv6地址已压缩,所述6LoWPAN压缩的IPv6报文中还包括内层IPv6字段,所述内层IPv6字段中包括所述第一源IPv6地址。
  17. 如权利要求14至16任一项所述的装置,其特征在于,
    所述转发处理模块,具体用于根据所述第一终结MAC地址查询所述网络节点的二层转发表,获取所述第一下一跳的MAC地址,所述二层转发表中包括所述第一终 结MAC地址与所述第一下一跳节点的MAC地址的对应关系。
  18. 如权利要求17所述的装置,其特征在于,还包括表项转换模块;
    所述表项转换模块,用于根据所述低速无线网状网中各个节点的IPv6地址与MAC地址的对应关系,将所述网络节点的三层路由表转换为所述二层转发表。
  19. 如权利要求14至18任一项所述的装置,其特征在于,还包括地址学习模块;
    所述地址学习模块,用于接收所述终结节点发送的第一目标公告对象DAO报文或第一目标导向的有向无环图信息对象DIO报文,从所述第一DAO报文或第一DIO报文中获取所述终结节点的IPv6地址与所述终结节点的MAC地址的对应关系;接收所述第一下一跳节点发送的第二DAO报文或第二DIO报文,从所述第二DAO报文或第二DIO报文中获取所述第一下一跳节点的IPv6地址与所述第一下一跳节点的MAC地址的对应关系。
  20. 如权利要求14至19任一项所述的装置,其特征在于,还包括路由通告模块;
    所述路由通告模块,用于发送第三DAO报文或第三DIO报文,所述第三DAO报文或第三DIO报文中包括所述网络节点的IPv6地址和MAC地址,以使收到所述第三DAO报文或第三DIO报文的节点获取所述网络节点的IPv6地址与所述网络节点的MAC地址的对应关系。
  21. 如权利要求14至20任一项所述的装置,其特征在于,还包括接收模块;
    所述接收模块,用于接收第二数据帧,所述第二数据帧中包括6LoWPAN压缩的第二IPv6报文,以及在所述6LoWPAN压缩的第二IPv6报文外层的第二MAC头和第二二层转发头,所述第二MAC头中包括第二源MAC地址和第二目的MAC地址,所述第二二层转发头中包括第二始发MAC地址和第二终结MAC地址;
    所述转发处理模块,还用于当所述第二终结MAC地址不是所述网络节点的MAC地址时,根据所述第二终结MAC地址获取第二下一跳节点的MAC地址;将所述第二源MAC地址更新为所述网络节点的MAC地址,将所述第二目的MAC地址更新为所述第二下一跳节点的MAC地址;
    所述发送模块,还用于向所述第二下一跳节点发送所述第二数据帧。
  22. 如权利要求21所述的装置,其特征在于,还包括解封装模块,用于当所述第二终结MAC地址是所述网络节点的MAC地址时,去除所述第二数据帧的链路层封装,得到所述6LoWPAN压缩的第二IPv6报文,所述6LoWPAN压缩的第二IPv6报文中包括第二6LoWPAN压缩头,所述第二6LoWPAN压缩头中包括第二源地址压缩标识和第二目的地址压缩标识,所述第二源地址压缩标识用于指示源IPv6地址是否压缩,所述第二目的地址压缩标识用于指示目的IPv6地址是否压缩;根据所述第二二层转发头和所述第二6LoWPAN压缩头,对所述6LoWPAN压缩的第二IPv6报文进行解压缩,得到第二IPv6报文。
  23. 如权利要求22所述的装置,其特征在于,所述解封装模块,具体用于:
    当所述第二源地址压缩标识指示源IPv6地址已压缩,所述第二目的地址压缩标识指示目的IPv6地址已压缩时,根据所述第二二层网状头中的第二始发MAC地址得 到所述第二IPv6报文的第二源IPv6地址,根据所述第二二层网状头中的第二终结MAC地址得到所述第二IPv6报文的第二目的IPv6地址;
    当所述第二源地址压缩标识指示源IPv6地址已压缩,所述第二目的地址压缩标识指示目的IPv6地址未压缩时,根据所述第二二层网状头中的第二始发MAC地址得到所述第二IPv6报文的第二源IPv6地址,从所述6LoWPAN压缩的第二IPv6报文的内层IPv6字段中获取所述第二IPv6报文的第二目的IPv6地址;
    当所述第二源地址压缩标识指示源IPv6地址未压缩,所述第二目的地址压缩标识指示目的IPv6地址已压缩时,根据所述第二二层网状头中的第二终结MAC地址得到所述第二IPv6报文的第二目的IPv6地址,从所述6LoWPAN压缩的第二IPv6报文的内层IPv6字段中获取所述第二IPv6报文的第二源IPv6地址。
PCT/CN2017/088532 2016-11-30 2017-06-15 报文转发方法和装置 Ceased WO2018099046A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP17876095.5A EP3537669B1 (en) 2016-11-30 2017-06-15 Message forwarding method and apparatus
US16/426,808 US11109269B2 (en) 2016-11-30 2019-05-30 Packet forwarding method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611094695.X 2016-11-30
CN201611094695.XA CN108123870B (zh) 2016-11-30 2016-11-30 报文转发方法和装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/426,808 Continuation US11109269B2 (en) 2016-11-30 2019-05-30 Packet forwarding method and apparatus

Publications (1)

Publication Number Publication Date
WO2018099046A1 true WO2018099046A1 (zh) 2018-06-07

Family

ID=62227241

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/088532 Ceased WO2018099046A1 (zh) 2016-11-30 2017-06-15 报文转发方法和装置

Country Status (4)

Country Link
US (1) US11109269B2 (zh)
EP (1) EP3537669B1 (zh)
CN (1) CN108123870B (zh)
WO (1) WO2018099046A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020029829A1 (en) * 2018-08-07 2020-02-13 Huawei Technologies Co., Ltd. Method and apparatus for virtual network functions and packet forwarding
CN111064668A (zh) * 2018-10-17 2020-04-24 华为技术有限公司 路由表项的生成方法、装置及相关设备
US10909067B2 (en) 2018-08-07 2021-02-02 Futurewei Technologies, Inc. Multi-node zero-copy mechanism for packet data processing
EP3949292B1 (en) * 2019-03-28 2023-09-13 Landis+Gyr Technology, Inc. Systems and methods for establishing communication links between networks and devices with different routing protocols

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR3057132A1 (fr) * 2016-10-04 2018-04-06 Orange Procede d'authentification mutuelle entre un equipement utilisateur et un reseau de communication
JP6904846B2 (ja) * 2017-08-07 2021-07-21 キヤノン株式会社 通信装置、通信装置の制御方法、および、プログラム
CN109120446B (zh) * 2018-08-22 2022-02-15 迈普通信技术股份有限公司 一种零配置启动方法及设备
CN112511429B (zh) * 2020-03-25 2024-09-24 中兴通讯股份有限公司 信息发送和处理的方法、节点、控制器、计算机可读介质
US11611639B2 (en) * 2020-08-06 2023-03-21 Charter Communications Operating, Llc Apparatus and method for an accelerated and offload dual border relay
CN111711571B (zh) * 2020-08-20 2020-11-13 湖南智领通信科技有限公司 支持ip透传的自组网按需路由方法、装置和计算机设备
US12035219B2 (en) * 2020-09-16 2024-07-09 Qualcomm Incorporated Unicast packet addressing and communication
CN113055294A (zh) * 2020-12-29 2021-06-29 中兴通讯股份有限公司 报文封装、解封装方法、装置、存储介质及电子装置
US11463558B2 (en) * 2021-02-23 2022-10-04 Gigamon Inc. Tool port aware stateful protocol visibility for packet distribution
CN115226154A (zh) * 2021-04-20 2022-10-21 华为技术有限公司 报文处理方法、装置、系统、设备及计算机可读存储介质
US11995017B2 (en) * 2021-06-09 2024-05-28 Enfabrica Corporation Multi-plane, multi-protocol memory switch fabric with configurable transport
CN115696316B (zh) * 2021-07-30 2026-01-27 展讯半导体(南京)有限公司 通信方法及装置、计算机可读存储介质、终端设备、路由设备
US11949593B2 (en) * 2022-05-10 2024-04-02 Cisco Technology, Inc. Stateless address translation at an autonomous system (AS) boundary for host privacy
US12531929B2 (en) * 2023-08-15 2026-01-20 Cypress Semiconductor Corporation Methods, devices and systems for communications between real world wireless devices and virtual wireless devices
CN120529237B (zh) * 2025-04-03 2026-04-03 浙江潮汐力科技有限公司 音频处理方法、装置、设备、系统和计算机程序产品

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012059821A1 (en) * 2010-11-03 2012-05-10 Alcatel Lucent A method and device for transmitting an ipv6 over low power wireless personal area network data packet
US20120287932A1 (en) * 2011-05-13 2012-11-15 Wassim Haddad Label Switched Routing To Connect Low Power Network Domains
CN105991555A (zh) * 2015-02-04 2016-10-05 成都世纪华宁科技有限公司 基于6LoWPAN的网络连接方法及其系统

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6791982B2 (en) * 1999-09-29 2004-09-14 Telefonaktiebolaget Lm Ericsson Segmentation protocol that supports compressed segmentation headers
JP4113499B2 (ja) * 2001-12-03 2008-07-09 ノキア コーポレイション ワイヤレスメッシュネットワークにおけるアドレッシング及びルーティング
US8451752B2 (en) * 2007-05-21 2013-05-28 Arrowspan, Inc. Seamless handoff scheme for multi-radio wireless mesh network
US9432213B2 (en) * 2007-12-31 2016-08-30 Rpx Clearinghouse Llc IP forwarding across a link state protocol controlled ethernet network
KR101417744B1 (ko) * 2008-01-17 2014-07-09 경희대학교 산학협력단 인터넷 프로토콜 버전6 기반 저전력 무선네트워크에서이동성 헤더 압축 방법 및 장치
KR101588887B1 (ko) * 2009-02-09 2016-01-27 삼성전자주식회사 멀티-홉 기반의 인터넷 프로토콜을 사용하는 네트워크에서 이동 노드의 이동성 지원 방법 및 그 네트워크 시스템
KR101524316B1 (ko) * 2009-02-09 2015-06-01 삼성전자주식회사 6LoWPAN 기반의 MANEMO 환경에서 통신 경로 최적화를 지원하기 위한 방법
KR20120061099A (ko) * 2010-10-22 2012-06-13 고려대학교 산학협력단 IPv6 어드레스의 관리 방법 및 이를 수행하는 게이트웨이
US20120213098A1 (en) * 2011-02-21 2012-08-23 Future Wireless Tech LLC Real-time and synchronization Internet of things analyzer System Architecture
WO2013040438A1 (en) * 2011-09-15 2013-03-21 Fisher-Rosemount Systems, Inc. Communicating data frames across communication networks that use incompatible network routing protocols
CN102421162B (zh) * 2011-11-29 2014-10-22 北京交通大学 一种支持IPv6无线传感器网络的混合式路由
US9521219B2 (en) * 2014-01-20 2016-12-13 Echelon Corporation Systems, methods, and apparatuses using common addressing
US9420518B2 (en) * 2014-08-07 2016-08-16 Gainspan Corporation Layer-3 mesh connectivity of wireless local networks
US10129202B2 (en) * 2014-11-25 2018-11-13 Cisco Technology, Inc. Optimizing global IPv6 address assignments
US10050840B2 (en) * 2015-11-23 2018-08-14 Telefonaktiebolaget Lm Ericsson (Publ) Method and system for an internet of things (IOT) device access in a software-defined networking (SDN) system
CN105763455B (zh) * 2016-04-13 2019-11-08 南京邮电大学 一种基于6LoWPAN邻居发现的节点安全注册方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012059821A1 (en) * 2010-11-03 2012-05-10 Alcatel Lucent A method and device for transmitting an ipv6 over low power wireless personal area network data packet
US20120287932A1 (en) * 2011-05-13 2012-11-15 Wassim Haddad Label Switched Routing To Connect Low Power Network Domains
CN105991555A (zh) * 2015-02-04 2016-10-05 成都世纪华宁科技有限公司 基于6LoWPAN的网络连接方法及其系统

Non-Patent Citations (1)

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

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020029829A1 (en) * 2018-08-07 2020-02-13 Huawei Technologies Co., Ltd. Method and apparatus for virtual network functions and packet forwarding
US10909067B2 (en) 2018-08-07 2021-02-02 Futurewei Technologies, Inc. Multi-node zero-copy mechanism for packet data processing
US10986041B2 (en) 2018-08-07 2021-04-20 Futurewei Technologies, Inc. Method and apparatus for virtual network functions and packet forwarding
CN111064668A (zh) * 2018-10-17 2020-04-24 华为技术有限公司 路由表项的生成方法、装置及相关设备
EP3949292B1 (en) * 2019-03-28 2023-09-13 Landis+Gyr Technology, Inc. Systems and methods for establishing communication links between networks and devices with different routing protocols

Also Published As

Publication number Publication date
CN108123870A (zh) 2018-06-05
CN108123870B (zh) 2021-06-01
EP3537669B1 (en) 2021-10-27
US11109269B2 (en) 2021-08-31
US20190281495A1 (en) 2019-09-12
EP3537669A4 (en) 2019-09-11
EP3537669A1 (en) 2019-09-11

Similar Documents

Publication Publication Date Title
CN108123870B (zh) 报文转发方法和装置
CN110830356B (zh) 传输报文的方法和装置
WO2022078509A1 (zh) IPv6报文的扩展头封装方法及装置
JP4823359B2 (ja) マルチホップメッシュネットワークを介する管理トラフィックの送信
JP5661949B2 (ja) ネットワークにおいて通信するためのシステムおよび方法
US12537792B2 (en) Interface extension method, apparatus, and system
CN107113898A (zh) 用于使用pc5协议的直接通信的系统、方法和设备
MX2013013376A (es) Aparato y metodos para compresion de cabecera de control de acceso de medios.
US10791051B2 (en) System and method to bypass the forwarding information base (FIB) for interest packet forwarding in an information-centric networking (ICN) environment
CN103888386A (zh) 可扩展虚拟局域网报文的传输方法及装置、系统
CN111865906A (zh) 报文传输的方法、装置和系统
CN109819524B (zh) 报文处理方法及装置
TWI667899B (zh) 電子設備及用於通訊的方法
KR20140069307A (ko) 감소된 전력 무선 통신을 위한 시스템 및 방법
JP2017502556A (ja) 近傍アウェアネットワークにおけるハッシュ値を含むプライベートサービス識別子
EP3813318B1 (en) Packet transmission method, communication device, and system
Devasena IPv6 low power wireless personal area network (6LoWPAN) for networking Internet of things (IoT)–analyzing its suitability for IoT
CN109526030B (zh) 报文的处理方法、装置和设备
US20220182320A1 (en) Secure data connections in low data rate networks
US12224934B2 (en) Communication method and related device
CN101060482B (zh) 一种路由查找方法和转发系统
KR20230026424A (ko) IPv6 네트워크 통신 방법, 장치 및 시스템
WO2020097855A1 (zh) 无线通信的方法和通信设备
CN102316605B (zh) 建立通信连接的方法和装置
WO2017041534A1 (zh) 一种电力线网络通信的方法及装置、计算机存储介质

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2017876095

Country of ref document: EP

Effective date: 20190604