A message processing method and device, electronic equipment and storage medium
By generating a SID list for the forwarding path and indicating the existence and compression value of the G-SID in the SRv6 message, the problem of cumbersome message processing in G-SRv6 technology is solved, and more efficient network node resource utilization is achieved.
Patent Information
- Application Number
- CN202411266926.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-09-10
AI Technical Summary
When using G-SRv6 technology, it is necessary to add the continued compression behavior attribute, which makes the message processing process of network nodes cumbersome.
By generating a SID list corresponding to the forwarding path and indicating the existence and compression value of the G-SID in the SRH header of the SRv6 message, the message processing process is simplified and the addition of the COC attribute is avoided.
It simplifies the message processing process, saves resource allocation, and improves the processing efficiency of network nodes.
Smart Images

Figure CN119211125B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a message processing method, device, electronic device and storage medium. Background Art
[0002] The programmability of Internet Protocol version 6 (IPv6) Segment Routing (SRv6) is gaining increasing recognition. However, SRv6 technology can pose issues such as high SRv6 message overhead. This has led to the development of Generalized Segment Routing (G-SRv6) for IPv6. G-SRv6 is a hybrid encoding technology that supports both the standard 128-bit Segment Identifier (SID) and the Generalized Segment Identifier (G-SID, also known as a compressed SID, e.g., a 32-bit SID). This optimizes SRv6 performance while supporting SRv6 functionality, enabling network-scale deployment.
[0003] When using G-SRv6 technology, the Continue of Compression Flavor (COC) attribute needs to be added to indicate whether the next SID is a compressed SID. This requires the corresponding network node to apply for related SIDs configured with the COC attribute and related SIDs not configured with the COC attribute, which makes the processing flow of G-SRv6 messages more complicated. Summary of the Invention
[0004] In order to overcome the problems existing in the related art, the present application provides a message processing method, device, electronic device and storage medium.
[0005] According to a first aspect of an embodiment of the present application, a message processing method is provided, the method being applied to a network node, the method comprising:
[0006] Receive messages;
[0007] If the message is a data message, when it is determined that the message needs to be forwarded through the SRv6-Traffic Engineering (TE) policy, and there is a network node configured with a G-SID among the network nodes on the forwarding path corresponding to the target SRv6-TE policy, a first SID list corresponding to the forwarding path is generated, and based on the first SID list, the message is encapsulated as an SRv6 message and forwarded to the next-hop network node, wherein the last first address in the first SID list in the Segment Routing Header (SRH) of the SRv6 message indicates the presence of a G-SID in the first SID list, the length of a common prefix, the length of a G-SID, and the compressed values corresponding to the other first addresses in the first SID list except the last first address, where the compressed value is used to represent the total number of G-SIDs included in the corresponding address;
[0008] If the message is an SRv6 message, the message includes an IPv6 header and an SRH header, it is determined that the message needs to be modified, the Segment Left (SL) value in the SRH header is not 0, and the last second address in the second SID list in the SRH header indicates that a G-SID exists in the second SID list, then when the address indicated by the SL value is the second address, according to the destination address in the IPv6 header, the second SID list, the compressed value corresponding to the address indicated by the SL value minus 1, and the length of a common prefix and a length of a G-SID indicated by the second address, the message is modified and sent to the next hop network node; or,
[0009] When the address indicated by the SL value is not the second address, the message is modified based on at least the destination address in the IPv6 header, the SL value, the second SID list, the length of a common prefix indicated by the second address, the length of a G-SID, a first compression value corresponding to the address indicated by the SL value, and a second compression value corresponding to the address indicated by the SL value minus 1, and the modified message is sent to the next-hop network node.
[0010] According to a second aspect of an embodiment of the present application, a message processing device is provided, the device being applied to a network node, the device comprising:
[0011] A receiving module, used for receiving messages;
[0012] an encapsulation module, configured to, if the message is a data message, generate a first SID list corresponding to the forwarding path when it is determined that the message needs to be forwarded through a target SRv6-Traffic Engineering TE policy and a network node configured with a G-SID exists among the network nodes on the forwarding path corresponding to the target SRv6-TE policy, and encapsulate the message into an SRv6 message based on the first SID list and then forward it to the next-hop network node, wherein the last first address in the first SID list in the SRH header of the SRv6 message indicates the existence of a G-SID in the first SID list, the length of a common prefix, the length of a G-SID, and compressed values corresponding to other first addresses in the first SID list except the last first address, where the compressed value is used to represent the total number of G-SIDs included in the corresponding address;
[0013] a processing module, configured to: if the message is an SRv6 message, the message includes an IPv6 header and an SRH header, it is determined that the message needs to be modified, the SL value in the SRH header is not 0, and the last second address in the second SID list in the SRH header indicates that a G-SID exists in the second SID list, then, when the address indicated by the SL value is the second address, modify the message according to the destination address in the IPv6 header, the second SID list, the compressed value corresponding to the address indicated by the SL value minus 1, and the length of a common prefix and a length of a G-SID indicated by the second address, and send the modified message to the next-hop network node; or,
[0014] When the address indicated by the SL value is not the second address, the message is modified based on at least the destination address in the IPv6 header, the SL value, the second SID list, the length of a common prefix indicated by the second address, the length of a G-SID, a first compression value corresponding to the address indicated by the SL value, and a second compression value corresponding to the address indicated by the SL value minus 1, and the modified message is sent to the next-hop network node.
[0015] According to the third aspect of an embodiment of the present application, an electronic device is provided, comprising a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to implement the method steps of the above-mentioned message processing method.
[0016] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps of the above-mentioned message processing method are implemented.
[0017] The technical solutions provided by the embodiments of the present application may have the following beneficial effects:
[0018] In the embodiment of the present application, there is no need to add the COC attribute, which saves resource configuration. In addition, the last address in the SID list in the SRH header is used to indicate the presence of a G-SID in the SID list. Based on the length of a G-SID indicated by the last address in the SID list in the SRH header and the compression value corresponding to each address in the SID list, the forwarding of the SRv6 message is guided, simplifying the message processing process.
[0019] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0021] Figure 1 A flowchart of a message processing method provided in an embodiment of the present application;
[0022] Figure 2 Schematic diagram of the transmission process of data packet 1 provided in an embodiment of the present application;
[0023] Figure 3 A schematic diagram of the structure of a message processing device provided in an embodiment of the present application;
[0024] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0026] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. As used in this application and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
[0027] It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words "if" or "if" as used herein may be interpreted as "when" or "when".
[0028] Next, the embodiments of the present application are described in detail.
[0029] The present application provides a message processing method, which is applied to a network node, such as Figure 1 As shown, the method may include the following steps:
[0030] S11. Receive message.
[0031] S12. If the message is a data message, when it is determined that the message needs to be forwarded through the target SRv6-TE policy and there is a network node configured with a G-SID among the network nodes on the forwarding path corresponding to the target SRv6-TE policy, a first SID list corresponding to the forwarding path is generated, and based on the first SID list, the message is encapsulated as an SRv6 message and forwarded to the next-hop network node.
[0032] In this step, the last first address in the first SID list in the SRH header of the message indicates the existence of a G-SID in the first SID list, the length of a common prefix (Common Prefix Length), the length of a G-SID, and the compressed values corresponding to the other first addresses in the first SID list except the last first address, and the compressed value is used to represent the total number of G-SIDs included in the corresponding address.
[0033] S13. If the message is an SRv6 message, the message includes an IPv6 header and an SRH header, it is determined that the message needs to be modified, the SL value in the SRH header is not 0, and the last second address in the second SID list in the SRH header indicates that a G-SID exists in the second SID list, then, when the address indicated by the SL value is the last second address, modify the message based on the destination address in the IPv6 header, the second SID list, the compressed value corresponding to the address indicated by the SL value minus 1, and the length of a common prefix indicated by the second address and the length of a G-SID, and send the modified message to the next-hop network node; or, when the address indicated by the SL value is not the second address, modify the message based on at least the destination address in the IPv6 header, the SL value, the second SID list, the length of a common prefix indicated by the second address, the length of a G-SID, the first compressed value corresponding to the address indicated by the SL value, and the second compressed value corresponding to the address indicated by the SL value minus 1, and send the modified message to the next-hop network node.
[0034] Specifically, in the above step S12, for the network node, for the last first address in the first SID list in the routing extension header SRH header of the SRv6 message, the first byte (Byte) in this address can be used to indicate the presence of a G-SID in the first SID list, for example, 0xFD; the highest bit in the second byte (Byte) in this address can be used to indicate the length of a G-SID, and the remaining bits indicate the length of the common prefix (Common Prefix); starting from the third Byte, every 4 bits indicate a compressed value corresponding to a first address, and the indication order of the compressed values is the same as the arrangement order of other first addresses except the last first address in the first SID list.
[0035] It should be noted that, in the above step S12, the specific forwarding process of encapsulating the message into an SRv6 message and then forwarding it to the next-hop network node is an existing technology and will not be described in detail here.
[0036] Specifically, in the above step S13, the network node may determine whether the message needs to be modified in the following manner:
[0037] If a common SID is configured for the packet, then when the destination address included in the IPv6 header is its own common SID, the packet is determined to need to be modified.
[0038] If the G-SID is configured for itself, when the destination address included in the IPv6 header includes the public prefix corresponding to its own G-SID and its own G-SID, it is determined that the message needs to be modified.
[0039] In one example, the common SID is a 128-bit SID, and the G-SID is a 32-bit SID.
[0040] In addition, in the step S13, the network node can implement the modification of the packet according to the destination address in the IPv6 header, the length of the common prefix indicated by the second address indication, the length of the G-SID, the first compressed value corresponding to the address indicated by the SL value, and the second compressed value corresponding to the address indicated by the SL value minus 1 in the following manner.
[0041] If the compressed value corresponding to the address indicated by the SL value minus 1 is 0, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value minus 1 in the second SID list.
[0042] If the compressed value corresponding to the address indicated by the SL value minus 1 is not 0, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the target address, wherein the target address includes, in sequence, the common prefix included in the destination address before the update, which is obtained by the network node based on the length of the common prefix indicated by the second address indication, the last G-SID included in the address indicated by the SL value minus 1, which is obtained by the network node based on the length of the G-SID indicated by the second address indication from the second SID list, and the segment index SI corresponding to the last G-SID.
[0043] The network node can implement the modification of the packet according to the destination address in the IPv6 header, the SL value, the second SID list, the length of the common prefix indicated by the second address indication, the length of the G-SID, the first compressed value corresponding to the address indicated by the SL value, and the second compressed value corresponding to the address indicated by the SL value minus 1 in the following manner.
[0044] If the SL value is greater than 1, and the first compressed value corresponding to the address indicated by the SL value in the second address indication is 0, and the second compressed value corresponding to the address indicated by the SL value minus 1 in the second address indication is not 0, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the first address, wherein the first address includes, in sequence, the first common prefix included in the address indicated by the SL value, which is obtained by the network node based on the length of the common prefix indicated by the second address indication, the last first G-SID included in the address indicated by the SL value minus 1, which is obtained by the network node based on the length of the G-SID indicated by the second address indication from the second SID list, and the first SI corresponding to the first G-SID; or,
[0045] when the first compression value and the second compression value are both 0, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value reduced by 1 in the second SID list; or
[0046] when the first compression value is not 0, if the second SI included in the destination address in the IPv6 header is not 0, when the second compression value is 0, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value reduced by 1 in the second SID list, or when the second compression value is not 0, the destination address in the IPv6 header is updated to the second address, wherein the second address includes the second common prefix included in the destination address before the update, a third G-SID located in front of the second G-SID included in the destination address before the update in the address indicated by the SL value obtained from the second SID list based on the length of one G-SID indicated by the second address, and a third SI, which is the second SI reduced by 1, of the address indicated by the SL value obtained from the second SID list based on the length of one G-SID indicated by the second address;
[0047] when the second SI is 0, when the second compression value is 0, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value reduced by 1 in the second SID list, or when the second compression value is not 0, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the third address, wherein the third address includes, in sequence, the third common prefix included in the destination address before the update, the last fourth G-SID included in the address indicated by the SL value reduced by 1 obtained from the second SID list based on the length of one G-SID indicated by the second address, and the fourth SI corresponding to the fourth G-SID;
[0048] when the SL value is equal to 1, when the first compression value and the second compression value are both 0, if the device supports a penultimate segment popping SRH PSP behavior, the destination address in the IPv6 header is updated to the address indicated by the SL value reduced by 1 in the second SID list, and the SRH header is popped; if the device does not support the PSP behavior, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value reduced by 1 in the second SID list; or
[0049] when the first compression value is not 0 and the second compression value is 0, if the first compression value is equal to 1, when the device supports the PSP behavior, the destination address in the IPv6 header is updated to the address indicated by the SL value reduced by 1 in the second SID list, and the SRH header is popped, or when the device does not support the PSP behavior, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value reduced by 1 in the second SID list;
[0050] If the first compression value is greater than 1 and the fifth SI included in the destination address in the IPv6 header is not 0, the destination address in the IPv6 header is updated to a fourth address, where the fourth address includes the fourth common prefix included in the destination address before the update, a fifth G-SID preceding the G-SID included in the destination address before the update in the address indicated by the SL value obtained from the second SID list based on the length of a G-SID indicated by the second address, and a sixth SI corresponding to the fifth G-SID, where the sixth SI is the fifth SI minus 1;
[0051] If the first compression value is greater than 1 and the fifth SI included in the destination address in the IPv6 header is 0, then when it supports PSP behavior, the destination address in the IPv6 header is updated to the address indicated by the SL value in the second SID list minus 1, and the SRH header is discarded; or, when it does not support PSP behavior, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value in the second SID list minus 1.
[0052] It should be noted that, when the SL value is greater than 1, if the first compression value corresponding to the address indicated by the SL value indicated by the second SID is 0, and the second compression value corresponding to the address indicated by the SL value indicated by the second SID minus 1 is not 0, this indicates that the address corresponding to the first compression value is an ordinary SID, and the address corresponding to the second compression value contains a second compression value of G-SIDs, and the above-mentioned network node and the network node corresponding to the second compression value of G-SID are located in the same compression domain.
[0053] If the first compressed value and the second compressed value are both 0, this indicates that the addresses corresponding to the first compressed value and the second compressed value are both common SIDs.
[0054] Furthermore, in the embodiment of the present application, the network node may further perform the following operations:
[0055] When the message is an SRv6 message, the message includes an IPv6 header and an SRH header, and the SL value in the G-SRH header is 0, the IPv6 header and the G-SRH header of the message are discarded, and the discarded message is forwarded.
[0056] It should be noted that, when the message is an SRv6 message, the message includes an IPv6 header and an SRH header, and the SL value in the G-SRH header is 0, it means that the network node is the previous-hop device of the destination network node of the data message carried in the SRv6 message, and the previous-hop network node of the network node does not support PSP behavior.
[0057] Furthermore, in the embodiment of the present application, the network node may further perform the following operations:
[0058] When the message is an SRv6 message, the message includes only an IPv6 header, and the destination address in the IPv6 header is its own SID, the IPv6 header of the message is ejected and the message after being ejected is forwarded.
[0059] It should be noted that, when the message is an SRv6 message, the message only includes an IPv6 header, and the destination address in the IPv6 header is its own SID, it means that the network node is the previous-hop device of the destination network node of the data message carried in the SRv6 message, and the previous-hop network node of the network node supports PSP behavior.
[0060] The above message processing method is described in detail below with reference to specific embodiments.
[0061] like Figure 2 As shown in the figure, it is assumed that the network nodes on the forwarding path corresponding to SRv6-TE policy 1 are network node A (denoted as A), network node C1 (denoted as C1), network node C2 (denoted as C2), network node C3 (denoted as C3), network node C4 (denoted as C4), network node C5 (denoted as C5), network node C6 (denoted as C6), network node D1 (denoted as D1), network node D2 (denoted as D2), network node D3 (denoted as D3), network node D4 (denoted as D4), network node D5 (denoted as D5), network node D6 (denoted as D6), and network node B (denoted as B).
[0062] Also, assume that network node A is configured with a common SID, for example, A::1.
[0063] Network nodes C1 through C6 are located in a compressed domain and share a common prefix with a length of 64 bits. Network node C1 is configured with a normal SID, for example, C::1:1:0:0. Network nodes C2 through C6 are configured with 32-bit G-SIDs, for example, 2:1, 3:1, 4:1, 5:1, and 6:1, respectively.
[0064] Network nodes D1 through D6 are located in another compression domain and share a common prefix. Network node D1 is configured with a normal SID, for example, D::1:1:0:0. Network nodes D2 through D6 are configured with G-SIDs, for example, 2:1, 3:1, 4:1, 5:1, and 6:1, respectively. Network node D6 supports PSP behavior.
[0065] Network node B is configured with an End.DT4 address for a virtual private network (VPN) instance 100, for example, B::200.
[0066] Here, network node A (denoted as A) and network node B (denoted as B) may both be provider edge (PE) devices.
[0067] Assume that network node A receives data message 1 and determines that the message needs to be forwarded through SRv6-TE policy 1, and there is a network node configured with G-SID among the network nodes on the forwarding path corresponding to SRv6-TE policy 1. At this time, network node A generates a SID list corresponding to the forwarding path (for example, SID list 1), and based on SID list 1, encapsulates the data message into SRv6 message 1 (for example, Figure 2 As shown in FIG, 5 , the SRv6 packet is forwarded to the next-hop network node. That is, the network node A sends the SRv6 packet 1 to the network node C1.
[0068] Here, the source address (SA) in the IPv6 header of SRv6 packet 1 is A::1, the destination address (DA) is C::1:1:0:0, and it also carries a payload.
[0069] In the last address in SID list 1 in the SRH header of SRv6 packet 1, the first byte (ie, “FD”) indicates that a G-SID exists in SID list 1.
[0070] The second byte (ie, "C0") indicates the length of the common prefix and the length of a G-SID.
[0071] The "0" in the third byte (i.e., "01") indicates that the compressed value corresponding to the address with an SL value of 0 is 0, that is, the address indicated by an SL value of 0 is a normal SID; the "1" in "01" indicates that the compressed value corresponding to the address with an SL value of 1 is 1, that is, the address indicated by an SL value of 1 includes 1 G-SID, and the rest are padding bits.
[0072] The "4" in the fourth byte (i.e., "40") indicates that the compressed value corresponding to the address with an SL value of 2 is 4, that is, the address indicated by the SL value of 2 includes 4 G-SIDs; the "0" in "40" indicates that the compressed value corresponding to the address with an SL value of 3 is 0, that is, the address indicated by the SL value of 3 is a normal SID.
[0073] The "1" in the fifth byte (i.e., "14") indicates that the compressed value corresponding to the address with an SL value of 4 is 1, that is, there is one G-SID in the address indicated by an SL value of 1, and the rest are padding bits; the "4" in "14" indicates that the compressed value corresponding to the address with an SL value of 5 is 4, that is, the address indicated by an SL value of 5 includes 4 G-SIDs.
[0074] The remaining bytes are all 0.
[0075] Network node C1 receives SRv6 message 1 and discovers that SRv6 message 1 includes an IPv6 header and an SRH header, that SRv6 message 1 needs to be modified, that the SL value in the SRH header of SRv6 message 1 is 6 (i.e., not 0), and that the last address in SID List 1 in the SRH header indicates that a G-SID exists in SID List 1. Network node C1 then further discovers that the address indicated by the SL value is the last address, and that the compressed value corresponding to the address indicated by the SL value after decrementing it by 1 (i.e., SL=5) is 4 (i.e., not 0). This indicates that the address indicated by the SL value after decrementing it by 1 includes four G-SIDs. These four G-SIDs and the network nodes corresponding to the destination address in the IPv6 header are in the same compressed domain. In this case, network node C1 decrements the SL value by 1 and updates the destination address in the IPv6 header to C::2:1:0:3, obtaining SRv6 message 2. Network node C1 then sends SRv6 message 2 to the next-hop network node (i.e., network node C2).
[0076] Here, C::2:1:0:3 includes the common prefix in C::1:1:0:0 obtained by the network node C1 based on the length of a common prefix indicated by the last address, the last G-SID (i.e., 2:1) included in the address indicated by the SL value minus 1 (i.e., SL=5) obtained by the network node C1 from SID list 1 based on the length of a G-SID indicated by the last address, and the SI corresponding to 2:1 (i.e., 3).
[0077] Network node C2 receives SRv6 message 2 and finds that SRv6 message 2 includes an IPv6 header and an SRH header, that SRv6 message 2 needs to be modified, that the SL value in the SRH header of SRv6 message 2 is 5 (i.e., not 0), and that the last address in SID list 1 in the SRH header indicates that a G-SID exists in SID list 1. At this time, network node C2 further finds that the address indicated by the SL value is not the last address, that the compression value corresponding to the address indicated by the SL value (i.e., SL=5) is 4 (i.e., not 0), and that the SI included in the destination address in the IPv6 header is 3 (i.e., not 0). In this case, network node C2 updates the destination address in the IPv6 header to C::3:1:0:2, obtains SRv6 message 3, and sends SRv6 message 3 to the next-hop network node (i.e., network node C3).
[0078] Here, C::3:1:0:2 includes the common prefix in C::2:1:0:3, the G-SID (i.e., 3:1) preceding the G-SID (i.e., 2:1) included in the destination address before the update (i.e., C::2:1:0:3) in the address indicated by the SL value obtained by the network node C2 from SID list 1 based on the length of a G-SID indicated by the last address, and the SI corresponding to 3:1 (i.e., 2).
[0079] Network node C3 receives SRv6 message 3 and finds that SRv6 message 3 includes an IPv6 header and an SRH header, that SRv6 message 3 needs to be modified, that the SL value in the SRH header of SRv6 message 3 is 5 (i.e., not 0), and that the last address in SID list 1 in the SRH header indicates that a G-SID exists in SID list 1. At this time, network node C3 further finds that the address indicated by the SL value is not the last address, that the compression value corresponding to the address indicated by the SL value (i.e., SL=5) is 4 (i.e., not 0), and that the SI included in the destination address in the IPv6 header is 2 (i.e., not 0). In this case, network node C3 updates the destination address in the IPv6 header to C::4:1:0:1, obtains SRv6 message 4, and sends SRv6 message 4 to the next-hop network node (i.e., network node C4).
[0080] Here, C::4:1:0:1 includes the common prefix in C::3:1:0:2, the G-SID (i.e., 4:1) preceding the G-SID (i.e., 3:1) included in the destination address before the update (i.e., C::3:1:0:2) in the address indicated by the SL value obtained by the network node C3 from SID list 1 based on the length of a G-SID indicated by the last address, and the SI corresponding to 4:1 (i.e., 1).
[0081] Network node C4 receives SRv6 message 4 and finds that SRv6 message 4 includes an IPv6 header and an SRH header, that SRv6 message 4 needs to be modified, that the SL value in the SRH header of SRv6 message 4 is 5 (i.e., not 0), and that the last address in SID list 1 in the SRH header indicates that a G-SID exists in SID list 1. At this time, network node C4 further finds that the address indicated by the SL value is not the last address, that the compression value corresponding to the address indicated by the SL value (i.e., SL=5) is 4 (i.e., not 0), and that the SI included in the destination address in the IPv6 header is 1 (i.e., not 0). In this case, network node C4 updates the destination address in the IPv6 header to C::5:1:0:0, obtains SRv6 message 5, and sends SRv6 message 5 to the next-hop network node (i.e., network node C5).
[0082] Here, C::5:1:0:0 includes the common prefix in C::4:1:0:1, the G-SID (i.e., 5:1) preceding the G-SID (i.e., 4:1) included in the destination address before the update (i.e., C::4:1:0:1) in the address indicated by the SL value obtained by the network node C4 from SID list 1 based on the length of a G-SID indicated by the last address, and the SI corresponding to 5:1 (i.e., 0).
[0083] Network node C5 receives SRv6 message 5 and finds that SRv6 message 5 includes an IPv6 header and an SRH header, that SRv6 message 5 needs to be modified, that the SL value in the SRH header of SRv6 message 5 is 5 (i.e., not 0), and that the last address in SID list 1 in the SRH header indicates that there is a G-SID in SID list 1. At this time, network node C5 further finds that the address indicated by the SL value is not the last address, that the compression value corresponding to the address indicated by the SL value (i.e., SL=5) is 4 (i.e., not 0), and that the SI included in the destination address in the IPv6 header is 0. The compressed value corresponding to the address indicated by the SL value minus 1 (i.e., SL=4) is 0 and is 1 (i.e., not 0). This indicates that network node C5 and the network node corresponding to the G-SID (i.e., 6:1) included in the address indicated by the SL value minus 1 (i.e., network node D6) are located in the same compression domain. In this case, network node C5 subtracts 1 from the SL value (i.e., SL=4), updates the destination address in the IPv6 header to C::6:1:0:3, obtains SRv6 packet 6, and sends SRv6 packet 6 to the next-hop network node (i.e., network node C6).
[0084] Here, C::6:1:0:3 includes the common prefix in C::5:1:0:0, the last G-SID (i.e., 6:1) included in the address indicated by the SL value obtained by the network node C5 from SID list 1 based on the length of a G-SID indicated by the last second address minus 1 (i.e., SL=4), and the SI corresponding to 6:1 (i.e., 3).
[0085] Network node C6 receives SRv6 message 6 and finds that SRv6 message 6 includes an IPv6 header and an SRH header, that SRv6 message 6 needs to be modified, that the SL value in the SRH header of SRv6 message 6 is 4 (i.e., not 0), and that the last address in SID list 1 in the SRH header indicates that there is a G-SID in SID list 1. At this time, network node C6 further finds that the address indicated by the SL value is not the last address, that the compression value corresponding to the address indicated by the SL value (i.e., SL=4) is 1 (i.e., not 0), and that the destination address in the IPv6 header contains The enclosed SI is 3 (i.e., not 0), and the compressed value corresponding to the address indicated by the SL value minus 1 (i.e., SL=3) is 0. This indicates that the next-hop network node corresponding to network node C6 (i.e., network node D1) is configured with a normal SID. In this case, network node C6 subtracts 1 from the SL value (i.e., SL=3), updates the destination address in the IPv6 header to the address indicated by SL=3 in SID list 1 (i.e., D::1:1:0:0), obtains SRv6 message 7, and sends SRv6 message 7 to the next-hop network node (i.e., network node D1).
[0086] Network node D1 receives SRv6 message 7 and finds that SRv6 message 7 includes an IPv6 header and an SRH header, and needs to modify SRv6 message 7. The SL value in the SRH header of SRv6 message 7 is 3 (i.e., not 0), and the last address in the SID list 1 in the SRH header indicates that there is a G-SID in SID list 1. At this time, network node D1 further finds that the address indicated by the SL value is not the last address, the compressed value corresponding to the address indicated by the SL value is 0, and the address indicated by the SL value minus 1 (i.e., SL=2) is The compression value corresponding to the address is 4 (i.e., not 0), which means that the address indicated by the SL value minus 1 includes 4 G-SIDs. These 4 G-SIDs and the network node corresponding to the destination address in the IPv6 header (i.e., network node D1) are in the same compression domain. In this case, network node D1 subtracts 1 from the SL value (i.e., SL=2), updates the destination address in the IPv6 header to D::2:1:0:3, obtains SRv6 packet 8, and sends SRv6 packet 8 to the next-hop network node (i.e., network node D2).
[0087] Here, D::2:1:0:3 includes the common prefix in D::1:1:0:0 obtained by the network node D1 based on the length of a common prefix indicated by the last address, the last G-SID (i.e., 2:1) included in the address indicated by the SL value minus 1 (i.e., SL=2) obtained by the network node D1 from SID list 1 based on the length of a G-SID indicated by the last address, and the SI corresponding to 2:1 (i.e., 3).
[0088] Network node D2 receives SRv6 message 8 and finds that SRv6 message 8 includes an IPv6 header and an SRH header, that SRv6 message 8 needs to be modified, that the SL value in the SRH header of SRv6 message 8 is 2 (i.e., not 0), and that the last address in SID list 1 in the SRH header indicates that a G-SID exists in SID list 1. At this time, network node D2 further finds that the address indicated by the SL value is not the last address, that the compression value corresponding to the address indicated by the SL value (i.e., SL=2) is 4 (i.e., not 0), and that the SI included in the destination address in the IPv6 header is 3 (i.e., not 0). In this case, network node D2 updates the destination address in the IPv6 header to D::3:1:0:2, obtains SRv6 message 9, and sends SRv6 message 9 to the next-hop network node (i.e., network node D3).
[0089] Here, D::3:1:0:2 includes the common prefix in D::2:1:0:3, the G-SID (i.e., 3:1) preceding the G-SID (i.e., 2:1) included in the destination address before the update (i.e., D::2:1:0:3) in the address indicated by the SL value obtained by network node D2 from SID list 1 based on the length of a G-SID indicated by the last address, and the SI corresponding to 3:1 (i.e., 2).
[0090] Network node D3 receives SRv6 message 9 and finds that SRv6 message 9 includes an IPv6 header and an SRH header, that SRv6 message 9 needs to be modified, that the SL value in the SRH header of SRv6 message 9 is 2 (i.e., not 0), and that the last address in SID list 1 in the SRH header indicates that a G-SID exists in SID list 1. At this time, network node D3 further finds that the address indicated by the SL value is not the last address, that the compression value corresponding to the address indicated by the SL value (i.e., SL=2) is 4 (i.e., not 0), and that the SI included in the destination address in the IPv6 header is 2 (i.e., not 0). In this case, network node D3 updates the destination address in the IPv6 header to D::4:1:0:1, obtains SRv6 message 10, and sends SRv6 message 10 to the next-hop network node (i.e., network node D4).
[0091] Here, D::4:1:0:1 includes the common prefix in D::3:1:0:2, the G-SID (i.e., 4:1) preceding the G-SID (i.e., 3:1) included in the destination address before the update (i.e., D::3:1:0:2) in the address indicated by the SL value obtained by the network node D3 from SID list 1 based on the length of a G-SID indicated by the last address, and the SI corresponding to 4:1 (i.e., 1).
[0092] Network node D4 receives SRv6 message 10 and finds that SRv6 message 10 includes an IPv6 header and an SRH header, that SRv6 message 10 needs to be modified, that the SL value in the SRH header of SRv6 message 10 is 2 (i.e., not 0), and that the last address in SID list 1 in the SRH header indicates that a G-SID exists in SID list 1. At this time, network node D4 further finds that the address indicated by the SL value is not the last address, that the compression value corresponding to the address indicated by the SL value (i.e., SL=2) is 4 (i.e., not 0), and that the SI included in the destination address in the IPv6 header is 1 (i.e., not 0). In this case, network node D4 updates the destination address in the IPv6 header to D::5:1:0:0, obtains SRv6 message 11, and sends SRv6 message 11 to the next-hop network node (i.e., network node D5).
[0093] Here, D::5:1:0:0 includes the common prefix in D::4:1:0:1, the G-SID (i.e., 5:1) preceding the G-SID (i.e., 4:1) included in the destination address before the update (i.e., D::4:1:0:1) in the address indicated by the SL value obtained by network node D4 from SID list 1 based on the length of a G-SID indicated by the last address, and the SI corresponding to 5:1 (i.e., 0).
[0094] The network node D5 receives the SRv6 message 11 and finds that the SRv6 message 11 includes an IPv6 header and an SRH header, that the SRv6 message 11 needs to be modified, that the SL value in the SRH header of the SRv6 message 11 is 2 (i.e., not 0), and that the last address in the SID list 1 in the SRH header indicates that there is a G-SID in the SID list 1. At this time, the network node D5 further finds that the address indicated by the SL value is not the last address, that the compression value corresponding to the address indicated by the SL value (i.e., SL=2) is 4 (i.e., not 0), and that the S-SID included in the destination address in the IPv6 header is 0. I is 0, and the compression value corresponding to the address indicated by the SL value minus 1 (i.e., SL=4) is 1 (i.e., not 0). This indicates that network node D5 and the network node corresponding to the G-SID (i.e., 6:1) included in the address indicated by the SL value minus 1 (i.e., network node D6) are located in the same compression domain. In this case, network node D5 subtracts 1 from the SL value (i.e., SL=1), updates the destination address in the IPv6 header to D::6:1:0:3, obtains SRv6 message 12, and sends SRv6 message 12 to the next-hop network node (i.e., network node D6).
[0095] Here, D::6:1:0:3 includes the common prefix in D::5:1:0:0, the last G-SID (i.e., 6:1) included in the address indicated by the SL value minus 1 (i.e., SL=1) obtained by the network node D5 from SID list 1 based on the length of a G-SID indicated by the last second address, and the SI corresponding to 6:1 (i.e., 3).
[0096] The network node D6 receives the SRv6 message 12 and finds that the SRv6 message 12 includes an IPv6 header and an SRH header, that the SRv6 message 12 needs to be modified, that the SL value in the SRH header of the SRv6 message 12 is 1 (i.e., not 0), and that the last address in the SID list 1 in the SRH header indicates that there is a G-SID in the SID list 1. At this time, the network node D6 further finds that the address indicated by the SL value is not the last address, that the compression value corresponding to the address indicated by the SL value (i.e., SL=1) is 1, and that the S The compressed value corresponding to the address indicated by the L value minus 1 (i.e., SL=0) is 0, and network node D6 supports PSP behavior. This indicates that the next-hop network node corresponding to network node D6 (i.e., network node B) is configured with a normal SID. In this case, network node D6 updates the destination address in the IPv6 header to the address indicated by the SL value minus 1 (SL=0) in SID list 1 (i.e., B::200), and pops off the SRH header to obtain SRv6 message 13, and sends SRv6 message 13 to network node B.
[0097] When network node B receives SRv6 message 13 and finds that SRv6 message 13 only includes an IPv6 header and the destination address in the IPv6 header is its own ordinary SID, it removes the IPv6 header of SRv6 message 13, obtains data message 1, and forwards data message 1. The specific forwarding process is existing technology and will not be described in detail here.
[0098] As can be seen from the above technical solution, in the embodiment of the present application, there is no need to add the COC attribute, which saves resource configuration. In addition, the last address in the SID list in the SRH header is used to indicate the presence of a G-SID in the SID list. Based on the length of a G-SID indicated by the last address in the SID list in the SRH header and the compression value corresponding to each address in the SID list, the forwarding of the SRv6 message is guided, simplifying the message processing process.
[0099] Based on the same inventive concept, the present application also provides a message processing device, which is applied to a network node, and its structural diagram is shown as follows: Figure 3 As shown, specifically including:
[0100] Receiving module 31, used for receiving messages;
[0101] An encapsulation module 32 is configured to, if the message is a data message, generate a first SID list corresponding to the forwarding path when it is determined that the message needs to be forwarded through a target SRv6-TE policy and a network node configured with a G-SID exists among the network nodes on the forwarding path corresponding to the target SRv6-TE policy, and encapsulate the message into an SRv6 message based on the first SID list and then forward it to the next-hop network node, wherein the last first address in the first SID list in the SRH header of the SRv6 message indicates the existence of a G-SID in the first SID list, the length of a common prefix, the length of a G-SID, and compressed values corresponding to other first addresses in the first SID list except the last first address, where the compressed value is used to represent the total number of G-SIDs included in the corresponding address;
[0102] A processing module 33 is configured to: if the message is an SRv6 message, the message includes an IPv6 header and an SRH header, it is determined that the message needs to be modified, the SL value in the SRH header is not 0, and the last second address in the second SID list in the SRH header indicates that a G-SID exists in the second SID list, then, when the address indicated by the SL value is the second address, modify the message according to the destination address in the IPv6 header, the second SID list, the compressed value corresponding to the address indicated by the SL value minus 1, and the length of a common prefix and a length of a G-SID indicated by the second address, and send the modified message to the next-hop network node; or,
[0103] When the address indicated by the SL value is not the second address, the message is modified based on at least the destination address in the IPv6 header, the SL value, the second SID list, the length of a common prefix indicated by the second address, the length of a G-SID, a first compression value corresponding to the address indicated by the SL value, and a second compression value corresponding to the address indicated by the SL value minus 1, and the modified message is sent to the next-hop network node.
[0104] Preferably, the processing module 33 is specifically configured to determine whether the message needs to be modified by:
[0105] If a common SID is configured for the packet, then when the destination address included in the IPv6 header is the common SID of the packet, it is determined that the packet needs to be modified.
[0106] If the G-SID is configured for itself, when the destination address included in the IPv6 header includes the public prefix corresponding to its own G-SID and its own G-SID, it is determined that the message needs to be modified.
[0107] Preferably, the processing module 33 is specifically configured to implement the step of modifying the message according to the destination address in the IPv6 header, the second SID list, the compressed value corresponding to the address indicated by the SL value minus 1, and the length of a common prefix indicated by the second address and the length of a G-SID in the following manner:
[0108] If the compressed value corresponding to the address indicated by the SL value minus 1 is 0, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value minus 1 in the second SID list;
[0109] If the compressed value corresponding to the address indicated by the SL value minus 1 is not 0, the SL value is reduced by 1 and the destination address in the IPv6 header is updated to the target address;
[0110] The target address includes, in sequence, the common prefix included in the destination address before the update obtained based on the length of a common prefix indicated by the second address, the last G-SID included in the address indicated by the SL value minus 1 obtained from the second SID list based on the length of a G-SID indicated by the second address, and the segment index SI corresponding to the last G-SID.
[0111] Preferably, the processing module 33 is specifically configured to implement the step of modifying the message according to at least the destination address in the IPv6 header, the SL value, the second SID list, the length of a common prefix indicated by the second address, the length of a G-SID, a first compressed value corresponding to the address indicated by the SL value, and a second compressed value corresponding to the address indicated by the SL value minus 1, in the following manner:
[0112] If the SL value is greater than 1, when the first compressed value corresponding to the address indicated by the SL value indicated by the second address is 0 and the second compressed value corresponding to the address indicated by the SL value indicated by the second address after deducting 1 is not 0, the SL value is deducted by 1, and the destination address in the IPv6 header is updated to the first address, wherein the first address sequentially includes the first common prefix included in the address indicated by the SL value obtained based on the length of a common prefix indicated by the second address, the last first G-SID included in the address indicated by the SL value obtained from the second SID list after deducting 1 based on the length of a G-SID indicated by the second address, and the first SI corresponding to the first G-SID; or,
[0113] when the first compression value and the second compression value are both 0, reducing the SL value by 1 and updating the destination address in the IPv6 header to an address indicated by the second SID list after the SL value is reduced by 1; or
[0114] when the first compression value is not 0, if a second SI included in the destination address in the IPv6 header is not 0, when the second compression value is 0, reducing the SL value by 1 and updating the destination address in the IPv6 header to an address indicated by the second SID list after the SL value is reduced by 1, or when the second compression value is not 0, updating the destination address in the IPv6 header to a second address, wherein the second address includes a second common prefix included in the destination address before the update, a third G-SID located in front of a second G-SID included in the destination address before the update in an address indicated by the second SID list based on a length of one G-SID indicated by the second address and indicated by the SL value, and a third SI which is the second SI minus 1;
[0115] when the second SI is 0, when the second compression value is 0, reducing the SL value by 1 and updating the destination address in the IPv6 header to an address indicated by the second SID list after the SL value is reduced by 1, or when the second compression value is not 0, reducing the SL value by 1 and updating the destination address in the IPv6 header to a third address, wherein the third address includes, in sequence, a third common prefix included in the destination address before the update, a last fourth G-SID included in an address indicated by the second SID list based on the length of one G-SID indicated by the second address after the SL value is reduced by 1, and a fourth SI corresponding to the fourth G-SID;
[0116] when the SL value is equal to 1, when the first compression value and the second compression value are both 0, if the SRH PSP behavior is supported, updating the destination address in the IPv6 header to an address indicated by the second SID list after the SL value is reduced by 1, and popping off the SRH header, or if the PSP behavior is not supported, reducing the SL value by 1 and updating the destination address in the IPv6 header to an address indicated by the second SID list after the SL value is reduced by 1; or
[0117] when the first compression value is not 0 and the second compression value is 0, if the first compression value is equal to 1, then when the device itself supports the PSP behavior, the destination address in the IPv6 header is updated to the address indicated by the SL value minus 1 in the second SID list, and the SRH header is popped, or when the device itself does not support the PSP behavior, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value minus 1 in the second SID list;
[0118] when the first compression value is greater than 1, and the fifth SI included in the destination address in the IPv6 header is not 0, the destination address in the IPv6 header is updated to a fourth address, wherein the fourth address includes a fourth common prefix included in the destination address before the update, an address indicated by the SL value obtained from the second SID list based on the length of one G-SID of the second address indicated by the device itself, a fifth G-SID before the G-SID included in the destination address before the update, and a sixth SI corresponding to the fifth G-SID, the sixth SI being the fifth SI minus 1;
[0119] when the first compression value is greater than 1, and the fifth SI included in the destination address in the IPv6 header is 0, when the device itself supports the PSP behavior, the destination address in the IPv6 header is updated to the address indicated by the SL value minus 1 in the second SID list, and the SRH header is popped, or when the device itself does not support the PSP behavior, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value minus 1 in the second SID list.
[0120] Preferably, the processing module 33 is further configured to:
[0121] when the packet is an SRv6 packet, the packet includes an IPv6 header and a G-SRH header, and the SL value in the G-SRH header is 0, the IPv6 header and the G-SRH header of the packet are popped, and the popped packet is forwarded; or
[0122] when the packet is an SRv6 packet, the packet only includes an IPv6 header, and the destination address in the IPv6 header is the SID of the device itself, the IPv6 header of the packet is popped, and the popped packet is forwarded.
[0123] As can be seen from the above technical solution, in the embodiment of the present application, there is no need to add the COC attribute, which saves resource configuration. In addition, the last address in the SID list in the SRH header is used to indicate the presence of a G-SID in the SID list. Based on the length of a G-SID indicated by the last address in the SID list in the SRH header and the compression value corresponding to each address in the SID list, the forwarding of the SRv6 message is guided, simplifying the message processing process.
[0124] The present application also provides an electronic device, such as Figure 4 As shown, it includes a processor 41 and a machine-readable storage medium 42, wherein the machine-readable storage medium 42 stores machine-executable instructions that can be executed by the processor 41, and the processor 41 is prompted by the machine-executable instructions to implement the steps of the above-mentioned message processing method.
[0125] The machine-readable storage medium may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Alternatively, the machine-readable storage medium may be at least one storage device located remote from the processor.
[0126] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0127] In another embodiment provided by the present application, a computer-readable storage medium is further provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned message processing method are implemented.
[0128] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A message processing method, characterized in that: The method is applied to a network node, and the method includes: Receive messages; If the message is a data message, when it is determined that the message needs to be forwarded through the target Internet Protocol Version 6 IPv6 Segment Routing SRv6-Traffic Engineering TE policy, and there is a network node configured with a general segment identifier G-SID among the network nodes on the forwarding path corresponding to the target SRv6-TE policy, a first SID list corresponding to the forwarding path is generated, and based on the first SID list, the message is encapsulated as an SRv6 message and forwarded to the next-hop network node, wherein the last first address in the first SID list in the routing extension header (SRH) of the SRv6 message indicates the existence of a G-SID in the first SID list, the length of a common prefix, the length of a G-SID, and the compressed values corresponding to the other first addresses in the first SID list except the last first address, where the compressed value is used to represent the total number of G-SIDs included in the corresponding address; If the message is an SRv6 message, the message includes an IPv6 header and an SRH header, it is determined that the message needs to be modified, the SL value of the remaining segment in the SRH header is not 0, and the last second address in the second SID list in the SRH header indicates that a G-SID exists in the second SID list, then when the address indicated by the SL value is the second address, according to the destination address in the IPv6 header, the second SID list, the compressed value corresponding to the address indicated by the SL value minus 1, and the length of a common prefix and a length of a G-SID indicated by the second address, the message is modified and sent to the next hop network node; or, When the address indicated by the SL value is not the second address, the message is modified based on at least the destination address in the IPv6 header, the SL value, the second SID list, the length of a common prefix indicated by the second address, the length of a G-SID, a first compression value corresponding to the address indicated by the SL value, and a second compression value corresponding to the address indicated by the SL value minus 1, and the modified message is sent to the next-hop network node.
2. The method according to claim 1, characterized in that Determine whether the message needs to be modified by: If a common SID is configured for the packet, then when the destination address included in the IPv6 header is the common SID of the packet, it is determined that the packet needs to be modified. If the G-SID is configured for itself, when the destination address included in the IPv6 header includes the public prefix corresponding to its own G-SID and its own G-SID, it is determined that the message needs to be modified.
3. The method according to claim 1, characterized in that Modifying the message according to the destination address in the IPv6 header, the second SID list, a compressed value corresponding to the address indicated by the SL value minus 1, and a length of a common prefix and a length of a G-SID indicated by the second address, specifically comprising: If the compressed value corresponding to the address indicated by the SL value minus 1 is 0, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value minus 1 in the second SID list; If the compressed value corresponding to the address indicated by the SL value minus 1 is not 0, the SL value is reduced by 1 and the destination address in the IPv6 header is updated to the target address; The target address includes, in sequence, the common prefix included in the destination address before the update obtained based on the length of a common prefix indicated by the second address, the last G-SID included in the address indicated by the SL value minus 1 obtained from the second SID list based on the length of a G-SID indicated by the second address, and the segment index SI corresponding to the last G-SID.
4. The method according to claim 1, wherein Modifying the message based on at least the destination address in the IPv6 header, the SL value, the second SID list, the length of a common prefix indicated by the second address, the length of a G-SID, a first compressed value corresponding to the address indicated by the SL value, and a second compressed value corresponding to the address indicated by the SL value minus 1, specifically comprising: If the SL value is greater than 1, when the first compressed value corresponding to the address indicated by the SL value indicated by the second address is 0 and the second compressed value corresponding to the address indicated by the SL value indicated by the second address after deducting 1 is not 0, the SL value is deducted by 1, and the destination address in the IPv6 header is updated to the first address, wherein the first address sequentially includes the first common prefix included in the address indicated by the SL value obtained based on the length of a common prefix indicated by the second address, the last first G-SID included in the address indicated by the SL value obtained from the second SID list after deducting 1 based on the length of a G-SID indicated by the second address, and the first SI corresponding to the first G-SID; or, When both the first compression value and the second compression value are 0, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value reduced by 1 in the second SID list; or When the first compression value is not 0, if the second SI included in the destination address in the IPv6 header is not 0, then, when the second compression value is 0, decrement the SL value by 1, and update the destination address in the IPv6 header to the address indicated by the SL value decremented by 1 in the second SID list; or, when the second compression value is not 0, update the destination address in the IPv6 header to the second address, where the second address includes the second common prefix included in the destination address before the update, a third G-SID in the address indicated by the SL value obtained from the second SID list based on the length of a G-SID indicated by the second address, and a third SI, where the third SI is the second SI decremented by 1; If the second SI is 0, when the second compression value is 0, the SL value is decremented by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value decremented by 1 in the second SID list; or, when the second compression value is not 0, the SL value is decremented by 1, and the destination address in the IPv6 header is updated to a third address, where the third address sequentially includes the third common prefix included in the destination address before the update, the last fourth G-SID included in the address indicated by the SL value decremented by 1 obtained from the second SID list based on the length of a G-SID indicated by the second address, and the fourth SI corresponding to the fourth G-SID; If the SL value is equal to 1, when the first compression value and the second compression value are both 0, if the second last segment pop-up SRH PSP behavior is supported, the destination address in the IPv6 header is updated to the address indicated by the SL value in the second SID list minus 1, and the SRH header is popped out; if the second last segment pop-up SRH PSP behavior is not supported, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value in the second SID list minus 1; or, When the first compression value is not 0 and the second compression value is 0, if the first compression value is equal to 1, then, if the PSP behavior is supported, the destination address in the IPv6 header is updated to the address indicated by the SL value in the second SID list minus 1, and the SRH header is discarded; or, if the PSP behavior is not supported, the SL value is decremented by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value in the second SID list minus 1; If the first compression value is greater than 1 and the fifth SI included in the destination address in the IPv6 header is not 0, updating the destination address in the IPv6 header to a fourth address, where the fourth address includes the fourth common prefix included in the destination address before the update, a fifth G-SID preceding the G-SID included in the destination address before the update in the address indicated by the SL value obtained from the second SID list based on the length of a G-SID indicated by the second address, and a sixth SI corresponding to the fifth G-SID, where the sixth SI is the fifth SI minus 1; If the first compression value is greater than 1 and the fifth SI included in the destination address in the IPv6 header is 0, then when it supports PSP behavior, the destination address in the IPv6 header is updated to the address indicated by the SL value in the second SID list minus 1, and the SRH header is discarded, or, when it does not support PSP behavior, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value in the second SID list minus 1.
5. The method according to claim 1, wherein The method further comprises: When the message is an SRv6 message, the message includes an IPv6 header and an SRH header, and the SL value in the G-SRH header is 0, discard the IPv6 header and the G-SRH header of the message, and forward the discarded message; or When the message is an SRv6 message, the message includes only an IPv6 header, and the destination address in the IPv6 header is its own SID, the IPv6 header of the message is ejected, and the message after being ejected is forwarded.
6. A message processing device, characterized in that: The device is applied to a network node, and includes: A receiving module, used for receiving messages; an encapsulation module configured to, if the message is a data message, generate a first SID list corresponding to the forwarding path when it is determined that the message needs to be forwarded through a target Internet Protocol version 6 (IPv6) segment routing (SRv6)-traffic engineering (TE) policy, and a network node configured with a general segment identifier (G-SID) exists among the network nodes on the forwarding path corresponding to the target SRv6-TE policy; and, based on the first SID list, encapsulate the message into an SRv6 message and forward it to the next-hop network node, wherein the last first address in the first SID list in an extended routing header (SRH) of the SRv6 message indicates the presence of a G-SID in the first SID list, the length of a common prefix, the length of a G-SID, and compressed values corresponding to other first addresses in the first SID list except the last first address, where the compressed value is used to represent the total number of G-SIDs included in the corresponding address; a processing module, configured to: if the message is an SRv6 message, the message includes an IPv6 header and an SRH header, it is determined that the message needs to be modified, the SL value of the remaining segment in the SRH header is not 0, and the last second address in the second SID list in the SRH header indicates that a G-SID exists in the second SID list, then, when the address indicated by the SL value is the second address, modify the message according to the destination address in the IPv6 header, the second SID list, the compressed value corresponding to the address indicated by the SL value minus 1, and the length of a common prefix and a length of a G-SID indicated by the second address, and send the modified message to the next-hop network node; or, When the address indicated by the SL value is not the second address, the message is modified based on at least the destination address in the IPv6 header, the SL value, the second SID list, the length of a common prefix indicated by the second address, the length of a G-SID, a first compression value corresponding to the address indicated by the SL value, and a second compression value corresponding to the address indicated by the SL value minus 1, and the modified message is sent to the next-hop network node.
7. The device according to claim 6, characterized in that The processing module is specifically used to: If the compressed value corresponding to the address indicated by the SL value minus 1 is 0, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value minus 1 in the second SID list; If the compressed value corresponding to the address indicated by the SL value minus 1 is not 0, the SL value is reduced by 1 and the destination address in the IPv6 header is updated to the target address; The target address includes, in sequence, the common prefix included in the destination address before the update obtained based on the length of a common prefix indicated by the second address, the last G-SID included in the address indicated by the SL value minus 1 obtained from the second SID list based on the length of a G-SID indicated by the second address, and the segment index SI corresponding to the last G-SID.
8. The device according to claim 6, characterized in that The processing module is specifically used to: If the SL value is greater than 1, when the first compressed value corresponding to the address indicated by the SL value indicated by the second address is 0 and the second compressed value corresponding to the address indicated by the SL value indicated by the second address after deducting 1 is not 0, the SL value is deducted by 1, and the destination address in the IPv6 header is updated to the first address, wherein the first address sequentially includes the first common prefix included in the address indicated by the SL value obtained based on the length of a common prefix indicated by the second address, the last first G-SID included in the address indicated by the SL value obtained from the second SID list after deducting 1 based on the length of a G-SID indicated by the second address, and the first SI corresponding to the first G-SID; or, When both the first compression value and the second compression value are 0, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value reduced by 1 in the second SID list; or When the first compression value is not 0, if the second SI included in the destination address in the IPv6 header is not 0, then, when the second compression value is 0, decrement the SL value by 1, and update the destination address in the IPv6 header to the address indicated by the SL value decremented by 1 in the second SID list; or, when the second compression value is not 0, update the destination address in the IPv6 header to the second address, where the second address includes the second common prefix included in the destination address before the update, a third G-SID in the address indicated by the SL value obtained from the second SID list based on the length of a G-SID indicated by the second address, and a third SI, where the third SI is the second SI decremented by 1; If the second SI is 0, when the second compression value is 0, the SL value is decremented by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value decremented by 1 in the second SID list; or, when the second compression value is not 0, the SL value is decremented by 1, and the destination address in the IPv6 header is updated to a third address, where the third address sequentially includes the third common prefix included in the destination address before the update, the last fourth G-SID included in the address indicated by the SL value decremented by 1 obtained from the second SID list based on the length of a G-SID indicated by the second address, and the fourth SI corresponding to the fourth G-SID; If the SL value is equal to 1, when the first compression value and the second compression value are both 0, if the second last segment pop-up SRH PSP behavior is supported, the destination address in the IPv6 header is updated to the address indicated by the SL value in the second SID list minus 1, and the SRH header is popped out; if the second last segment pop-up SRH PSP behavior is not supported, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value in the second SID list minus 1; or, When the first compression value is not 0 and the second compression value is 0, if the first compression value is equal to 1, then, if the PSP behavior is supported, the destination address in the IPv6 header is updated to the address indicated by the SL value in the second SID list minus 1, and the SRH header is discarded; or, if the PSP behavior is not supported, the SL value is decremented by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value in the second SID list minus 1; If the first compression value is greater than 1 and the fifth SI included in the destination address in the IPv6 header is not 0, updating the destination address in the IPv6 header to a fourth address, where the fourth address includes the fourth common prefix included in the destination address before the update, a fifth G-SID preceding the G-SID included in the destination address before the update in the address indicated by the SL value obtained from the second SID list based on the length of a G-SID indicated by the second address, and a sixth SI corresponding to the fifth G-SID, where the sixth SI is the fifth SI minus 1; If the first compression value is greater than 1 and the fifth SI included in the destination address in the IPv6 header is 0, then when it supports PSP behavior, the destination address in the IPv6 header is updated to the address indicated by the SL value in the second SID list minus 1, and the SRH header is discarded, or, when it does not support PSP behavior, the SL value is reduced by 1, and the destination address in the IPv6 header is updated to the address indicated by the SL value in the second SID list minus 1.
9. An electronic device, characterized in that: The method comprises a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to implement the method steps according to any one of claims 1 to 5.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Message forwarding method and device of SRV6 protocol, electronic equipment and medium
CN113726654A
Message processing method and device, electronic equipment and medium
CN113973074A