METHOD FOR FORWARDING PACKET ON SR NETWORK, DEVICE, AND SYSTEM
20220217081 · 2022-07-07
Assignee
Inventors
- Cheng Li (Beijing, CN)
- Zhenbin Li (Beijing, CN)
- Yang XIA (Beijing, CN)
- Taixu Tian (Dongguan, CN)
- Yaqun Xiao (Beijing, CN)
Cpc classification
H04L45/566
ELECTRICITY
International classification
H04L45/00
ELECTRICITY
Abstract
A method for processing a packet on an SR network is provided, including: receiving a packet, where a packet header of the packet includes a destination address field, a first pointer, a second pointer, and a list used to process the packet, the list includes a plurality of sequentially arranged identifiers, and a value of the first pointer and a value of the second pointer jointly indicate a location of a first identifier in the plurality of identifiers in the list; determining the first identifier based on the value of the first pointer and the value of the second pointer; and copying the first identifier to the destination address field. In this method, a CL pointer is set in the packet header to jointly form a two-dimensional pointer with an SL pointer, to indicate a location of a C-SID in a SID list.
Claims
1. A packet processing method, wherein the method is applied to a segment routing (SR) network, and the method comprises: receiving a packet, wherein the packet comprises a first pointer, a second pointer, and a segment list, the segment list comprises a plurality of compressed segment identifiers (C-SIDs); determining the first C-SID in the plurality of C-SIDs in the segment list based on the value of the first pointer and the value of the second pointer; and adding the first C-SID to a destination address field of the packet.
2. The method according to claim 1, wherein the segment list comprises at least one element, wherein the at least one element comprises a first element, the first element comprises at least two C-SIDs in the plurality of C-SIDs, and the first C-SID is one of the at least two C-SIDs.
3. The method according to claim 2, wherein the second pointer is a segment left (SL) pointer, the second pointer is comprised in a segment routing header (SRH) of the packet.
4. The method according to claim 2, wherein the first pointer is comprised in an initial C-SID in the at least two C-SIDs, or the first pointer is comprised in the destination address field of the packet.
5. The method according to claim 4, wherein the first pointer is a compressed segment identifiers left (CL) pointer.
6. The method according to claim 2, wherein the determining the first C-SID in the plurality of C-SIDs in the segment list based on the value of the first pointer and the value of the second pointer comprises: determining the first element in the segment list based on the value of the second pointer, and determining the first C-SID in the first element based on the value of the first pointer.
7. The method according to claim 1, wherein the determining the first C-SID in the plurality of C-SIDs in the segment list based on the value of the first pointer and the value of the second pointer comprises: updating the value of the first pointer; determining the first C-SID in the plurality of C-SIDs in the segment list based on an updated value of the first pointer and the value of the second pointer.
8. The method according to claim 1, wherein the determining the first C-SID in the plurality of C-SIDs in the segment list based on the value of the first pointer and the value of the second pointer comprises: updating the value of the first pointer and the value of the second pointer; determining the first C-SID in the plurality of C-SIDs in the segment list based on an updated value of the first pointer and an updated value of the second pointer.
9. The method according to claim 1, wherein the plurality of C-SIDs are one-to-one mapped to a plurality of segment identifiers, each of the plurality of segment identifiers comprises a first part and a second part, the first part is before the second part, first parts of all of the plurality of segment identifiers are the same, and each of the plurality of C-SIDs comprises the second part of each of the plurality of segment identifiers.
10. The method according to claim 9, wherein each of the plurality of C-SIDs does not comprise the first part, the first part is a prefix part of a segment identifier.
11. The method according to claim 9, wherein the destination address field comprises the first part.
12. The method according to claim 2, wherein the length of each of the at least one element is 128 bits.
13. The method according to claim 1, wherein the method further comprises: receiving structure information of the destination address field, wherein the structure information indicates an addition location of the first C-SID in the destination address field; and the adding the first C-SID to a destination address field of the packet comprises: adding the first C-SID to the destination address field of the packet based on the structure information.
14. The method according to claim 13, wherein the receiving structure information of the destination address field comprises: receiving a control packet, wherein the control packet comprises the structure information, and the control packet is an intermediate system-to-intermediate system (IS-IS) protocol packet, an open shortest path first (OSPF) protocol packet, or a border gateway protocol (BGP) packet.
15. The method according to claim 1, wherein a length of each of the plurality of C-SIDs is 32 bits or 16 bits.
16. A packet forwarding method, wherein the method is applied to a segment routing (SR) network, and the method comprises: receiving a packet; adding a first pointer, a second pointer, and a segment list to a packet header of the packet, the segment list comprises a plurality of compressed segment identifiers (C-SIDs), a value of the first pointer and a value of the second pointer jointly indicate a location of a first C-SID in the plurality of C-SIDs in the segment list; and sending the packet encapsulated with the packet header.
17. The method according to claim 16, wherein the plurality of C-SIDs are one-to-one mapped to a plurality of segment identifiers, each of the plurality of segment identifiers comprises a first part and a second part, the first part is before the second part, first parts of all of the plurality of segment identifiers are the same, and each of the plurality of C-SIDs comprises the second part of each of the segment identifier.
18. The method according to claim 16, wherein the packet header comprises a destination address field, and the method further comprises: adding the first part to the destination address field.
19. A network device comprising: at least one processor; one or more memories coupled to the at least one processor and storing programming instructions, wherein the at least one processor is configured to execute the programming instructions to cause the network device to: receive a packet, wherein the packet comprises a first pointer, a second pointer, and a segment list, the segment list comprises a plurality of compressed segment identifiers (C-SIDs); determine the first C-SID in the plurality of C-SIDs in the segment list based on the value of the first pointer and the value of the second pointer; and add the first C-SID to a destination address field of the packet.
20. The network device according to claim 19, wherein the segment list comprises at least one element, wherein the at least one element comprises a first element, the first element comprises at least two C-SIDs in the plurality of C-SIDs, and the first C-SID is one of the at least two C-SIDs.
21. The network device according to claim 20, wherein the second pointer is a segment left (SL) pointer, the second pointer is comprised in the segment routing header (SRH) of the packet.
22. The network device according to claim 20, wherein the first pointer is comprised in an initial C-SID in the at least two C-SIDs, or the first pointer is comprised in the destination address field of the packet.
23. The network device according to claim 22, wherein the first pointer is a compressed segment identifiers left (CL) pointer.
24. The network device according to claim 20, wherein the network device is further caused to: determine the first element in the segment list based on the value of the second pointer, an d determine the first C-SID in the first element based on the value of the first pointer.
25. The network device according to claim 19, wherein the network device is further caused to: update the value of the first pointer; determine the first C-SID in the plurality of C-SIDs in the segment list based on an updated value of the first pointer and the value of the second pointer.
26. The network device according to claim 19, wherein the network device is further caused to: update the value of the first pointer and the value of the second pointer; determine the first C-SID in the plurality of C-SIDs in the segment list based on an updated value of the first pointer and an updated value of the second pointer.
27. The network device according to claim 19, wherein the plurality of C-SIDs are one-to-one mapped to a plurality of segment identifiers, each of the plurality of segment identifiers comprises a first part and a second part, the first part is before the second part, first parts of all of the plurality of segment identifiers are the same, and each of the plurality of C-SIDs comprises the second part of each of the plurality of segment identifiers.
28. The network device according to claim 27, wherein each of the plurality of C-SIDs does not comprises the first part, the first part is a prefix part of a segment identifier.
29. The network device according to claim 27, wherein the destination address field comprises the first part.
30. The network device according to claim 20, wherein the length of each of the at least one element is 128 bits.
31. The network device according to claim 19, wherein the network device is further caused to: receive structure information of the destination address field, wherein the structure information indicates an addition location of the first C-SID in the destination address field; and add the first C-SID to the destination address field of the packet based on the structure information.
32. The network device according to claim 31, wherein the network device is further caused to: receive a control packet, wherein the control packet comprises the structure information, and the control packet is an intermediate system-to-intermediate system (IS-IS) protocol packet, an open shortest path first (OSPF) protocol packet, or a border gateway protocol (BGP) packet.
33. The network device according to claim 19, wherein a length of each of the plurality of C-SIDs is 32 bits or 16 bits.
34. A network device comprising: at least one processor; one or more memories coupled to the at least one processor and storing programming instructions, wherein the at least one processor is configured to execute the programming instructions to cause the network device to: receive a packet; add a first pointer, a second pointer, and a segment list to a packet header of the packet, the segment list comprises a plurality of compressed segment identifiers (C-SIDs), a value of the first pointer and a value of the second pointer jointly indicate a location of a first C-SID in the plurality of C-SIDs in the segment list; and send the packet encapsulated with the packet header.
35. The network device according to claim 34, wherein the plurality of C-SIDs are one-to-one mapped to a plurality of segment identifiers, each of the plurality of segment identifiers comprises a first part and a second part, the first part is before the second part, first parts of all of the plurality of segment identifiers are the same, and each of the plurality of C-SIDs comprises the second part of each of the segment identifier.
36. The network device according to claim 35, wherein the network device is further caused to: add the first part to the destination address field.
37. A network system, comprising: a first network device and a second network device, wherein the first network device is configured to: receive a packet; add a first pointer, a second pointer, and a segment list to a packet header of the packet, the segment list comprises a plurality of compressed segment identifiers (C-SIDs); and send the packet encapsulated with the packet header to the second network device; wherein the second network device is configured to: receive the packet; determining the first C-SID in the segment list based on the value of the first pointer and the value of the second pointer; and adding the first C-SID to a destination address field of the packet.
38. The network system according to claim 37, wherein the segment list comprises at least one element, wherein the at least one element comprises a first element, the first element comprises at least two C-SIDs in the plurality of C-SIDs, and the first C-SID is one of the at least two C-SIDs.
39. The network system according to claim 38, wherein the second pointer is a segment left (SL) pointer, the second pointer is comprised in the segment routing header (SRH) of the packet.
40. The network system according to claim 38, wherein the first pointer is comprised in an initial C-SID in the at least two C-SIDs, or the first pointer is comprised in the destination address field of the packet, and the first pointer is a compressed segment identifiers left (CL) pointer.
Description
BRIEF DESCRIPTION OF DRAWINGS
[0053] To describe technical solutions of this disclosure more clearly, the following briefly describes accompanying drawings used in embodiments. It is clearly that the accompanying drawings in the following description merely show some embodiments of this disclosure, and persons of ordinary skill in the art can derive other technical solutions and accompanying drawings from these accompanying drawings without creative efforts.
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
DESCRIPTION OF EMBODIMENTS
[0071] The following describes embodiments of this disclosure with reference to accompanying drawings.
[0072]
[0073] On the SR network, a packet processing process includes a plurality of segments, and each segment is an instruction or an instruction set for processing a packet. Each segment has a corresponding segment identifier, namely, a SID. The segment identifier includes two types: a node segment identifier (node SID) and an adjacent segment identifier (adjacent SID).
[0074] The locator field in the SID is used to locate a specific network device that executes an instruction or an instruction set included in a segment. The locator field includes a prefix part and a node ID part. In an SRv6 network domain, prefix parts of SIDs of all network devices are the same. In an SRv6 network domain, a node ID part of a SID of each network device is different, and each node ID part is used to uniquely determine a network device in the domain. For a specific SID, a network device uniquely determined by a node ID part in the SID is a network device that executes a segment identified by the SID.
[0075] The function field in the SID is used to indicate specific content of the instruction or the instruction set included in the segment. In other words, the function field is used to indicate a function on the SRv6 network. The function on the SRv6 network may further relate to an argument, and the argument is indicated by using an argument field in the SID (not shown in
[0076] Generally, a total length of the SID on the SRv6 network is 128 bits. The locator field and the function field are separately of specific lengths, and the specific lengths may change through network setting. For example, the locator field is 48 bits, and the function field is 80 bits. Alternatively, the locator field is 64 bits, and the function field is 64 bits. Alternatively, the locator field is 48 bits, the function field is 64 bits, and the argument field is 16 bits.
[0077] The SID list includes a plurality of SIDs.
[0078] With reference to the application scenario shown in
[0079] An embodiment of this disclosure provides a packet processing method, and a device and a system that are based on the method. The method, the device, and the system are based on a same inventive concept. Principles of resolving problems by the method, the device, and the system are similar. Therefore, for the embodiments of the method, the device, and the system, refer to each other, and same or similar content is not described again.
[0080] An embodiment of the present invention provides a packet processing method. The method is applied to an SR network, and relates to a network device 301 and a network device 302. The network device 301 may be a network ingress device, for example, the network device S shown in
[0081] S310: The network device 301 receives a packet.
[0082] As the network ingress device, the network device 301 may receive the packet sent by a host. The packet may be a service packet. The host may be a terminal device, for example, a personal computer, a mobile phone, or a tablet computer.
[0083] S315: The network device 301 generates a packet header and encapsulates the packet header into the packet, where the packet header includes a first pointer, a second pointer, and a list used to process the packet. The list includes a plurality of sequentially arranged identifiers, the plurality of identifiers are one-to-one mapped to a plurality of segments on the SR network, and a value of the first pointer and a value of the second pointer jointly indicate a location of a first identifier in the plurality of identifiers in the list.
[0084] On the SRv6 network, the packet header includes an IPv6 packet header and an SRH, and the list is a SID list in the SRH. For the received packet, the network device 301 generates the packet header including the SID list, and encapsulates the packet header into the received packet, to process the packet.
[0085] On the SR network, each segment used to process the packet has a specific segment identifier, namely, a SID. In other words, the plurality of segments used to process the packet are one-to-one mapped to a plurality of SIDs. With reference to the foregoing description, each SID may include a locator field and a function field, and the locator field includes a prefix part and a node ID part. A sum of lengths of the locator field and the function field may be 128 bits. In an SRv6 network domain, prefix parts of SIDs of all network devices are the same. A node ID part of a SID of each network device is different, and each node ID part is used to uniquely determine a network device in the domain. In other words, each SID may be divided into two parts. A first part includes the prefix part, and a second part includes the node ID part and the function field. First parts of all SIDs are the same. However, the second part of each SID is different. A sum of lengths of the first part and the second part is 128 bits. Therefore, to reduce a length of the SID list, the first part may be omitted. In other words, the prefix part of the locator field in the SID is omitted. As shown in
[0086] With reference to the disclosure scenario shown in
[0087] Similarly, SIDs of the network device 2, the network device 3, the network device 4, the network device 5, the network device 6, or the network device 7 may respectively be: A1::0002:2222, A1::0003:3333, A1::0004:4444, A1::0005:5555, A1::0006:6666, and A1::0007:7777. C-SIDs of the network devices may be: 0002:2222, 0003:3333, 0004:4444, 0005:5555, 0006:6666, and 0007:7777. A length of each C-SID is 32 bits.
[0088] With reference to the foregoing description, the C-SID includes the node ID part and the function field in the SID. The length of the C-SID is determined by a sum of lengths of the node ID part and the function field in the SID. Specifically, the length of the C-SID is the same as the sum of the lengths of the node ID part and the function field in the SID. For example, the length of the C-SID may be 32 bits, or the length of the C-SID may be 16 bits.
[0089] Optionally, in a network planning process, each SID may be divided into three parts. A first part includes the prefix part, a second part includes the node ID part and the function field, and a third part is padding content. Third parts of all SIDs are the same and are filled with same content, for example, all 0s. A sum of lengths of the first part, the second part, and the third part is 128 bits. Therefore, a sum of lengths of the first part and the second part is less than 128 bits. As shown in
[0090]
[0091] The C-SID of each network device may be advertised by using an extended control plane protocol. A prefix part of a SID in an SRv6 network domain can also be advertised by using the extended control plane protocol. The control plane protocol may be, for example, an interior gateway protocol (IGP), a border gateway protocol (BGP), a border gateway protocol link state (BGP-LS), or a path computation element communication protocol (PCEP).
[0092] The SID list including the C-SID may be generated by the controller, or may be generated by the network ingress device. For example, the controller obtains the forwarding path of the packet through calculation, and generates the SID list corresponding to the forwarding path. The SID list includes the C-SID, and the controller sends the SID list to the network ingress device. Alternatively, the network ingress device obtains the forwarding path of the packet through calculation, and generates the SID list corresponding to the forwarding path. The SID list includes the C-SID. Alternatively, the controller obtains the forwarding path of the packet through calculation, and generates the SID list corresponding to the forwarding path. The SID list includes the SID but does not include the C-SID, and the controller sends the SID list to the network ingress device. The network ingress device generates a new SID list based on the received SID list. The new SID list includes the C-SID.
[0093] A control plane protocol used to send the SID list may be, for example, a border gateway protocol (BGP) or a path computation element communication protocol (PCEP). The control plane protocol may be extended to send the SID list including the C-SID. A new attribute of the control plane protocol may be extended to identify that the SID list including the SID may be converted into the SID list including the C-SID, or that the SID list including the SID should be converted into the SID list including the C-SID. For example, after obtaining the forwarding path of the packet through calculation, the controller generates the SID list corresponding to the forwarding path. The SID list includes the SID but does not include the C-SID, and the controller sends the SID list to the network ingress device. The extended new attribute of the control plane protocol is used to identify that the SID list may be converted into the SID list including the C-SID. The network ingress device generates, based on indication of the attribute, a new SID list based on the received SID list. The new SID list includes the C-SID.
[0094] Optionally, the network device 301 may advertise a capability attribute of the network device 301 to another network device by using a control plane protocol. The capability attribute is used to indicate that the network device 301 can be compatible with a C-SID, for example, advertise a C-SID mapped to a segment, generate a SID list including the C-SID, encapsulate the SID list including the C-SID into a packet, and process the packet based on the C-SID. The control plane protocol may be, for example, an interior gateway protocol (IGP), a border gateway protocol (BGP), or a path computation element communication protocol (PCEP). In an example, the network device 301 adds the omitted first part in the SID to the DA field. With reference to the foregoing analysis, the plurality of C-SIDs in the SID list are one-to-one mapped to the plurality of segments. Further, the plurality of segments are one-to-one mapped to the plurality of SIDs. To reduce the length of the SID list, the first part in the SID is omitted, that is, the prefix part of the locator field in the SID is omitted. Only the second part in the SID, namely, the node ID part and the function field, is used as the C-SID and stored in the SID list. Optionally, the SID list may include only the C-SID, but does not include the prefix part corresponding to the C-SID. The network device 301 adds the first part in the SID, namely, the prefix part of the locator field, to the destination address field, and the network device 301 copies, to the DA field, a currently to-be-processed C-SID in the plurality of C-SIDs in the SID list. The first part in the DA field and the currently to-be-processed C-SID form the currently to-be-processed SID, so that the network device may still process the packet based on content in the DA field. For example, refer to
[0095] When the SID on the network includes the third part including the padding content, the network device 301 further adds the omitted third part in the SID to the DA field. In addition, the first part, the second part, and the third part are sequentially arranged in the DA field based on locations of the first part, the second part, and the third part in the SID. Therefore, the network device 301 adds the first part to the beginning of the DA field. A first bit of the first part is aligned with a first bit of the DA field. The network device 301 adds the third part to the end of the DA field. A last bit of the third part is aligned with a last bit of the DA field. The first part in the DA field, the currently to-be-processed C-SID, and the third part form the currently to-be-processed SID. Therefore, when receiving the packet, a subsequent network device on the packet forwarding path may still process the packet based on the content in the DA field. Optionally, when the SID on the network includes the third part including the padding content, the network device 301 or the controller on the network may advertise structure information of the DA field to another network device by using a control plane protocol, so that the another network device can correctly parse the content in the DA field. The structure information indicates an addition location of the C-SID in the DA field. In other words, the structure information indicates an addition location of the second part in the SID in the DA field. With reference to the foregoing description, the first part, the second part, and the third part are sequentially arranged in the DA field based on the locations of the first part, the second part, and the third part in the SID, and the structure information indicates the location of the second part in the SID in the SID. For example, the structure information may include a length of the first part and a length of the second part. In other words, a length of the prefix part and the length of the C-SID are advertised. Alternatively, the structure information may include a length of the first part and a length of the third part, or the structure information may include a length of the first part, a length of the second part, a length of the third part, or the like. The control plane protocol used to notify the structure information may be an intermediate system to intermediate system (IS-IS) protocol, an open shortest path first (OSPF) protocol, a border gateway protocol (BGP) protocol, or the like. For a specific process in which the another network device parses the content in the DA field, refer to the following description.
[0096] With reference to the foregoing description, the SRH includes the SL pointer used to indicate the quantity of remaining to-be-processed segments. After each update, a location to which the SL pointer points in the SID list is offset by a length of one SID, namely, 128 bits. When the C-SID is used, because the length of the C-SID is less than the length of the SID, original space for storing one SID can store a plurality of C-SIDs. Therefore, after each update, a location to which the SL pointer points in the SID list is offset by lengths of the plurality of C-SIDs, and each C-SID cannot be accurately located.
[0097] In this embodiment of this disclosure, space in the SID list is divided into a plurality of elements, and after each update, the SL pointer points to a different element. Further, a new pointer may be set to determine a currently to-be-processed C-SID in each element. The new pointer may be referred to as the CL pointer, and the CL pointer and the SL pointer form the two-dimensional pointer. A value of the SL pointer is used to determine a location of a currently to-be-processed element in the SID list, and a value of the CL pointer is used to determine a location of the currently to-be-processed C-SID in the element. Therefore, a location of the currently to-be-processed C-SID in the SID list may be determined based on the value of the SL pointer and the value of the CL pointer. In other words, the value of the SL pointer and the value of the CL pointer jointly indicate the location of the C-SID in the SID list.
[0098] In an example, space occupied by each SID may be divided into one element. To be specific, a length of each element is 128 bits, and after each update, the location to which the SL pointer points in the SID list is still offset by 128 bits. Refer to the SID list in the packet header of the packet shown in
[0099] Along with behavior of copying, by the network device, the C-SID in the SID list to the DA field, the value of the CL pointer also needs to be updated, to ensure that the value of the CL pointer is always used to determine the location of the currently to-be-processed C-SID in the element.
[0100] A manner in which the CL pointer is updated is associated with an initial value of the CL pointer. As shown in
[0101] There are two execution sequences between an action in which the value of the CL pointer is updated and an action in which the C-SID is copied to the DA field. The first sequence is that the value of the CL pointer is updated, and then the C-SID is copied. The second sequence is that the C-SID is copied, and then the value of the CL pointer is updated. The foregoing two execution sequences may be selected through network settings. After an execution sequence is selected, all network devices on the network perform the foregoing two actions according to the execution sequence, to ensure that the value of the CL pointer is always used to determine the location of the currently to-be-processed C-SID in the element.
[0102] The CL pointer has a specific location in the packet header. In an example, the CL pointer may be included in the C-SID.
[0103] In an example, the CL pointer may be a field obtained from the SRH through division. This is not shown in
[0104] In an example, the CL pointer may be a part obtained from the DA field in the IPv6 packet header through division. Specifically, the CL pointer is located in a last part of the DA field, namely, a last part of the C-SID in the DA field. As shown in
[0105] With reference to the foregoing description, the network device 301 may advertise the another network device that the network device 301 can process the C-SID. On the network, some network devices cannot be compatible with the C-SID. When a network device that cannot be compatible with the C-SID is located in the forwarding path of the packet, the network device also processes the packet based on a segment. The network device cannot be compatible with the C-SID, and does not advertise a C-SID mapped to a segment, but only advertises a SID mapped to a segment. Therefore, a SID list corresponding to the forwarding path includes the SID mapped to the segment. When the forwarding path further passes through the network device compatible with the C-SID, the SID list corresponding to the forwarding path includes both the C-SID and the SID.
[0106]
[0107] With reference to the application scenario shown in
[0108] When the SID list includes both the C-SID and the SID, the SID list may still be sent by using the foregoing extended control plane protocol.
[0109] When the SID list includes both the C-SID and the SID, a start indication may be set in the packet header to indicate a start of the C-SID.
[0110] In an example, C-SIDs in the SID list are used to indicate segments executed by all network devices that can be compatible with the C-SID, and the start indication may be included in a last SID before a first C-SID. For example, the start indication may be a specific function on an SRv6 network, and is stored in a function field of the last SID.
[0111] In an example, in the segments executed by the all network devices that can be compatible with the C-SID, a first segment is still indicated in the SID list by using a SID whose length is 128 bits, and the remaining segments are indicated by using C-SIDs. The start indication may be included in a SID to which the first segment maps, and the SID may also be referred to as a special SID.
[0112] When the special SID is used, space occupied by the C-SID may be divided into one element, and a length of the element may be greater than 128 bits. Space occupied by each remaining SID is divided into one element, and a length of the element is 128 bits. Therefore, lengths of all space may not be the same, and lengths offset by locations pointed to by an SL pointer in the SID list after each update are also not necessarily the same. Refer to the SID list in the packet header of the packet shown in
[0113] The CL pointer in the special SID is used to determine a currently to-be-processed C-SID from the element including the C-SID. Along with behavior of copying, by a network device, the C-SID in the SID list to a DA field, a value of the CL pointer is updated, to ensure that the value of the CL pointer is always used to determine a location of the currently to-be-processed C-SID in the element. With reference to the packet shown in
[0114] A value of the quantity indication is used to indicate a quantity of all C-SIDs. The value of the quantity indication is used to determine, when the plurality of C-SIDs end, a length that is offset when the SL pointer is updated. With reference to the packet shown in
[0115] In an example, a value of the function field in the special SID is used to indicate a specific function on the SRv6 network, and the quantity indication and the CL pointer are used as arguments of the specific function. The specific function is used to: when the value of the CL pointer is an initial value, that is, when the plurality of C-SIDs in the SID list start, copy the prefix part, namely, the foregoing prefix, of the SID to which the C-SID is mapped to the DA field; and copy a first C-SID in the plurality of C-SIDs to the DA field.
[0116] In an example, the network device 301 may obtain SIDs and C-SIDs for a same segment, including the foregoing special SID. The SIDs and C-SIDs may be advertised by a network device executing the segment. When the SID list is generated, in a plurality of segments that can be indicated by the C-SID, instead of the C-SID, the special SID should be used as a first segment.
[0117] When the SID list includes both the C-SID and the SID, an end indication may be further set in the packet header to indicate an end of the C-SID. The network device may determine a last C-SID in the plurality of C-SIDs based on the end indication, and copy 128 bits after the last C-SID to the DA field, that is, copy a SID after the last C-SID to the DA field.
[0118] In an example, in the SID list, one end indication is set after the plurality of C-SIDs, to indicate an end of the plurality of C-SIDs. The end indication may be a type field whose length is the same as the length of the C-SID, and a value of the end indication is a specific value, for example, all 0s. As shown in
[0119] In an example, in the SID list, one end indication is set in the last C-SID in the plurality of C-SIDs, to indicate an end of the plurality of C-SIDs. As shown in
[0120] Optionally, the end indication may be a specific function in the SRv6 network, and is stored in a function field of the last C-SID.
[0121] Optionally, the end indication may be a specific field in the C-SID. With reference to the foregoing description, a last part of fields in the C-SID may be divided and used as a candidate field of the CL pointer. On this basis, some fields before the candidate field of the CL pointer may be divided as candidate fields of the end indication.
[0122] In an example, the network device 301 may obtain C-SIDs of different formats for a same segment, including the format of the C-SID including the candidate field of the end indication and the candidate field of the CL pointer. The C-SIDs of different formats may be advertised by a network device executing the segment. The format of the C-SID including the candidate field of the end indication and the candidate field of the CL pointer may be selected for a last C-SID in each element in the SID list. The candidate field of the CL pointer may be used as the CL pointer, and is used to determine a currently to-be-processed C-SID in the element. When the last C-SID in the element is a last C-SID in all C-SIDs at the same time, an end indication in the last C-SID may be used to indicate an end of the C-SID.
[0123] S320: The network device 301 sends the packet encapsulated with the packet header.
[0124] With reference to the foregoing description, the network device 301 copies the first C-SID in the SID list to the DA field. The first part of the SID and the first C-SID that are in the DA field re-form a SID. The network device 301 sends the packet encapsulated with the packet header. Optionally, the network device 301 processes the packet based on an SRv6 network function indicated by the function field in the SID, and a processing process is determined by a specific instruction in the SRv6 network function. Optionally, the processing process may include sending the packet. For example, the network device 301 sends the packet to the network device 302.
[0125] S325: The network device 302 receives the packet. The packet header of the packet includes the destination address field, the first pointer, the second pointer, and the list used to process the packet. The list includes the plurality of sequentially arranged identifiers, the plurality of identifiers are one-to-one mapped to the plurality of segments on the SR network, and the value of the first pointer and the value of the second pointer jointly indicate the location of the first identifier in the plurality of identifiers in the list.
[0126] S330: The network device 302 determines the first identifier based on the value of the first pointer and the value of the second pointer.
[0127] S335: The network device 302 copies the first identifier to the destination address field.
[0128] The network device 302 receives the SID list including the C-SID, determines the currently to-be-processed C-SID based on the SL pointer and the CL pointer, and copies the C-SID to the DA field. The C-SID may overwrite an original C-SID in the DA field, and form a SID with the prefix part in the DA field. The subsequent network device on the packet forwarding path may process the packet based on the SID.
[0129] When the SID on the network includes the third part including the padding content, the network device 302 learns, based on the structure information, of the SID, advertised by the network device 301 or the controller on the network, the specific location of the second part in the DA field. Therefore, the network device 302 may copy the currently to-be-processed C-SID to the corresponding location of the second part in the DA field based on the specific location of the second part in the DA field, so that the C-SID overwrites the original C-SID in the DA field. In other words, the network device 302 updates the second part in the DA field, but does not update the first part and the third part in the DA field. The updated second part is combined with the first part and the third part to form a SID. The subsequent network device on the packet forwarding path may process the packet based on the SID. With reference to the foregoing description, there are the two execution sequences between the action in which the value of the CL pointer is updated and the action in which the C-SID is copied to the DA field. In relation to this, there are also two execution manners for determining, at the network device 302, the currently to-be-processed C-SID based on the SL pointer and the CL pointer. In addition, space including the C-SID in the SID list may be divided into a plurality of elements, or may be divided into one element. In relation to this, at the network device 302, there are also different execution manners for determining the currently to-be-processed C-SID based on the SL pointer and the CL pointer.
[0130] When the execution sequence is that the value of the CL pointer is first updated and then the C-SID is copied, and the space including the C-SID in the SID list may be divided into the plurality of elements, an example is used for description with reference to the application scenario shown in
[0131] Alternatively, the network device 302 may be the network device 2 in
[0132] Alternatively, the network device 302 may be the network device 3 in
[0133] When the execution sequence is that the C-SID is first copied and then the value of the CL pointer is updated, and the space including the C-SID in the SID list may be divided into the plurality of elements, in a packet received by the network device 1, a value of a CL pointer is already 2. This indicates a location of a second C-SID in an element. The network device 1 obtains a second C-SID, namely, the C-SID 2, in a first element based on indications of an SL pointer and a CL pointer, and copies the C-SID 2 to a DA field in a packet header to replace the original C-SID 1 in the DA field. The network device 1 updates a value of the CL pointer, for example, modifies the value of the CL pointer to 3, to indicate a location of a third C-SID in a container in the element. In this case, the DA field includes a combination of a prefix part and the C-SID 2, namely, A1:0002:2222, which is a SID of the network device 2. The network device 1 queries a forwarding entry based on the SID of the network device 2 in the DA field, and sends the packet to the network device 2 based on a query result. Another execution process may be obtained by analogy based on the foregoing description. Details are not described herein again.
[0134] In an example, the network device 302 determines whether a C-SID in a current DA field is the last C-SID in the element of the SID list. If the C-SID in the current DA field is the last C-SID in the element of the SID list, the network device 302 needs to update the value of the SL pointer and the value of the CL pointer. The plurality of network devices on the packet forwarding path sequentially process the plurality of C-SIDs in the SID list, and after processing a C-SID in one element in the SID list is completed, continue to process a C-SID in a next element. In this case, both the value of the CL pointer and the value of the SL pointer need to be modified, to ensure that the currently to-be-processed C-SID can still be determined based on the value of the CL pointer and the value of the SL pointer.
[0135] With reference to the application scenario shown in
[0136] When the execution sequence is that the C-SID first copied and then the value of the SL pointer and the value of the CL pointer are updated, an execution process may be deduced by analogy based on the foregoing description. Details are not described herein again.
[0137] In addition, the network device 302 may alternatively be the network device 5, the network device 6, or the network device 7 in
[0138] When the space including the C-SID in the SID list is divided into one element, an execution process may be deduced by analogy based on the foregoing description. Details are not described herein again.
[0139] Although, in the foregoing example for the application scenario shown in
[0140]
[0141] the receiving unit 601 is configured to receive a packet; and
[0142] the processing unit 602 is configured to: generate a packet header and encapsulate the packet header into the packet, where the packet header includes a first pointer, a second pointer, and a list used to process the packet, the list includes a plurality of sequentially arranged identifiers, the plurality of identifiers are one-to-one mapped to a plurality of segments on an SR network, and a value of the first pointer and a value of the second pointer jointly indicate a location of a first identifier in the plurality of identifiers in the list; and process the packet encapsulated with the packet header based on the list.
[0143]
[0144] The memory 701 is configured to store instructions. When the embodiment shown in
[0145] The processor 702 is configured to execute the instructions in the memory 701, to perform the foregoing packet processing method applied to the embodiment shown in
[0146] The network interface 703 is configured to communicate with another network device.
[0147] The network interface 703, the processor 702, and the memory 701 are connected to each other. For example, the network interface 703, the processor 702, and the memory 701 are connected to each other through a bus. The bus may be a peripheral component interconnect (peripheral component interconnect, PCI for short) bus, an extended industry standard architecture (extended industry standard architecture, EISA for short) bus, or the like. The bus may be classified into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is used to represent the bus in
[0148] In a specific embodiment, the processor 702 is configured to: receive a packet through the network interface 703; generate a packet header and encapsulate the packet header into the packet, where the packet header includes a first pointer, a second pointer, and a list used to process the packet, the list includes a plurality of sequentially arranged identifiers, the plurality of identifiers are one-to-one mapped to a plurality of segments on an SR network, and a value of the first pointer and a value of the second pointer jointly indicate a location of a first identifier in the plurality of identifiers in the list; and process the packet encapsulated with the packet header based on the list. For a detailed processing process of the processor 702, refer to the detailed description of the process S310, S315, and S320 in the foregoing embodiment shown in
[0149] The network interface 703 is used by the network device 700 to receive and send a packet by using a network system. For a specific process, refer to the detailed description of the process S310 in the foregoing embodiment shown in
[0150]
[0151] the receiving unit 801 is configured to receive a packet. A packet header of the packet includes a destination address field, a first pointer, a second pointer, and a list used to process the packet, the list includes a plurality of sequentially arranged identifiers, the plurality of identifiers are one-to-one mapped to a plurality of segments on an SR network, and a value of the first pointer and a value of the second pointer jointly indicate a location of a first identifier in the plurality of identifiers in the list; and
[0152] the processing unit 802 is configured to: determine the first identifier based on the value of the first pointer and the value of the second pointer; and copy the first identifier to the destination address field.
[0153]
[0154] The memory 901 is configured to store instructions. When the embodiment shown in
[0155] The processor 902 is configured to execute the instructions in the memory 901, to perform the foregoing packet processing method applied to the embodiment shown in
[0156] The network interface 903 is configured to communicate with another network device.
[0157] The network interface 903, the processor 902, and the memory 901 are connected to each other. For example, the network interface 903, the processor 902, and the memory 901 are connected to each other through a bus. The bus may be a PCI bus, an EISA bus, or the like. The bus may be classified into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is used to represent the bus in
[0158] In a specific embodiment, the processor 902 is configured to: receive a packet through the network interface 903, where a packet header of the packet includes a destination address field, a first pointer, a second pointer, and a list used to process the packet, the list includes a plurality of sequentially arranged identifiers, the plurality of identifiers are one-to-one mapped to a plurality of segments on an SR network, and a value of the first pointer and a value of the second pointer jointly indicate a location of a first identifier in the plurality of identifiers in the list; determine the first identifier based on the value of the first pointer and the value of the second pointer; and copy the first identifier to the destination address field. For a detailed processing process of the processor 902, refer to the detailed description of the process S325, S330, and S335 in the foregoing embodiment shown in
[0159] The network interface 903 is used by the network device 900 to send and receive a packet by using a network system. For a specific process, refer to the detailed description of the process S325 in the foregoing embodiment shown in
[0160] The memory 701 and the memory 901 may be random access memories (RAM), flash memories, read-only memories (ROM), erasable programmable read-only memories (EPROM), electrically erasable programmable read-only memories (EEPROM), registers, hard disks, removable hard disks, CD-ROMs, or any other forms of storage medium known to persons skilled in the art.
[0161] The processor 702 and the processor 902 may be, for example, central processing units (CPU), general-purpose processors, digital signal processors (DSP), field programmable gate arrays (FPGA), or other programmable logical devices, transistor logical devices, hardware components, or any combinations thereof. The processor 702 and the processor 902 may implement or execute various example logical blocks, modules and circuits described with reference to content disclosed in this disclosure. Alternatively, the processor may be a combination of processors implementing a computing function, for example, a combination of one or more microprocessors, or a combination of a DSP and a microprocessor.
[0162] The network interface 703 and the network interface 903 may be, for example, interface cards, and may be Ethernet interfaces or asynchronous transfer mode (ATM) interfaces. The network interface 703 and the network interface 903 may be wired interfaces or wireless interfaces.
[0163] The processor 702 and the processor 902 may be, for example, application-specific integrated circuits (ASIC). In this case, the processor 702 and the processor 902 perform, based on circuits of the processor 702 and the processor 902, the foregoing packet processing method applied to the embodiment shown in
[0164]
[0165] Specifically, the first network device is configured to: receive a packet; generate a packet header and encapsulate the packet header into the packet, where the packet header includes a first pointer, a second pointer, and a list used to process the packet, the list includes a plurality of sequentially arranged identifiers, the plurality of identifiers are one-to-one mapped to a plurality of segments on an SR network, and a value of the first pointer and a value of the second pointer jointly indicate a location of a first identifier in the plurality of identifiers in the list; and process the packet encapsulated with the packet header based on the list.
[0166] The second network device is configured to: receive a packet, where a packet header of the packet includes a destination address field, a first pointer, a second pointer, and a list used to process the packet, the list includes a plurality of sequentially arranged identifiers, the plurality of identifiers are one-to-one mapped to a plurality of segments on an SR network, and a value of the first pointer and a value of the second pointer jointly indicate a location of a first identifier in the plurality of identifiers in the list; determine the first identifier based on the value of the first pointer and the value of the second pointer; and copy the first identifier to the destination address field.
[0167] An embodiment of the present invention further provides a non-transient storage medium, configured to store software instructions used in the foregoing embodiment. The non-transient storage medium includes a program used to perform the methods shown in the foregoing embodiment. When the program is executed on a computer or a network device, the computer or the network device is enabled to perform the method in the foregoing method embodiment.
[0168] An embodiment of the present invention further provides a computer program product including computer program instructions. When the computer program product runs on a computer, a network node is enabled to perform the method in the foregoing method embodiment.
[0169] In this specification, the claims, and the accompanying drawings of this disclosure, terms “first”, “second”, “third”, “fourth”, and the like (if existent) are intended to distinguish between similar objects but do not necessarily indicate a specific order or sequence. It should be understood that the data termed in such a way is interchangeable in proper circumstances, so that the embodiments of the present invention described herein can be implemented in orders other than the order illustrated or described herein. Moreover, the terms “include”, “contain” and any other variants mean to cover the non-exclusive inclusion, for example, a process, method, system, product, or device that includes a list of steps or units is not necessarily limited to those steps or units, but may include other steps or units not expressly listed or inherent to such a process, method, product, or device.
[0170] It may be clearly understood by persons skilled in the art that, for the purpose of convenient and brief description, for a detailed working process of the foregoing system, apparatus, and unit, refer to a corresponding process in the foregoing method embodiment. Details are not described herein again.
[0171] In the several embodiments provided in this disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other manners. For example, the described apparatus embodiment is merely an example. For example, the unit division is merely logical service division and may be other division in an actual implementation. For example, a plurality of units or components may be combined or integrated into another system, or some features may be ignored or not performed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented through some interfaces. The indirect couplings or communication connections between the apparatuses or units may be implemented in electronic, mechanical, or other forms.
[0172] The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, that is, may be located in one position, or may be distributed on a plurality of network units. Some or all of the units may be selected based on an actual requirement to achieve the objectives of the solutions of the embodiments.
[0173] In addition, service units in the embodiments of this disclosure may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in a form of hardware, or may be implemented in a form of a software service unit.
[0174] When the service unit is implemented in the form of a software functional unit and sold or used as an independent product, the integrated unit may be stored in a computer-readable storage medium. Based on such an understanding, the technical solutions of this disclosure essentially, or the part contributing to the conventional technology, or all or some of the technical solutions may be implemented in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for instructing a computer device (which may be a personal computer, a server, or a network device) to perform all or some of the steps of the methods described in the embodiments of this disclosure. The foregoing storage medium includes various media, for example, a USB flash drive, a removable hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, an optical disc, or another medium that can store program code.
[0175] Persons skilled in the art should be aware that in the foregoing one or more examples, the services described in the present invention may be implemented by using hardware, software, firmware, or any combination thereof When the services are implemented by software, the services may be stored in a computer-readable medium or transmitted as one or more instructions or code in the computer-readable medium. The computer-readable medium includes a computer storage medium and a communication medium. The communication medium includes any medium that enables a computer program to be transmitted from one place to another. The storage medium may be any available medium accessible to a general-purpose or a special-purpose computer.
[0176] The objectives, technical solutions, and beneficial effects of the present invention have been described in further detail in the foregoing specific implementations. It should be understood that the foregoing description is merely a specific implementation of the present invention.
[0177] The foregoing embodiments are merely intended for describing the technical solutions of this disclosure instead of limiting this disclosure. Although this disclosure is described in detail with reference to the foregoing embodiments, persons of ordinary skill in the art should understand that they may still make modifications to the technical solutions described in the foregoing embodiments or make equivalent replacements to some technical features thereof, without departing from the scope of the technical solutions of the embodiments of this disclosure.