A method, device and system for forwarding a packet in an SR network
By replacing some segment identifiers with compressed segment identifiers in the segment routing network, the problem of low message transmission efficiency caused by excessively long segment list lengths is solved, and more efficient message transmission is achieved.
Patent Information
- Application Number
- CN202310212097.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2019-08-31
- Filing Date
- 2019-12-19
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2039-12-19
AI Technical Summary
The problem of reduced message transmission efficiency caused by excessively long segment list length in segment routing (SR) networks.
By replacing partial segment identifiers (SIDs) with compressed segment identifiers (USIDs), omitting the block portion of partial SIDs in the segment list, and using pointers to indicate the position of the USID within the element, the length of the segment list is reduced.
The length of the segment list has been reduced, which improves message transmission efficiency and reduces network resource consumption.
Smart Images

Figure CN116319617B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of communication, and in particular to a method, network device and system for forwarding a packet in a segment routing (SR) network. BACKGROUND
[0002] SR is a protocol for forwarding packets on a network designed based on the concept of source routing, which supports explicitly specifying a packet forwarding path at a source node. When SR is deployed on a sixth version of Internet Protocol 6 (IPv6) data plane, it is referred to as IPv6 segment routing (SRv6), and when SR is deployed on a multiple protocol label switching (MPLS) data plane, it is referred to as SR-MPLS. Among them, SRv6 extends a segment routing header (SRH) on the basis of IPv6.
[0003] The SRH includes a segment list, and the segment list includes a plurality of segment identifications (SIDs) arranged in sequence, each of which corresponds to a node or a link in a packet forwarding path. The SRH is encapsulated in a packet, and the segment list therein carries the forwarding and processing process of the packet in the SR network. Among them, each SID is a 128-bit IPv6 address. Since each SID occupies 128 bits in the packet, the length of the SRH increases by 128 bits for each additional SID in the segment list, and accordingly, the length of the packet also increases by 128 bits. On the one hand, the increase in the length of the packet will result in a large amount of network resources, such as bandwidth, being occupied in the forwarding process. For example, when there are 100 nodes in the packet forwarding path, the SRH includes 100 SIDs, and the length of the segment list is as high as 1600 bytes. The excessively long length of the segment list reduces the efficiency of packet transmission in the SR network. SUMMARY
[0004] The present application provides a method, device and system for forwarding a packet, which is used to solve the technical problem of reduced packet transmission efficiency in the SR network caused by the excessively long length of the segment list.
[0005] In a first aspect, a method for forwarding a packet is provided. The method comprises: receiving a first packet, wherein a first packet header of the first packet comprises a segment list for forwarding the first packet, the segment list comprises a plurality of identifiers arranged in sequence, each of the plurality of identifiers corresponds to a network device or a link, the segment list comprises a first element with a length of 128 bits, the first element comprises at least two adjacent identifiers in the plurality of identifiers, the first packet comprises a first pointer; determining a position of a first identifier in the first element according to a value of the first pointer, the first identifier is one of the at least two identifiers; copying at least one identifier starting from the first identifier to a second packet header of the first packet to generate a second packet; and sending the second packet.
[0006] The method can be performed by an intermediate node on a packet forwarding path. The segment list can be a segment list in a SRH of an SRv6 packet. At least two identifiers corresponding to network devices can be stored in an element with a length of 128 bits in the segment list, and each identifier does not need to occupy 128 bits, thereby reducing the length of the segment list, reducing the length of the packet, and improving packet transmission efficiency. The number of identifiers stored in each 128-bit element can be adjusted according to the actual situation of the network. When a 128-bit element contains multiple identifiers, these identifiers can be understood as micro segment IDs (USIDs). Through the first pointer included in the packet header, the position of the USID in the element can be accurately and quickly obtained.
[0007] In a possible implementation, the plurality of identifiers are one-to-one mapped to a plurality of segment identifiers, each of the plurality of segment identifiers corresponds to a network device or a link, each of the plurality of segment identifiers comprises a first part and a second part, the first part of each of the plurality of segment identifiers is the prefix part, the prefix parts of the plurality of segment identifiers are the same, and each of the plurality of identifiers comprises the second part of the segment identifier to which the identifier is mapped. A USID can be obtained by omitting part of a SID. Since the BLOCK part of the SID of all network devices in a domain is the same, the BLOCK of the SID can be omitted to obtain a USID, and the USID is placed in the segment list, thereby reducing the length of the segment list.
[0008] In a possible implementation, the second packet header includes a destination address (DA) field, and the DA field includes a first part and a second part; and the copying of the at least one identifier starting with the first identifier into the second packet header of the first packet includes copying the at least one identifier starting with the first identifier into the second part of the DA field. The first identifier is an identifier to be added into the DA field, and can also be referred to as an identifier to be added, and the first identifier can be a USID. When multiple identifiers are included in an element of the segment list, the network device determines a first identifier from the multiple identifiers according to a first pointer, copies the at least one identifier starting with the first identifier into the DA field, and directly places a prefix part of the SID into the DA field, so that the prefix part of the SID and the at least one identifier starting with the first identifier are combined to guide packet forwarding.
[0009] In a possible implementation, the multiple identifiers have the same length; and before the copying of the at least one identifier starting with the first identifier into the second packet header of the first packet, the method further includes determining the number of the at least one identifier according to the length of the multiple identifiers and the length of the prefix part. In the DA field, a part is occupied by the prefix part, and another part is occupied by the at least one USID copied into the DA field, and the network device can determine the number of the at least one USID that can be copied into the DA field according to the length of the USID and the length of the prefix part.
[0010] In a possible implementation, the segment list does not include the prefix part. Since the head node stores the current USID to be processed and the BLOCK part corresponding to the USID in the DA field when adding the SRH into the packet, the USID adjacent to the BLOCK part in the DA field can be referred to as an active USID. Therefore, for the active USID and other USIDs corresponding to the same prefix part as the active USID, the segment list can no longer store the prefix parts corresponding to the USIDs, but only store the USIDs themselves. Thus, the length of the segment list is reduced.
[0011] In a possible implementation, the first packet includes a destination address field, and the destination address field includes a second identifier, the second identifier being one of the multiple identifiers; before determining the position of the first identifier in the first element according to the value of the first pointer, the method further includes: determining that the segment list includes an identifier different from the type of the second identifier according to a switching flag in the second identifier; and copying at least one identifier starting from the first identifier to the second packet header of the first packet includes: copying the at least one identifier different from the type of the second identifier to the second packet header to form a forwarding identifier stack. The segment list can further include other types of identifiers, such as MPLS labels or Internet Protocol version 4 (IPv4) addresses, and the network device copies these other types of identifiers to the forwarding identifier stack in the packet header. Therefore, the method can be compatible with more network scenarios, and the entire forwarding path is programmed through the segment list, thereby improving the forwarding efficiency.
[0012] In a possible implementation, the first packet includes a quantity flag; before copying at least one identifier starting from the first identifier to the second packet header of the first packet, the method further includes: determining the number of the at least one identifier according to the value of the quantity flag. The at least one identifier is an identifier of another type, such as an MPLS label or an IPv4 address. Before copying the identifiers of the other types to the forwarding identifier stack, the network device can first determine the number of the identifiers of the other types according to the quantity flag, and then copies the corresponding number of identifiers of the other types to the forwarding identifier stack.
[0013] In a possible implementation, determining the position of the first identifier in the first element according to the value of the first pointer includes: determining the number of redundant identifiers in the destination address field, the redundant identifiers being of a type different from the second identifier; correcting the value of the first pointer according to the number of the redundant identifiers; and determining the position of the first identifier in the first element according to the corrected value of the first pointer. The first identifier is the first identifier of the at least one identifier of the other type, and the redundant identifiers are the identifiers of the other type that have been added to the DA field. The network device corrects the value of the first pointer according to the number of the identifiers of the other type that have been added to the DA field, and determines the starting position of the at least one identifier to be added to the DA field in the segment list according to the corrected value of the first pointer.
[0014] In a possible implementation, the copying the at least one identifier starting from the first identifier into the forwarding identifier stack comprises adding a next identifier of a last identifier in the at least one identifier in a destination address field of the first packet. The network device also copies a compressed segment identifier after other types of identifiers in a segment list into the DA field, so that after the forwarding identifier stack is popped, the packet is forwarded according to the DA field.
[0015] In a possible implementation, the at least one identifier is an MPLS label or an IPv4 address. The other types of identifiers can be MPLS labels or IPv4 addresses.
[0016] In a possible implementation, the first pointer is included in the first packet header. The first pointer can be in a specific field of an SRH or in a segment list.
[0017] In a possible implementation, after the copying the at least one identifier starting from the first identifier into the second packet header of the first packet, the method further comprises modifying a value of the first pointer, so that the modified value of the first pointer is used to indicate a position of a second identifier in the first element, the second identifier not belonging to the at least one identifier. The network device modifies the value of the first pointer, so that the value of the first pointer always points to an identifier to be added, thereby enabling a subsequent network device on a forwarding path to continue determining the identifier to be added according to the value of the first pointer.
[0018] In a possible implementation, after the copying the at least one identifier starting from the first identifier into the second packet header of the first packet, the method further comprises modifying a value of the first pointer, so that the modified value of the first pointer is used to indicate a position of a second identifier in a second element, the second identifier not belonging to the at least one identifier, the second element being different from the first element. After identifiers in the current element are processed, the network device can point the first pointer to an identifier in a next element, for example, reset the value of the first pointer to 0, thereby pointing to a start position of the next element.
[0019] In a second aspect, the present application provides a method for forwarding a packet. The method comprises: receiving a first packet; obtaining a segment list, the segment list corresponding to a forwarding path of the first packet, the forwarding path comprising a plurality of network devices, the segment list comprising a plurality of identifiers arranged in sequence, each of the plurality of identifiers corresponding to one of the plurality of network devices or one of links in the forwarding path, the segment list comprising a first element with a length of 128 bits, the first element comprising at least two adjacent identifiers of the plurality of identifiers; adding the segment list in the first packet to generate a second packet, the second packet comprising a first pointer, a value of the first pointer indicating a position of a first identifier in the first element, the first identifier being one of the at least two adjacent identifiers; and sending the second packet.
[0020] The method can be performed by an ingress node on a packet forwarding path. The segment list can be a segment list in an SRH of an SRv6 packet. At least two identifiers corresponding to network devices can be stored in an element with a length of 128 bits in the segment list, and each identifier does not need to occupy 128 bits, thereby reducing the length of the segment list, reducing the length of the packet, and improving the transmission efficiency of the packet. The number of identifiers stored in each 128-bit element can be adjusted according to the actual situation of the network. When a 128-bit element contains multiple identifiers, the ingress node on the packet forwarding path adds a first pointer in the packet header to indicate the position of different identifiers in the element, so that the intermediate nodes on the packet forwarding path can accurately and quickly obtain the position of the identifiers in the element.
[0021] In a possible implementation, the plurality of identifiers are one-to-one mapped to a plurality of segment identifiers, each of the plurality of segment identifiers corresponding to one of the plurality of network devices or one of links in the forwarding path, each of the plurality of segment identifiers comprising a first part and a second part, the first part of each of the plurality of segment identifiers being a prefix part, the prefix parts of the plurality of segment identifiers being the same, and each of the plurality of identifiers comprising the second part of the segment identifier to which the each of the plurality of identifiers is mapped. A USID can be obtained by omitting part of a SID. Since the BLOCK part of the SID of all network devices in a domain is the same, a USID can be obtained by omitting the BLOCK part of the SID, and the USID is placed in the segment list, thereby reducing the length of the segment list.
[0022] In a possible implementation, the first packet includes a packet header, and the packet header includes a destination address field, and the destination address field includes a first part and a second part; and the adding the segment list in the first packet to generate the second packet includes: adding the prefix part in the first part of the destination address field; and adding one or more of the plurality of identifiers in the second part of the destination address field. Since the prefix part of the SID is omitted in the USID in the segment list, an ingress node on the forwarding path directly adds the prefix part to the DA field, and also adds the first identifier in the segment list to the DA field, so that the prefix part of the SID and the first identifier are combined to guide packet forwarding.
[0023] In a possible implementation, the segment list does not include the prefix part. The prefix part of the SID is stored in the DA field, and only the USID is stored in the segment list, and the prefix part of the SID is no longer stored. Thus, the length of the segment list is reduced.
[0024] In a possible implementation, at least one of the plurality of identifiers is an MPLS label or an IPv4 address.
[0025] In a possible implementation, the second packet includes a quantity flag, and a value of the quantity flag is used to indicate a quantity of the at least one identifier. Other types of identifiers can also be included in the segment list, and in this case, an ingress node of the forwarding path adds the quantity flag in the packet to indicate a quantity of the other types of identifiers.
[0026] In a possible implementation, the first pointer is located in a packet header of the second packet. The first pointer can be in a specific field of the SRH, or in the segment list.
[0027] In a possible implementation, the second packet further includes a second pointer, and a value of the second pointer is used to indicate a position of the first element in the segment list. The second pointer can be a Segment Left (SL) pointer.
[0028] In a possible implementation, the obtaining the segment list includes: receiving the segment list. The segment list can be received by an ingress node of the forwarding path from a controller in the network.
[0029] In a possible implementation, the obtaining the segment list includes: determining the forwarding path of the first packet, and generating the segment list corresponding to the forwarding path. The segment list can be generated by an ingress node of the forwarding path.
[0030] In a third aspect, the present application provides a method for generating a segment list for forwarding a packet, the method comprising: determining a forwarding path of the packet, the forwarding path comprising a plurality of network devices;
[0031] generating the segment list corresponding to the forwarding path, the segment list comprising a plurality of identifiers arranged in sequence, each of the plurality of identifiers corresponding to one of the plurality of network devices or one of links in the forwarding path, the segment list comprising a first element with a length of 128 bits, the first element comprising at least two adjacent identifiers of the plurality of identifiers.
[0032] The method can be performed by a network device for generating a segment list, which can be a controller in the network or an ingress node of a packet forwarding path in the network. The segment list can be a segment list in an SRH of an SRv6 packet. The network device stores at least two identifiers corresponding to the network device in an element with a length of 128 bits in the segment list, instead of storing only one identifier per 128 bits, thereby reducing the length of the segment list, reducing the length of the packet, and improving the transmission efficiency of the packet. The number of identifiers stored in each 128-bit element can be adjusted according to the actual situation of the network. When a 128-bit element contains multiple identifiers, these identifiers can be understood as compressed segment identifiers (USIDs).
[0033] In a possible implementation, the plurality of identifiers are one-to-one mapped to a plurality of segment identifiers, each of the plurality of segment identifiers corresponding to one of the plurality of network devices or one of links in the forwarding path, each of the plurality of segment identifiers comprising a first part and a second part, the first part of each of the plurality of segment identifiers being a prefix part, and each of the plurality of identifiers comprising the second part of the segment identifier to which the identifier is mapped. USIDs can be obtained by omitting part of the content in SIDs. Since the BLOCK part of the SID of all network devices in a domain is the same, the BLOCK part of the SID can be omitted to obtain a USID, which is placed in the segment list, thereby reducing the length of the segment list.
[0034] In a possible implementation, the segment identifier of the plurality of segment identifiers further comprises a third part, the third part being a padding part, the padding parts of the plurality of segment identifiers being the same, and the identifiers of the plurality of identifiers not comprising the padding part. The function field in the USID can be a compressed function field, and the length of the compressed function field is less than the length of the uncompressed function field. Thus, the length of the USID is less than the length of the SID, and the USID is placed in the segment list, thereby reducing the length of the segment list.
[0035] In a possible implementation, the plurality of segment identifiers comprises a first segment identifier, and the segment list does not comprise a prefix part of the first segment identifier. The plurality of segment identifiers comprises a first segment identifier, and the segment list does not comprise a prefix part of the first segment identifier. Only USIDs are stored in the segment list, and the prefix part of the SID is not stored in the segment list. Thus, the length of the segment list is reduced.
[0036] In a possible implementation, the plurality of segment identifiers further comprises a second segment identifier, the prefix part of the first segment identifier is different from the prefix part of the second segment identifier, and the segment list comprises the prefix part of the second segment identifier. When the plurality of network devices on the forwarding path belong to different network domains, the prefix parts of the SIDs of these network devices are at least two kinds, and at this time, the first kind of prefix part is not stored in the segment list, and the second kind of prefix part is stored in the segment list. The first kind of prefix part is directly put into the DA field by the ingress node of the forwarding path.
[0037] In a possible implementation, at least one of the plurality of identifiers is a segment identifier, an MPLS label, or an IPv4 address.
[0038] In a possible implementation, the segment list further comprises a quantity flag, and a value of the quantity flag is used to indicate a quantity of the at least one other identifier.
[0039] In a possible implementation, after the segment list corresponding to the forwarding path is generated, the method further comprises: sending the segment list to an ingress device of the forwarding path; or encapsulating the segment list into a packet and sending the packet. When the network device that generates the segment list is a controller in the network, the controller generates the segment list and sends the segment list to the ingress node of the forwarding path, so that the ingress node encapsulates the segment list into a packet and guides forwarding of the packet. When the network device that generates the segment list is the ingress node of the packet forwarding path, the ingress node encapsulates the segment list into a packet and guides forwarding of the packet.
[0040] In a fourth aspect, a network device is provided, which executes the method in the first aspect or any possible implementation of the first aspect. Specifically, the network device comprises units for executing the method in the first aspect or any possible implementation of the first aspect.
[0041] In a fifth aspect, a network device is provided, which executes the method in the second aspect or any possible implementation of the second aspect. Specifically, the network device comprises units for executing the method in the second aspect or any possible implementation of the second aspect.
[0042] In a sixth aspect, the present application provides a network device, which executes the method in the third aspect or any possible implementation manner of the third aspect. Specifically, the network device comprises units for executing the method in the third aspect or any possible implementation manner of the third aspect.
[0043] In a seventh aspect, the present application provides a network device, which comprises a processor, a communication interface and a memory. The communication interface can be a transceiver. The memory can be used to store program code, and the processor is configured to invoke the program code in the memory to execute the method in the first aspect or any possible implementation manner of the first aspect, which will not be repeated here.
[0044] In an eighth aspect, the present application provides a network device, which comprises a processor, a communication interface and a memory. The communication interface can be a transceiver. The memory can be used to store program code, and the processor is configured to invoke the program code in the memory to execute the method in the second aspect or any possible implementation manner of the second aspect, which will not be repeated here.
[0045] In a ninth aspect, the present application provides a network device, which comprises a processor, a communication interface and a memory. The communication interface can be a transceiver. The memory can be used to store program code, and the processor is configured to invoke the program code in the memory to execute the method in the third aspect or any possible implementation manner of the third aspect, which will not be repeated here.
[0046] In a tenth aspect, the present application provides a network system, which comprises the network device provided in the fourth, fifth or sixth aspect, or the network system comprises the network device provided in the seventh, eighth or ninth aspect.
[0047] In an eleventh aspect, the present application provides a computer readable storage medium, which stores instructions, when the instructions are run on a computer, the computer is caused to execute the method in the aspects.
[0048] In a twelfth aspect, the present application provides a computer program product comprising computer program instructions, when the computer program product is run on a network device, the network device is caused to execute the method provided in the first aspect, the second aspect, the third aspect, any possible implementation manner of the first aspect, any possible implementation manner of the second aspect or any possible implementation manner of the third aspect.
[0049] In a thirteenth aspect, the present application provides a chip comprising a memory and a processor, the memory is configured to store a computer program, and the processor is configured to call and run the computer program from the memory to execute the method in the first aspect and any possible implementation manner of the first aspect, or the processor executes the method in the second aspect or any possible implementation manner of the second aspect, or the processor executes the method in the third aspect or any possible implementation manner of the third aspect.
[0050] Optionally, the chip only comprises a processor, and the processor is configured to read and execute a computer program stored in the memory, and when the computer program is executed, the processor executes the method in the first aspect or any possible implementation manner of the first aspect, or the processor executes the method in the second aspect or any possible implementation manner of the second aspect, or the processor executes the method in the third aspect or any possible implementation manner of the third aspect.
[0051] In a fourteenth aspect, the present application provides a method for forwarding a packet. The method comprises: receiving a first packet, wherein a first packet header of the first packet comprises a segment list used for forwarding the first packet, the segment list comprises a plurality of identifiers arranged in sequence, an identifier in the plurality of identifiers corresponds to a network device or a link, the segment list comprises a first element and a second element, the first element and the second element have a length of 128 bits, the first element comprises at least two adjacent identifiers in the plurality of identifiers; a destination address field in a second packet header of the first packet comprises a first identifier, the first identifier is an identifier in the plurality of identifiers; adding the second element to the destination address field according to an indication of the first identifier to generate a second packet; and sending the second packet.
[0052] The method can be performed by an intermediate node on a packet forwarding path. The segment list can be a segment list in an SRH of an SRv6 packet. At least two identifiers corresponding to network devices can be stored in a 128-bit element in the segment list, and each identifier does not need to occupy 128 bits, thereby reducing the length of the segment list, reducing the length of the packet, and improving packet transmission efficiency. When a 128-bit element contains multiple identifiers, the identifiers can be understood as a compressed segment identifier (USID). A segment identifier (SID) with a length of 128 bits can also be stored in the segment list, that is, the SID and the USID are stored in the segment list at the same time. When added to the DA field, the SID and the USID correspond to different adding modes, and therefore a switching flag needs to be set between the USID and the SID. The network device can obtain the switching flag from the DA field, and take a corresponding adding mode according to the indication of the switching flag, for example, when the SID is added to the DA field, the element with a length of 128 bits in the segment list is added to the DA field as a whole. Therefore, packet forwarding is ensured. BRIEF DESCRIPTION OF DRAWINGS
[0053] In order to more clearly illustrate the technical solutions of the present application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings below are only some of the drawings of the present application, and those skilled in the art can also obtain other technical solutions and drawings that can achieve the present application according to these drawings without any creative labor.
[0054] Figure 1 An application scenario schematic diagram provided for an embodiment of the present application;
[0055] Figure 2 A format schematic diagram of a SID provided for an embodiment of the present application;
[0056] Figure 3 A structure schematic diagram of a packet provided for an embodiment of the present application;
[0057] Figure 4 A structure schematic diagram of a segment list provided for an embodiment of the present application;
[0058] Figure 5 A structure schematic diagram of a SID provided for an embodiment of the present application;
[0059] Figure 6 A structure schematic diagram of a segment list provided for an embodiment of the present application;
[0060] Figure 7 A structure schematic diagram of a segment list provided for an embodiment of the present application;
[0061] Figure 8A segment list structure diagram provided for an embodiment of the present application;
[0062] Figure 9 A message structure diagram provided for an embodiment of the present application;
[0063] Figure 10 A message structure diagram provided for an embodiment of the present application;
[0064] Figure 11 A message structure diagram provided for an embodiment of the present application;
[0065] Figure 12 A message structure diagram provided for an embodiment of the present application;
[0066] Figure 13 A message structure diagram provided for an embodiment of the present application;
[0067] Figure 14 A message structure diagram provided for an embodiment of the present application;
[0068] Figure 15 A message structure diagram provided for an embodiment of the present application;
[0069] Figure 16 A message structure diagram provided for an embodiment of the present application;
[0070] Figure 17 A message structure diagram provided for an embodiment of the present application;
[0071] Figure 18 A message processing method flow chart provided for an embodiment of the present application;
[0072] Figure 19 A message processing method flow chart provided for an embodiment of the present application;
[0073] Figure 20 A network device structure diagram provided for an embodiment of the present application;
[0074] Figure 21 A network device structure diagram provided for an embodiment of the present application;
[0075] Figure 22 A network device structure diagram provided for an embodiment of the present application;
[0076] Figure 23 A network device structure diagram provided for an embodiment of the present application;
[0077] Figure 24 A network device structure diagram provided for an embodiment of the present application;
[0078] Figure 25 A structural schematic diagram of a network system provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0079] Embodiments of the present application are described below with reference to the accompanying drawings.
[0080] Figure 1 A possible application scenario of an embodiment of the present application is shown. The network in the application scenario includes network devices, specifically including: a network device S, a network device 1, a network device 2, a network device 3, a network device 4, a network device 5, a network device 6, a network device 7, a network device 8, a network device 9, a network device 10, a network device 11 and a network device 12. These network devices can be switches, routers or forwarders. Among them, the network device S can be an ingress device of the network. The network device can also include a controller, Figure 1 which is not shown in the figure. The controller can be connected with the network devices 1 to 10. The controller can generate a segment list of a forwarding path corresponding to a packet and send the segment list to the network ingress device. The controller can send a control packet containing network configuration information to the network devices 1 to 12. The network device in the embodiment of the present application can also be referred to as a network node, or a node.
[0081] Among them, the network device S is an SR-capable network device. The network devices 1 to 12 can be SR-capable network devices, specifically, the network devices can be SRv6-capable network devices, or the network devices can also be MPLS-capable network devices. The network devices 1 to 12 can also be IPv4-capable network devices but not SR-capable network devices.
[0082] In an SR network, the processing process of a packet is composed of multiple segments, and each segment is an instruction or a set of instructions for processing the packet. In an SRv6 network, each segment has a corresponding segment identifier, i.e., SID. The segment identifier includes two types of node segment identifier (node SID) and adjacent segment identifier (adjacent SID). Figure 2 The format of a SID in an SRv6 network is shown, as shown in Figure 2 Each SID can include a location (Locator) field and a function (Function) field.
[0083] The location field in a SID is used to locate the specific network device that executes the instructions or instruction set included in the segment. The location field includes a prefix (BLOCK) portion and a sequence number (Node ID) portion. Within an SRv6 network domain, the prefix portion of a network device's SID can be the same. Within an SRv6 network domain, the sequence number portion of each network device's SID is different, and each sequence number portion uniquely identifies a network device within that domain. For a specific SID, the network device uniquely identified by the sequence number portion of that SID is the network device executing the segment identified by that SID.
[0084] The function field in the SID represents the specific content of the instructions or instruction set included in the segment, which is the function in the SRv6 network. Functions in an SRv6 network may also involve parameters, represented by the argument field in the SID. Figure 2 (Not shown in the image). When the function does not involve parameters, the parameter field may not be included in the SID.
[0085] Typically, the total length of a SID in an SRv6 network is 128 bits. The location field and function field each have specific lengths, and these lengths can be changed through network settings. For example, the location field can be 48 bits and the function field 80 bits, or the location field can be 64 bits and the function field 64 bits, or the location field can be 48 bits, the function field 64 bits, and the parameter field 16 bits.
[0086] A list of segments composed of multiple SIDs. Figure 3 This illustrates the format of a message in an SRv6 network. For example... Figure 3 As shown, the message header includes an IPv6 header and an SRH. The IPv6 header includes a destination address (DA) field, and the SRH includes a segment list, which contains multiple SIDs arranged in sequence. These SIDs can be node segment identifiers, adjacent segment identifiers, or a combination of node segment identifiers and adjacent segment identifiers.
[0087] The segment list can be encapsulated in a packet by an ingress node on a packet forwarding path, and subsequent network devices on the packet forwarding path can process the packet according to the segment list in the packet. Specifically, the packet is sent out by an ingress node on a forwarding path, and a specific network device on the forwarding path receives the packet. The network device determines that the SID of the network device is included in the DA field of the IPv6 packet header of the packet, and then processes the packet according to the instruction set corresponding to the segment identified by the SID. The specific way of processing the packet may, for example, be forwarding the packet. The network device also needs to update the DA field. In the process of updating the DA field, the segment left (SL) pointer in the SRH needs to be used. As shown in Figure 3 , the segment list includes a plurality of SIDs arranged in sequence, namely Segment List[0] to Segment List[n]. The plurality of SIDs correspond to a plurality of network devices on the packet forwarding path, and the plurality of network devices respectively execute the instruction set corresponding to the plurality of segments. The SL pointer can point to the plurality of SIDs in the segment list in sequence. Specifically, in the process of processing the packet, the value of the SL pointer is updated once for each segment, and the position pointed to by the SL pointer in the segment list is offset by the length of one SID, i.e. 128 bits, after each update. The value of the SL pointer is constantly updated as the plurality of segments represented by the plurality of SIDs in the segment list are executed in sequence. Therefore, the SL pointer is used to indicate the number of remaining segments to be processed in the segment list. Or, each value of the SL pointer corresponds to a specific number of remaining segments to be processed in the segment list, and the SL pointer always points to the current SID to be processed. In addition, according to the order of the segments represented by the plurality of SIDs in the process of processing the packet, the plurality of SIDs are arranged in reverse order in the segment list, that is, the SID of the first executed segment is arranged at the bottom of the segment list, the SIDs of the subsequent executed segments are arranged in sequence upwards, and the SID of the last executed segment is arranged at the top of the segment list. Referring to Figure 3 , Segment List[n] represents the first executed segment, and Segment List[0] represents the last executed segment. For example, the value of the SL pointer is 3, which means that the number of remaining segments to be processed in the segment list is 4, or it can also be understood that the SL pointer points to the current SID to be processed, which is the fourth SID from the bottom to the top; the value of the SL pointer is 0, which means that the number of remaining segments to be processed is 1, or it can also be understood that the SL pointer points to the current SID to be processed, which is the last SID from the bottom to the top, i.e. Figure 3 Segment List[0] in. After the network device determines the current SID to be processed according to the SL pointer, it copies the SID to the DA field in the IPv6 packet header, which is used for subsequent processing of the packet according to the content in the DA field. The specific way of processing the packet may, for example, be forwarding the packet.
[0088] The packet can be processed through the network shown in Figure 1 For example, the processing manner can be forwarding, that is, the packet is forwarded through the network shown in Figure 1 For example, the network device S sends the packet to the network device 10, and the forwarding path of the packet sequentially passes through the network device 1, the network device 2, the network device 3, the network device 4, the network device 5, the network device 6, the network device 7, the network device 8, and the network device 9. That is, the network device S is the head node of the forwarding path. In addition to the head node network device S, the forwarding path also includes the network device 1 to the network device 10, a total of 10 network devices. If the 10 network devices are all network devices supporting SRv6, and the forwarding behavior at each network device corresponds to a segment respectively, then the segment list representing the entire packet forwarding process includes 10 SIDs. The length of each SID is 128 bits, and the length of the segment list is 160 bytes. Therefore, the existence of the segment list in the packet leads to an increase in the length of the packet, reducing the transmission efficiency and processing efficiency of the network.
[0089] Embodiments of the present application provide a method for forwarding a packet, and a device and a system based on the method. These methods, devices and systems are based on the same inventive concept. Through the method, a compressed segment identifier with a smaller length can be used instead of a SID with a length of 128 bits, thereby reducing the length of the segment list, and further reducing the length of the packet, improving the transmission efficiency and processing efficiency of the network.
[0090] Embodiments of the present application provide a method for forwarding a packet. The method involves each node on the forwarding path of the packet. In combination with the application scenario shown in Figure 1 For example, the network device S sends the packet to the network device 10, and the forwarding path of the packet sequentially passes through the network device 1, the network device 2, the network device 3, the network device 4, the network device 5, the network device 6, the network device 7, the network device 8, and the network device 9. The steps of the method include:
[0091] The network device S receives the packet. The network device S is a network entry device in the network and is an entry node of the forwarding path of the packet. The network device S receives the packet, which can be a packet generated by a host (not shown in Figure 1 The host can be a terminal device such as a personal computer, a mobile phone or a tablet computer.
[0092] As an ingress node of a forwarding path of a packet, the network device S needs to determine the forwarding path of the received packet. Optionally, the network device S can determine the forwarding path of the packet by searching for the forwarding path for forwarding the packet from a plurality of stored forwarding paths according to a feature of the packet. The plurality of stored forwarding paths can be received by the network device S from a controller in the network. The feature of the packet can be any one element or a combination of multiple elements in a five-tuple of the packet, the five-tuple including the following elements: a source IP address, a source port, a destination IP address, a destination port, and a protocol number of the packet. Optionally, the network device S can also calculate the forwarding path for forwarding the packet according to information carried by the packet and network topology information. The forwarding path includes a plurality of network devices. In combination with Figure 1 In the application scenario shown, the network device S sends a packet to the network device 10, and the forwarding path of the packet passes through the network devices 1, 2, 3, 4, 5, 6, 7, 8, and 9 in sequence.
[0093] The network device S obtains a segment list. The segment list can be a segment list in an SRH of an SRv6 packet. As shown in Figure 4 At this time, the segment list corresponds to the forwarding path of the packet, the forwarding path includes the network devices 1 to 10, and the segment list includes a plurality of SIDs arranged in sequence, each of the plurality of SIDs corresponds to one of the plurality of network devices or one link in the forwarding path, and each SID has a length of 128 bits.
[0094] The segment list can be received by the network device S from a controller and stored in the device. Specifically, the network device S searches for the forwarding path for forwarding the packet from a plurality of stored forwarding paths and finds the segment list corresponding to the forwarding path. The segment list can also be generated by the network device S. Specifically, the network device S calculates the forwarding path for forwarding the packet according to information carried by the packet and generates the segment list corresponding to the forwarding path.
[0095] In an SRv6 network, the forwarding path of a packet can also be represented by a plurality of segments. Each segment is executed by a specific network device, and each segment has a corresponding SID. Therefore, for a segment, there is a corresponding relationship between the SID of the segment and the network device executing the segment, that is, the SID corresponds to a network device, or in other words, the SID is a SID of a network device.
[0096] In combination with Figure 1The application scenario shown is used as an example. The segment identifier of the network device 1 can be A:1:01:11::, and the length of the segment identifier is 128 bits. The "::" represents a full 0 byte. Among them, A:1:01 is the position field, and the length is 48 bits. A:1 / 48 is the BLOCK part, and the length is 32 bits. " / 48" represents a 48-bit mask. 01 is the serial number part, and the length is 16 bits. That is, the length of the position field is 48 bits. 11:: is the function field, and the length is 80 bits. Similarly, the network device 2, the network device 3, the network device 4, the network device 5, the network device 6, the network device 7, the network device 8, the network device 9, or the network device 10 can also be network devices within the same domain. At this time, the segment identifiers of these network devices can be A:1:02:22::, A:1:03:33::, A:1:04:44::, A:1:05:55::, A:1:06:66::, A:1:07:77::, A:1:08:88::, A:1:09:99::, and A:1:0a:aa::.
[0097] To reduce the length of each SID, a certain part or parts of the SID can be omitted to form a micro segment identifier (USID). By replacing the SIDs with the USIDs in the segment list, the length of the segment list can be reduced.
[0098] Since the BLOCK part of the SID of all network devices within a domain can be the same, in the segment list, to reduce the length of each SID, the BLOCK part of the SID can be omitted to form a USID. That is, the SID of a network device is divided into two parts. The first part is the BLOCK part, and the second part is the remaining part of the SID except the BLOCK part. When placed in the segment list, the same BLOCK part is omitted. For example, Figure 1 The SID of the network device 1 in the above is A:1:01:11::, wherein A:1 / 48 is the BLOCK part, and 01 is the serial number part, and the length is 16 bits. The BLOCK part of the SID is omitted, and the remaining part is 01:11::, and the length is 96 bits. Similarly, the BLOCK part of the position field of the SID of the network device 2, the network device 3, the network device 4, the network device 5, the network device 6, the network device 7, the network device 8, the network device 9, or the network device 10 can also be omitted, and the remaining parts are 02:22::, 03:33::, 04:44::, 05:55::, 06:66::, 07:77::, 08:88::, 09:99::, and 0a:aa::, respectively. The lengths of these remaining parts are all less than the length of the SID.
[0099] Optionally, in the segment list, to reduce the length of the SID, the function field of the SID can also be set to a compressed format, and the function field in the compressed format is smaller than the function field in the non-compressed format. When the SID is planned, all the function fields are divided into two parts, the compressed function field and the non-compressed function field. Figure 5 The SID including the compressed function field and the SID including the non-compressed function field are shown. The compressed function field is used to represent the commonly used functions, and the non-compressed function field is used to represent the less commonly used functions. The length of the compressed function field is smaller than the length of the non-compressed function field, for example, the length of the compressed function field is 16 bits, and the length of the non-compressed function field is 80 bits. As shown in Figure 5 When the SID adopts the compressed function field, the compressed function field is followed by a padding part, and the padding part is the same specific content, so that the length of the entire SID is still 128 bits. For example, the padding part can be all 0. Therefore, to reduce the length of the SID, when the function field in the SID is the compressed function field, the padding part after the compressed function field can be omitted to form the USID. For example, Figure 1 The SID of the network device 1 in the network device list can be A:1:01:11::, wherein 11 is the function field, and is the compressed function field, and the length is 16 bits, that is, the length of the padding part is 64 bits. The padding part after the compressed function field of the SID is omitted, and the remaining part is A:1:01:11, and the length is 64 bits. Similarly, the padding part after the compressed function field of the SID of the network device 2, the network device 3, the network device 4, the network device 5, the network device 6, the network device 7, the network device 8, the network device 9 or the network device 10 can also be omitted, and the remaining parts are A:1:02:22, A:1:03:33, A:1:04:44, A:1:05:55, A:1:06:66, A:1:07:77, A:1:08:88, A:1:09:99, A:1:0a:aa respectively. The lengths of these remaining parts are all smaller than the length of the SID.
[0100] Optionally, the first bit of the compressed function field and the first bit of the non-compressed function field can be set to different values. Thus, for the obtained SID, the network device can determine whether the function field of the SID is the compressed function field or the non-compressed function field through the first bit of the function field. For example, the first bit of the compressed function field is 0, and the first bit of the non-compressed function field is 1, or the first bit of the compressed function field is 1, and the first bit of the non-compressed function field is 0.
[0101] Preferably, if the BLOCK part of the position field of the SID and the padding part after the compressed function field of the SID are omitted at the same time, the length of the remaining part can be further reduced, and in this case, the USID includes the serial number part of the position field of the SID and the compressed function field. For example, Figure 1 The BLOCK part of the position field of the SID of the network device 1 and the padding part after the compressed function field can be omitted at the same time, and the remaining part is 01:11, and the length is 32 bits. Similarly, the BLOCK part of the position field of the SID of the network device 2, the network device 3, the network device 4, the network device 5, the network device 6, the network device 7, the network device 8, the network device 9 or the network device 10 and the padding part after the compressed function field can be omitted at the same time, and the remaining parts are 02:22, 03:33, 04:44, 05:55, 06:66, 07:77, 08:88, 09:99 and 0a:aa respectively. The lengths of these remaining parts are all less than the length of the SID.
[0102] Therefore, the length of the USID is less than 128 bits. There is a one-to-one mapping relationship between the USID and the SID, and there is also a one-to-one mapping relationship between the segment represented by the USID and the segment represented by the SID, that is, each SID can obtain a unique USID, and there is a one-to-one mapping relationship between the SID and the USID. Therefore, for a segment, there is a corresponding relationship between the USID of the segment and the SID of the segment, and there is a corresponding relationship between the USID of the segment and the network device executing the segment, that is, the USID corresponds to a network device, or in other words, the USID is the USID of a network device.
[0103] Optionally, the lengths of the compressed function fields of all SIDs are the same, and the lengths of all USIDs are the same.
[0104] The plurality of SIDs are arranged in sequence according to the order of the corresponding network devices on the forwarding path, thereby forming a segment list. Replacing the SIDs in the segment list with corresponding USIDs can reduce the length of the segment list, and further reduce the length of the message, thereby improving network efficiency.
[0105] In the embodiments of the present application, the space in the segment list is divided into a plurality of elements, and the SL pointer points to different elements after each update. For example, the space occupied by each SID can be divided into an element, that is, the length of each element is 128 bits, and the position pointed to by the SL pointer in the segment list is still offset by 128 bits after each update. Since the length of the USID is less than 128 bits, for example, the length of the USID can be 32 bits, therefore, the network device S stores a plurality of USIDs in the element with a length of 128 bits in the segment list, for example, at least two USIDs, thereby achieving the purpose of reducing the length of the segment list. Figure 6The structure of the segment list is shown. For example, when the length of the USID is 32 bits, 4 USIDs are stored in each element in the segment list. For example, USID1, USID2, USID3 and USID4 are stored in the first element, and USID5, USID6, USID7 and USID8 are stored in the second element.
[0106] Thus, the network device S obtains the segment list. The segment list corresponds to a forwarding path of the first packet, the forwarding path includes a plurality of network devices, the segment list includes a plurality of identifiers arranged in sequence, an identifier in the plurality of identifiers corresponds to a network device in the plurality of network devices or a link in the forwarding path, and the segment list includes an element with a length of 128 bits, the element includes at least two adjacent identifiers in the plurality of identifiers.
[0107] In the embodiments of the present application, the plurality of USIDs in the segment list are arranged in sequence according to the order of the corresponding network devices on the forwarding path. However, the arrangement manner of the plurality of USIDs in the element is not limited. The plurality of USIDs in the element can be arranged in sequence or in reverse order. For example, as shown in the following table, the arrangement order of the 4 USIDs stored in the first element from top to bottom can be USID1, USID2, USID3 and USID4, and the arrangement order of the 4 USIDs from top to bottom can also be USID4, USID3, USID2 and USID1. Figure 6
[0108] Optionally, the network device generating the segment list can select whether to generate the segment list including the USID. The network device can publish masks with different lengths, respectively corresponding to the compressed function field and the non-compressed function field. For example, the length of the mask of the compressed segment identifier is the sum of the length of the position field in the SID and the length of the compressed function field, and the length of the mask of the non-compressed segment identifier is the sum of the length of the position field in the SID and the length of the non-compressed function field. Moreover, the length of the mask of the compressed segment identifier is less than the length of the mask of the non-compressed segment identifier. In combination with the application scenario shown in the following table, the length of the compressed mask corresponding to the network device 1 is 64 bits, and the length of the non-compressed mask corresponding to the network device 1 is 128 bits. Thus, the network device generating the segment list obtains the masks with different lengths published by other network devices. When the network device generating the segment list generates the segment list including the USID, the segment list including the USID is bound to the mask of the compressed segment identifier. When the network device generating the segment list generates the segment list including the SID, the segment list including the SID is bound to the non-compressed mask. Thus, after the segment list is encapsulated in the packet, the network device forwarding the packet can obtain the SID or the USID from the segment list by using the masks with different lengths. Figure 1
[0109] Optionally, the segment list can include both USIDs and other types of identifiers. The other types of identifiers can be SIDs, that is, the segment list with USIDs can still include SIDs. In the network devices through which the packet forwarding path passes, some network devices can not have the capability to process USIDs, at this time, the segment list can still store the 128-bit length SIDs corresponding to these network devices. Thus, the network compatibility is improved. As shown in Figure 6 When the network device 9 does not have the capability to process USIDs, the segment list stores the SID 9 corresponding to the network device 9, that is, the 128-bit length A:1:09:99::.
[0110] Optionally, the network device generating the segment list can determine whether to put the USIDs or SIDs of other network devices in the segment list according to whether the other network devices have the capability to process USIDs. The network device generating the segment list can be a controller in the network, or an ingress node of the packet forwarding path, for example, Figure 1 As shown in the network device S. For example, the network device S obtains a compression capability flag corresponding to the network device 9, which is used to indicate whether the network device 9 has the capability to process USIDs. When the compression capability flag indicates that the network device 9 has the capability to process USIDs, the network device S stores the USID corresponding to the network device 9 in the generated segment list, and when the compression capability flag indicates that the network device 9 does not have the capability to process USIDs, the network device S stores the SID corresponding to the network device 9 in the generated segment list.
[0111] Optionally, when the segment list stores the 128-bit length SID corresponding to a network device, the USID before the segment identifier in the segment list includes a prompt flag, which is used to indicate that the next identifier of the current USID is the 128-bit length SID. Optionally, the prompt flag can be included in the compressed function field part of the USID. For example, two associated compressed function fields can be set for each USID, when the prompt flag is included in the USID, one of the compressed function fields is used, and when the prompt flag is not included in the USID, the other compressed function field is used. As shown in Figure 6 As shown in the figure, two associated compressed function fields can be set for the USID 8, which are 87 and 88 respectively, when the prompt flag is included in the USID 8, 87 is used, and when the prompt flag is not included in the USID 8, 88 is used. Since Figure 6 As shown in the segment list, the 128-bit length SID 9 corresponding to the network device 9 is stored, the prompt flag should be included in the USID 8, that is, the USID 8 is 08:87.
[0112] Optionally, after the SID with length of 128 bits is stored in the segment list, the BLOCK part of the SID needs to be stored in the start position of the next element of the SID in the segment list. As shown in Figure 6 the segment list stores the SID 9 with length of 128 bits corresponding to the network device 9, the start position of the next element in the segment list stores a BLOCK, which can be A:1, with length of 32 bits. After the BLOCK, the USID 10 corresponding to the network device 10 is stored.
[0113] Optionally, in the element of the segment list, multiple USIDs are stored in sequence, and after the multiple USIDs are stored, if there are still extra bits at the end of the element, the extra bits can be padded. For example, the extra bits are padded as all 0.
[0114] Optionally, when multiple network devices in the forwarding path of the packet belong to different domains, the BLOCK part of the SID also needs to be stored in the segment list. Within one domain, the BLOCK part of the SID of all network devices is the same, while between different domains, the BLOCK part of the SID of the network devices is not the same. When a network device belongs to a different domain from the previous hop network device in the forwarding path, the BLOCK part of the SID of the network device needs to be stored in the segment list. Optionally, the BLOCK part needs to be stored in the start part of an element, i.e. the BLOCK part is stored in the start part of the next element after the USID of the previous hop network device, and then the USID of the network device is stored after the BLOCK part. Figure 7 The structure of a segment list is shown, in combination with Figure 1 the application scenario shown in FIG. 8, the network device 9 and the network device 8 belong to different domains, the SID of the network device 8 is A:1:8:88::, the SID of the network device 9 is A2:9:99::, i.e. the BLOCK part of the SID of the network device 8 is A:1, the BLOCK part of the SID of the network device 9 is A2, the USID 8 of the network device 8 is 8:88, and the USID 9 of the network device 9 is 9:99. As shown in Figure 7 the USID 9 corresponding to the network device is stored in the next element of the USID 8, and the BLOCK A2 with length of 32 bits is stored before the USID 9.
[0115] As an entry node of the forwarding path of the packet, the network device S adds the segment list in the packet. Specifically, the network device S adds the segment list in the SRH of the packet.
[0116] Optionally, the segment list further comprises a SL pointer. In combination with the above description, the SL pointer is included in the SRH, and the SL pointer points to an element in the segment list. In the forwarding process of the packet, an intermediate node on the forwarding path adds the SID stored in the element pointed by the SL pointer to the destination address (DA) field in the outer IPv6 header of the SRH. That is, the SL pointer is used to indicate the current element to be processed in the segment list.
[0117] When the USID is used, since the length of the USID is smaller than the length of the SID, the element originally storing one SID can store multiple USIDs. Thus, a new pointer is needed to indicate the position of different USIDs in each element. Optionally, the segment list comprises a first pointer, and the value of the first pointer is used to indicate the position of the first identifier to be copied to the packet header in the element. The new pointer can be referred to as a PI pointer. The SL in the segment list can be a second pointer, and the value of the SL pointer is used to indicate the position of different elements in the segment list, and the value of the PI pointer is used to indicate the position of different USIDs in the element. The PI pointer and the SL pointer jointly constitute a two-dimensional pointer. Thus, an intermediate node on the forwarding path can determine the identifier currently to be added in the element of the segment list according to the value of the PI pointer, for example, the USID currently to be added.
[0118] The position of the PI pointer can be in the packet header, and the packet header can be the SRH or the IPv6 header. For example, the PI pointer can be located in the PI field of the SRH, or the PI pointer can be located in the DA field of the IPv6 header. The PI pointer can also be located in the segment list. For example, the PI pointer can be located in the first USID in each element in the segment list.
[0119] Optionally, the network device S further adds the BLOCK part of the SID in the DA field of the IPv6 header in the packet. Optionally, the network device S further adds at least one identifier in the DA field. The at least one identifier can be multiple identifiers. The multiple identifiers can be multiple USIDs, or a combination of USIDs and other types of identifiers. That is, the DA field of the IPv6 header in the packet can also be divided into two parts. The BLOCK part omitted in the segment list is placed in the first part of the DA field, and the at least one identifier is placed in the second part of the DA field.
[0120] Optionally, the number of the at least one identifier added by the network device S in the DA field is determined by the length of the BLOCK and the length of the identifier. The network device S adds as many identifiers as possible in the part of the DA field other than the BLOCK. For example, when the multiple identifiers are multiple USIDs, the number of the multiple USIDs can be (128-LBLOCK ) / L USID , wherein L BLOCK is the length of the BLOCK, L USID is the length of the USID. For example, when the length of the BLOCK is 32 bits and the length of the USID is 32 bits, 3 USIDs are added to the DA field. For example, when the other type of identifier is the same as the length of the USID, the number of the multiple identifiers including the combination of the USID and the other type of identifier can also be the integer part of (128-L BLOCK ) / L USID . For example, when the length of the BLOCK is 32 bits, the length of the USID is 32 bits, and the length of the MPLS label is 32 bits, the combination of 2 USIDs and 1 MPLS label is added to the DA field.
[0121] is combined Figure 9 for illustration. Figure 9 The structure of the packet to which the segment list and the PI pointer are added is shown, and the PI pointer is located in the PI field of the SRH. Moreover, the network device S adds the BLOCK part of the SID in the DA field. After the BLOCK of the DA field, 3 USIDs are added. As shown in Figure 9 , the 3 USIDs are USID1, USID2, and USID3. The value of the PI pointer is 3, indicating that the first 3 USIDs in the element of the segment list have been added to the DA field. According to the value of the PI pointer, it can be determined that the identifier to be added in the element is the fourth USID, USID4.
[0122] The network device S sends the packet. When the network device S sends the packet, the next-hop network device of the packet is determined according to the content of the DA field according to the longest match rule. The DA field includes the BLOCK and the multiple USIDs arranged in sequence, and the BLOCK and the first USID combination constitute the SID corresponding to the first USID. Thus, the determined next-hop network device is the network device corresponding to the first USID.
[0123] Referring to Figure 9 , the structure of the packet is shown, and the application scenario shown in Figure 1 is combined for illustration. The network device S queries the local routing table according to the content in the DA field in the packet header of the packet according to the longest match rule. Specifically, the part composed of the BLOCK+USID1 is A:1:01:11, which is matched with the entry in the routing table, and the matching with SID1 is successful, that is, the network device S determines that the next-hop network device is the network device 1, and thus sends the packet including the segment list to the network device 1.
[0124] The network device 1 receives the packet, and according to the content of the DA field, queries the local segment identification table according to the longest matching rule to determine the packet processing action. The DA field includes the BLOCK and a plurality of USIDs arranged in sequence. The BLOCK and the first USID are combined to form the SID corresponding to the first USID. Thus, the determined packet processing action is the packet processing action corresponding to the function field in the first USID, and can also be referred to as the packet processing action corresponding to the first USID.
[0125] Referring to the packet structure shown in Figure 9 and the application scenario shown in Figure 1 , it is illustrated that the packet including the segment list is sent by the network device S to the network device 1. The network device 1 queries the local segment identification table according to the DA field in the packet according to the longest matching rule. The part composed of the BLOCK+USID1 matches the entry in the local segment identification table successfully, and then the network device 1 performs the packet forwarding processing action corresponding to the USID1.
[0126] Optionally, the packet forwarding processing action can include updating the DA field. Specifically, the network device 1 deletes a USID length of bits after the BLOCK in the DA field, and moves the remaining part forward, and fills the blank part at the end with all 0s.
[0127] Optionally, after completing the updating of the DA field, the network device 1 further judges whether the part after the BLOCK in the DA field is all 0s. If not, the network device 1 queries the local routing table according to the content of the DA field according to the longest matching rule, and continues to forward the packet.
[0128] Optionally, after the packet reaches other intermediate nodes on the forwarding path, the processing action of the packet by the other intermediate nodes can be the same as the above packet processing action of the network device 1. That is, the processing action of the packet by the plurality of intermediate nodes on the forwarding path includes updating the DA field, and judging whether the part after the BLOCK in the DA field is all 0s.
[0129] Referring to the application scenario shown in Figure 1 , it is illustrated that the network device 1 updates the DA field, and the USID1 after the BLOCK in the DA field is deleted, the remaining part is moved forward, and the blank part at the end is filled with all 0s. At this time, the DA field includes the BLOCK, USID2 and USID3, and the structure of the packet is as shown in Figure 11The network device 1 judges that the part after the BLOCK in the DA field is not all 0, and continues to forward the packet. At this time, the content of the DA field is matched successfully with the SID of the network device 2 according to the longest match rule, that is, the part composed of the BLOCK+USID2 is matched successfully with the SID of the network device 2, and the network device 1 sends the packet to the network device 2.
[0130] The packet arrives at the network device 2, and the network device 2 queries the local segment identification table according to the DA field in the packet according to the longest match rule, and the part composed of the BLOCK+USID2 is matched successfully, and corresponding packet processing actions are performed. Moreover, the network device 2 updates the DA field, that is, the USID2 in the DA field is deleted, the rest is moved forward, and the blank part at the end is filled with all 0. At this time, the DA field includes the BLOCK and the USID3, and the structure of the packet is as shown in Figure 12 The network device 2 judges that the part after the BLOCK in the DA field is not all 0, and continues to forward the packet. At this time, the content of the DA field is matched successfully with the SID of the network device 3 according to the longest match rule, that is, the part composed of the BLOCK+USID3 is matched successfully with the SID of the network device 3, and the network device 2 sends the packet to the network device 3.
[0131] The network device 3 receives the packet. Optionally, after completing the update of the DA field, the network device 3 further judges whether there is a remaining identification after the BLOCK in the DA field. If there is no remaining identification, for example, the part after the BLOCK is all 0, then the network device 3 needs to continue to copy the identification into the DA field. The network device that performs the copying action can be referred to as a copy node, that is, the network device 3 is a copy node.
[0132] The copy node determines the position of the first identification in the first element according to the value of the first pointer. The first pointer is the PI pointer, and the first identification is the current identification to be added. Optionally, before determining the current identification to be added according to the value of the PI pointer, the network device 3 first determines the current element according to the value of the SL pointer. The network device 3 further determines the current identification to be added in the current element according to the value of the PI pointer. The current identification to be added is the first identification.
[0133] In combination with Figure 1The application scenario shown is used as an example. According to the DA field in the packet, the network device 3 queries the local segment identifier table according to the longest matching rule, and the partial matching composed of the BLOCK+USID3 is successful, and the corresponding forwarding action is performed. Moreover, the network device 3 updates the DA field, that is, the USID3 in the DA field is deleted, and the remaining part is moved forward, and the blank part at the end is filled with all 0s. At this time, the DA field only includes the BLOCK. The network device 3 judges that the part after the BLOCK in the DA field is all 0s, that is, the USID needs to be added to the DA field. At this time, the network device 3 determines the current element according to the value of the SL pointer. For example, the value of the SL pointer in the packet can be 4, and the network device 3 determines that the current element is the first element in the segment list. Further, the network device 3 determines that the current identifier to be added is the fourth USID, that is, USID4, according to the value of the PI pointer, which is 3.
[0134] The copying node copies at least one identifier starting from the first identifier to the packet header of the first packet. Optionally, when the at least one identifier starting from the first identifier is at least one USID, the packet header can be an IPv6 packet header. The copying node determines the number of the at least one USID.
[0135] Optionally, the copying node determines the integer part of (128-L BLOCK ) / L USID , and takes the value of the integer part as the number of the at least one USID.
[0136] Optionally, the copying node compares the integer part of (128-L BLOCK ) / L USID and the number of the remaining USIDs in the current element that have not been added to the DA field, and takes the smaller value of the two as the number of the at least one USID.
[0137] Optionally, after adding the at least one USID to the DA field, the copying node modifies the value of the PI pointer in the packet, so that the modified value of the PI pointer points to the current identifier to be added in the segment list, which can be referred to as a third identifier. The third identifier can be the next identifier of the last USID in the at least one USID in the segment list.
[0138] Optionally, the identifier to be added can be a USID, which is located in the next element of the current element in the segment list, that is, all the USIDs in the current element have been added to the DA field. At this time, the USID can be the first USID in the next element. At this time, the modified value of the PI pointer is used to indicate the position of the USID in the next element, for example, the modified value of the PI pointer can be 0.
[0139] Optionally, after all the identifiers in the current element have been added to the DA field, the copy node modifies the value of the SL pointer in the packet, so that the value of the modified SL pointer points to the next element of the current element in the segment list.
[0140] With reference to the application scenario shown in Figure 1 , the network device 3 determines that the current identifier to be added is USID 4. Moreover, the network device 3 determines that the number of remaining USIDs in the current element that have not been added to the DA field is 1, i.e., only USID 4. Since the length of a USID is 32 bits and the length of a BLOCK is 32 bits, the integer part of (128-L BLOCK ) / L USID is 3, which is greater than the number of remaining USIDs. Thus, the network device 3 determines that the number of at least one USID to be added to the DA field is 1. The network device 3 adds USID 4 to the DA field of the IPv6 packet header of the packet, and the structure of the packet at this time is as shown in Figure 14 . Moreover, since all the USIDs in the current element have been added to the DA field, the network device 3 modifies the value of the SL pointer in the packet, and the value of the modified SL pointer is 3, which points to the second element in the segment list. Moreover, the network device 3 modifies the value of the PI pointer, and the value of the modified PI pointer is 0, which points to the first USID in the second element, i.e., USID 5.
[0141] The network device 3 sends the packet. The packet continues to be forwarded along the forwarding path, and the intermediate nodes on the forwarding path continue to update the DA field in the packet. When the identifiers in the DA field have been processed, i.e., there is no remaining identifier after the BLOCK in the DA field, the copy node continues to update the DA field in the packet. For example, after the at least one USID added to the DA field has been processed, the copy node continues to add at least one identifier starting from the current identifier to be added to the DA field of the packet according to the value of the PI pointer.
[0142] Optionally, the at least one identifier starting from the current identifier to be added can be a USID, and in this case, the processing process of the copy node is similar to the above description, which is not described herein again.
[0143] Optionally, the at least one USID is a plurality of USIDs. When the at least one USID is a plurality of USIDs, the plurality of USIDs are adjacent to each other in the segment list.
[0144] Optionally, the copy node modifies the value of the PI pointer in the packet after adding the at least one USID in the DA field, so that the modified value of the PI pointer points to the next identifier in the segment list after the last USID in the at least one USID.
[0145] Optionally, the current identifier to be added can be a USID, which can be located in the current element together with the at least one USID. At this time, the modified value of the PI pointer is used to indicate the position of the USID in the current element.
[0146] Optionally, the current identifier to be added can be a USID, which is located in the next element of the current element in the segment list, that is, all USIDs in the current element have been added to the DA field. At this time, the USID can be the first USID in the next element. At this time, the modified value of the PI pointer is used to indicate the position of the USID in the next element, for example, the modified value of the PI pointer can be 0.
[0147] Optionally, after all identifiers in the current element have been added to the DA field, the copy node modifies the value of the SL pointer in the packet, so that the modified value of the SL pointer points to the next element of the current element in the segment list.
[0148] The network device 4 receives the packet, processes the packet according to the BLOCK+USID4 in the DA field, and updates the DA field by deleting the USID4 in the DA field and moving the remaining part forward, and filling the blank part at the end with all 0s. At this time, the DA field only includes the BLOCK. The network device 4 is a copy node. The network device 4 judges that the part after the BLOCK in the DA field is all 0s, and then the network device 4 continues to add identifiers to the DA field of the packet. The network device 4 determines that the current element is the second element in the segment list according to the value of the SL pointer in the packet, and determines that the current identifier to be added is the first USID, USID5, in the second element according to the value of the PI pointer. The network device 4 determines that the integer part of (128-L BLOCK ) / L USID is 3, and determines that the number of remaining USIDs in the current element that have not been added to the DA field is 4, and takes the smaller value of the two, that is, 3, as the number of USIDs to be added to the DA field. Thus, the network device 4 adds three USIDs starting from USID5, that is, USID5, USID6 and USID7, to the DA field, and the structure of the packet at this time is as shown in Figure 15 . And the network device 4 modifies the value of the PI pointer, so that the value of the PI pointer points to the USID to be added, that is, USID8.
[0149] After that, the packet continues to be forwarded through network device 5, network device 6, network device 7 to network device 8, and the packet processing actions of these network devices are similar to those of network device 1, network device 2, network device 3 and network device 4 respectively. Network device 7 is also a copy node, which will not be described here.
[0150] Optionally, the at least one identifier starting from the current identifier to be added can be a SID with a length of 128 bits. In combination with the above description, the previous USID of the SID in the segment list includes a prompt flag. When the copy node processes the previous USID, it can determine that the next identifier of the USID is a SID with a length of 128 bits according to the prompt flag. Optionally, the copy node adds the SID with a length of 128 bits in the DA field of the packet. That is, the BLOCK part in the DA field will also be overwritten.
[0151] Optionally, after the copy node adds the at least one USID in the DA field, it modifies the value of the PI pointer in the packet so that the modified value of the PI pointer points to the current identifier to be added. At this time, the current identifier to be added is the next identifier of the last USID in the at least one USID in the segment list.
[0152] Optionally, the current identifier to be added can be a SID with a length of 128 bits. At this time, since the SID occupies all the space in an element, the modified value of the PI pointer can be 0, for example.
[0153] For example, network device 8 is also a copy node. Network device 8 receives the packet, processes the packet according to BLOCK+USID8 in the DA field, finds that USID8 includes a prompt flag, and determines that the next identifier of USID8 in the segment list is a SID with a length of 128 bits. Network device 8 determines that the current element is the third element in the segment list according to the value of the SL pointer in the packet, adds the SID in the element to the DA field, that is, adds SID9 to the DA field, and the packet at this time is constructed as shown in Figure 16 .
[0154] Optionally, the USIDs and other types of identifiers can be included in the segment list at the same time. The other types of identifiers can be MPLS labels or IPv4 addresses, that is, MPLS labels or IPv4 addresses can be mixed in the segment list taking the USIDs. In the network devices through which the forwarding path of the packet passes, some network devices can not support SRv6, but can support MPLS or can support IPv4, at this time, the MPLS labels or IPv4 addresses corresponding to these network devices are directly stored in the segment list. Thus, the network compatibility is improved and the network efficiency is improved. In combination with Figure 1 The application scenario shown, the network device S sends a packet to the network device 10, and the forwarding path of the packet passes through the network device 1, the network device 2, the network device 3, the network device 4, the network device 5, the network device 6, the network device 7, the network device 8, and the network device 9 in turn. Among them, the network device 3, the network device 4, the network device 5, and the network device 6 do not support SRv6, but can support MPLS.
[0155] In the segment list, the USIDs, MPLS labels, and / or IPv4 addresses are arranged in turn according to the order of the corresponding network devices on the forwarding path. Among them, the length of each MPLS label can be 32 bits, and the length of each IPv4 address can also be 32 bits. The length of the MPLS label or the IPv4 address can be the same as the length of the USID, or can be different from the length of the USID. Figure 8 The structure of the segment list at this time is shown, since the network device 3, the network device 4, the network device 5, and the network device 6 do not support SRv6, but can support MPLS, the MPLS labels corresponding to these network devices, i.e., M3, M4, M5, and M6, can be stored in the segment list. The USIDs or SIDs corresponding to other network devices are also stored in the segment list. The length of the MPLS label is 32 bits, which is the same as the length of the USID. Moreover, these MPLS labels can be stored together with the USIDs in an element, such as Figure 8 As shown, USID1, USID2, M3, and M4 are stored in the first element of the segment list, and M5, M6, USID7, and USID8 are stored in the second element. The storage mode of the IPv4 address is similar to that of the MPLS label, which will not be described here.
[0156] Optionally, when the segment list includes MPLS labels and / or IPv4 addresses, the network device S adds a switching flag in the packet, which can be located in the segment list. For example, when the segment list includes a plurality of MPLS labels or IPv4 addresses arranged in sequence, the switching flag can be located in a specific identifier in the segment list, for example, referred to as a second identifier. The second identifier can be in the previous USID of the first MPLS label or IPv4 address. Alternatively, the switching flag can be an independent identifier added between the last USID and the first MPLS label or IPv4 address. The switching flag is used to indicate that the subsequent identifier in the segment list will include MPLS labels and / or IPv4 addresses, so that when the network device reads the previous USID, it can determine that the subsequent identifier in the segment list will include MPLS labels and / or IPv4 addresses. The specific process will be described in detail below.
[0157] Optionally, when the network device S adds at least one identifier in the DA field, the network device S will determine whether the switching flag is included in each of the at least one identifier added, and if the switching flag is included in an identifier, the network device S will not add the subsequent identifier of this identifier to the DA field after adding this identifier to the DA field. At this time, the at least one identifier added to the DA field are all USIDs, and do not include other types of identifiers.
[0158] Optionally, when the segment list includes MPLS labels and / or IPv4 addresses, the network device S also adds a quantity flag in the packet, the value of the quantity flag being used to indicate the number of MPLS labels and / or IPv4 addresses in the segment list. The location of the quantity flag can be in the packet header, which can be the SRH or the IPv6 packet header. For example, the quantity flag can be located in a specific field of the SRH, or the quantity flag can be located in the DA field of the IPv6 packet header. The quantity flag can also be located in the segment list. For example, when the segment list includes a plurality of MPLS labels or IPv4 addresses arranged in sequence, the quantity flag can be located in the previous USID of the first MPLS label or IPv4 address. At this time, the PI pointer is used to indicate the location of different USIDs, MPLS labels or IPv4 addresses in the element.
[0159] Optionally, the switching flag and the quantity flag can be the same flag, that is, the quantity flag also functions as the switching flag. At this time, the segment list includes a plurality of MPLS labels or IPv4 addresses arranged in sequence, and the quantity flag can be located in the previous USID of the first MPLS label or IPv4 address.
[0160] In combinationFigure 10 An example is given. Figure 10 The structure of the packet with segment list and PI pointer is shown, and the MPLS label is included in the segment list. And the network device S adds the BLOCK part of the SID in the DA field. After the BLOCK of the DA field, 2 USIDs and 1 MPLS label are added. As shown in the figure, the 2 USIDs are USID1, USID2, and the 1 MPLS label is M3. The value of the PI pointer is 3, indicating that the first 3 identifiers in the element of the segment list have been added to the DA field. According to the value of the PI pointer, the identifier to be added in the element, i.e. M3, can be determined, and the specific content will be described in detail below. Figure 10
[0161] When the segment list of the packet further includes other types of identifiers, such as MPLS labels and / or IPv4 addresses, the intermediate nodes on the forwarding path can copy the other types of identifiers to the forwarding identifier stack in the packet, which is used to guide the forwarding of the packet. The intermediate node performing the above copying behavior can be referred to as a copying node.
[0162] Optionally, when processing the current USID, the copying node on the forwarding path can determine that the next identifier in the segment list will include an MPLS label or an IPv4 address through the above switching flag or the number flag. At this time, the identifier to be added currently should be the first MPLS label or IPv4 address. The copying node further determines the first MPLS label or IPv4 address according to the value of the PI pointer.
[0163] If the current USID is the last USID in the DA field, i.e. there is no other identifier after the USID in the DA field, the copying node can directly determine the first MPLS label or IPv4 address in the segment list according to the value of the PI pointer.
[0164] If the current USID is not the last USID in the DA field, i.e. there are other identifiers after the USID in the DA field, it means that part of the MPLS labels or IPv4 addresses have been added to the DA field, and the first MPLS label or IPv4 address has been added to the DA field. Optionally, the copying node can obtain the other identifiers that have been added to the DA field and the other identifiers that have not been added to the DA field, respectively. Optionally, the copying node can also determine the number N of the MPLS labels or IPv4 addresses that have been added to the DA field, N being an integer, and then correct the value of the PI pointer according to the value of the PI pointer and the number N, and determine the first MPLS label or IPv4 address in the segment list according to the corrected value of the PI pointer. Specifically, the copying node corrects the value of the PI pointer by subtracting the number N from the value of the PI pointer. The above process can also be regarded as a rollback of the PI pointer in the segment list.
[0165] Referring to Figure 13 the message structure shown in the figure, the DA field in the message includes BLOCK, USID2 and M3, and the number flag in USID2 has a value of 4. In addition, the value of the PI pointer in the message can be 3. In combination with the application scenario shown in Figure 1 the figure, the above copying node can be the network device 2. The network device 2 queries the local segment identifier table according to the DA field in the message, and part composed of BLOCK+USID2 matches successfully according to the longest match rule, and performs the corresponding forwarding action. In addition, the network device 2 determines, through the number flag included in USID2, that the next identifier in the segment list will include MPLS labels in USID2, and the number of MPLS labels is 4. At this time, the identifier to be added currently should be the first MPLS label.
[0166] The network device 2 further determines that the current USID2 is not the last USID in the DA field, and there are 32 non-0 bits after USID2 in the DA field, i.e. there is 1 MPLS label after USID2, which means that the first MPLS label has been added to the DA field. The network device 2 determines that the corrected value of the PI pointer should be 2 according to the value of the PI pointer being 3 and the number of MPLS labels that have been added to the DA field being 1, and determines that the first MPLS label should be the 3rd identifier in the current element, i.e. M3, according to the corrected value of the PI pointer.
[0167] Optionally, when the at least one identifier starting from the first identifier is at least one other type of identifier, such as an MPLS label or an IPv4 address, the copying node adds these other types of identifiers into the second packet header to form a forwarding identifier stack, such as an MPLS label stack or an IPv4 address stack.
[0168] In combination with the above description, when part of the other types of identifiers have been added into the DA field, the copying node can optionally acquire the other identifiers that have been added into the DA field and the other identifiers that have not been added into the DA field respectively, and add these two parts of the other identifiers together into the second packet header to form the forwarding identifier stack; the copying node can also optionally determine the position of the first other type of identifier in the segment list according to the value of the corrected PI pointer, to acquire all the other types of identifiers from the segment list.
[0169] The copying node determines the number of the at least one MPLS label or IPv4 address. Optionally, the intermediate node sets the value of the number flag as the number of the at least one MPLS label or IPv4 address.
[0170] The at least one MPLS label or IPv4 address corresponds to at least one MPLS or IPv4 supporting network device, and after passing through these network devices, the packet can re-enter the SRv6 network. At this time, in the segment list, there is one or more USIDs after the at least one MPLS label or IPv4 address, and these USIDs also need to be copied into the DA field of the IPv6 packet header of the packet. Optionally, these USIDs can be copied into the DA field by the intermediate node. Optionally, these USIDs can also be copied into the DA field by the last network device of the at least one MPLS or IPv4 supporting network device.
[0171] When these USIDs can be copied to the DA field by intermediate nodes, optionally, after copying these USIDs to the DA field, the copying node modifies the value of the PI pointer in the message so that the modified PI pointer points to another identifier in the segment list, which may be called a third identifier. This third identifier may be the identifier following the last USID among those copied to the DA field in the segment list. This third identifier may be located in the same element of the segment list as the last USID, or it may be located in a different element. For example, when the element containing the last USID is the first element and the element containing the third identifier is the second element, the first element and the second element may be the same or different. Optionally, when the first element and the second element are different, the copying node also modifies the value of the SL pointer in the message so that the modified SL pointer points to the second element. For example, this second element may be the element following the first element in the segment list.
[0172] Combination Figure 1 The application scenario shown is illustrated with an example. The aforementioned copy node can be network device 2. The structure of the message received by network device 2 is as follows: Figure 13 As shown. Network device 2 determines that the first MPLS label should be the third identifier in the current element, i.e., M3. Furthermore, based on the quantity flag value of 4, network device 2 determines that the number of at least one MPLS label to be added to the DA field is 4. Network device 2 builds an MPLS header outside the IPv6 header of the packet. This MPLS header includes a forwarding identifier stack, i.e., an MPLS label stack. Network device 2 adds four MPLS labels starting with M3 to the MPLS label stack. These four MPLS labels include M3, M4, M5, and M6. Network device 2 also copies at least one USID after M6 from the segment list to the DA field; specifically, network device 2 copies USID7 and USID8 to the DA field. Additionally, network device 2 modifies the value of the SL pointer to 2, pointing to the third element in the segment list, and modifies the value of the PI pointer to 0, pointing to the first identifier in the third element, i.e., SID9. At this point, the packet structure is as follows. Figure 17 As shown.
[0173] The network device 2 forwards the packet to the network device 3 according to the top label M3 of the MPLS label stack in the MPLS packet header. The packet reaches the network device 3, and the M3 at the top of the MPLS label stack is popped, and M4 becomes the top label. The network device 3 forwards the packet to the network device 4 according to M4. Then the packet reaches the network device 4, the network device 5 and the network device 6 in turn, and the specific process is similar to the above description, which is not described here again. At the network device 5 or the network device 6, the MPLS packet header in the packet is stripped. The network device 6 supports MPLS and SRv6 at the same time. The network device 6 continues to forward the packet according to the DA field in the IPv6 packet header of the packet, see the packet structure shown in Figure 17 The DA field includes BLOCK, USID7 and USID8. Thus, the network device 6 forwards the packet to the network device 7. The specific process is similar to the above description, which is not described here again.
[0174] The above is an example of the processing process of the MPLS label, and the processing process of the IPv4 address is similar to the above description, which is not described here again.
[0175] The embodiment of the application provides a method for forwarding a packet. Figure 18 A method flowchart of the method is shown. The method relates to a network device 401 and a network device 402. The network device 401 can be a network entry device in a network, and is used for encapsulating a segment list of a forwarding path corresponding to a packet in the packet, for example, Figure 1 The network device S is shown. The network device 402 can be a forwarding device in a network, specifically, the network device 402 is a copy node in the above embodiment, for example, Figure 1 The network device 3, the network device 4, the network device 7, the network device 8 or the network device 9 shown in the above embodiment, or Figure 1 The network device 2 shown in the above embodiment. The steps of the method include:
[0176] S410, the network device 401 receives a packet.
[0177] S420, the network device 401 obtains a segment list. The segment list corresponds to a forwarding path of the first packet, the forwarding path includes a plurality of network devices, and the segment list includes a plurality of identifiers arranged in turn. An identifier in the plurality of identifiers corresponds to a network device in the plurality of network devices or a link in the forwarding path. The segment list includes an element with a length of 128 bits, and the element includes at least two adjacent identifiers in the plurality of identifiers.
[0178] S430, the network device 401 adds the segment list in the packet. The segment list includes a first pointer, and a value of the first pointer is used to indicate a position of a first identifier in an element. The first identifier is one of the at least two identifiers.
[0179] S440, the network device 401 sends the packet.
[0180] The network device 401 can be a network entry device in a network, and the network device 401 is an entry node of a forwarding path of the packet, for example, Figure 1 The network device S is shown. The specific process can refer to the description of the network device S in the above embodiments, and similar parts will not be described here.
[0181] S450, the network device 402 receives the packet. The packet header of the packet includes a segment list for forwarding the packet, the segment list includes a plurality of identifiers arranged in sequence, each of the plurality of identifiers corresponds to a network device or a link, the segment list includes a first element with a length of 128 bits, the first element includes at least two adjacent identifiers in the plurality of identifiers, and the first packet includes a first pointer.
[0182] S460, the network device 402 determines the position of the first identifier in the first element according to the value of the first pointer.
[0183] S470, the network device 402 copies at least one identifier starting with the first identifier to the packet header of the packet.
[0184] S480, the network device 402 sends the packet.
[0185] The network device 402 can be a copy node of the forwarding path of the packet, that is, the network device 402 is an intermediate node that copies at least one identifier to the packet. The at least one identifier copied by the network device 402 can be a USID, or an MPLS label or an IPv4 address. Specifically, in combination with Figure 1 The network device 402 can be the network device 2, the network device 3, the network device 4, the network device 7, the network device 8 or the network device 9 in 1. The specific process can refer to the description of the network device 2, the network device 3, the network device 4, the network device 7, the network device 8 or the network device 9 in the above embodiments, and similar parts will not be described here.
[0186] In an actual network, the forwarding path of a packet can be generated by a controller or an ingress node of the forwarding path. When the controller generates the forwarding path of a packet, the controller will also generate a segment list corresponding to the forwarding path, which can be a segment list including USIDs. The controller sends the segment list to the ingress node of the forwarding path. The ingress node of the forwarding path determines the forwarding path of the packet from a plurality of forwarding paths stored in the device after receiving the packet, and determines the segment list corresponding to the forwarding path. The segment list is encapsulated into the packet for forwarding the packet.
[0187] The embodiment of the present application provides a method for forwarding a packet. Figure 19 A method flowchart of the method is shown. The method involves a network device 301, a network device 302 and a network device 303. The network device 301 can be a controller in a network, which is used to calculate a forwarding path of a packet and generate a segment list corresponding to the forwarding path. The network device 302 can be an ingress device in a network, which is used to encapsulate a segment list in a packet, for example, Figure 1 The network device S is shown. The network device 303 can be a forwarding device in a network, which is used to forward a packet according to a segment list. Specifically, the network device 303 can be a copy node in the above embodiment, for example, Figure 1 The network device 2, the network device 3, the network device 4, the network device 7, the network device 8 or the network device 9 are shown. The steps of the method include:
[0188] S310, the network device 301 determines a forwarding path of a packet, and the forwarding path includes a plurality of network devices.
[0189] The network device 301 can be a controller in a network. The controller calculates a forwarding path for forwarding a packet.
[0190] S315, the network device 301 generates a segment list corresponding to the forwarding path, the segment list includes a plurality of identifiers arranged in sequence, each identifier in the plurality of identifiers corresponds to one network device in the plurality of network devices or one link in the forwarding path, and the segment list includes a first element with a length of 128 bits, and the first element includes at least two adjacent identifiers in the plurality of identifiers.
[0191] Optionally, the network device 301 obtains a plurality of segment identifiers, the plurality of segment identifiers corresponding to at least one of the plurality of network devices or at least one link in the forwarding path. For example, the controller obtains the SID of each network device on the forwarding path. The network device 301 obtains a plurality of identifiers from the plurality of segment identifiers, the plurality of identifiers one-to-one mapping to the plurality of segment identifiers. In order to reduce the length of the SID, the controller can convert the plurality of SIDs into a plurality of USIDs, the plurality of USIDs one-to-one mapping to the plurality of SIDs. The specific method includes omitting the BLOCK part of the SID and / or setting the function field of the SID to a compressed format. The specific process can refer to the description of step S420, and the similar parts will not be repeated.
[0192] The network device 301 generates the segment list corresponding to the forwarding path, the segment list including the plurality of identifiers arranged in sequence, the segment list including elements with a length of 128 bits, the elements including at least two adjacent identifiers in the plurality of identifiers. For example, the controller puts the plurality of USIDs instead of the plurality of SIDs into the segment list, thereby reducing the length of the segment list. The space in the segment list can be divided into a plurality of elements, and the length of each element can be 128 bits. At least two USIDs can be stored in each element. The specific process can refer to the description of step S420, and the similar parts will not be repeated.
[0193] S320, the network device 301 sends the segment list to the network device 302.
[0194] The network device 302 is a network device in the network, and the network device 302 is an ingress node of the forwarding path of the packet, for example, Figure 1 The network device S is shown. The network device 302 obtains the segment list, the segment list corresponding to the forwarding path of the packet, the segment list including a plurality of identifiers arranged in sequence, each of the plurality of identifiers corresponding to one of the plurality of network devices.
[0195] S325, the network device 302 receives the packet.
[0196] As an ingress node of the forwarding path, the network device 302 receives the packet and determines the forwarding path of the packet. Optionally, the network device 302 can find the forwarding path for forwarding the packet from a plurality of stored forwarding paths, thereby determining the forwarding path of the packet. The plurality of stored forwarding paths can be received by the network device 302 from the controller.
[0197] S330, network device 302 adds the segment list to the message, the segment list including the first pointer, the value of the first pointer being used to indicate the position of the first identifier in the element, the first identifier being one of the at least two identifiers.
[0198] The specific process of step S330 can be referred to the description of step S430, and the similarities will not be repeated here.
[0199] S335, network device 302 sends the message.
[0200] The specific process of step S335 can be referred to the description of step S440, and the similarities will not be repeated here.
[0201] S340, network device 303 receives the message.
[0202] The specific process of step S340 can be referred to the description of step S450, and the similarities will not be repeated here.
[0203] S345, network device 303 determines the position of the first identifier in the first element based on the value of the first pointer. The first pointer is the newly added PI pointer described above.
[0204] The specific process of step S345 can be referred to the description of step S460, and the similarities will not be repeated here.
[0205] S350, network device 303 copies at least one identifier starting with the first identifier into the header of the message.
[0206] The specific process of step S350 can be referred to the description of step S470, and the similarities will not be repeated here.
[0207] S355, network device 303 sends the message.
[0208] The specific process of step S355 can be referred to the description of step S480, and the similarities will not be repeated here.
[0209] Figure 20 This is a schematic diagram of the structure of a device 400 provided in an embodiment of this application. Figure 1 Any network device in China can Figure 20 The device shown is used to achieve this. Figure 18 Network devices 401 and 402 in the illustrated embodiments, and Figure 19 Network devices 301, 302, and 303 in the illustrated embodiment can be accessed via Figure 20 This is achieved using the device shown. See also Figure 20The device 2000 comprises at least one processor 2001, a communication bus 2002 and at least one communication interface 2004. Optionally, the device 2000 can further comprise a memory 2003.
[0210] The processor 2001 can be a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, transistor logic device, a hardware component or any combination thereof. The processor can implement or execute various logical blocks, modules and circuits described in combination with the disclosure of the embodiments of the present application. The processor can also be a combination for implementing computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like. The processor can be used to generate a segment list, or to process a received packet and continue forwarding the processed packet through the communication interface, so as to implement the method provided in the embodiments of the present application.
[0211] For example, when the controller or the network entry device in the network is implemented by the device shown in Figure 20 , the processor can be used to generate a segment list, so that the network device forwards the corresponding packet according to the segment list. For specific implementation, reference can be made to the processing part of the controller or the network entry device in the method embodiments. For example, when the network entry device in Figure 1 is implemented by the device shown in Figure 20 , the processor can be used to add a segment list in the received packet, so that the subsequent network device forwards the packet according to the segment list in the packet. For specific implementation, reference can be made to the processing part of the network entry device in the method embodiments. For another example, when the forwarding device in the network is implemented by the device shown in Figure 1 , the processor can be used to forward the packet according to the segment list in the packet. For specific implementation, reference can be made to the processing part of the forwarding device in the method embodiments. Figure 20
[0212] The communication bus 2002 is used to transfer information between the processor 2001, the communication interface 2004 and the memory 2003. The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 20 Only one thick line is used in the figure to represent the bus, but it does not mean that there is only one bus or only one type of bus.
[0213] The memory 2003 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, a magneto-optical disk storage (including a compact disk, a laser disc, an optical disc, a digital versatile disc, a Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to this. The memory 2003 can exist independently and be connected to the processor 2001 through the communication bus 2002. The memory 403 can also be integrated with the processor 2001.
[0214] Optionally, the memory 2003 is used to store program code or instructions for executing the scheme of the present application, and is controlled by the processor 2001 to execute. The processor 2001 is used to execute the program code stored in the memory 2003. The program code can include one or more software modules. Optionally, the processor 2001 itself can also store program code or instructions for executing the scheme of the present application.
[0215] The communication interface 2004 is configured to communicate with other devices or communication networks, which can be an Ethernet, a radio access network (RAN), a wireless local area network (WLAN), or the like, using any transceiver-like mechanism. In the embodiments of the present application, the communication interface 2004 can be configured to receive packets sent by other nodes in the segment routing network, and can also be configured to send packets to other nodes in the segment routing network. The communication interface 2004 can be an Ethernet interface, a Fast Ethernet (FE) interface, a Gigabit Ethernet (GE) interface, or an Asynchronous Transfer Mode (ATM) interface.
[0216] In a specific implementation, as an embodiment, the device 2000 can include multiple processors, such as the processor 2001 and the processor 2005 shown in Figure 20 Each of the processors can be a single-CPU processor or a multi-CPU processor. The processor herein can refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0217] Figure 21 FIG. 21 is a structural schematic diagram of a device 2100 provided by an embodiment of the present application. Figure 1 Any network device other than the controller in Figure 21 may be implemented by the device shown in Figure 18 The network device 401, the network device 402, and Figure 19 The network device 302 and the network device 303 in the embodiment shown in Figure 21 may be implemented by the device shown in Figure 21A device structure diagram is shown. The device 2100 includes a main board and one or more interface boards, the main board is communicatively connected with the interface boards. The main board is also called a main processing unit (MPU) or a route processor card, and is responsible for the control and management of various components in the device 2100, including route calculation, device management and maintenance functions. The interface board is also called a line processing unit (LPU) or a line card, and is used for forwarding data. In some embodiments, the device 2100 can also include a switching network board, which is communicatively connected with the main board and the interface board, and is used for forwarding data between the interface boards. The switching network board can also be called a switch fabric unit (SFU). The interface board includes a central processor, a memory, a forwarding chip and a physical interface card (PIC). The central processor is communicatively connected with the memory, the network processor and the physical interface card. The memory is used to store a forwarding table. The forwarding chip is used to forward a received data frame based on the forwarding table stored in the memory. If the destination address of the data frame is the address of the device 2100, the data frame is uploaded to the CPU for processing. If the destination address of the data frame is not the address of the device 2100, the next hop and the out interface corresponding to the destination address are found from the forwarding table according to the destination address, and the data frame is forwarded to the out interface corresponding to the destination address. The forwarding chip can be a network processor (NP). The PIC, also called a subcard, can be installed on the interface board, and is responsible for converting an optical signal into a data frame and forwarding the data frame to the forwarding chip for processing after performing a legality check on the data frame. In some embodiments, the central processor can also perform the function of the forwarding chip, such as implementing software forwarding based on a general-purpose CPU, so that the interface board does not need a forwarding chip. The communication connection between the main board, the interface board and the switching network board can be realized through a bus. In some embodiments, the forwarding chip can be realized through an application-specific integrated circuit (ASIC) or a field programmable gate array (FPGA).
[0218] In logic, the device 2100 includes a control plane and a forwarding plane, the control plane includes a main control board and a central processor, and the forwarding plane includes various components performing forwarding, such as a memory, a PIC, and an NP. The control plane performs functions such as router, generating a forwarding table, processing signaling and protocol packets, configuring and maintaining the state of the PE1, and the like, and the control plane issues the generated forwarding table to the forwarding plane, in which the NP performs table lookup and forwarding on the packets received by the PIC of the device 2100 based on the forwarding table issued by the control plane. The forwarding table issued by the control plane can be stored in the memory. In some embodiments, the control plane and the forwarding plane can be completely separated and not on the same device.
[0219] Figure 22 A possible structure diagram of the network device involved in the above embodiments is shown, and the network device 1400 can implement the functions of the network device 402 or the network device 303 in the above embodiments. Referring to Figure 20 , the network device 1400 includes a receiving unit 1401, a processing unit 1402, and a sending unit 1403. These units can perform the corresponding functions of the network device 402 or the network device 303 in the above methods. For example,
[0220] The receiving unit 1401 is configured to receive a first packet, a first packet header of the first packet includes a segment list for forwarding the first packet, the segment list includes a plurality of identifiers arranged in sequence, an identifier in the plurality of identifiers corresponds to a network device or a link, the segment list includes a first element with a length of 128 bits, the first element includes at least two adjacent identifiers in the plurality of identifiers, and the first packet includes a first pointer and a second pointer.
[0221] The processing unit 1402 is configured to determine a position of the first element in the segment list according to a value of the second pointer, determine a position of the first identifier in the first element according to a value of the first pointer, the first identifier being one of the at least two identifiers; copy at least one identifier starting with the first identifier to a second packet header of the first packet to generate a second packet.
[0222] The sending unit 1403 is configured to send the second packet.
[0223] The network device 1400 can also be implemented by the device shown in Figure 20 . At this time, the network device 1400 includes at least one processor, a communication bus, and at least one communication interface. Optionally, the network device 1400 can also include a memory.
[0224] In a specific embodiment, the processor in network device 1400 is used to receive a first message through a communication interface. The first message header includes a segment list for forwarding the first message. The segment list includes a plurality of identifiers arranged sequentially, each of which corresponds to a network device or a link. The segment list includes a first element of length 128 bits, which includes at least two adjacent identifiers from the plurality of identifiers. The first message includes a first pointer. The position of the first identifier in the first element is determined according to the value of the first pointer, and the first identifier is one of the at least two identifiers. At least one identifier starting with the first identifier is copied to the second message header of the first message to generate a second message. The second message is then sent through communication interface 1503. For detailed processing procedures of the processor, please refer to the detailed descriptions of processes S450, S460, S470, S480 and S340, S345, S350, S355 in the above embodiments, which will not be repeated here.
[0225] The communication interface in network device 1400 is used by network device 1400 to receive and send messages through the network system. For the specific process, please refer to the detailed descriptions of S450, S480, and S340, S355 in the above embodiments; they will not be repeated here.
[0226] Network device 1400 can also be used. Figure 21 The device shown is used to implement this. In this case, network device 1400 includes a main control board and one or more interface boards, with the main control board and interface boards communicatively connected. For details, please refer to the description of network device 2100 in the above embodiments, which will not be repeated here.
[0227] Figure 23 A possible structural diagram of the network device involved in the above embodiments is shown. The network device 1600 can implement the functions of the network device 401 or the network device 302 in the above embodiments. (See also...) Figure 23 The network device 1600 includes a receiving unit 1601, a processing unit 1602, and a transmitting unit 1603. These units can perform the corresponding functions of network device 401 or network device 302 in the above method. For example,
[0228] The receiving unit 1601 is used to receive the first message.
[0229] Processing unit 1602 is configured to obtain a segment list, the segment list corresponding to the forwarding path of the first packet, the forwarding path including multiple network devices, the segment list including multiple identifiers arranged in sequence, the identifiers corresponding to one of the multiple network devices or one link in the forwarding path, the segment list including a first element of length 128 bits, the first element including at least two adjacent identifiers among the multiple identifiers; and adding the segment list to the first packet to generate a second packet, the second packet including a first pointer, the value of the first pointer being used to indicate the position of a first identifier in the first element, the first identifier being one of the at least two identifiers.
[0230] The sending unit 1603 is used to send the second message.
[0231] Network device 1600 can also be used. Figure 20 The network device 1600 is implemented using the device shown. In this case, the network device 1600 includes at least one processor, a communication bus, and at least one communication interface. Optionally, the network device 1600 may also include a memory.
[0232] In a specific embodiment, the processor in network device 1600 is used to receive a first message through a communication interface; obtain a segment list, the segment list corresponding to the forwarding path of the first message, the forwarding path including multiple network devices, the segment list including multiple identifiers arranged in sequence, each of the multiple identifiers corresponding to one of the multiple network devices or one link in the forwarding path, the segment list including a first element of length 128 bits, the first element including at least two adjacent identifiers among the multiple identifiers; add the segment list to the first message to generate a second message, the second message including a first pointer, the value of the first pointer being used to indicate the position of the first identifier in the first element, the first identifier being one of the at least two identifiers; and send the second message through the communication interface. For detailed processing procedures of this processor, please refer to the detailed descriptions of processes S410, S420, S430 and S325, S330, S335 in the above embodiments, which will not be repeated here.
[0233] The communication interface in network device 1600 is used by network device 1600 to receive and send messages through the network system. For the specific process, please refer to the detailed description of S410, S440 and S325, S335 in the above embodiments, which will not be repeated here.
[0234] Network device 1600 can also be used. Figure 21The device shown is used to implement this. In this case, network device 1600 includes a main control board and one or more interface boards, with the main control board and interface boards communicatively connected. For details, please refer to the description of network device 2100 in the above embodiments, which will not be repeated here.
[0235] Figure 24 A possible structural diagram of the network device 301 involved in the above embodiments is shown. The network device 1800 can implement the functions of the network device 301 or the network device 401 in the above embodiments. (See also...) Figure 24 The network device 1800 includes a determining unit 1801 and a processing unit 1802. These units can perform the corresponding functions of network device 301 or network device 401 in the above method. For example,
[0236] The determining unit 1801 is used to determine the forwarding path of a message, wherein the forwarding path includes multiple network devices.
[0237] Processing unit 1802 is configured to generate a segment list corresponding to the forwarding path. The segment list includes a plurality of identifiers arranged in sequence. Each of the plurality of identifiers corresponds to one of the plurality of network devices or one of the links in the forwarding path. The segment list includes a first element of length 128 bits, which includes at least two adjacent identifiers from the plurality of identifiers.
[0238] Optionally, network device 1800 further includes a sending unit 1803. Sending unit 1803 is configured to send the segment list to the ingress device of the forwarding path. Alternatively, processing unit 1802 is further configured to encapsulate the segment list into a message; sending unit 1803 is configured to send the message.
[0239] Network device 1800 can also be used. Figure 20 The network device 1800 is implemented using the device shown. In this case, the network device 1800 includes at least one processor, a communication bus, and at least one communication interface. Optionally, the network device 1800 may also include a memory.
[0240] In a specific embodiment, the processor in the network device 1800 is used to determine the forwarding path of a packet, the forwarding path including multiple network devices; generate the segment list corresponding to the forwarding path, the segment list including the multiple identifiers arranged in sequence, each of the multiple identifiers corresponding to one of the multiple network devices or one link in the forwarding path, the segment list including a first element of length 128 bits, the first element including at least two adjacent identifiers among the multiple identifiers.
[0241] Optionally, the processor in the network device 1800 is further configured to send the segment list through the communication interface.
[0242] The detailed processing procedure of the processor can refer to the detailed description of the procedures S310, S315, S320 and S420 in the above embodiments, which will not be repeated here.
[0243] The communication interface in the network device 1800 is configured to receive and send information by the network system for the network device 1900. The specific process can refer to the detailed description of S320 and S420 in the above embodiments, which will not be repeated here.
[0244] Referring to Figure 25 , the network system 2200 is shown. Figure 25 The network system 2200 includes a first network device 2201 and a second network device 2202. The first network device 2201 in the network system can perform the processing steps S310, S315, S320 of the network device 301 in the above Figure 18 The processing steps S410, S420, S430, S440 of the network device 401 in the above Figure 19 The processing steps S325, S330, S335 of the network device 302 in the above Figure 20 The processing steps S450, S460, S470 of the network device 402 in the above
[0245] Optionally, the network system 2200 further includes a third network device 2203. The first network device 2203 in the network system can perform the processing steps S310, S315, S320 of the network device 301 in the above Figure 19
[0246] Correspondingly, the first network device 2201 in the network system can be the network device 1600 in the above Figure 23 The second network device 2202 in the network device can be the network device 1400 in the above Figure 22 The third network device 2203 in the network device can be the network device 1800 in the above Figure 24
[0247] Specifically, the third network device is configured to determine a forwarding path of a packet, the forwarding path comprising a plurality of network devices; generate a segment list corresponding to the forwarding path, the segment list comprising a plurality of identifiers arranged in sequence, each of the plurality of identifiers corresponding to one of the plurality of network devices or one of links in the forwarding path, the segment list comprising a first element with a length of 128 bits, the first element comprising at least two adjacent identifiers of the plurality of identifiers.
[0248] The second network device is configured to receive a first packet; obtain a segment list corresponding to a forwarding path of the first packet, the forwarding path comprising a plurality of network devices, the segment list comprising a plurality of identifiers arranged in sequence, each of the plurality of identifiers corresponding to one of the plurality of network devices or one of links in the forwarding path, the segment list comprising a first element with a length of 128 bits, the first element comprising at least two adjacent identifiers of the plurality of identifiers; add the segment list in the first packet to generate a second packet, the second packet comprising a first pointer, a value of the first pointer being used to indicate a position of a first identifier in the first element, the first identifier being one of the at least two identifiers; and send the second packet.
[0249] Optionally, when the network system comprises the third network device, the second network device obtaining the segment list means that the second network device receives the segment list sent by the third network device. Optionally, when the network system does not comprise the third network device, the second network device obtaining the segment list means that the second network device generates the segment list.
[0250] The first network device is configured to receive the second packet, a first packet header of the second packet comprising the segment list, the second packet comprising a first pointer; determine the position of the first identifier in the first element according to a value of the first pointer; copy at least one identifier starting from the first identifier to a second packet header of the second packet to generate a third packet; and a sending unit configured to send the third packet.
[0251] Embodiments of the present application also provide a non-transitory storage medium for storing software instructions used in the foregoing embodiments, which comprises a program for executing the method shown in the foregoing embodiments, which, when executed on a computer or network device, causes the computer or network device to perform the method in the foregoing method embodiments.
[0252] Embodiments of the present application also provide a computer program product comprising computer program instructions, which, when the computer program product is run on a computer, causes a network node to perform the method in the foregoing method embodiments.
[0253] The "first" of the first message, the first network device, the first identifier, the first pointer and the quantity flag mentioned in the embodiments of the present application is only used for name identification, and does not represent the first in sequence. The same rule applies to "second", "third" and "fourth". However, the "first" of the first identifier mentioned in the embodiments of the present application represents the first in sequence. The same rule applies to "Nth".
[0254] In the embodiments of the present application, "A and / or B" is considered to include A alone, B alone, and A+B.
[0255] It should be noted that any device embodiment described above is only illustrative, wherein the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., they can be located in one place or distributed to multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiments according to actual needs. In addition, in the embodiment of the network device or host provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which can be implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement it without creative labor.
[0256] The steps of the method or algorithm described in the disclosure of the embodiments of the present application can be implemented in hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in a random access memory (RAM), a flash memory, a read-only memory (ROM), an erasable programmable ROM (EPROM), an electrically EPROM (EEPROM), a hard disk, a mobile hard disk, an optical disk or any other form of storage medium well known in the art. The storage medium is coupled to the processor so that the processor can read information from the storage medium. Of course, the storage medium can also be a component of the processor.
[0257] The above specific embodiments further illustrate the purpose, technical solutions and beneficial effects of the present application. It should be understood that the above description is only a specific embodiment of the present application and is not used to limit the protection scope of the present application. Any modification, replacement, improvement, etc. made on the basis of the technical solutions of the present application should be included in the protection scope of the present application.
Claims
1. A method for forwarding a packet, the method comprising: The method comprises: receiving a first packet in a Segment Routing version 6, SRv6, network, a first packet header of the first packet comprising a segment list for forwarding the first packet, the segment list comprising a plurality of compressed segment identifiers arranged in sequence, the segment list comprising a first element with a length of 128 bits, the first element comprising at least two adjacent compressed segment identifiers in the plurality of compressed segment identifiers, the first packet comprising a first pointer and a second pointer; determining a position of a first compressed segment identifier in the first element according to a value of the first pointer, the first compressed segment identifier being one of the at least two compressed segment identifiers, and determining a position of the first element in the segment list according to a value of the second pointer; copying at least one compressed segment identifier comprising the first compressed segment identifier to a second packet header of the first packet to generate a second packet; sending the second packet.
2. The method of claim 1, wherein, The second packet header is an IPv6 packet header, and the first pointer is included in a destination address field of the second packet header.
3. The method according to claim 1 or 2, characterized in that, The method further comprises: decrementing the value of the first pointer by 1.
4. The method according to any one of claims 1 to 3, characterized in that, The method further comprises: decrementing the value of the second pointer by 1.
5. The method according to any one of claims 1 to 4, characterized in that, The plurality of compressed segment identifiers are one-to-one mapped to a plurality of segment identifiers, each segment identifier in the plurality of segment identifiers comprising a first part and a second part, the first part of each segment identifier in the plurality of segment identifiers being a prefix part, and each compressed segment identifier in the plurality of compressed segment identifiers comprising the second part.
6. The method of claim 5, wherein, The second packet header is an IPv6 packet header, and the prefix part is included in a destination address field of the second packet header.
7. The method of claim 6, wherein, The method further comprises updating the prefix part in the destination address field.
8. The method according to claim 6 or 7, characterized in that, The copying of the at least one compressed segment identifier comprising the first compressed segment identifier to the second packet header of the first packet comprises: copying the at least one compressed segment identifier to the destination address field, the at least one compressed segment identifier being located after the prefix part.
9. The method according to any one of claims 5-8, characterized in that, The prefix part has a length of 48 bits or 64 bits.
10. The method according to any one of claims 5 to 9, characterized in that, Each compressed segment identifier in the plurality of compressed segment identifiers does not comprise the prefix part.
11. The method according to any one of claims 5-10, characterized in that, The second part comprises a function part and a sequence number part in a segment identifier.
12. The method according to any one of claims 5-11, characterized in that, Each segment identifier in the plurality of segment identifiers further comprises a third part, the third part being located after the second part, and the third part having a value of all zeros, and each compressed segment identifier in the plurality of compressed segment identifiers does not comprise the third part of each segment identifier in the plurality of segment identifiers.
13. The method of claim 12, wherein, The first part, the second part, and the third part have a total length of 128 bits.
14. The method according to any one of claims 1 to 13, characterized in that, The segment list further comprises at least one segment identifier, the at least one segment identifier having a length of 128 bits.
15. The method according to any one of claims 1 to 14, characterized in that, Each compressed segment identifier in the plurality of compressed segment identifiers has a length of 32 bits or 16 bits.
16. The method according to any one of claims 1 to 15, characterized in that, The at least one compressed segment identifier is included in the at least two compressed segment identifiers.
17. A method of forwarding a packet, the method comprising: The method comprises: receiving a first packet; adding a segment list of a Segment Routing version 6 (SRv6) network to the first packet to generate a second packet, wherein the segment list corresponds to a forwarding path of the first packet, the segment list comprises a plurality of compressed segment identifiers arranged in sequence, the segment list comprises a first element with a length of 128 bits, the first element comprises at least two adjacent compressed segment identifiers in the plurality of compressed segment identifiers, the second packet comprises a first pointer and a second pointer, a value of the first pointer indicates a position of a first compressed segment identifier in the first element, the first compressed segment identifier is one of the at least two compressed segment identifiers, and the second pointer is a Segment Left (SL) pointer, a value of the second pointer indicates a position of the first element in the segment list; sending the second packet.
18. The method of claim 17, wherein, The adding the segment list of the Segment Routing version 6 (SRv6) network to the first packet to generate the second packet comprises: adding the first pointer to a destination address field of an IPv6 packet header of the second packet.
19. The method of claim 17 or 18, wherein, The adding the segment list of the Segment Routing version 6 (SRv6) network to the first packet to generate the second packet comprises: adding the segment list to a Segment Routing Header (SRH) of the second packet.
20. The method according to any one of claims 17-19, characterized by, The adding the segment list of the Segment Routing version 6 (SRv6) network to the first packet to generate the second packet comprises: adding at least one compressed segment identifier in the plurality of compressed segment identifiers to a destination address field of an IPv6 packet header of the second packet.
21. The method according to any one of claims 17-20, characterized in that, The method further comprises: obtaining the plurality of compressed segment identifiers according to a plurality of segment identifiers; wherein a compressed segment identifier in the plurality of compressed segment identifiers corresponds to a segment identifier in the plurality of segment identifiers in a one-to-one manner, the segment identifier has a length of 128 bits, each segment identifier in the plurality of segment identifiers comprises a first part and a second part, the first part is a prefix part in the segment identifier, and each compressed segment identifier in the plurality of compressed segment identifiers respectively comprises the second part of each segment identifier in the plurality of segment identifiers.
22. The method of claim 21, wherein, The method further comprises: adding the prefix part in a destination address field of an IPv6 packet header of the second packet.
23. A network system, characterized by The network system comprises a first network device and a second network device, wherein the first network device is configured to perform the method according to any one of claims 1-16, and the second network device is configured to perform the method according to any one of claims 17-22.
24. A network device, comprising: The network device is configured to perform the method according to any one of claims 1-22.
25. A chip, characterized by The chip is configured to perform the method according to any one of claims 1-22.
26. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and when the computer program is executed on a processor, the method according to any one of claims 1-22 is implemented.
27. A computer program product, characterised in that, The computer program product comprises a computer program, and when the computer program is executed by a computer, the method according to any one of claims 1-22 is implemented.
Citation Information
Patent Citations
System and Method for Dataplane-Signaled Packet Capture in a Segment Routing Environment
US20170250908A1