Message forwarding method, node, device and storage medium
By judging and processing the inclusion of SL in the SR network, and performing corresponding SL reduction and splicing operations, a real purpose SID is generated, and the problem of failure of packet forwarding under compression function in the SR network is solved, and normal packet forwarding is achieved in the case of failure.
Patent Information
- Application Number
- CN202510203886.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-24
- Publication Date
- 2025-05-23
AI Technical Summary
When the SR compression function is configured in the SR network, if the proxy forwarding node determines that it cannot forward the message to the current destination address, and the SID corresponding to the updated SL may not represent the real address, resulting in the message forwarding failure.
By determining whether the SL corresponding to the second node is included in the segment index, if not, the preset step size of the SL is reduced to obtain a new SL; if the new SL is included in the segment index, the compressed address of the common prefix length bit data in the SID corresponding to the first SL and the lowest bit in the SID corresponding to the second SL is spliced to generate the real destination SID.
It effectively avoids packet forwarding failures caused by compressed address not real address, and ensures that fault processing and packet forwarding can be performed normally when SR compression function is configured in the SR network.
Smart Images

Figure CN120034476A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network technology, and in particular to a message forwarding method, node, device and storage medium. Background Art
[0002] When a message enters an SR (Segment Routing) network for forwarding, the SID (Segment Identifier) list specifies the nodes or links that the message must pass through along the way. Messages forwarded using SR technology carry an SRH (Segment Routing Header), which carries the SID of each node or link that the message needs to pass through, as well as the SL (Segment Left). After a node on the message forwarding path receives a message, if it determines that the destination address of the message is the address of this node, it uses the SL-1 carried in the SRH to determine the SID corresponding to the updated SL, uses the determined SID as the new destination address of the message, encapsulates the message with an IP header carrying the new destination address, and continues to forward the message to the new address. When an intermediate node in the message forwarding path fails, the upstream node of the intermediate node is required to act as a proxy forwarding node. If the proxy forwarding node determines that it cannot forward the message to the current destination address, it will replace the faulty node to use the SL-1 carried in the SRH in the message, determine the SID corresponding to the updated SL, and use it as the new destination address. That is, the proxy forwarding node completes the encapsulation of the new IP header on behalf of the faulty node. Since the destination address of the message has changed, the proxy forwarding node does not need to forward the message to the faulty node, but can bypass the faulty node and forward the message to the updated destination address. This can achieve fault handling in the SR message forwarding process.
[0003] However, when the SR compression function is configured in the SR network, the SID carried in the SRH in the message may not be the real SID, but a compressed SID that does not represent the real address after compression. In this case, if the proxy forwarding node determines that it cannot forward the message to the current destination address, it will use SL-1 when using relevant technologies to handle the fault. Determine the SID corresponding to the updated SL, but the determined SID may not represent the real address. If this SID is used as the destination address, the message forwarding process cannot be completed normally. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a message forwarding method, node, device and storage medium to forward messages when the SR compression function is configured in the SR network and a fault occurs. The specific technical solution is as follows:
[0005] In a first aspect, an embodiment of the present application provides a message forwarding method, which is applied to a first node, and the method includes:
[0006] Receive a message; wherein the message carries a segment routing header SRH option header, and the SRH option header includes the following information: segment index, common prefix length; the segment index is the remaining segment SL corresponding to the compressed segment identifier SID recording the compressed address;
[0007] In the case where it is determined that the message cannot be forwarded to the second node at the next hop, determining whether the first SL corresponding to the second node is included in the segment index;
[0008] If the first SL is not included in the segment index, a preset step size is subtracted from the first SL to obtain a second SL, where the preset step size is the absolute value of the difference between SLs corresponding to adjacent SIDs in the SRH of the message;
[0009] If the second SL is included in the segment index, concatenate the common prefix length bit data in the SID corresponding to the first SL and the least significant compressed address in the SID corresponding to the second SL, and generate a destination SID based on the concatenation result;
[0010] A new IP header whose destination address is the destination SID is encapsulated in the message, and the encapsulated message is forwarded.
[0011] In one embodiment of the present application, before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the method further includes:
[0012] If the first SL is included in the segment index, determine whether there is a compressed address corresponding to the first segment identification index SI in the compressed SID corresponding to the first SL, wherein each compressed address in the compressed SID corresponds to an SI, the difference between SIs of adjacent compressed addresses is a preset difference, and the first SI is equal to the SI corresponding to the compressed address of the second node minus the preset difference;
[0013] If there is a compressed address corresponding to the first SI, a preset step size is accumulated on the basis of the first SL until the calculation result is not included in the segment index, thereby obtaining an accumulated third SL;
[0014] The common prefix length bit data in the SID corresponding to the third SL is concatenated with the compressed address corresponding to the first SI in the compressed SID, and a destination SID is generated based on the concatenation result.
[0015] In one embodiment of the present application, before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the method further includes:
[0016] If there is no compressed address corresponding to the first SI, subtract a preset step length from the first SL to obtain a fourth SL, and determine whether the fourth SL is included in the segment index;
[0017] If the fourth SL is not included in the segment index, the SID corresponding to the second SL is determined as the destination SID.
[0018] In one embodiment of the present application, before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the method further includes:
[0019] If the fourth SL is included in the segment index, a preset step size is accumulated on the basis of the first SL until the calculation result is no longer included in the segment index, thereby obtaining an accumulated third SL;
[0020] The common prefix length bit data in the SID corresponding to the third SL is concatenated with the least significant compressed address in the SID corresponding to the fourth SL, and a destination SID is generated based on the concatenated result.
[0021] In one embodiment of the present application, the SRH option header further includes: an SI index, each SI index corresponds to a compressed SID, each data bit in the SI index corresponds to each position on the compressed SID, and the value of each data bit indicates whether there is a compressed address at the corresponding position;
[0022] The determining whether there is a compressed address corresponding to the first segment identification index SI in the compressed SID corresponding to the first SL includes:
[0023] Determine whether the value of the first data bit in the first SI index indicates the existence of a compressed address corresponding to the first SI, wherein the first SI index corresponds to the compressed SID corresponding to the first SL, and the position indicated by the first data bit is used to record the compressed address corresponding to the first SI.
[0024] In one embodiment of the present application, before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the method further includes:
[0025] If the second SL is not included in the segment index, the SID corresponding to the second SL is used as the destination SID.
[0026] In one embodiment of the present application, the SRH option header also includes at least one of the following information: the type of the SRH option header, the length of the SRH option header, and a reserved field.
[0027] In one embodiment of the present application, the SRH option header is located between the IP header and the SRH of the message.
[0028] In a second aspect, an embodiment of the present application provides a network node, as a first node, the network node including:
[0029] processor;
[0030] Transceiver;
[0031] A machine-readable storage medium storing machine-executable instructions that can be executed by the processor, the machine-executable instructions causing the processor to perform the following steps:
[0032] Receive a message; wherein the message carries a segment routing header SRH option header, and the SRH option header includes the following information: segment index, common prefix length; the segment index is the remaining segment SL corresponding to the compressed segment identifier SID recording the compressed address;
[0033] In the case where it is determined that the message cannot be forwarded to the second node at the next hop, determining whether the first SL corresponding to the second node is included in the segment index;
[0034] If the first SL is not included in the segment index, a preset step size is subtracted from the first SL to obtain a second SL, where the preset step size is the absolute value of the difference between SLs corresponding to adjacent SIDs in the SRH of the message;
[0035] If the second SL is included in the segment index, concatenate the common prefix length bit data in the SID corresponding to the first SL and the least significant compressed address in the SID corresponding to the second SL, and generate a destination SID based on the concatenation result;
[0036] A new IP header whose destination address is the destination SID is encapsulated in the message, and the encapsulated message is forwarded.
[0037] In one embodiment of the present application, before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the machine executable instructions further cause the processor to perform the following steps:
[0038] If the first SL is included in the segment index, determine whether there is a compressed address corresponding to the first segment identification index SI in the compressed SID corresponding to the first SL, wherein each compressed address in the compressed SID corresponds to an SI, the difference between SIs of adjacent compressed addresses is a preset difference, and the first SI is equal to the SI corresponding to the compressed address of the second node minus the preset difference;
[0039] If there is a compressed address corresponding to the first SI, a preset step length is accumulated on the basis of the first SL until the calculation result is not included in the segment index, thereby obtaining an accumulated third SL;
[0040] The common prefix length bit data in the SID corresponding to the third SL is concatenated with the compressed address corresponding to the first SI in the compressed SID, and a destination SID is generated based on the concatenation result.
[0041] In one embodiment of the present application, before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the machine executable instructions further cause the processor to perform the following steps:
[0042] If there is no compressed address corresponding to the first SI, subtract a preset step length from the first SL to obtain a fourth SL, and determine whether the fourth SL is included in the segment index;
[0043] If the fourth SL is not included in the segment index, the SID corresponding to the second SL is determined as the destination SID.
[0044] In one embodiment of the present application, before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the machine executable instructions further cause the processor to perform the following steps:
[0045] If the fourth SL is included in the segment index, a preset step size is accumulated on the basis of the first SL until the calculation result is no longer included in the segment index, thereby obtaining an accumulated third SL;
[0046] The common prefix length bit data in the SID corresponding to the third SL is concatenated with the least significant compressed address in the SID corresponding to the fourth SL, and a destination SID is generated based on the concatenated result.
[0047] In one embodiment of the present application, the SRH option header further includes: an SI index, each SI index corresponds to a compressed SID, each data bit in the SI index corresponds to each position on the compressed SID, and the value of each data bit indicates whether there is a compressed address at the corresponding position;
[0048] The determining whether there is a compressed address corresponding to the first segment identifier index SI in the compressed SID corresponding to the first SL specifically includes:
[0049] Determine whether the value of the first data bit in the first SI index indicates the existence of a compressed address corresponding to the first SI, wherein the first SI index corresponds to the compressed SID corresponding to the first SL, and the position indicated by the first data bit is used to record the compressed address corresponding to the first SI.
[0050] In one embodiment of the present application, before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the machine executable instructions further cause the processor to perform the following steps:
[0051] If the second SL is not included in the segment index, the SID corresponding to the second SL is used as the destination SID.
[0052] In one embodiment of the present application, the SRH option header also includes at least one of the following information: the type of the SRH option header, the length of the SRH option header, and a reserved field.
[0053] In one embodiment of the present application, the SRH option header is located between the IP header and the SRH of the message.
[0054] In a third aspect, an embodiment of the present application provides a message forwarding device, applied to a first node, the device comprising:
[0055] A message receiving module, used for receiving a message; wherein the message carries a segment routing header SRH option header, and the SRH option header includes the following information: segment index, common prefix length; the segment index is the remaining segment SL corresponding to the compressed segment identifier SID recording the compressed address;
[0056] A first segment index determination module, configured to determine whether a first SL corresponding to a second node at a next hop is included in the segment index when it is determined that the message cannot be forwarded to the second node at the next hop;
[0057] A second SL calculation module, configured to, if the first SL is not included in the segment index, subtract a preset step length from the first SL to obtain a second SL, wherein the preset step length is an absolute value of a difference between SLs corresponding to adjacent SIDs in the SRH of the message;
[0058] A first splicing module, configured to, if the second SL is included in the segment index, splice the common prefix length bit data in the SID corresponding to the first SL and the lowest bit compressed address in the SID corresponding to the second SL, and generate a destination SID based on the splicing result;
[0059] The message forwarding module is used to encapsulate the message with a new IP header whose destination address is the destination SID, and forward the encapsulated message.
[0060] In one embodiment of the present application, the device further includes:
[0061] a compressed address determination module, configured to determine whether there is a compressed address corresponding to a first segment identification index SI in the compressed SID corresponding to the first SL if the first SL is included in the segment index, wherein each compressed address in the compressed SID corresponds to an SI, the difference between SIs of adjacent compressed addresses is a preset difference, and the first SI is equal to the SI corresponding to the compressed address of the second node minus the preset difference;
[0062] A first SL accumulation module, configured to accumulate a preset step length on the basis of the first SL if there is a compressed address corresponding to the first SI, until a calculation result is not included in the segment index, to obtain an accumulated third SL;
[0063] The second splicing module is used to splice the common prefix length bit data in the SID corresponding to the third SL and the compressed address corresponding to the first SI in the compressed SID, and generate a destination SID based on the splicing result.
[0064] In one embodiment of the present application, the device further includes:
[0065] a fourth SL calculation module, configured to, if there is no compressed address corresponding to the first SI, reduce a preset step length from the first SL to obtain a fourth SL, and determine whether the fourth SL is included in the segment index;
[0066] The first SID determination module is used to determine the SID corresponding to the second SL as the destination SID if the fourth SL is not included in the segment index.
[0067] In one embodiment of the present application, the device further includes:
[0068] A second SL accumulation module is configured to accumulate a preset step size on the basis of the first SL if the fourth SL is included in the segment index, until the calculation result is no longer included in the segment index, so as to obtain an accumulated third SL;
[0069] The third splicing module is used to splice the common prefix length bit data in the SID corresponding to the third SL and the lowest bit compressed address in the SID corresponding to the fourth SL, and generate a destination SID based on the splicing result.
[0070] In one embodiment of the present application, the SRH option header further includes: an SI index, each SI index corresponds to a compressed SID, each data bit in the SI index corresponds to each position on the compressed SID, and the value of each data bit indicates whether there is a compressed address at the corresponding position;
[0071] The compressed address determination module is specifically used for:
[0072] If the first SL is included in the segment index, determine whether the value of the first data bit in the first SI index indicates the existence of a compressed address corresponding to the first SI, wherein the first SI index corresponds to the compressed SID corresponding to the first SL, and the position indicated by the first data bit is used to record the compressed address corresponding to the first SI.
[0073] In one embodiment of the present application, the device further includes:
[0074] The second SID determination module is used to use the SID corresponding to the second SL as the destination SID if the second SL is not included in the segment index.
[0075] In one embodiment of the present application, the SRH option header also includes at least one of the following information: the type of the SRH option header, the length of the SRH option header, and a reserved field.
[0076] In one embodiment of the present application, the SRH option header is located between the IP header and the SRH of the message.
[0077] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any method step described in the first aspect is implemented.
[0078] In a fifth aspect, an embodiment of the present application further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the methods described in the first aspect above.
[0079] Beneficial effects of the embodiments of the present application:
[0080] In the message forwarding method provided in the embodiment of the present application, since the message carries an SRH option header, the SRH option header contains a segment index that can represent the SL corresponding to the compressed SID that records the compressed address. After receiving the message, the first node should forward the message to the second node according to the forwarding method of segment routing. However, if it is determined that the message cannot be forwarded to the second node, a fault forwarding process needs to be performed. First, it is determined whether the first SL corresponding to the second node is included in the segment index. If it is not included in the segment index, it is determined that the address of the second node is not compressed. In order to skip the second node that cannot be forwarded to, it is necessary to forward the message to the next node of the second node, and the first SL is reduced by a preset step size to obtain the second SL. If the second SL is included in the segment index, it means that the SID corresponding to the second SL is a compressed SID, and the message cannot be directly forwarded as the destination address. In this case, the compressed address in the compressed SID needs to be spliced with the common prefix to obtain the real address of the next node of the second node, that is, the destination SID, to complete the message forwarding.
[0081] That is to say, in the embodiment of the present application, an SRH option header is added to the message to record information related to the compressed address. Even if the nodes on the message forwarding path do not support address compression, the SL corresponding to the compressed SID can be determined according to the information in the SRH option header. If the updated SL corresponds to the compressed SID during fault handling, the message will not be forwarded directly using the compressed SID as the destination address, but the message will be forwarded after the destination SID as the real address is spliced. This can avoid the problem of message forwarding failure caused by the compressed address not being the real address. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0083] Figure 1 A schematic diagram of a message in an SR network in the related art;
[0084] Figure 2 A schematic diagram of a first intermediate node protection method in the related art;
[0085] Figure 3 A schematic diagram of the structure of an SRv6 compression network provided in an embodiment of the present application;
[0086] Figure 4 A schematic diagram of a fault of the first SRv6 compression network provided in an embodiment of the present application;
[0087] Figure 5 A schematic diagram of a flow chart of a first message forwarding method provided in an embodiment of the present application;
[0088] Figure 6 A schematic diagram of a fault of a second SRv6 compression network provided in an embodiment of the present application;
[0089] Figure 7 A schematic diagram of a flow chart of a second message forwarding method provided in an embodiment of the present application;
[0090] Figure 8 A schematic diagram of a flow chart of a third message forwarding method provided in an embodiment of the present application;
[0091] Fig. 9 A flowchart of a fourth message forwarding method provided in an embodiment of the present application;
[0092] Fig.10A schematic diagram of the structure of a network node provided in an embodiment of the present application;
[0093] Fig.11 A structural schematic diagram of a message forwarding device is provided for an embodiment of the present application. DETAILED DESCRIPTION
[0094] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0095] In order to ensure that when the SR compression function is configured in the SR network and a fault occurs, fault handling can be completed and message forwarding can be performed normally, the embodiments of the present application provide a message forwarding method, node, device and storage medium.
[0096] In order to better describe this application, the relevant technologies and application scenarios are first described.
[0097] The following uses the SRv6 (Segment Routing Internet Protocol Version 6) network to represent the SR network and describes the messages transmitted in the SR network.
[0098] The head node of the forwarding path will encapsulate the message, and encapsulate the IPv6 (Internet Protocol Version 6, the sixth generation Internet Protocol segment routing) header and SRH before the original three-layer data message.
[0099] See also Figure 1 , which is a schematic diagram of a message in an SR network in the related technology.
[0100] The message in the figure includes an IPv6 header, SRH, and original message. The IPv6 header includes version, service category, flow label, payload length, next header, hop limit, source address, and destination address. 0, 3, 11, 15, 23, and 31 in the figure represent the data bit numbers.
[0101] The SRH contains the next header, the length of the extended header, the routing type, the SL, the last item, the identifier, the label, the segment list [0], ..., the segment list [n-1], and the optional type length value object. 0, 7, 15, 23, and 31 in the figure represent the data bit numbers.
[0102] The structure of the above message is the same as the structure defined in the related art, and the specific meaning of the fields contained therein will not be repeated in the embodiment of the present application.
[0103] In addition, the method of protecting intermediate nodes in the related art is described in detail.
[0104] See also Figure 2 , which is a schematic diagram of the first intermediate node protection method in the related art.
[0105] The SID list of SRv6 TE Policy (Segment Routing Internet Protocol Version 6 Traffic Engineering Policy) records the SIDs of nodes or links that need to be passed along the way during packet forwarding.
[0106] like Figure 2 As shown in the figure, node A is the head node for SRv6 message forwarding. Node A forwards the message to node F based on SRv6 TE Policy. The node forwarding path specified by SRv6 TE Policy is node A-node B-node D-node E-node F represented by the solid arrow, and the specified message forwarding process needs to pass through node D. When node D fails (indicated by a cross in the figure), node B cannot forward the message to node D. In a related technology, a backup path can be used for message forwarding. However, since SRv6 TE Policy stipulates that the message needs to pass through node D, the backup path also needs to pass through node D. Therefore, the backup path is node B-node C-node E-node D represented by the dotted arrow. That is, the message still needs to pass through node D, but node D has failed, so the backup path is invalid and cannot solve the failure.
[0107] Therefore, the related art proposes to use intermediate node protection to handle faults. The intermediate node protection is that the upstream node of the failed intermediate node replaces the failed intermediate node to forward messages, and the upstream node is called a proxy forwarding node.
[0108] After the SRv6 TE FRR (Traffic Engineer Fast ReRoute) function is enabled on a node, when there is an SRH in a message and the SL in the SRH is greater than 0 (that is, the node receiving the message is not the last node in the forwarding path), if the node determines that it cannot forward the message to the next node, the node performs the following operations as a proxy node to forward the message on behalf of the intermediate node.
[0109] (1) The proxy node replaces SL-1 in the SRH in the message.
[0110] (2) The SID corresponding to SL-1 is used as the destination address of the outer IP header and encapsulated to obtain a new message.
[0111] (3) Look up and forward the message according to the destination address of the newly encapsulated message.
[0112] With the aforementioned Figure 2 Taking the network structure shown as an example, if the above node D fails, node B acts as a proxy node and replaces node D to perform SL-1 and obtain the SID corresponding to SL-1. This SID is the SID of node E. With this SID as the destination address, the message is forwarded to node E. Thus, the message can be forwarded to node E by bypassing node D through the path of node B-node C-node E, and then node E can forward the message normally, so that the message can be forwarded normally to node F, thereby realizing fault handling.
[0113] Furthermore, the nodes in the network can be configured with the SR compression function to merge the addresses of multiple consecutive nodes with similar addresses into a unified SID. One SID can represent the addresses of up to four nodes, thereby saving the space occupied by the SID in the SRH and reducing the length of the message.
[0114] The following description takes G-SRV6 (Generalized SRv6, compressed SRv6) as an example.
[0115] See also Figure 3 , is a structural diagram of an SRv6 compression network provided in an embodiment of the present application.
[0116] The graph includes nodes 1 to 9, among which the address of node 1 is 1000:0:0:1:1::, the address of node 2 is 1000:0:0:2:1::, the address of node 3 is 888:0:0:3:2::, the address of node 4 is 888:0:0:4:2::, the address of node 5 is 888:0:0:5:2::, the address of node 6 is 888:0:0:6:2::, the address of node 7 is 888:0:0:7:1::, and the address of node 8 is 1000:0:0:8:1::.
[0117] In the above address, each colon separates two segments of data, each segment of data consists of 16 digits, and the fifth segment of data in the address is an operation code (opcode), and the operation code value is 1 or 2. The value of 1 indicates that the node corresponding to the address forwards the message in an uncompressed manner, and the value of 2 indicates that the node corresponding to the address forwards the message in a compressed manner. Node 1, node 2, and node 8 do not support compression, so the value of this segment is 1. The nodes after node 7 no longer support compression, so node 7 is the last node that supports compression, and it needs to forward messages to subsequent nodes in an uncompressed manner, so the value of this segment in its address is also 1. Node 3-node 6 forwards messages in a compressed manner, so the value of this segment is 2. The above values are only an example, and the embodiment of the present application does not limit the specific values of the operation code, and any two different values can be used as the value of the fifth segment of data. In addition, the last two segments of data in each address are omitted in the example, and there are specific values in actual applications.
[0118] In this embodiment, nodes 1, 2, and 8 are nodes that do not support compression. The length of the locator (location) in the address is 64 bits, the static segment occupies 8 bits, and args (parameters) occupies 48 bits. The specific positions of each field in the address can be referred to the definition in the relevant technology, which will not be repeated here.
[0119] Nodes 3 to 7 are nodes that support compression. The length of the locator (location) in their addresses is 64 bits, the static segment occupies 8 bits, and args occupies 48 bits. The common prefix of the addresses of nodes 3 to 7 is 888:0:0, and the common prefix (commom-profix) length is 48 bits. The 4th and 5th segments of data in the address are compressed using COC32 (32bit continuation of compression, 32-bit SID compression method), totaling 32 bits. The resulting compressed SID is: 7∶1:6:2:5:2:4:2, which actually contains 4 compressed addresses, namely "7:1", "6:2", "5:2", and "4:2". From low to high, they are the 4th to 5th segments of data in the addresses of nodes 4 to 7, and the order of the nodes corresponding to them from low to high is the same as the order of the nodes passed when the message is forwarded. In addition, except for the first node that supports compression in the forwarding path (node 3), the last two digits in the address of each node that supports compression (node 4-node 7) are SI (SID Index). Different compressed addresses in the same compressed SID correspond to different SIs, and the difference in SIs corresponding to adjacent compressed addresses is a preset difference. For example, if the preset difference is 1, the SIs corresponding to each compressed address in the compressed SID from low to high are 3, 2, 1, and 0, respectively. SI can be used to indicate the position of the corresponding compressed address in the compressed SID. For example, if the last two digits in the address of the node are 2, it means that the compressed address of the node in the compressed SID is the third compressed address in the compressed addresses sorted from low to high.
[0120] In addition, the last two digits of the addresses of other nodes are 0.
[0121] In the absence of a fault, the forwarding path of the message is node 1-node 2-node 3-node 4-node 5-node 6-node 7-node 8. This path is the orchestration path, which is represented by a solid arrow in the figure. Node 9 is used as a backup path.
[0122] In this case, the destination address in the IPv6 header of the message sent by node 1 is the address of node 2, 1000:0:0:2:1::, the SL in the SRH is 3, and the SID list in the SRH is: Address[0]: 1000:0:0:8:1::; Address[1]: 7:1:6:2:5:2:4:2; Address[2]: 888:0:0:3:2::; Address[3]: 1000:0:0:2:1::; Address[4]: 1000:0:0:1:1::. That is, the SID list contains the complete addresses of node 1, node 2, node 3, and node 8, as well as the compressed SIDs of node 4 to node 7. In the uncompressed case, the SID list needs to record the addresses of node 1 to node 8 respectively, for a total of 8 SIDs. However, after compression, only 5 SIDs need to be recorded, so the length of the SRH can be shortened.
[0123] From this example, it can be seen that since the total length of the SID is 128 bits, the two segments of data in each node address are used as compressed addresses to form a compressed SID, so the compressed address of a node occupies 32 bits in the compressed SID. Therefore, a compressed SID can contain up to 4 compressed addresses of nodes. If the number of compressed addresses is less than 4, the compressed address is located in the low position of the compressed SID, and the high position is filled with a preset value (usually 0). If the number of compressed addresses is greater than 4, there can be multiple compressed SIDs in the SID list.
[0124] When forwarding a message, node 2 receives a message with SL of 3, and determines that the operation code in the destination address of the message is 1. It then forwards the message in an uncompressed manner, and uses SL-1, the updated SL=2, and the SID corresponding to SL=2, i.e. 888:0:0:3:2:: as the destination address of the newly generated IPv6 header. It generates a new IPv6 header and encapsulates it into the message header, and then forwards the message to the destination address (the address of node 3).
[0125] Node 3 receives a message with SL of 2, and determines that the operation code in the destination address of the message is 2, so it forwards the message in a compressed manner, and the value of the last two digits (SI) of the destination address of the message is 0, then SL-1, and after updating SL=1. Node 3 concatenates the compressed address (4:2) corresponding to SI 3 (default value) in the compressed SID corresponding to SL=1 with the common prefix (888:0:0) in the destination address of the message to obtain a concatenation result (888:0:0:4:2), and generates SID (888:0:0:4:2::) according to the concatenation result, that is, the SID of node 4, as the destination address in the IPv6 header. The value of the last two digits in the generated SID is SI=3. Other bit nodes not mentioned in the generated SID can be assigned values according to relevant technologies, and the embodiments of the present application will not be repeated here.
[0126] Node 4 receives a message with SL=1, and determines that the operation code in the destination address of the message is 2. It then forwards the message in a compressed manner, and if the last two digits (SI) of the destination address of the message are 3, not 0, SL-1 is not changed, SL remains 1, and SI-1=2. Node 4 concatenates the compressed address (5:2) with SI=2 in the compressed SID corresponding to SL=1 with the common prefix (888:0:0) in the destination address of the message to obtain a concatenation result (888:0:0:5:2), and generates SID (888:0:0:5:2::) based on the concatenation result, i.e., the SID of node 5, as the destination address in the IPv6 header. The last two digits of the generated SID are SI=2.
[0127] Node 5 receives a message with SL=1, and determines that the operation code in the destination address of the message is 2. It then forwards the message in a compressed manner, and the last two digits (SI) of the destination address of the message are 2. If they are not 0, SL-1 is not changed, SL is kept as 1, and SI-1=1. Node 5 concatenates the compressed address (6:2) with SI=1 in the compressed SID corresponding to SL=1 and the common prefix (888:0:0) in the destination address of the message to obtain a concatenation result (888:0:0:6:2), and generates SID (888:0:0:6:2::) according to the concatenation result, i.e., the SID of node 6, as the destination address in the IPv6 header. The last two digits of the generated SID are SI=1.
[0128] Node 6 receives a message with SL=1, and determines that the operation code in the destination address of the message is 2. It then forwards the message in a compressed manner, and the last two digits (SI) of the destination address of the message are 1. If they are not 0, SL-1 is not changed, SL remains 1, and SI-1=0. Node 6 concatenates the compressed address (7:1) with SI=0 in the compressed SID corresponding to SL=1 with the common prefix (888:0:0) in the destination address of the message to obtain a concatenation result (888:0:0:6:2), and generates SID (888:0:0:6:2::) based on the concatenation result, i.e., the SID of node 7, as the destination address in the IPv6 header. The last two digits of the generated SID are SI=0.
[0129] Node 7 receives the message with SL as 1, and determines that the operation code in the destination address of the message is 1, so it forwards the message in a non-compressed manner. Since the last two digits (SI) of the destination address are 0, SL-1=0. The SID corresponding to SL=0, that is, 1000:0:0:8:1::, is used as the destination address of the newly generated IPv6 header, and a new IPv6 header is generated and encapsulated into the message header, and then the message is forwarded to the destination address (the address of node 8). Finally, the message is forwarded.
[0130] Based on the above description of the addresses of nodes that support compression and the methods of forwarding messages by nodes using compression and non-compression, if a fault occurs in the message forwarding path, corresponding problems will arise if the intermediate node protection method in the related art is used to handle the fault.
[0131] See also Figure 4 , which is a fault diagram of the first SRv6 compression network provided in an embodiment of the present application.
[0132] Figure 4 The network structure shown is similar to Figure 3 Same as Figure 3 Compared with the illustrated embodiment, the node 3 marked with a cross in the figure fails.
[0133] In this case, if the intermediate node protection is performed using the method in the related art, then Node 2 is a proxy node. As described above, Node 2 receives a message with an SL of 3, and Node 2 forwards the message normally, setting SL-1=2, and then determines that it cannot forward the message to the SID corresponding to SL=2. Then, as a proxy node, it reduces SL by 1 again, and at this time SL=1, and Node 2 uses the SID corresponding to SL=1 as the destination address to forward the message. However, as shown above, the SID corresponding to SL=1 is a compressed SID, not a real address, and message forwarding cannot be achieved at all using the above SID as the destination address.
[0134] To solve the above problems, see Figure 5 , is a flow chart of the first message forwarding method provided in the embodiment of the present application, which is applied to the first node, and the first node is all nodes except the last node on the message forwarding path. Since the last node is the node that finally receives the message, it does not need to forward the message itself, so it is not applicable to this solution. The above method includes the following steps S501-S505.
[0135] S501: receiving a message.
[0136] The message carries an SRH option header, which includes the following information: segment index, common prefix length; the segment index is the SL corresponding to the compressed SID that records the compressed address. The SL included in the segment index can be one or more. When the SRH contains multiple compressed SIDs, the segment index can include the SL corresponding to each compressed SID, or only include the minimum SL and maximum SL of the compressed SIDs with continuous SLs, indicating that the SIDs between the two are compressed SIDs.
[0137] In one embodiment of the present application, the SRH option header is located between the IP header and the SRH.
[0138] In another embodiment of the present application, the SRH option header further includes at least one of the following information: the type of the SRH option header, the length of the SRH option header, and a reserved field. The value of the reserved field may be a default value, such as 0.
[0139] The above type can be a preset value, such as 129, 130, etc., and the embodiment of the present application does not limit this specific value. The length of the SRH option header defaults to 3, and of course it can also be other values, which are not limited. The common prefix length is set according to the actual situation, and the value range can be any value in the range of 0-128. In the scenario of the above example, the common prefix length is 48.
[0140] S502: When it is determined that the message cannot be forwarded to the second node at the next hop, it is determined whether the first SL corresponding to the second node is included in the segment index.
[0141] In one embodiment of the present application, when one of the following situations exists, the first node determines that it cannot forward the message to the second node at the next hop.
[0142] Case 1: The first node queries the FIB (Forwarding Information Base) and does not find the corresponding forwarding table entry.
[0143] Case 2: The state of the outbound interface corresponding to the destination address of the message is DOWN (closed).
[0144] Case 3: The Local SID table is queried and the SRv6 SID is matched to End.X SID, and the outbound interface status corresponding to End.X SID is DOWN.
[0145] Case 4: The route found in the routing table is NULLO route.
[0146] In addition, the first SL is obtained after the first node receives the message and processes the SL carried in the message in a normal forwarding manner. For example, in the example shown above, nodes 2, 3, and 7 obtain the first SL by subtracting SL-1 carried in the message, and nodes 4-6 will not update the SL carried in the message, so the SL carried in the message is directly used as the first SL.
[0147] If the first SL corresponding to the second node is included in the segment index, it means that the SID of the second node is not compressed, and the complete SID corresponding to the second node can be directly obtained in the SRH.
[0148] If the first SL is not included in the segment index, step S503 is executed.
[0149] S503: Subtract a preset step length from the first SL to obtain a second SL.
[0150] Since the first SL is not included in the segment index, the address of the next node of the second node will not be compressed in the same compressed SID as the address of the second node. Therefore, the first SL can be directly reduced by a preset step size to obtain a second SL different from the first SL, and then the SID of the next node of the second node is determined based on the SID corresponding to the second SL which is different from the SID of the second node.
[0151] Specifically, according to the characteristics of SR forwarding, the preset step size is usually 1. However, the preset step size may also vary according to different specific embodiments. The preset step size is the absolute value of the difference between SLs corresponding to adjacent SIDs in the SRH of the message.
[0152] If the second SL is included in the segment index, step S504 is executed.
[0153] S504: Concatenate the first common prefix length bit data in the SID corresponding to the first SL with the least significant compressed address in the SID corresponding to the second SL, and generate a destination SID based on the concatenation result.
[0154] If the second SL is included in the segment index, it means that the SID corresponding to the second node is not compressed, but the address of the next node of the second node is compressed, so it can be determined that the address of at least one node is compressed starting from the next node of the second node. As described in the previous application scenario, since the second node is a node whose address is not compressed before the node whose address is compressed, the address of the node whose address is compressed has a common prefix that is the same as the address of the second node. In addition, since the SID is compressed starting from the next node of the second node, referring to the previous description of the application scenario, the compressed address of the next node must be in the lowest bit of the compressed SID.
[0155] Therefore, the first common prefix length bit data in the SID corresponding to the first SL (i.e., the SID of the second node) is the common prefix, and the lowest bit compressed address (i.e., the last two segments of data in the compressed SID) in the SID corresponding to the second SL (i.e., the compressed SID) is the compressed address of the next node of the second node. The two can be spliced together to obtain part of the address of the next node, and the remaining part can be generated according to the method of generating a complete SID based on the compressed address in the relevant technology. In the aforementioned application scenario, the SI (the last two bits) of the generated destination SID in this case has a value of 3.
[0156] S505: Encapsulate the message with a new IP header whose destination address is the destination SID, and forward the encapsulated message.
[0157] The destination SID is the SID of the next node of the second node, and the destination address in the IP header of the newly encapsulated message is the SID of the next node of the second node, so that the message can be forwarded to the next node of the second node by bypassing the second node.
[0158] As can be seen from the above, in the message forwarding method provided by the embodiment of the present application, since the message carries an SRH option header, the SRH option header contains a segment index that can represent the SL corresponding to the compressed SID that records the compressed address. After receiving the message, the first node should forward the message to the second node according to the forwarding method of segment routing. However, if it is determined that the message cannot be forwarded to the second node, a fault forwarding process needs to be performed. First, it is determined whether the first SL corresponding to the second node is included in the segment index. If it is not included in the segment index, it is determined that the address of the second node is not compressed. In order to skip the second node that cannot be forwarded to, it is necessary to forward the message to the next node of the second node, and the first SL is reduced by a preset step size to obtain the second SL. If the second SL is included in the segment index, it means that the SID corresponding to the second SL is a compressed SID, and the message cannot be directly forwarded as the destination address. In this case, the compressed address in the compressed SID needs to be spliced with the common prefix to obtain the real address of the next node of the second node, that is, the destination SID, to complete the message forwarding.
[0159] That is to say, in the embodiment of the present application, an SRH option header is added to the message to record information related to the compressed address. Even if the nodes on the message forwarding path do not support address compression, the SL corresponding to the compressed SID can be determined according to the information in the SRH option header. If the updated SL corresponds to the compressed SID during fault handling, the message will not be forwarded directly using the compressed SID as the destination address, but the message will be forwarded after the destination SID as the real address is spliced. This can avoid the problem of message forwarding failure caused by the compressed address not being the real address.
[0160] If in the aforementioned Figure 4 Application in the scenario shown Figure 5 In the scheme shown, the message sent by node 1, in addition to the content described above, should also contain at least a segment index with a value of 1, indicating that the SID corresponding to SL=1 is a compressed SID, and a common prefix length of 48.
[0161] In this case, if node 3 fails, node 2 is the first node and node 3 is the second node. The SL of the message received by node 2 is 3, and then SL-1 is normally obtained to obtain the first SL as 2, and the SID of node 3 is obtained based on the second SL, and it is determined that the message cannot be forwarded to node 3. In this case, it is determined that the first SL is 2 and is not included in the segment index. Therefore, the first SL is subtracted from 1 to obtain the second SL = 1. It is determined that the second SL is included in the segment index, and the first common prefix length bit data (888:0:0) in the SID corresponding to the first SL (the SID of node 3) is concatenated with the lowest bit compressed address (4:2) in the SID corresponding to the second SL (compressed SID) to obtain the concatenation result (888:0:0:4:2), and the destination SID (888:0:0:4:2::) is generated according to the concatenation result, that is, the SID of node 4, as the destination address in the IPv6 header. By forwarding the message, the message can be forwarded to node 4 bypassing node 3.
[0162] It can be seen that the solution provided by the embodiment of the present application can handle the above Figure 4 Fault shown.
[0163] In another embodiment of the present application, before the above-mentioned step S505, if step S503 determines that the above-mentioned second SL is not included in the above-mentioned segment index, step A is executed.
[0164] Step A: Use the SID corresponding to the second SL as the destination SID.
[0165] If the second SL is not included in the above segment index, it means that not only the first SL but also the SID corresponding to the second SL is not a compressed SID but a complete address. Therefore, the SID corresponding to the second SL can be directly used as the destination SID for subsequent message forwarding.
[0166] The foregoing Figure 4 The failure shown occurs on the first node whose address is compressed. If the failure occurs on other nodes whose addresses are compressed, there are other problems.
[0167] See also Figure 6 , which is a fault diagram of the second SRv6 compression network provided in an embodiment of the present application.
[0168] The network structure in the figure is Figure 3 The embodiment shown is the same, and the node 5 marked with a cross in the figure fails.
[0169] Then node 4 is a proxy node, and the SL corresponding to node 4 is 1. Therefore, if node 4 forwards the message according to the intermediate node protection method in the related art, SL-1 can be set to 0, and the SID corresponding to SL=0 is 1000:0:0:8:1::(SID of node 8). Therefore, node 4 will forward the message with the SID of node 8 as the destination address. According to the network structure shown in the figure, the forwarding path of the message may be node 4-node 7-node 8. Although the message can be forwarded to node 8, node 6, which has not failed, is skipped, which does not match the forwarding path specified by the segment routing.
[0170] To solve the above problems, see Figure 7 , is a flow chart of a second message forwarding method provided in an embodiment of the present application, which is similar to the aforementioned Figure 5 Compared with the embodiment shown in the figure, the following steps S506 to S508 are also included before step S505. If step S502 determines that the first SL is included in the above segment index, step S506 is executed.
[0171] S506: Determine whether there is a compression address corresponding to the first SI in the compression SID corresponding to the first SL.
[0172] Among them, each compressed address in the above compressed SID corresponds to an SI, the difference between the SIs of adjacent compressed addresses is a preset difference, and the above first SI is equal to the SI corresponding to the compressed address of the above second node minus the above preset difference.
[0173] If the first SL is included in the segment index, it means that the address of the second node is compressed. In this case, the address of the next node of the second node may be compressed into the same compressed SID as the address of the second node, or may be compressed into a different compressed SID. Therefore, it is necessary to determine whether the compressed SID corresponding to the first SL contains a compressed address corresponding to the first SI.
[0174] The SI corresponding to the compressed address of the second node is the value of the last two digits of the destination address in the message generated by the first node for the second node according to the normal forwarding process. The specific way in which the first node determines the destination address according to the normal forwarding process can be found in the relevant technology and will not be repeated here.
[0175] Taking the above application scenario as an example, the difference between the SIs of adjacent compressed addresses is 1, that is, the preset difference is 1. When node 5 is the second node, the SI corresponding to the compressed address of the second node is 2, and the first SI is 2-1=1. In this case, there is a compressed address corresponding to the first SI=1, that is, the compressed address of node 6.
[0176] Therefore, if there is a compressed address corresponding to the first SI, then the compressed address is the compressed address of the next node of the second node. The compressed address of the next node and the compressed address of the second node are included in the same compressed SID. Execute steps S507-S508.
[0177] In one embodiment of the present application, there may be the following two situations when the compressed address corresponding to the first SI does not exist in the compressed SID corresponding to the above-mentioned first SL. One is that the number of nodes whose addresses are compressed is not an integer multiple of the number of compressed addresses that a compressed SID can accommodate, so there is a non-compressed address segment with a value of 0 in the compressed SID, and the first SI corresponds to the non-compressed address segment. For example, a compressed SID can accommodate the compressed addresses of 4 nodes, but only the addresses of 3 nodes in the network are compressed, so there are only three compressed addresses in the compressed SID, and SI=0 corresponds to the non-compressed address segment. The second is that the first SI is not a valid SI. That is to say, the compressed address corresponding to the second node is the compressed address of the highest bit in the compressed SID, and the first SI obtained by subtracting the preset difference from its SI is no longer a valid SI.
[0178] In one embodiment of the present application, after determining that the first SI is obtained, it can be checked whether a compressed address exists at a position corresponding to the first SI in the compressed SID corresponding to the first SL.
[0179] In another embodiment of the present application, the above-mentioned SRH option header also includes: an SI index, each SI index corresponds to a compressed SID, each data bit in the SI index corresponds to each position on the compressed SID, and the value of each data bit indicates whether there is a compressed address at the corresponding position.
[0180] For example, a compressed SID can contain 4 compressed addresses. The SI index contains 4 digits, each digit corresponds to a position. A value of 1 indicates that a compressed address exists at the corresponding position, and a value of 0 indicates that a compressed address does not exist at the corresponding position. If the value of the SI index is 1111, it means that the compressed SID contains 4 compressed addresses. If the value of the SI index is 0111, it means that the compressed SID contains 3 compressed addresses, and there is no compressed address at the highest position. And so on.
[0181] Then, it can be determined whether there is a compressed address corresponding to the first SI through the following step B.
[0182] Step B: Determine whether the value of the first data bit in the first SI index indicates the existence of a compressed address corresponding to the first SI.
[0183] Among them, the above-mentioned first SI index corresponds to the compressed SID corresponding to the above-mentioned first SL, and the position indicated by the above-mentioned first data bit is used to record the compressed address corresponding to the first SI.
[0184] For example, based on the above example, if the first SI is 2, the first data bit is the second data bit from low to high in the first SI index; if the first SI is 1, the first data bit is the third data bit from low to high in the first SI index; if the first SI is 0, the first data bit is the fourth data bit from low to high in the first SI index. If the first data bit is 1, it means that there is a compressed address corresponding to the first SI.
[0185] In the case where the SRH option header contains all possible fields mentioned in the above embodiments, see Table 1, which is a field table of an SRH option header provided in an embodiment of the present application.
[0186] Table 1
[0187]
[0188] It should be noted that this table only represents the fields that may be included in the SRH option header. In the embodiment of the present application, it is not limited that the SRH option header must include other fields except the segment index and the common prefix length. The present application also does not limit the arrangement order of each field to the order in Table 1. The length of each field described in Table 1 is also only an example.
[0189] S507: Accumulate the preset step length on the basis of the first SL until the calculation result is not included in the above segment index, to obtain the accumulated third SL.
[0190] Since there is a compressed address corresponding to the first SI, and according to the above inference, it can be determined that the compressed address is the compressed address of the next node of the second node. Therefore, the compressed address can be obtained by executing this. In order to obtain the complete address of the next node of the second node, the common prefix needs to be obtained.
[0191] To this end, it is necessary to obtain the SID of the node whose address is not compressed and is adjacent to the preamble of the node whose address is compressed, and the first common prefix length bit data of the SID is the common prefix. According to the previous description of the application scenario, it can be determined that the SL corresponding to the SID of the node should be the smallest of all SLs greater than the first SL. Since the first SL is obtained after continuously subtracting the preset step length during the message forwarding process, the SL of each node before the second node in the forwarding order can be obtained in sequence by accumulating the preset step length on the basis of the first SL. In the present application, the preset step length is accumulated on the basis of the first SL until the calculation result is not included in the above-mentioned segment index, that is, until a corresponding SID is obtained that is not a compressed SID. This SL is the SL corresponding to the required node, that is, the third SL.
[0192] S508: Concatenate the common prefix length bit data in the SID corresponding to the third SL and the compressed address corresponding to the first SI in the compressed SID, and generate a destination SID based on the concatenation result.
[0193] As described above, the SID corresponding to the third SL is the SID of the node whose address is not compressed and adjacent to the preamble of the node whose address is compressed. The first common prefix length bit data in the SID is the common prefix. The compressed address corresponding to the first SI in the compressed SID is the compressed address of the next node of the second node. The concatenation result of the two is part of the complete address of the next node. The value of the last two bits (i.e., SI) of the address in the remaining part is the first SI.
[0194] As can be seen from the above, if the first SL is included in the segment index, it means that the SID corresponding to the first SL is a compressed SID, which is not a real address, but a compressed address. In this case, the addresses of the second node and the next node of the second node on the forwarding path may be compressed in the same compressed SID, so in this case, if fault handling is to be performed and the message is forwarded to the next node of the second node, when determining the address of the next node of the second node, the compressed address of the next node is first determined. That is, it is determined whether there is a compressed address corresponding to the first SI in the compressed SID corresponding to the first SL. If it exists, it means that the compressed address of the next node and the compressed address of the second node are included in the same compressed SID, and the compressed address of the next node can be directly obtained from the compressed SID. On the other hand, in the embodiment of the present application, the common prefix corresponding to the compressed address can also be obtained by accumulating the first SL. Thereby, the complete address of the next node is spliced, and then the message is forwarded to the next node of the second node. Since this forwarding only bypasses the second node where the fault occurs and forwards the message to the next node of the second node, it will not skip a large number of nodes in the forwarding path as in the related art. That is, it can meet the forwarding requirements of segment routing while handling failures.
[0195] If you will Figure 7 The embodiment shown is applied to Figure 6 In the scenario shown. The failed node 5 is the second node, and node 4 is the first node. After receiving the message, node 4 processes the message normally, and the first SL is equal to the SL carried in the SRH of the received message, that is, 1. Node 4 determines that the first SL is included in the segment index. The SI corresponding to node 4 is 3, and the SI corresponding to node 3 is 3-1=2. It is further determined that there is a compressed address corresponding to SI=2 in the compressed SID corresponding to the first SL, so the compressed address is the compressed address of the next node of the second node (that is, node 6) (6:2). Afterwards, the first SL+preset step size (1)=2, and the accumulated result obtained at this time is not included in the segment index. Therefore, the third SL=2. The first common prefix length (that is, 48) bits of data (888:0:0) in the SID corresponding to the third SL (that is, the SID of node 3) is the common prefix. The common prefix and the compressed address of the next node are concatenated to obtain a concatenation result (888:0:0:6:2), and a destination SID (888:0:0:6:2::) is generated based on the concatenation result, which is the SID of node 6. Therefore, forwarding a message with the SID as the destination address can forward the message to node 6. Therefore, node 6 will not be skipped, and the forwarding requirements of segment routing can be met by using the embodiment of the present application.
[0196] Figure 7The embodiment shown can handle the situation where the compressed address of the next node of the second node and the compressed address of the second node are located in the same compressed SID. However, there is also a situation where the address of the next node of the second node is not compressed. In this case, see Figure 8 , is a flow chart of a third message forwarding method provided in an embodiment of the present application. Figure 7 Compared with the embodiment shown, the present invention further includes the following steps S509 to S510.
[0197] If it is determined in step S506 that there is no compressed address corresponding to the first SI, step S509 is executed.
[0198] S509: Subtract a preset step length from the first SL to obtain a fourth SL, and determine whether the fourth SL is included in the segment index.
[0199] Since the compressed address corresponding to the first SI does not exist in the compressed SID corresponding to the first SL, there may be two situations. One is that the address of the next node of the second node is not compressed. The other is that the address of the next node of the second node is compressed, but its compressed address is not in the compressed SID corresponding to the first SL. In either case, it is necessary to reduce the first SL by a preset step size to obtain the fourth SL. The SID corresponding to the fourth SL is the next SID of the compressed SID containing the compressed address of the second node. Further determine the relationship between the SID corresponding to the fourth SL and the address of the next node of the second node.
[0200] If the fourth SL is not included in the above segment index, it means that the SID corresponding to the fourth SL is not a compressed SID, and the SID is the complete SID of the next node of the second node, that is, the address of the next node of the second node is not compressed. In this case, step S510 is executed.
[0201] S510: Determine the SID corresponding to the second SL as the destination SID.
[0202] As can be seen from the above, if there is no compressed address corresponding to the first SI, it means that the compressed SID corresponding to the first SL does not contain a part related to the address of the next node of the second node, so the first SL is reduced by the preset step length to obtain the fourth SL, and a new fourth SL is obtained. If the newly obtained fourth SL is not included in the segment index, it means that the SID corresponding to the fourth SL has not been compressed, that is, the address of the next node of the second node has not been compressed, and the SID can be directly used as the destination SID, so as to forward the message to the next node of the second node. Then, fault handling is realized, and in this process, only the second node will be bypassed, which can meet the needs of segment routing.
[0203] In another case, the address of the next node of the second node is compressed, in which case, see Fig. 9 , is a flow chart of the fourth message forwarding method provided in the embodiment of the present application. Figure 8 Compared with the illustrated embodiment, when the aforementioned step S509 determines that the fourth SL is included in the segment index, the following steps S511-S512 are executed.
[0204] S511: Accumulate a preset step length on the basis of the first SL until the calculation result is not included in the segment index, thereby obtaining an accumulated third SL.
[0205] This process is similar to the aforementioned step S507 and will not be described again here.
[0206] S512: Concatenate the first common prefix length bits in the SID corresponding to the third SL with the least significant compressed address in the SID corresponding to the fourth SL, and generate a destination SID based on the concatenation result.
[0207] Since the first SL is updated to the fourth SL in the aforementioned step S509, the message forwarding has not yet been performed based on the SID corresponding to the fourth SL. And because the fourth SL is included in the segment index, the SID corresponding to the fourth SL is a compressed SID. Since the message forwarding has not yet been performed based on the compressed SID, according to the generation logic of the compressed SID, the compressed address extracted from the compressed SID for the first time must be the compressed address at the lowest bit. Therefore, the lowest bit compressed address can be directly spliced with the common prefix, and the destination SID of the next node can be obtained based on the splicing result.
[0208] As can be seen from the above, if there is no compressed address corresponding to the first SI, it means that the compressed SID corresponding to the first SL does not contain a part related to the address of the next node of the second node, so the first SL is subtracted by the preset step size to obtain the fourth SL, and a new fourth SL is obtained. If the newly obtained fourth SL is included in the segment index, it means that the SID corresponding to the fourth SL has been compressed, that is, the address of the next node of the second node is compressed, and the compressed address should be located at the lowest bit of the SID corresponding to the latest found fourth SL, so the complete SID of the next node can be obtained by splicing the two. Thereby forwarding the message to the next node of the second node is realized. Then fault handling is realized, and in this process only the second node will be bypassed, which can meet the needs of segmented routing.
[0209] The following uses a more complex example to describe the process of troubleshooting using an embodiment of the present application.
[0210] Assume that there are nodes 1 to 13. The address of node 1 is 1000:0:0:1:1::, the address of node 2 is 1000:0:0:2:1::, the address of node 3 is 888:0:0:3:2::, the address of node 4 is 888:0:0:4:2::, the address of node 5 is 888:0:0:5:2::, the address of node 6 is 999:0:0:6:2::, and the address of node 7 is The address of node 12 is 999:0:0:7:2::, the address of node 13 is 1000:0:0:D:1::.
[0211] Among them, nodes 3 to 12 are nodes participating in address compression, nodes 3 to 5 have the same common prefix, and nodes 6 to 12 have the same common prefix.
[0212] Therefore, the complete address of node 3 is retained to obtain the common prefix, and the addresses of nodes 4-5 are compressed to obtain a compressed SID of 0:0:0:0:5:2:4:2. Since only the addresses of two nodes are compressed, the first 4 segments of the compressed SID are 0.
[0213] The complete address of node 6 is retained to obtain a common prefix, and the addresses of nodes 7 to 12 are compressed, resulting in compressed SIDs of A: 2: 9: 2: 8: 2: 7: 2 and 0: 0: 0: 0: C: 1: B: 2. Since the number of nodes whose addresses are compressed is greater than 4, 2 compressed SIDs are generated.
[0214] In this case, Node 1 sends a message to Node 13. The destination address in the IP header of the message sent by the outbound interface of Node 1 is 1000:0:0:2:1::. SL in the SRH is 6, and the SID list is: Address[0]: 1000:0:0:D:1::; Address[1]: 0:0:0:0:C:1:B:2; Address[2]: A:2:9:2:8:2:7:2; Address[3]: 999:0:0:6:2::; Address[4]: 0:0:0:0:5:2:4:2; Address[5]: 888:0:0:3:2::; Address[6]: 1000:0:0:2:1::; Address[7]: 1000:0:0:1:1::.
[0215] The information contained in the SRH option header includes: segment index 4 (00000101), SI index 3 (0011), common prefix length 48. Segment index 2 (00000010), SI index 15 (1111), common prefix length 48. Segment index 1 (00000001), SI index 3 (0011), common prefix length 48.
[0216] In this case, if node 5 fails, node 4 serves as the first node and node 5 serves as the second node. After receiving the message, node 4 first performs the normal message forwarding process, SL=4 remains unchanged, and SI-1=2 carried in the message is used to obtain the compressed address of node 5 from the compressed SID corresponding to SL=4, and combined with the common prefix in the destination address of the received message to obtain the address of node 5. It is determined that the message cannot be forwarded to node 5, and it is determined that the first SL (SL=4) corresponding to node 5 is included in the segment index. According to the SI index (0011) corresponding to segment index 4, it is determined that the compressed SID (0:0:0:0:5:2:4:2) corresponding to the first SL (SL=4) does not exist in the compressed address corresponding to the first SI (SI=2-1=1). Therefore, node 4 sets SL-1=4-1=3 and obtains the fourth SL=3. It is determined that the fourth SL is not included in the segment index, so the SID corresponding to SL=3 (999:0:0:6:2::), that is, the SID of node 6, is directly used as the destination address, thereby sending a message to node 6.
[0217] If node 10 fails, node 9 is the first node and node 10 is the second node. After receiving the message, node 9 first performs the normal message forwarding process, SL=2 remains unchanged, SI-1=0 carried in the message is used to obtain the compressed address of node 10 from the compressed SID corresponding to SL=2, and combined with the common prefix in the destination address of the received message to obtain the address of node 10. It is determined that the message cannot be forwarded to node 10, and it is determined that the first SL (SL=2) corresponding to node 10 is included in the segment index. The first SI=0-1=-1, the first SI is an invalid SI, so the compressed address corresponding to the first SI does not exist in the compressed SID corresponding to the first SL. Subtract the first SL-1 to obtain the fourth SL=1. The fourth SL is included in the segment index, so 1 is accumulated on the basis of the first SL until the calculation result is not included in the segment index, and the accumulated third SL=3 is obtained. Concatenate the first common prefix length bit data (999:0:0) in the SID corresponding to the third SL and the lowest compressed address (B:2) in the compressed SID (0:0:0:0:C:1:B:2) corresponding to the third SL to obtain the destination SID (999:0:0:B:2::), that is, the address of node 11, and then send a message to node 11.
[0218] Corresponding to the aforementioned message forwarding method, an embodiment of the present application also provides a network node.
[0219] See also Fig.10 , is a schematic diagram of a structure of a network node provided in an embodiment of the present application, as a first node, the network node includes:
[0220] Processor 1001;
[0221] transceiver 1004;
[0222] A machine-readable storage medium 1002, wherein the machine-readable storage medium 1002 stores machine-executable instructions that can be executed by the processor 1001, and the machine-executable instructions prompt the processor 1001 to perform the following steps:
[0223] Receive a message; wherein the message carries a segment routing header SRH option header, and the SRH option header includes the following information: segment index, common prefix length; the segment index is the remaining segment SL corresponding to the compressed segment identifier SID recording the compressed address;
[0224] In the case where it is determined that the message cannot be forwarded to the second node at the next hop, determining whether the first SL corresponding to the second node is included in the segment index;
[0225] If the first SL is not included in the segment index, a preset step size is subtracted from the first SL to obtain a second SL, where the preset step size is the absolute value of the difference between SLs corresponding to adjacent SIDs in the SRH of the message;
[0226] If the second SL is included in the segment index, concatenate the common prefix length bit data in the SID corresponding to the first SL and the least significant compressed address in the SID corresponding to the second SL, and generate a destination SID based on the concatenation result;
[0227] A new IP header whose destination address is the destination SID is encapsulated in the message, and the encapsulated message is forwarded.
[0228] like Fig.10 As shown, the network device may further include a communication bus 1003. The processor 1001, the machine-readable storage medium 1002, and the transceiver 1004 communicate with each other through the communication bus 1003. The communication bus 1003 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus 1003 may be divided into an address bus, a data bus, a control bus, etc.
[0229] The transceiver 1004 may be a wireless communication module. Under the control of the processor 1001 , the transceiver 1004 exchanges data with other devices.
[0230] The machine-readable storage medium 1002 may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk storage. In addition, the machine-readable storage medium 1002 may also be at least one storage device located away from the aforementioned processor.
[0231] Processor 1001 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0232] As can be seen from the above, in the message forwarding method provided by the embodiment of the present application, since the message carries an SRH option header, the SRH option header contains a segment index that can represent the SL corresponding to the compressed SID that records the compressed address. After receiving the message, the first node should forward the message to the second node according to the forwarding method of segment routing. However, if it is determined that the message cannot be forwarded to the second node, a fault forwarding process needs to be performed. First, it is determined whether the first SL corresponding to the second node is included in the segment index. If it is not included in the segment index, it is determined that the address of the second node is not compressed. In order to skip the second node that cannot be forwarded to, it is necessary to forward the message to the next node of the second node, and the first SL is reduced by a preset step size to obtain the second SL. If the second SL is included in the segment index, it means that the SID corresponding to the second SL is a compressed SID, and the message cannot be directly forwarded as the destination address. In this case, the compressed address in the compressed SID needs to be spliced with the common prefix to obtain the real address of the next node of the second node, that is, the destination SID, to complete the message forwarding.
[0233] That is to say, in the embodiment of the present application, an SRH option header is added to the message to record information related to the compressed address. Even if the nodes on the message forwarding path do not support address compression, the SL corresponding to the compressed SID can be determined according to the information in the SRH option header. If the updated SL corresponds to the compressed SID during fault handling, the message will not be forwarded directly using the compressed SID as the destination address, but the message will be forwarded after the destination SID as the real address is spliced. This can avoid the problem of message forwarding failure caused by the compressed address not being the real address.
[0234] In one embodiment of the present application, before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the machine executable instructions further cause the processor to perform the following steps:
[0235] If the first SL is included in the segment index, determine whether there is a compressed address corresponding to the first segment identification index SI in the compressed SID corresponding to the first SL, wherein each compressed address in the compressed SID corresponds to an SI, the difference between SIs of adjacent compressed addresses is a preset difference, and the first SI is equal to the SI corresponding to the compressed address of the second node minus the preset difference;
[0236] If there is a compressed address corresponding to the first SI, a preset step length is accumulated on the basis of the first SL until the calculation result is not included in the segment index, thereby obtaining an accumulated third SL;
[0237] The common prefix length bit data in the SID corresponding to the third SL is concatenated with the compressed address corresponding to the first SI in the compressed SID, and a destination SID is generated based on the concatenation result.
[0238] As can be seen from the above, if the first SL is included in the segment index, it means that the SID corresponding to the first SL is a compressed SID, which is not a real address, but a compressed address. In this case, the addresses of the second node and the next node of the second node on the forwarding path may be compressed in the same compressed SID, so in this case, if fault handling is to be performed and the message is forwarded to the next node of the second node, when determining the address of the next node of the second node, the compressed address of the next node is first determined. That is, it is determined whether there is a compressed address corresponding to the first SI in the compressed SID corresponding to the first SL. If it exists, it means that the compressed address of the next node and the compressed address of the second node are included in the same compressed SID, and the compressed address of the next node can be directly obtained from the compressed SID. On the other hand, in the embodiment of the present application, the common prefix corresponding to the compressed address can also be obtained by accumulating the first SL. Thereby, the complete address of the next node is spliced, and then the message is forwarded to the next node of the second node. Since this forwarding only bypasses the second node where the fault occurs and forwards the message to the next node of the second node, it will not skip a large number of nodes in the forwarding path as in the related art. That is, it can meet the forwarding requirements of segment routing while handling failures.
[0239] In one embodiment of the present application, before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the machine executable instructions further cause the processor to perform the following steps:
[0240] If there is no compressed address corresponding to the first SI, subtract a preset step length from the first SL to obtain a fourth SL, and determine whether the fourth SL is included in the segment index;
[0241] If the fourth SL is not included in the segment index, the SID corresponding to the second SL is determined as the destination SID.
[0242] As can be seen from the above, if there is no compressed address corresponding to the first SI, it means that the compressed SID corresponding to the first SL does not contain a part related to the address of the next node of the second node, so the first SL is reduced by the preset step length to obtain the fourth SL, and a new fourth SL is obtained. If the newly obtained fourth SL is not included in the segment index, it means that the SID corresponding to the fourth SL has not been compressed, that is, the address of the next node of the second node has not been compressed, and the SID can be directly used as the destination SID, so as to forward the message to the next node of the second node. Then, fault handling is realized, and in this process, only the second node will be bypassed, which can meet the needs of segment routing.
[0243] In one embodiment of the present application, before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the machine executable instructions further cause the processor to perform the following steps:
[0244] If the fourth SL is included in the segment index, a preset step size is accumulated on the basis of the first SL until the calculation result is no longer included in the segment index, thereby obtaining an accumulated third SL;
[0245] The common prefix length bit data in the SID corresponding to the third SL is concatenated with the least significant compressed address in the SID corresponding to the fourth SL, and a destination SID is generated based on the concatenated result.
[0246] As can be seen from the above, if there is no compressed address corresponding to the first SI, it means that the compressed SID corresponding to the first SL does not contain a part related to the address of the next node of the second node, so the first SL is subtracted by the preset step size to obtain the fourth SL, and a new fourth SL is obtained. If the newly obtained fourth SL is included in the segment index, it means that the SID corresponding to the fourth SL has been compressed, that is, the address of the next node of the second node is compressed, and the compressed address should be located at the lowest bit of the SID corresponding to the latest found fourth SL, so the complete SID of the next node can be obtained by splicing the two. Thereby forwarding the message to the next node of the second node is realized. Then fault handling is realized, and in this process only the second node will be bypassed, which can meet the needs of segmented routing.
[0247] In one embodiment of the present application, the SRH option header further includes: an SI index, each SI index corresponds to a compressed SID, each data bit in the SI index corresponds to each position on the compressed SID, and the value of each data bit indicates whether there is a compressed address at the corresponding position;
[0248] The determining whether there is a compressed address corresponding to the first segment identifier index SI in the compressed SID corresponding to the first SL specifically includes:
[0249] Determine whether the value of the first data bit in the first SI index indicates the existence of a compressed address corresponding to the first SI, wherein the first SI index corresponds to the compressed SID corresponding to the first SL, and the position indicated by the first data bit is used to record the compressed address corresponding to the first SI.
[0250] In one embodiment of the present application, before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the machine executable instructions further cause the processor to perform the following steps:
[0251] If the second SL is not included in the segment index, the SID corresponding to the second SL is used as the destination SID.
[0252] In one embodiment of the present application, the SRH option header also includes at least one of the following information: the type of the SRH option header, the length of the SRH option header, and a reserved field.
[0253] In one embodiment of the present application, the SRH option header is located between the IP header and the SRH of the message.
[0254] Corresponding to the aforementioned message forwarding method, an embodiment of the present application provides a message forwarding device.
[0255] See also Fig.11 , is a structural diagram of a message forwarding device provided in an embodiment of the present application, which is applied to a first node, and the device includes:
[0256] The message receiving module 1101 is used to receive a message; wherein the message carries a segment routing header SRH option header, and the SRH option header includes the following information: segment index, common prefix length; the segment index is the remaining segment SL corresponding to the compressed segment identifier SID recording the compressed address;
[0257] A first segment index determination module 1102 is configured to determine whether a first SL corresponding to a second node at a next hop is included in the segment index when it is determined that the message cannot be forwarded to the second node at the next hop;
[0258] A second SL calculation module 1103 is configured to, if the first SL is not included in the segment index, subtract a preset step length from the first SL to obtain a second SL, where the preset step length is an absolute value of a difference between SLs corresponding to adjacent SIDs in the SRH of the message;
[0259] A first splicing module 1104 is configured to, if the second SL is included in the segment index, splice the common prefix length bit data in the SID corresponding to the first SL and the lowest bit compressed address in the SID corresponding to the second SL, and generate a destination SID based on the splicing result;
[0260] The message forwarding module 1105 is used to encapsulate the message with a new IP header whose destination address is the destination SID, and forward the encapsulated message.
[0261] As can be seen from the above, in the message forwarding method provided by the embodiment of the present application, since the message carries an SRH option header, the SRH option header contains a segment index that can represent the SL corresponding to the compressed SID that records the compressed address. After receiving the message, the first node should forward the message to the second node according to the forwarding method of segment routing. However, if it is determined that the message cannot be forwarded to the second node, a fault forwarding process needs to be performed. First, it is determined whether the first SL corresponding to the second node is included in the segment index. If it is not included in the segment index, it is determined that the address of the second node is not compressed. In order to skip the second node that cannot be forwarded to, it is necessary to forward the message to the next node of the second node, and the first SL is reduced by a preset step size to obtain the second SL. If the second SL is included in the segment index, it means that the SID corresponding to the second SL is a compressed SID, and the message cannot be directly forwarded as the destination address. In this case, the compressed address in the compressed SID needs to be spliced with the common prefix to obtain the real address of the next node of the second node, that is, the destination SID, to complete the message forwarding.
[0262] That is to say, in the embodiment of the present application, an SRH option header is added to the message to record information related to the compressed address. Even if the nodes on the message forwarding path do not support address compression, the SL corresponding to the compressed SID can be determined according to the information in the SRH option header. If the updated SL corresponds to the compressed SID during fault handling, the message will not be forwarded directly using the compressed SID as the destination address, but the message will be forwarded after the destination SID as the real address is spliced. This can avoid the problem of message forwarding failure caused by the compressed address not being the real address.
[0263] In one embodiment of the present application, the device further includes:
[0264] a compressed address determination module, configured to determine whether there is a compressed address corresponding to a first segment identification index SI in the compressed SID corresponding to the first SL if the first SL is included in the segment index, wherein each compressed address in the compressed SID corresponds to an SI, the difference between SIs of adjacent compressed addresses is a preset difference, and the first SI is equal to the SI corresponding to the compressed address of the second node minus the preset difference;
[0265] A first SL accumulation module, configured to accumulate a preset step length on the basis of the first SL if there is a compressed address corresponding to the first SI, until a calculation result is not included in the segment index, to obtain an accumulated third SL;
[0266] The second splicing module is used to splice the common prefix length bit data in the SID corresponding to the third SL and the compressed address corresponding to the first SI in the compressed SID, and generate a destination SID based on the splicing result.
[0267] As can be seen from the above, if the first SL is included in the segment index, it means that the SID corresponding to the first SL is a compressed SID, which is not a real address, but a compressed address. In this case, the addresses of the second node and the next node of the second node on the forwarding path may be compressed in the same compressed SID, so in this case, if fault handling is to be performed and the message is forwarded to the next node of the second node, when determining the address of the next node of the second node, the compressed address of the next node is first determined. That is, it is determined whether there is a compressed address corresponding to the first SI in the compressed SID corresponding to the first SL. If it exists, it means that the compressed address of the next node and the compressed address of the second node are included in the same compressed SID, and the compressed address of the next node can be directly obtained from the compressed SID. On the other hand, in the embodiment of the present application, the common prefix corresponding to the compressed address can also be obtained by accumulating the first SL. Thereby, the complete address of the next node is spliced, and then the message is forwarded to the next node of the second node. Since this forwarding only bypasses the second node where the fault occurs and forwards the message to the next node of the second node, it will not skip a large number of nodes in the forwarding path as in the related art. That is, it can meet the forwarding requirements of segment routing while handling failures.
[0268] In one embodiment of the present application, the device further includes:
[0269] a fourth SL calculation module, configured to, if there is no compressed address corresponding to the first SI, reduce a preset step length from the first SL to obtain a fourth SL, and determine whether the fourth SL is included in the segment index;
[0270] The first SID determination module is used to determine the SID corresponding to the second SL as the destination SID if the fourth SL is not included in the segment index.
[0271] As can be seen from the above, if there is no compressed address corresponding to the first SI, it means that the compressed SID corresponding to the first SL does not contain a part related to the address of the next node of the second node, so the first SL is reduced by the preset step length to obtain the fourth SL, and a new fourth SL is obtained. If the newly obtained fourth SL is not included in the segment index, it means that the SID corresponding to the fourth SL has not been compressed, that is, the address of the next node of the second node has not been compressed, and the SID can be directly used as the destination SID, so as to forward the message to the next node of the second node. Then, fault handling is realized, and in this process, only the second node will be bypassed, which can meet the needs of segment routing.
[0272] In one embodiment of the present application, the device further includes:
[0273] A second SL accumulation module is configured to accumulate a preset step size on the basis of the first SL if the fourth SL is included in the segment index, until the calculation result is no longer included in the segment index, so as to obtain an accumulated third SL;
[0274] The third splicing module is used to splice the common prefix length bit data in the SID corresponding to the third SL and the lowest bit compressed address in the SID corresponding to the fourth SL, and generate a destination SID based on the splicing result.
[0275] As can be seen from the above, if there is no compressed address corresponding to the first SI, it means that the compressed SID corresponding to the first SL does not contain a part related to the address of the next node of the second node, so the first SL is subtracted by the preset step size to obtain the fourth SL, and a new fourth SL is obtained. If the newly obtained fourth SL is included in the segment index, it means that the SID corresponding to the fourth SL has been compressed, that is, the address of the next node of the second node is compressed, and the compressed address should be located at the lowest bit of the SID corresponding to the latest found fourth SL, so the complete SID of the next node can be obtained by splicing the two. Thereby forwarding the message to the next node of the second node is realized. Then fault handling is realized, and in this process only the second node will be bypassed, which can meet the needs of segmented routing.
[0276] In one embodiment of the present application, the SRH option header further includes: an SI index, each SI index corresponds to a compressed SID, each data bit in the SI index corresponds to each position on the compressed SID, and the value of each data bit indicates whether there is a compressed address at the corresponding position;
[0277] The compressed address determination module is specifically used for:
[0278] If the first SL is included in the segment index, determine whether the value of the first data bit in the first SI index indicates the existence of a compressed address corresponding to the first SI, wherein the first SI index corresponds to the compressed SID corresponding to the first SL, and the position indicated by the first data bit is used to record the compressed address corresponding to the first SI.
[0279] In one embodiment of the present application, the device further includes:
[0280] The second SID determination module is used to use the SID corresponding to the second SL as the destination SID if the second SL is not included in the segment index.
[0281] In one embodiment of the present application, the SRH option header also includes at least one of the following information: the type of the SRH option header, the length of the SRH option header, and a reserved field.
[0282] In one embodiment of the present application, the SRH option header is located between the IP header and the SRH of the message.
[0283] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned message forwarding methods are implemented.
[0284] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any message forwarding method in the above embodiments.
[0285] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0286] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0287] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the network node, device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0288] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A message forwarding method, characterized in that: Applied to the first node, the method comprises: Receive a message; wherein the message carries a segment routing header SRH option header, and the SRH option header includes the following information: segment index, common prefix length; the segment index is the remaining segment SL corresponding to the compressed segment identifier SID recording the compressed address; In the case where it is determined that the message cannot be forwarded to the second node at the next hop, determining whether the first SL corresponding to the second node is included in the segment index; If the first SL is not included in the segment index, a preset step size is subtracted from the first SL to obtain a second SL, where the preset step size is the absolute value of the difference between SLs corresponding to adjacent SIDs in the SRH of the message; If the second SL is included in the segment index, concatenate the common prefix length bit data in the SID corresponding to the first SL and the least significant compressed address in the SID corresponding to the second SL, and generate a destination SID based on the concatenation result; A new IP header whose destination address is the destination SID is encapsulated in the message, and the encapsulated message is forwarded.
2. The method according to claim 1, characterized in that Before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the method further includes: If the first SL is included in the segment index, determine whether there is a compressed address corresponding to the first segment identification index SI in the compressed SID corresponding to the first SL, wherein each compressed address in the compressed SID corresponds to an SI, the difference between SIs of adjacent compressed addresses is a preset difference, and the first SI is equal to the SI corresponding to the compressed address of the second node minus the preset difference; If there is a compressed address corresponding to the first SI, a preset step length is accumulated on the basis of the first SL until the calculation result is not included in the segment index, thereby obtaining an accumulated third SL; The common prefix length bit data in the SID corresponding to the third SL is concatenated with the compressed address corresponding to the first SI in the compressed SID, and a destination SID is generated based on the concatenation result.
3. The method according to claim 2, characterized in that Before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the method further includes: If there is no compressed address corresponding to the first SI, subtract a preset step length from the first SL to obtain a fourth SL, and determine whether the fourth SL is included in the segment index; If the fourth SL is not included in the segment index, the SID corresponding to the second SL is determined as the destination SID.
4. The method according to claim 3, characterized in that Before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the method further includes: If the fourth SL is included in the segment index, a preset step size is accumulated on the basis of the first SL until the calculation result is no longer included in the segment index, thereby obtaining an accumulated third SL; The common prefix length bit data in the SID corresponding to the third SL is concatenated with the least significant compressed address in the SID corresponding to the fourth SL, and a destination SID is generated based on the concatenation result.
5. The method according to claim 2, characterized in that: The SRH option header also includes: an SI index, each SI index corresponds to a compressed SID, each data bit in the SI index corresponds to each position on the compressed SID, and the value of each data bit indicates whether there is a compressed address at the corresponding position; The determining whether there is a compressed address corresponding to the first segment identification index SI in the compressed SID corresponding to the first SL includes: Determine whether the value of the first data bit in the first SI index indicates the existence of a compressed address corresponding to the first SI, wherein the first SI index corresponds to the compressed SID corresponding to the first SL, and the position indicated by the first data bit is used to record the compressed address corresponding to the first SI.
6. The method according to any one of claims 1 to 5, characterized in that Before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the method further includes: If the second SL is not included in the segment index, the SID corresponding to the second SL is used as the destination SID.
7. The method according to any one of claims 1 to 5, characterized in that The SRH option header also includes at least one of the following information: the type of the SRH option header, the length of the SRH option header, and a reserved field.
8. The method according to any one of claims 1 to 5, characterized in that The SRH option header is located between the IP header and the SRH of the message.
9. A network node, characterized in that: As a first node, the network node includes: processor; Transceiver; A machine-readable storage medium storing machine-executable instructions that can be executed by the processor, the machine-executable instructions causing the processor to perform the following steps: Receive a message; wherein the message carries a segment routing header SRH option header, and the SRH option header includes the following information: segment index, common prefix length; the segment index is the remaining segment SL corresponding to the compressed segment identifier SID recording the compressed address; In the case where it is determined that the message cannot be forwarded to the second node at the next hop, determining whether the first SL corresponding to the second node is included in the segment index; If the first SL is not included in the segment index, a preset step size is subtracted from the first SL to obtain a second SL, where the preset step size is the absolute value of the difference between SLs corresponding to adjacent SIDs in the SRH of the message; If the second SL is included in the segment index, concatenate the common prefix length bit data in the SID corresponding to the first SL and the least significant compressed address in the SID corresponding to the second SL, and generate a destination SID based on the concatenation result; A new IP header whose destination address is the destination SID is encapsulated in the message, and the encapsulated message is forwarded.
10. The network node according to claim 9, characterized in that: Before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the machine executable instructions further cause the processor to perform the following steps: If the first SL is included in the segment index, determine whether there is a compressed address corresponding to the first segment identification index SI in the compressed SID corresponding to the first SL, wherein each compressed address in the compressed SID corresponds to an SI, the difference between SIs of adjacent compressed addresses is a preset difference, and the first SI is equal to the SI corresponding to the compressed address of the second node minus the preset difference; If there is a compressed address corresponding to the first SI, a preset step length is accumulated on the basis of the first SL until the calculation result is not included in the segment index, thereby obtaining an accumulated third SL; The common prefix length bit data in the SID corresponding to the third SL is concatenated with the compressed address corresponding to the first SI in the compressed SID, and a destination SID is generated based on the concatenation result.
11. The network node according to claim 10, characterized in that: Before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the machine executable instructions further cause the processor to perform the following steps: If there is no compressed address corresponding to the first SI, subtract a preset step length from the first SL to obtain a fourth SL, and determine whether the fourth SL is included in the segment index; If the fourth SL is not included in the segment index, the SID corresponding to the second SL is determined as the destination SID.
12. The network node according to claim 11, characterized in that: Before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the machine executable instructions further cause the processor to perform the following steps: If the fourth SL is included in the segment index, a preset step size is accumulated on the basis of the first SL until the calculation result is no longer included in the segment index, thereby obtaining an accumulated third SL; The common prefix length bit data in the SID corresponding to the third SL is concatenated with the least significant compressed address in the SID corresponding to the fourth SL, and a destination SID is generated based on the concatenation result.
13. The network node according to claim 10, characterized in that: The SRH option header also includes: an SI index, each SI index corresponds to a compressed SID, each data bit in the SI index corresponds to each position on the compressed SID, and the value of each data bit indicates whether there is a compressed address at the corresponding position; The determining whether there is a compressed address corresponding to the first segment identifier index SI in the compressed SID corresponding to the first SL specifically includes: Determine whether the value of the first data bit in the first SI index indicates the existence of a compressed address corresponding to the first SI, wherein the first SI index corresponds to the compressed SID corresponding to the first SL, and the position indicated by the first data bit is used to record the compressed address corresponding to the first SI.
14. The network node according to any one of claims 9 to 13, characterized in that: Before encapsulating the message with a new IP header whose destination address is the destination SID and forwarding the encapsulated message, the machine executable instructions further cause the processor to perform the following steps: If the second SL is not included in the segment index, the SID corresponding to the second SL is used as the destination SID.
15. The network node according to any one of claims 9 to 13, characterized in that: The SRH option header also includes at least one of the following information: the type of the SRH option header, the length of the SRH option header, and a reserved field.
16. The network node according to any one of claims 9 to 13, characterized in that: The SRH option header is located between the IP header and the SRH of the message.
17. A message forwarding device, characterized in that: Applied to a first node, the device comprises: A message receiving module, used for receiving a message; wherein the message carries a segment routing header SRH option header, and the SRH option header includes the following information: segment index, common prefix length; the segment index is the remaining segment SL corresponding to the compressed segment identifier SID recording the compressed address; A first segment index determination module, configured to determine whether a first SL corresponding to a second node at a next hop is included in the segment index when it is determined that the message cannot be forwarded to the second node at the next hop; A second SL calculation module, configured to, if the first SL is not included in the segment index, subtract a preset step length from the first SL to obtain a second SL, wherein the preset step length is an absolute value of a difference between SLs corresponding to adjacent SIDs in the SRH of the message; A first splicing module, configured to, if the second SL is included in the segment index, splice the common prefix length bit data in the SID corresponding to the first SL and the lowest bit compressed address in the SID corresponding to the second SL, and generate a destination SID based on the splicing result; The message forwarding module is used to encapsulate the message with a new IP header whose destination address is the destination SID, and forward the encapsulated message.
18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 8 are implemented.