Method, device, storage medium and electronic device for inserting message forwarding path
By dividing the routing path into multiple segment sets and adjusting the routing information, the method improves the editing efficiency of message forwarding paths, enabling efficient handling of complex routing scenarios with reduced editing demands.
Patent Information
- Application Number
- CN202111621057.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2041-12-27
AI Technical Summary
Existing technologies face low editing efficiency in managing multiple layers of routing segments for message forwarding paths, particularly in scenarios requiring seven or more routing segments, placing high demands on the editing capabilities of ingress devices.
The method involves dividing the routing path into multiple routing segment sets, inserting target routing segment sets into the initial message multiple times, and adjusting the intermediate routing information to obtain a target message that indicates the routing path, thereby reducing the editing requirements and improving efficiency.
This approach enhances the editing efficiency of message forwarding paths by allowing longer paths to be inserted with lower editing capabilities, effectively addressing the inefficiencies in existing systems.
Smart Images

Figure CN116366517B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of message processing, and in particular, to a method, device, storage medium and electronic device for inserting a message forwarding path. Background Art
[0002] SR is a protocol designed based on the source routing concept to forward data packets on the network, and supports explicit specification of the data packet forwarding path at the source node. When SR is deployed on the sixth version of the Internet Protocol (Internet Protocol Version 6, referred to as IPv6) data plane, it is called IPv6 segment routing (SRv6), in which SRv6 extends the segment routing header (SRH) on the basis of IPv6. SRH includes a segment list (segmentlist) to support the programming of the entire forwarding path at the ingress device of the forwarding path. Specifically, the segment list includes multiple segment identifications (SIDs) arranged in sequence, and each SID corresponds to a node or link in the message forwarding path. The SRH including the segment list is encapsulated in the data message. Therefore, in the message forwarding process, the forwarding processing indicated by each SID in the segment list is executed in sequence to realize message forwarding.
[0003] During actual use, there may be a need to include multiple layers of routing segments in the forwarding path. This requires the ingress device to have the ability to edit multiple layers of Segment Lists. For example, the actual application scenario requires the forwarding path to contain seven routing segments. In this case, the ingress device is required to have the ability to edit seven layers of Segment Lists, so as to edit a forwarding path with seven routing segments according to the needs of the scenario. Therefore, this places high demands on the editing capabilities of the ingress device.
[0004] With regard to the problem of low editing efficiency of message forwarding paths existing in the related art, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a method, device, storage medium and electronic device for inserting a message forwarding path, so as to at least solve the problem of low editing efficiency of the message forwarding path existing in the related art.
[0006] According to one embodiment of the present invention, a method for inserting a message forwarding path is provided, comprising: obtaining multiple routing segment sets corresponding to an initial message to be forwarded, wherein the multiple routing segment sets are obtained by dividing the routing path of the initial message; inserting a target routing segment set from the multiple routing segment sets into the initial message in multiple times to obtain an intermediate message carrying intermediate routing information, wherein the target routing segment set has a corresponding relationship with the intermediate routing information; adjusting the intermediate routing information to target routing information to obtain a target message carrying the target routing information, wherein the target routing information is used to indicate the routing path, and the target message is used to route according to the routing path.
[0007] Optionally, inserting a target routing segment set from the multiple routing segment sets into the initial message in multiple times to obtain an intermediate message carrying intermediate routing information includes: determining a first routing segment set and a second routing segment set from the multiple routing segment sets as the target routing segment set, wherein the number of routing segments included in the first routing segment set matches a routing segment editing attribute, and the number of routing segments included in the second routing segment set matches the routing segment editing attribute, and the routing segment editing attribute is used to indicate the number of routing segments allowed to be edited when editing routing information at a single time; according to the arrangement order of the routing segments included in each routing segment set in the target routing segment set in the routing path, inserting the first routing information corresponding to the first routing segment set and the second routing information corresponding to the second routing segment set into the target position of the protocol message header of the initial message in sequence to obtain the intermediate message, wherein the intermediate routing information includes the first routing information and the second routing information.
[0008] Optionally, according to the arrangement order of the routing segments included in each routing segment set in the target routing segment set in the routing path, the first routing information corresponding to the first routing segment set and the second routing information corresponding to the second routing segment set are inserted into the target position of the protocol message header of the initial message in sequence, and the intermediate message is obtained, including: when the routing segments included in the first routing segment set are before the routing segments included in the second routing segment set in the routing path, the first routing message header and the routing segments included in the first routing segment set are inserted into the target position of the initial message to obtain the first message, wherein the first routing information includes the first routing message header and the routing segments included in the first routing segment set; the second routing message header and the routing segments included in the second routing segment set are inserted into the target position of the first message to obtain the intermediate message, wherein the second routing information includes the second routing message header and the routing segments included in the second routing segment set.
[0009] Optionally, adjusting the intermediate routing information to the target routing information to obtain the target message carrying the target routing information includes: performing an editing operation on the routing message header corresponding to the target routing segment set included in the intermediate routing information to obtain a routing message header to be processed and an intermediate routing segment set, wherein the intermediate routing segment set includes routing segments included in the target routing segment set arranged in the order of arrangement of routing segments in the routing path; adjusting the intermediate routing segment set according to whether the target routing segment set is a set of all routing segments in the multiple routing segment sets to obtain a second message carrying the routing message header to be processed and the routing path; adjusting the routing message header to be processed carried by the second message to a target routing message header according to the routing path to obtain the target message carrying the target routing information, wherein the target routing information includes the target routing message header and the routing path.
[0010] Optionally, performing an editing operation on the routing message header included in the intermediate routing information and corresponding to the target routing segment set to obtain the routing message header to be processed and the intermediate routing segment set includes: changing the second routing message header in the intermediate routing information to the routing message header to be processed to obtain a third message, wherein the data in the routing message header to be processed is the same as the data in the first routing message header, the intermediate routing information includes the first routing information corresponding to the first routing segment set and the second routing information corresponding to the second routing segment set, the target routing segment set includes the first routing segment set and the second routing segment set, the first routing information includes the first routing message header and the routing segments included in the first routing segment set, the second routing information includes the second routing message header and the reason segments included in the second routing segment set, and in the routing path, the routing segments included in the first routing segment set are before the routing segments included in the second routing segment set; deleting the first routing message header in the third message to obtain the routing message header to be processed and the intermediate routing segment set.
[0011] Optionally, adjusting the intermediate routing segment set according to whether the target routing segment set is the entire routing segment set in the multiple routing segment sets includes: when the target routing segment set is not the entire routing segment set in the multiple routing segment sets, and the multiple routing segment sets also include a third routing segment set, inserting the routing segments included in the third routing segment set into the position corresponding to the target offset value in the intermediate routing segment set to obtain the routing path, wherein the target routing segment set includes the first routing segment set and the second routing segment set; when the target routing segment set is the entire routing segment set in the multiple routing segment sets, determining the routing segments included in the intermediate routing segment set as the routing path.
[0012] Optionally, according to the routing path, the to-be-processed routing message header carried by the second message is adjusted to a target routing message header, and the target message carrying the target routing information is obtained, including: adjusting the target field in the to-be-processed routing message header according to the routing information of multiple routing segments included in the routing path, to obtain the target routing message header, wherein the target field is used to indicate the routing information.
[0013] According to another embodiment of the present invention, there is also provided a device for inserting a message forwarding path, comprising: an acquisition module, used to acquire multiple routing segment sets corresponding to an initial message to be forwarded, wherein the multiple routing segment sets are obtained by dividing the routing path of the initial message; an insertion module, used to insert a target routing segment set from the multiple routing segment sets into the initial message in multiple times, to obtain an intermediate message carrying intermediate routing information, wherein the target routing segment set has a corresponding relationship with the intermediate routing information; an adjustment module, used to adjust the intermediate routing information to target routing information, to obtain a target message carrying the target routing information, wherein the target routing information is used to indicate the routing path, and the target message is used to route according to the routing path.
[0014] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when run.
[0015] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0016] According to the present invention, a plurality of routing segment sets corresponding to an initial message to be forwarded are obtained, wherein the plurality of routing segment sets are obtained by dividing the routing path of the initial message; a target routing segment set in the plurality of routing segment sets is inserted into the initial message for multiple times to obtain an intermediate message carrying intermediate routing information, wherein the target routing segment set has a corresponding relationship with the intermediate routing information; the intermediate routing information is adjusted to target routing information to obtain a target message carrying the target routing information, wherein the target routing information is used to indicate the routing path, and the target message is used to perform routing according to the routing path, that is, the routing path of the initial message is divided into a plurality of routing segment sets, and a target routing segment set in the plurality of routing segment sets is inserted into the initial message for multiple times to obtain an intermediate message carrying intermediate routing information, wherein the target routing segment set has a corresponding relationship with the intermediate routing information; the intermediate routing information is adjusted to target routing information to obtain a target message carrying the target routing information, wherein the target routing information is used to indicate the routing path, and the target message is used to perform routing according to the routing path, that is, the routing path of the initial message is divided into a plurality of routing segment sets, The target routing segment set is inserted into the initial message multiple times, so that the initial message carries the intermediate information corresponding to the target routing set, and then the target message carrying the target routing information can be obtained, so that the initial message is routed according to the routing path. By inserting the target routing segment sets in multiple routing sets into the initial message multiple times, the requirements for the editing capability of routing information are reduced, and the business needs of completing the higher routing information editing capability through the lower routing information editing capability are realized, and then the operation of inserting a longer forwarding path into the message is completed through the lower routing information editing capability. Therefore, the problem of low editing efficiency of the message forwarding path existing in the related art is solved, and the effect of improving the editing efficiency of the message forwarding path is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a block diagram of the hardware structure of a mobile terminal of the method for inserting a message forwarding path according to an embodiment of the present invention;
[0018] Figure 2 is a flow chart of a method for inserting a message forwarding path according to an embodiment of the present invention;
[0019] Figure 3 is a schematic diagram of an optional target message according to an embodiment of the present invention;
[0020] Figure 4 is a schematic diagram of an optional target message format according to an embodiment of the present invention;
[0021] Figure 5 is an optional message forwarding path insertion flow chart according to an embodiment of the present invention;
[0022] Figure 6 is a schematic diagram of an optional message structure according to an embodiment of the present invention;
[0023] Figure 7 It is a structural block diagram of a device for inserting a message forwarding path according to an embodiment of the present invention. DETAILED DESCRIPTION
[0024] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in combination with the embodiments.
[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0026] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 1 is a block diagram of the hardware structure of a mobile terminal according to the method for inserting a message forwarding path according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0027] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for inserting the message forwarding path in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0028] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0029] In this embodiment, a method for inserting a message forwarding path is provided. Figure 2 is a flow chart of a method for inserting a message forwarding path according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0030] Step S202, obtaining a plurality of routing segment sets corresponding to the initial message to be forwarded, wherein the plurality of routing segment sets are obtained by dividing the routing path of the initial message;
[0031] Step S204, inserting a target routing segment set from the plurality of routing segment sets into the initial message in multiple times to obtain an intermediate message carrying intermediate routing information, wherein the target routing segment set has a corresponding relationship with the intermediate routing information;
[0032] Step S206: Adjust the intermediate routing information to target routing information, and obtain a target message carrying the target routing information, wherein the target routing information is used to indicate the routing path, and the target message is used to perform routing according to the routing path.
[0033] Through the above steps, the routing path of the initial message is divided into multiple routing segment sets, and the target routing segment sets in the multiple routing segment sets are inserted into the initial message multiple times, so that the initial message carries the intermediate information corresponding to the target routing set, and then the target message carrying the target routing information can be obtained, so that the initial message is routed according to the routing path, and the target routing segment sets in the multiple routing sets are inserted into the initial message multiple times, thereby reducing the requirements for the editing capability of the routing information, and achieving the business needs of completing the higher routing information editing capability through the lower routing information editing capability, and then achieving the operation of inserting a longer forwarding path into the message through the lower routing information editing capability. Therefore, the problem of low editing efficiency of the message forwarding path existing in the related art is solved, and the effect of improving the editing efficiency of the message forwarding path is achieved.
[0034] This solution is applied to devices with message editing capabilities, including but not limited to switches, routers, mobile terminal devices, etc.
[0035] In the technical solution provided in the above step S202, the multiple routing segment sets of the initial message can be a routing segment set obtained by other devices or modules, or can be obtained by dividing the routing path according to the routing segment editing attribute used to indicate that the single editing of routing information is the number of routing segments allowed to be edited. This solution does not limit this.
[0036] Optionally, in this embodiment, the number of routing segments in each routing segment set in the multiple routing segment sets may be the same or different, and this solution does not limit this.
[0037] In the technical solution provided in the above step S204, the multiple routing segment sets may include only multiple target routing segment sets, or may include other routing segment sets whose number of routing segments is less than the number of routing segments in the target routing segment set. For example, each target routing segment set includes 3 routing segments. When the routing path includes 6 routing segments, the routing path can be divided into two target routing segment sets. When the routing path includes 7 routing segments, the routing path can be divided into two target routing segment sets and one other routing segment set including only one routing segment.
[0038] In the technical solution provided in the above step S206, the target routing information may include but is not limited to the routing segment information of the target routing message header and the routing segment in the routing path.
[0039] As an optional embodiment, inserting the target routing segment set in the plurality of routing segment sets into the initial message multiple times to obtain the intermediate message carrying the intermediate routing information includes:
[0040] Determine a first routing segment set and a second routing segment set from the plurality of routing segment sets as the target routing segment set, wherein the number of routing segments included in the first routing segment set matches a routing segment editing attribute, and the number of routing segments included in the second routing segment set matches the routing segment editing attribute, and the routing segment editing attribute is used to indicate the number of routing segments allowed to be edited when editing routing information at a single time;
[0041] According to the arrangement order of the routing segments included in each routing segment set in the target routing segment set in the routing path, the first routing information corresponding to the first routing segment set and the second routing information corresponding to the second routing segment set are inserted into the target position of the protocol message header of the initial message in sequence to obtain the intermediate message, wherein the intermediate routing information includes the first routing information and the second routing information.
[0042] Optionally, in this embodiment, the route segment editing attribute may be set as required, or may be determined according to the hardware conditions of the device.
[0043] Figure 3 is a schematic diagram of an optional target message according to an embodiment of the present invention, such as Figure 3 As shown, the target message may include, but is not limited to, the following contents: IPv6 message header, SR message header, payload data, and in the IPv6 forwarding plane, the IPv6 address is the Segment, and the message forwarding path is represented by the IPv6 address sequence. A new SRH (Segment Routing Header) is defined based on the original routing extension header of the IPv6 message to record Segment related information.
[0044] Figure 4 is a schematic diagram of an optional target message format according to an embodiment of the present invention, such as Figure 4 As shown in the figure, the target message contains the protocol message header (i.e., IPV6 message header), the routing message header (SR message header), and the routing segment information. The routing segment information is an ordered segment list encapsulated in the routing message header. The intermediate nodes of the path only need to forward according to the path specified in the routing message header. The segment is any instruction to guide the device to process the message, such as: forwarding the message to the destination according to the shortest path, forwarding the message through the specified interface, forwarding the message to the specified application / business instance, etc.
[0045] As an optional embodiment, according to the arrangement order of the routing segments included in each routing segment set in the target routing segment set in the routing path, the first routing information corresponding to the first routing segment set and the second routing information corresponding to the second routing segment set are sequentially inserted into the target position of the protocol message header of the initial message, and the intermediate message is obtained, including:
[0046] In a case where the routing segments included in the first routing segment set are before the routing segments included in the second routing segment set in the routing path, inserting a first routing message header and the routing segments included in the first routing segment set into the target position of the initial message to obtain a first message, wherein the first routing information includes the first routing message header and the routing segments included in the first routing segment set;
[0047] Inserting a second routing message header and routing segments included in the second routing segment set into the target position of the first message to obtain the intermediate message, wherein the second routing information includes the second routing message header and routing segments included in the second routing segment set.
[0048] Optionally, in this embodiment, the target position may be a field position after the protocol message in the message, and the acquisition may also be other field positions in the message.
[0049] As an optional embodiment, adjusting the intermediate routing information to target routing information, and obtaining a target message carrying the target routing information includes:
[0050] Performing an editing operation on the routing message header corresponding to the target routing segment set included in the intermediate routing information to obtain a routing message header to be processed and an intermediate routing segment set, wherein the intermediate routing segment set includes the routing segments included in the target routing segment set arranged in the order of arrangement of the routing segments in the routing path;
[0051] According to whether the target routing segment set is all routing segment sets in the multiple routing segment sets, the intermediate routing segment set is adjusted to obtain a second message carrying the routing message header to be processed and the routing path;
[0052] According to the routing path, the to-be-processed routing message header carried by the second message is adjusted to a target routing message header to obtain the target message carrying the target routing information, wherein the target routing information includes the target routing message header and the routing path.
[0053] Optionally, in this embodiment, the editing operation performed on the routing segment message header corresponding to the target routing segment set in the intermediate routing information may include but is not limited to update and delete operations on the routing message header, and this solution does not limit this.
[0054] Optionally, in this embodiment, adjusting the intermediate routing segment set may include, but is not limited to, adjusting the order of routing segments in the intermediate routing segment set and adding routing segments to the intermediate routing segment set.
[0055] Optionally, in this embodiment, the adjustment of the routing message header to be processed to the target routing message header may be, but is not limited to, adjusting the bytes in the routing message header that identify the total length of the routing segments, or may also be adjusting the characters used to indicate the last routing segment in the routing segment list, which is not limited in this solution.
[0056] As an optional embodiment, performing an editing operation on the routing message header corresponding to the target routing segment set included in the intermediate routing information to obtain the routing message header to be processed and the intermediate routing segment set includes:
[0057] The second routing message header in the intermediate routing information is changed to the routing message header to be processed to obtain a third message, wherein the data in the routing message header to be processed is the same as the data in the first routing message header, the intermediate routing information includes the first routing information corresponding to the first routing segment set and the second routing information corresponding to the second routing segment set, the target routing segment set includes the first routing segment set and the second routing segment set, the first routing information includes the first routing message header and the routing segments included in the first routing segment set, the second routing information includes the second routing message header and the reason segments included in the second routing segment set, and the routing segments included in the first routing segment set are before the routing segments included in the second routing segment set in the routing path;
[0058] The first routing message header in the third message is deleted to obtain the routing message header to be processed and the set of intermediate routing segments.
[0059] As an optional embodiment, according to whether the target routing segment set is all routing segment sets in the multiple routing segment sets, adjusting the intermediate routing segment set includes:
[0060] In a case where the target routing segment set is not all routing segment sets in the multiple routing segment sets, and the multiple routing segment sets further include a third routing segment set, inserting the routing segments included in the third routing segment set into positions corresponding to the target offset values in the intermediate routing segment set to obtain the routing path, wherein the target routing segment set includes the first routing segment set and the second routing segment set;
[0061] In a case where the target routing segment set is all routing segment sets in the plurality of routing segment sets, the routing segments included in the intermediate routing segment set are determined as the routing path.
[0062] Optionally, in this embodiment, the routing segments in the third routing segment set may be any routing segments other than the routing segments containing the starting node and the ending node in the routing path. For example, the routing path contains seven routing segments arranged in sequence, and the switch can edit 3 routing segment information at a time. The first routing segment and the seventh routing segment respectively contain the routing segments of the revelation node and the ending node. In this case, the routing path can be divided into two target routing segment sets and a third routing segment set. The two target routing segment sets each contain 3 routing segments, and the third set routing segment set contains 1 routing segment. The routing segments contained in the third routing segment set may be any routing segments other than the first routing segment and the seventh routing segment.
[0063] As an optional embodiment, according to the routing path, adjusting the to-be-processed routing message header carried by the second message to a target routing message header, and obtaining the target message carrying the target routing information includes:
[0064] The target field in the to-be-processed routing message header is adjusted according to the routing information of the multiple routing segments included in the routing path to obtain the target routing message header, wherein the target field is used to indicate the routing information.
[0065] Figure 5 It is an optional message forwarding path insertion flow chart according to an embodiment of the present invention. The flow can be applied to, but is not limited to, a switch device with a 3-layer Segment List editing capability. Taking a switch with a 3-layer Segment List editing capability as an example, the switch device includes 4 modules, Module A: a 3-layer SRv6 editing module, an SRv6-exclusive function module designed for a 3-layer Segment List, providing message editing capabilities specified by the protocol, including Segment List and SRH editing capabilities; Module B: an OAM processing module, a general module for the OAM function of a switching chip, supporting the processing of OAM messages; Module C: a flexible message editing module, a function module for flexible message editing provided by the switching chip, supporting the insertion, deletion and replacement of a part of the message content at a specific position in the message, and the replacement operation can be based on the message content at another position in the message; Module D: an IPv6 message editing module, a general module for the IPv6 editing function of a switching chip, providing the function of adding IPv6 encapsulation to the original message. For example, the original routing path contains 7 routing segments. The forwarding paths of the message are routing segment 7, routing segment 6, routing segment 5, routing segment 4, routing segment 3, routing segment 2, and routing segment 1. The switch needs to complete the editing operation of the 7-layer segment list, such as Figure 5 As shown, the message forwarding path insertion process may include but is not limited to the following steps:
[0066] S501, determine the routing path of the message in the initial routing path according to the message type. In the above path, routing segment 1 is the routing path from the user layer to the tunnel layer. When the message is a user communication message, the routing path is from routing segment 7 to routing segment 1. When the message is a network control message, the routing path is from routing segment 7 to routing segment 2. The user communication message passes through module D and is obtained after adding the IPv6 Header. Figure 6 In message 3, Figure 6 is a schematic diagram of an optional message structure according to an embodiment of the present invention, such as Figure 6As shown, the IPDA (IPV6 Destination Address) in the protocol message header (i.e., IPV6 Header) in message 3 is SID1 (Segment Identity 1). When the message is not a user message but a network control message, it is sent by module B as shown below. Figure 6 Message 1 in or Figure 6 In message 2 (message 1 is the protection user identifier, and message 2 is the protection tunnel identifier), the IPDA in the protocol message header in messages 1 and 2 is SID2.
[0067] S502, divide the routing path of the message according to the three-layer Segment List editing capability of the switch to obtain multiple routing segment sets, the multiple routing segment sets include multiple target routing segment sets and other routing segment sets, the number of routing segments in the target routing segment set is equal to the number of routing segments corresponding to the routing segment information that the switch can edit, the number of routing segments in other routing segment sets is less than the number of routing segments in the target routing segment set, because the routing path of the user communication message contains 7 routing segments, the routing path of the user communication message can be divided into two target routing segment sets and one other routing segment set, Segment List2 is divided into other routing segment sets, Segment List5, 6, 7 and Segment List 1, 3, 4 are respectively divided into the target routing segment set, the routing path of the network control message is divided into two target routing segment sets, namely Segment List 5, 6, 7 and Segment List 1, 3, 4, after module A, adding three-layer SRv6 information (adding three-layer Segment List 5, 6, 7 and SRH2), Figure 6 Message 1 and message 3 in become message 4, Figure 6 Message 2 in the message becomes message 5.
[0068] S503: The message is looped back in the chip and passes through module A again to add three-layer SRv6 information (when the message is a user communication message, three-layer Segment List 1 3 4 and SRH1 are added; when the message is a network control message, three-layer Segment List 2, 3, 4 and SRH1 are added). At this time, there are two SRHs in the message. The one at the front in the message byte order is SRH1, which is added by module A this time, and the one at the back is SRH2, which is added by module A last time. Figure 6 As shown, message 4 becomes message 6, and message 5 becomes message 7.
[0069] S504, after module C, replace SRH2 in the message with SRH1, and delete the original SRH2 Figure 6 Message 6 becomes message 8, and message 7 becomes message 9.
[0070] S505: The message is looped back in the chip and processed again by module C. The IPv6 destination address of the data message and the user identification protection message is replaced with Segment 7, and Segment 2 is inserted and the relevant fields in the SRH are updated. Figure 6 Message 8 in the tunnel identification protection message is changed to message 10; the tunnel identification protection message replaces the IPv6 destination address with Segment 7 and updates the relevant fields in the SRH. Figure 6 Message 9 in the message becomes message 11.
[0071] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0072] In this embodiment, a device for inserting a message forwarding path is also provided. Figure 7 is a structural block diagram of a device for inserting a message forwarding path according to an embodiment of the present invention, such as Figure 7 As shown, the device comprises:
[0073] An acquisition module 72 is used to acquire a plurality of routing segment sets corresponding to the initial message to be forwarded, wherein the plurality of routing segment sets are obtained by dividing the routing path of the initial message;
[0074] An inserting module 74 is used to insert a target routing segment set from the plurality of routing segment sets into the initial message in multiple times to obtain an intermediate message carrying intermediate routing information, wherein the target routing segment set has a corresponding relationship with the intermediate routing information;
[0075] The adjustment module 76 is used to adjust the intermediate routing information to the target routing information, and obtain a target message carrying the target routing information, wherein the target routing information is used to indicate the routing path, and the target message is used to perform routing according to the routing path.
[0076] Optionally, the insertion module includes:
[0077] a determining unit, configured to determine a first routing segment set and a second routing segment set from the plurality of routing segment sets as the target routing segment set, wherein the number of routing segments included in the first routing segment set matches a routing segment editing attribute, and the number of routing segments included in the second routing segment set matches the routing segment editing attribute, and the routing segment editing attribute is used to indicate the number of routing segments allowed to be edited when editing routing information at a single time;
[0078] An insertion unit is used to insert the first routing information corresponding to the first routing segment set and the second routing information corresponding to the second routing segment set into the target position of the protocol message header of the initial message in sequence according to the arrangement order of the routing segments included in each routing segment set in the target routing segment set in the routing path, so as to obtain the intermediate message, wherein the intermediate routing information includes the first routing information and the second routing information.
[0079] Optionally, the insertion unit is used for:
[0080] In a case where the routing segments included in the first routing segment set are before the routing segments included in the second routing segment set in the routing path, inserting a first routing message header and the routing segments included in the first routing segment set into the target position of the initial message to obtain a first message, wherein the first routing information includes the first routing message header and the routing segments included in the first routing segment set;
[0081] Inserting a second routing message header and routing segments included in the second routing segment set into the target position of the first message to obtain the intermediate message, wherein the second routing information includes the second routing message header and routing segments included in the second routing segment set.
[0082] Optionally, the adjustment module includes:
[0083] an editing unit, configured to perform an editing operation on a routing message header included in the intermediate routing information and corresponding to the target routing segment set, to obtain a routing message header to be processed and an intermediate routing segment set, wherein the intermediate routing segment set includes routing segments included in the target routing segment set arranged in the order of arrangement of routing segments in the routing path;
[0084] A first adjustment unit, configured to adjust the intermediate routing segment set according to whether the target routing segment set is all routing segment sets in the multiple routing segment sets, to obtain a second message carrying the routing message header to be processed and the routing path;
[0085] The second adjustment unit is used to adjust the to-be-processed routing message header carried by the second message to a target routing message header according to the routing path, so as to obtain the target message carrying the target routing information, wherein the target routing information includes the target routing message header and the routing path.
[0086] Optionally, the editing unit is used to:
[0087] The second routing message header in the intermediate routing information is changed to the routing message header to be processed to obtain a third message, wherein the data in the routing message header to be processed is the same as the data in the first routing message header, the intermediate routing information includes the first routing information corresponding to the first routing segment set and the second routing information corresponding to the second routing segment set, the target routing segment set includes the first routing segment set and the second routing segment set, the first routing information includes the first routing message header and the routing segments included in the first routing segment set, the second routing information includes the second routing message header and the reason segments included in the second routing segment set, and the routing segments included in the first routing segment set are before the routing segments included in the second routing segment set in the routing path;
[0088] The first routing message header in the third message is deleted to obtain the routing message header to be processed and the set of intermediate routing segments.
[0089] Optionally, the first adjustment unit is used to:
[0090] In a case where the target routing segment set is not all routing segment sets in the multiple routing segment sets, and the multiple routing segment sets further include a third routing segment set, inserting the routing segments included in the third routing segment set into positions corresponding to the target offset values in the intermediate routing segment set to obtain the routing path, wherein the target routing segment set includes the first routing segment set and the second routing segment set;
[0091] In a case where the target routing segment set is all routing segment sets in the plurality of routing segment sets, the routing segments included in the intermediate routing segment set are determined as the routing path.
[0092] Optionally, the second adjustment unit is used to:
[0093] The target field in the to-be-processed routing message header is adjusted according to the routing information of the multiple routing segments included in the routing path to obtain the target routing message header, wherein the target field is used to indicate the routing information.
[0094] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0095] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0096] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0097] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0098] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0099] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0100] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0101] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for inserting a message forwarding path, characterized in that: include: Acquire multiple routing segment sets corresponding to the initial message to be forwarded, wherein the multiple routing segment sets are obtained by dividing the routing path of the initial message; Inserting a target routing segment set from the plurality of routing segment sets into the initial message multiple times to obtain an intermediate message carrying intermediate routing information, wherein the target routing segment set has a corresponding relationship with the intermediate routing information; Adjusting the intermediate routing information to target routing information to obtain a target message carrying the target routing information, wherein the target routing information is used to indicate the routing path, and the target message is used to perform routing according to the routing path; Wherein, inserting the target routing segment set from the multiple routing segment sets into the initial message in multiple times to obtain the intermediate message carrying the intermediate routing information includes: determining the first routing segment set and the second routing segment set from the multiple routing segment sets as the target routing segment set, wherein the number of routing segments included in the first routing segment set matches the routing segment editing attribute, and the number of routing segments included in the second routing segment set matches the routing segment editing attribute, and the routing segment editing attribute is used to indicate the number of routing segments allowed to be edited when editing routing information at a single time; according to the arrangement order of the routing segments included in each routing segment set in the target routing segment set in the routing path, the first routing information corresponding to the first routing segment set and the second routing information corresponding to the second routing segment set are sequentially inserted into the target position of the protocol message header of the initial message to obtain the intermediate message, wherein the intermediate routing information includes the first routing information and the second routing information.
2. The method according to claim 1, characterized in that According to the arrangement order of the routing segments included in each routing segment set in the target routing segment set in the routing path, the first routing information corresponding to the first routing segment set and the second routing information corresponding to the second routing segment set are sequentially inserted into the target position of the protocol message header of the initial message, so that the intermediate message includes: In a case where the routing segments included in the first routing segment set are before the routing segments included in the second routing segment set in the routing path, inserting a first routing message header and the routing segments included in the first routing segment set into the target position of the initial message to obtain a first message, wherein the first routing information includes the first routing message header and the routing segments included in the first routing segment set; Inserting a second routing message header and routing segments included in the second routing segment set into the target position of the first message to obtain the intermediate message, wherein the second routing information includes the second routing message header and routing segments included in the second routing segment set.
3. The method according to claim 1, characterized in that Adjusting the intermediate routing information to target routing information, and obtaining a target message carrying the target routing information includes: Performing an editing operation on the routing message header corresponding to the target routing segment set included in the intermediate routing information to obtain a routing message header to be processed and an intermediate routing segment set, wherein the intermediate routing segment set includes the routing segments included in the target routing segment set arranged in the order of arrangement of the routing segments in the routing path; According to whether the target routing segment set is all routing segment sets in the multiple routing segment sets, the intermediate routing segment set is adjusted to obtain a second message carrying the routing message header to be processed and the routing path; According to the routing path, the to-be-processed routing message header carried by the second message is adjusted to a target routing message header to obtain the target message carrying the target routing information, wherein the target routing information includes the target routing message header and the routing path.
4. The method according to claim 3, characterized in that Performing an editing operation on the routing message header corresponding to the target routing segment set included in the intermediate routing information, and obtaining the routing message header to be processed and the intermediate routing segment set includes: The second routing message header in the intermediate routing information is changed to the routing message header to be processed to obtain a third message, wherein the data in the routing message header to be processed is the same as the data in the first routing message header, the intermediate routing information includes the first routing information corresponding to the first routing segment set and the second routing information corresponding to the second routing segment set, the target routing segment set includes the first routing segment set and the second routing segment set, the first routing information includes the first routing message header and the routing segments included in the first routing segment set, the second routing information includes the second routing message header and the routing segments included in the second routing segment set, and the routing segments included in the first routing segment set are before the routing segments included in the second routing segment set in the routing path; The first routing message header in the third message is deleted to obtain the routing message header to be processed and the set of intermediate routing segments.
5. The method according to claim 3, characterized in that: According to whether the target routing segment set is all routing segment sets in the multiple routing segment sets, adjusting the intermediate routing segment set includes: In a case where the target routing segment set is not all routing segment sets in the multiple routing segment sets, and the multiple routing segment sets further include a third routing segment set, inserting the routing segments included in the third routing segment set into positions corresponding to the target offset values in the intermediate routing segment set to obtain the routing path, wherein the target routing segment set includes the first routing segment set and the second routing segment set; In a case where the target routing segment set is all routing segment sets in the plurality of routing segment sets, the routing segments included in the intermediate routing segment set are determined as the routing path.
6. The method according to claim 3, characterized in that According to the routing path, adjusting the to-be-processed routing message header carried by the second message to a target routing message header, and obtaining the target message carrying the target routing information includes: The target field in the to-be-processed routing message header is adjusted according to the routing information of the multiple routing segments included in the routing path to obtain the target routing message header, wherein the target field is used to indicate the routing information.
7. A device for inserting a message forwarding path, characterized in that: include: An acquisition module, used to acquire a plurality of routing segment sets corresponding to the initial message to be forwarded, wherein the plurality of routing segment sets are obtained by dividing the routing path of the initial message; An insertion module, configured to insert a target routing segment set from the plurality of routing segment sets into the initial message in multiple times to obtain an intermediate message carrying intermediate routing information, wherein the target routing segment set has a corresponding relationship with the intermediate routing information; An adjustment module, used to adjust the intermediate routing information to target routing information, and obtain a target message carrying the target routing information, wherein the target routing information is used to indicate the routing path, and the target message is used to perform routing according to the routing path; The insertion module includes: a determination unit, which is used to determine the first routing segment set and the second routing segment set in the multiple routing segment sets as the target routing segment set, wherein the number of routing segments included in the first routing segment set matches the routing segment editing attribute, and the number of routing segments included in the second routing segment set matches the routing segment editing attribute, and the routing segment editing attribute is used to indicate the number of routing segments allowed to be edited when editing routing information at a single time; an insertion unit, which is used to insert the first routing information corresponding to the first routing segment set and the second routing information corresponding to the second routing segment set into the target position of the protocol message header of the initial message in sequence according to the arrangement order of the routing segments included in each routing segment set in the target routing segment set in the routing path, to obtain the intermediate message, wherein the intermediate routing information includes the first routing information and the second routing information.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 6 when executed by a processor.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 6 are implemented.
