WO2023125563A1 - Routing information editing method and apparatus, and storage medium and electronic apparatus - Google Patents

Routing information editing method and apparatus, and storage medium and electronic apparatus Download PDF

Info

Publication number
WO2023125563A1
WO2023125563A1 PCT/CN2022/142480 CN2022142480W WO2023125563A1 WO 2023125563 A1 WO2023125563 A1 WO 2023125563A1 CN 2022142480 W CN2022142480 W CN 2022142480W WO 2023125563 A1 WO2023125563 A1 WO 2023125563A1
Authority
WO
WIPO (PCT)
Prior art keywords
routing
target
message
editor
information
Prior art date
Application number
PCT/CN2022/142480
Other languages
French (fr)
Chinese (zh)
Inventor
成伟
王俊杰
张思渊
Original Assignee
苏州盛科通信股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 苏州盛科通信股份有限公司 filed Critical 苏州盛科通信股份有限公司
Publication of WO2023125563A1 publication Critical patent/WO2023125563A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/34Source routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering

Definitions

  • the present invention claims the priority of the Chinese patent application filed on December 27, 2021 with the application number 202111621056.5 and the title of the invention "routing information editing method, device, storage medium and electronic device", the entire contents of which are incorporated by reference incorporated in the present invention.
  • Embodiments of the present invention relate to the field of message processing, and in particular, relate to a routing information editing method, device, storage medium, and electronic device.
  • Segment Routing (segment routing) is a source routing technology.
  • Figure 1 is a schematic diagram of the Segment Routing forwarding plane in related technologies. As shown in Figure 1, the Segment Routing forwarding plane is divided into: SR MPLS (Segment Routing Multi-Protocol Label Switching , multi-protocol label switching segment routing) data plane, SRv6 (Segment Routing Internet Protocol Version 6, segment routing based on Internet Protocol Version 6 forwarding plane) data plane.
  • SRv6 is an extended SR (Segment Routing, segment routing) solution based on IPv6 (Internet Protocol Version 6, Internet Protocol Version 6). Backed by the IPv6 data plane, SRv6 further enhances network programmability, which is conducive to supporting network and service programmability, and opening up end-to-end network channels.
  • FIG 2 is a schematic diagram of a standard SRv6 message, as shown in Figure 2, a standard SRv6 message, including SRH (Segment Routing Header, segment routing header), the outer IPv6, wherein, SRH is divided into two parts: one is the SID List (Segment ID List, segment routing identification list), the length is 128bit, the second is the characteristic field of SRH, such as: Segment Left, Last Entry (Last Entry, the number of segment routing identification list SID), etc.
  • SRH Segment Routing Header, segment routing header
  • the outer IPv6 wherein, SRH is divided into two parts: one is the SID List (Segment ID List, segment routing identification list), the length is 128bit, the second is the characteristic field of SRH, such as: Segment Left, Last Entry (Last Entry, the number of segment routing identification list SID), etc.
  • FIG. 3 is a schematic diagram of editing SRv6 SID (Segment ID, Segment Routing ID). encapsulation. If the MACDA (Media Access Control Destination Address, Media Access Control Destination Address) of the received IPv6 message is the same as the routing MAC (Media Access Control, Media Access Control) of the device, and the routing table entry is found, the next hop is SRv6 For forwarding path, SW-A will complete the editing of IPv6 encapsulation according to the route lookup result.
  • SRv6 SID Segment ID, Segment Routing ID
  • FIG. 4 is a schematic diagram of the SRH encapsulation operation of the SRv6 head node in the related technology, as shown in Figure 4, the implementation process for chip SRv6 SRH encapsulation and SID editing is as follows:
  • the chip When the chip receives the data packet, it first performs message parsing and processing, and obtains message MACDA, MACSA (Media Access Control Destination Address, Media Access Control Start Address), IPv6 DA, IPv6 SA and other information in the parsing module, and parses The obtained message information is carried to the subsequent processing flow.
  • message parsing and processing and obtains message MACDA, MACSA (Media Access Control Destination Address, Media Access Control Start Address), IPv6 DA, IPv6 SA and other information in the parsing module, and parses
  • MACDA Media Access Control Destination Address
  • MACSA Media Access Control Start Address
  • IPv6 DA IPv6 SA
  • the chip maps to different queues according to the Priority (priority) of the data message, and schedules according to the outgoing port.
  • the chip will index to DsNexthop (next hop plus package editing table) according to the NextHopPtr in the search result of the IPE forwarding table in the inbound direction, and complete the SRv6 SRH package according to the SRv6 Edit (editing) table of DsNexthop , and edit the multi-layer SRv6 SID. After editing the message, forward it from the egress port to the next-hop network device.
  • SRv6 SRH When SRv6 SRH is packaged and processed, chips that currently support SRv6 also encounter challenges. Since the SID List in SRH is composed of multiple 128-bit Segment Lists, more than 3 SRv6 SIDs are edited, and the Nexthop of the switching chip (Next hop) Editing table entries consumes a lot of pressure on resources. In some scenarios, where the SRv6 traffic is small but the number of SID layers edited is high, the cost of only relying on the expansion chip Nexthop resource is high.
  • Embodiments of the present invention provide a routing information editing method, device, storage medium, and electronic device, so as to at least solve the problem of low editing efficiency of message forwarding paths in the related art.
  • a method for editing routing information including: acquiring an initial message to be routed, wherein the initial message is used to indicate that the routing path is followed by matching the initial message routing; inserting the first routing segment set edited by the first editor into the target position of the initial message to obtain the first message, wherein the number of routing segments included in the first routing segment set is the same as the The routing segment editing attribute of the first editor matches, and the routing segment editing attribute is used to indicate the number of routing segments that are allowed to be edited when the editor edits routing information once.
  • Routing information in a format matched by the editor inserting the second routing information corresponding to the second routing segment set edited by the second editor into the first message to obtain the intermediate message carrying the intermediate routing information
  • the second routing information is used to indicate routing according to the path corresponding to the second routing segment set
  • the plurality of routing segments include routing segments in the first routing segment set and the second routing segment set
  • the routing segment in the routing segment set, the number of routing segments included in the second routing segment set matches the routing segment editing attribute of the second editor, and the second editor is used for editing Routing information in a matched format
  • the multiple editors include the first editor and the second editor, the intermediate routing information has the same information as the first routing segment set and the second routing segment set
  • the target routing path represented by the routing segments in the first routing segment set and the second routing segment set matches the initial message; adjust the intermediate routing information to the target routing information, and obtain the carried A target packet with the target routing information, wherein the target routing information is used to indicate that the target packet should be routed according to the target routing path
  • inserting the first routing segment set edited by the first editor into the target position of the initial message, and obtaining the first message includes: obtaining the first routing segment set edited by the first editor corresponding to the first routing information, wherein the first routing information is used to indicate routing according to the path corresponding to the first routing segment set; inserting the first routing segment set included in the first routing information into The target position of the initial packet is obtained from the first packet.
  • inserting the first routing segment set included in the first routing information into the target position of the initial message, and obtaining the first message includes: inserting the first routing information Inserting into the target position of the initial message to obtain a second message carrying the first routing information; deleting the protocol header indicated by the target offset value in the second message to obtain the The first packet of the first routing segment set, wherein the first routing information includes the protocol packet header and the first routing segment set.
  • inserting the second routing information corresponding to the second routing segment set edited by the second editor into the first message includes: obtaining the destination routing node of the first message, wherein, The destination routing node is an end point of a routing path; the destination routing path is determined in a destination routing table according to the destination routing node, wherein the destination routing table stores the destination routing pointing to the destination routing node path; determine the second identifier of the routing information of the routing segment set to be edited in the target routing path; obtain the second routing information edited by the second editor matching the second identifier, wherein , the second routing information includes an initial routing packet header and the second routing segment set; inserting the second routing information into the target position of the first packet.
  • the adjusting the intermediate routing information to target routing information, and obtaining the target message carrying the target routing information includes: determining the routing information corresponding to the multiple routing segments carried in the intermediate message Routing section information; according to the multiple routing sections of the target routing path, the first field of the initial routing packet header of the intermediate routing information is changed to obtain the routing packet header to be processed, wherein the first field It is used to indicate the field lengths of the plurality of routing segments carried in the intermediate message; changing the second field in the routing message header to be processed to a target routing segment to obtain the target routing segment carrying the target routing information A target message, wherein the target routing segment is a second routing segment among the plurality of routing segments sorted according to the target routing path, and the second field is used to indicate the next routing segment of the message.
  • a device for editing routing information including: an acquisition module configured to acquire an initial message to be routed, wherein the initial message is used to indicate the The routing path matched by the initial message is routed; the first insertion module is configured to insert the first routing segment set edited by the first editor into the target position of the initial message to obtain the first message, wherein, The number of routing segments included in the first routing segment set matches the routing segment editing attribute of the first editor, and the routing segment editing attribute is used to indicate the routing segments that are allowed to be edited when the editor edits routing information once The first editor is used to edit the routing information in the format matched by the first editor; the second insertion module is set as the second corresponding to the second routing segment set edited by the second editor Inserting routing information into the first message to obtain the intermediate message carrying the intermediate routing information, wherein the second routing information is used to indicate routing according to the path corresponding to the second routing segment set , the multiple routing segments include routing segments in the first routing segment set and routing segments in the second routing segment
  • a computer-readable storage medium is also provided, and a computer program is stored in the computer-readable storage medium, wherein the computer program is configured to perform any one of the above methods when running Steps in the examples.
  • 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 perform any of the above Steps in the method examples.
  • the initial message is used to indicate routing according to the routing path matching the initial message; inserting the first routing segment set edited by the first editor into The target position of the initial message, to obtain the first message, wherein the number of routing segments included in the first routing segment set matches the routing segment editing attribute of the first editor, and the routing segment editing attribute is used to instruct the editor to edit once The number of routing segments that are allowed to be edited when routing information.
  • the first editor is used to edit the routing information that matches the format of the first editor; insert the second routing information corresponding to the second routing segment set edited by the second editor In the first message, an intermediate message carrying intermediate routing information is obtained, wherein the second routing information is used to indicate routing according to the path corresponding to the second routing segment set, and the plurality of routing segments include the first routing segment set Routing segments and routing segments in the second routing segment set, the number of routing segments included in the second routing segment set matches the routing segment editing properties of the second editor, and the second editor is used to edit the format matched by the second editor
  • the routing information of the multiple editors includes the first editor and the second editor, and the intermediate routing information has a corresponding relationship with the first routing segment set and the second routing segment set.
  • the target routing path represented by the routing segment of the target matches the initial message; the intermediate routing information is adjusted to the target routing information to obtain the target message carrying the target routing information, wherein the target routing information is used to indicate that the target message is routed according to the target
  • the routing path is used for routing, that is, the editor is used to edit the routing information that matches the format of the editor. Edit the routing information of the initial message with the second editor to obtain multiple routing segments corresponding to the routing path of the initial message, and insert the multiple routing segments edited by the first editor and the second editor into the initial In the message, the intermediate message carrying the intermediate routing information corresponding to multiple routing segments can be obtained. After the intermediate routing information is adjusted, the target message carrying the target routing information can be obtained.
  • the first editor and the second editor are used to edit multiple routing segments in the routing path, instead of using only one editor to edit multiple routing segments, thereby reducing the burden of editing the routing information of the routing path
  • the requirement for the routing segment editing capability of the device at the same time reduces the pressure on the editor's editing resources, and realizes the business requirements of higher routing segment editing capabilities through devices with lower routing segment editing capabilities.
  • the editing ability of the routing section can complete the editing of the target routing path including the number of routing sections exceeding the routing section editing capability of the device into the message. Therefore, the problem of low editing efficiency of the routing path of the message existing in the related technology is solved. The effect of improving the editing efficiency of the message routing path is achieved.
  • Figure 1 is a schematic diagram of the Segment Routing forwarding plane in the related art
  • Figure 2 is a schematic diagram of a standard SRv6 message
  • Figure 3 is a schematic diagram of SRv6 SID editing
  • FIG. 4 is a schematic diagram of an SRH encapsulation operation of an SRv6 first node in the related art
  • Fig. 5 is a block diagram of the mobile terminal hardware structure of the editing method of routing information according to the embodiment of the present invention.
  • FIG. 6 is a flowchart of a method for editing routing information according to an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of an optional routing segment insertion according to an embodiment of the present invention.
  • FIG. 8 is a schematic diagram of an optional message for inserting a routing message for the first time according to an embodiment of the present invention.
  • Fig. 9 is a schematic diagram of optional intermediate routing information according to an embodiment of the present invention.
  • FIG. 10 is a flow chart of an optional target routing path editing method according to an embodiment of the present invention.
  • FIG. 11 is a schematic diagram of an optional message loopback according to an embodiment of the present invention.
  • Fig. 12 is a structural block diagram of a device for editing routing information according to an embodiment of the present invention.
  • FIG. 5 is a block diagram of the hardware structure of the mobile terminal according to the routing information editing method according to the embodiment of the present invention.
  • the mobile terminal may include one or more (only one is shown in Figure 5) processors 502 (the processor 502 may include but not limited to a microprocessor MCU (Microcontroller Unit, micro control unit) or programmable Processing devices such as logic devices FPGA (Field Programmable Gate Array, editable logic array) and a memory 504 for storing data, wherein the above-mentioned mobile terminal may also include a transmission device 506 and an input/output device 508 configured as a communication function .
  • processors 502 may include but not limited to a microprocessor MCU (Microcontroller Unit, micro control unit) or programmable Processing devices such as logic devices FPGA (Field Programmable Gate Array, editable logic array) and a memory 504 for storing data
  • FPGA Field Programmable Gate Array
  • the mobile terminal may also include a transmission device 506 and an input/output device 508 configured as a communication function .
  • the structure shown in FIG. 5 is only for illustration, and it does not limit the structure
  • the memory 504 can be set to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the routing information editing method in the embodiment of the present invention, the processor 502 runs the computer program stored in the memory 504 , so as to perform various functional applications and data processing, that is, to realize the above-mentioned method.
  • the memory 504 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
  • the memory 504 may include memory located remotely from the processor 502, and these remote memories may be connected to the mobile terminal through a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • the transmission device 506 is arranged to receive or transmit data via a network.
  • the aforementioned network example may include a wireless network provided by a mobile terminal's communication provider.
  • the transmission device 506 includes a network interface controller (NIC for short), which can be connected to other network devices through a base station so as to communicate with the Internet.
  • the transmission device 506 may be a radio frequency (Radio Frequency, referred to as RF) module, which is configured to communicate with the Internet in a wireless manner.
  • RF radio frequency
  • FIG. 6 is a flowchart of a method for editing routing information according to an embodiment of the present invention. As shown in FIG. 6, the process includes the following steps:
  • Step S602 acquiring an initial packet to be forwarded, wherein the initial packet is used to indicate routing according to a routing path matching the initial packet;
  • Step S604 inserting the first routing segment set edited by the first editor into the target position of the initial message to obtain the first message, wherein the number of routing segments included in the first routing segment set is the same as the number of routing segments included in the first routing segment set Match the routing segment editing attribute of the first editor, the routing segment editing attribute is used to indicate the number of routing segments that the editor is allowed to edit when editing routing information once, and the first editor is used to edit the Routing information in the format matched by the editor;
  • Step S606 inserting the second routing information corresponding to the second routing segment set edited by the second editor into the first message to obtain the intermediate message carrying the intermediate routing information, wherein the The second routing information is used to indicate routing according to the path corresponding to the second routing segment set, and the multiple routing segments include routing segments in the first routing segment set and routes in the second routing segment set segment, the number of routing segments included in the second routing segment set matches the routing segment editing attribute of the second editor, and the second editor is used to edit routing information in a format matched by the second editor , the intermediate routing information has a corresponding relationship with the first routing segment set and the second routing segment set, and the target route represented by the routing segments in the first routing segment set and the second routing segment set The path matches the initial message;
  • Step S608 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 that the target message is routed according to the target routing path for routing.
  • the editor is used to edit the routing information matching the format of the editor.
  • the first editor and the second The editor edits the routing information of the initial message to obtain multiple routing segments corresponding to the routing path of the initial message, and inserts the multiple routing segments edited by the first editor and the second editor into the initial message , and then obtain the intermediate message carrying the intermediate routing information corresponding to multiple routing segments.
  • the target message carrying the target routing information can be obtained, and the editing of the initial message is realized.
  • routing paths use the first editor and the second editor to edit multiple routing segments in the routing path, instead of using only one editor to edit multiple routing segments, thereby reducing the burden on the device when editing the routing information of the routing path
  • the requirements for the ability to edit routing segments reduce the pressure on the editor’s editing resources, and realize the business requirements of higher editing capabilities for routing segments through devices with lower routing segment editing capabilities, and then realize the The editing ability completes the editing of the target routing path whose number of routing segments exceeds the routing segment editing capability of the device into the message. Therefore, the problem of low editing efficiency of the routing path of the message in the related technology is solved, and the improvement is achieved.
  • the effect of editing efficiency on the packet routing path is achieved.
  • the initial message may be a message in IPv6 format or a message in IPv4 format, which is not limited in this solution.
  • the initial message may carry a target field, and according to the target field, the information for routing with the routing path of the initial message can be determined, for example, the message header of the initial message carries a message
  • the destination routing node of the message and the starting routing node of the message, the matching routing path can be determined according to the destination routing node and the starting routing node, or the identification information used to indicate the path can also be carried in the initial message, according to the The identification information can determine a routing path matching the identification information.
  • the target routing path may include only one first routing segment set, or may include multiple first routing segment sets, when the target routing path includes multiple first routing segment sets Next, you only need to repeatedly call the first editor for editing, so as to obtain multiple sets of first routing segments.
  • the editor is used to edit routing information
  • the editor may be in the form of an editing table, in which a fixed field for editing routing information is stored, or the editor may also be It is a packaged script package including codes for editing routing information, which is not limited in this solution.
  • the target routing path may include only one second routing segment set, or may include multiple second routing segment sets, for example, when the target routing segment set includes two second routing segment sets , the second editor needs to be called twice to edit the second routing information corresponding to the second routing segment set, and the routing header of the second routing information inserted for the first time in the two second routing information is deleted by setting the offset value.
  • This solution does not limit the number of second routing segments.
  • the editing capabilities of the second editors of different devices are different, and the number of routing segments included in the second routing segment set is less than or equal to the number of routing segments allowed to be edited by the routing segment editing properties of the second editor.
  • the maximum number of routing segments For example, the second editor can edit 3 routing segments at a time, and a second routing segment set can include 3 routing segments or two routing segments. This solution does not limit this
  • the intermediate routing information includes multiple routing segments in the routing path and a packet header in the target format.
  • the intermediate routing information may include multiple routing segments included in the target routing path and the SRH( Segment Routing Header, segment routing header).
  • adjusting the intermediate routing information to the target routing information may be adjusting the fixed field in the packet header, or it may also be adjusting the ordering of multiple routing paths, for example, the intermediate routing
  • the information is routing information in SRv6 format, which is adjusted by related fields in SRH (for example: SL (Segment Left, the remaining number of segment routing identifiers), LE (Last Entry, the number of segment routing identifier list SIDs), etc.) .
  • inserting the first routing segment set edited by the first editor into the target position of the initial message, and obtaining the first message includes:
  • first routing information corresponding to the first routing segment set edited by the first editor wherein the first routing information is used to indicate routing according to a path corresponding to the first routing segment set;
  • the first routing information may include, but is not limited to, routing segments in the packet header and the first routing segment set, and insert the first routing segment set included in the first routing information into
  • the target position of the initial message may be to obtain only the first routing segment set in the first editor, or insert the first routing information into the initial message, and delete it after inserting the target position of the initial message A packet header in the first routing information.
  • the target location may be, but not limited to, the location immediately after the header of the protocol packet in the initial packet.
  • the inserting the first routing segment set included in the first routing information into the target position of the initial message, and obtaining the first message includes:
  • the protocol packet header indicated by the target offset value in the second packet to obtain the first packet carrying the first routing segment set, wherein the first routing information includes the protocol A packet header and the set of the first routing segment.
  • Fig. 7 is a schematic diagram of an optional routing segment insertion according to an embodiment of the present invention.
  • This embodiment can be applied to edit SRv6 segment routes through IPv6 protocol messages.
  • the following operations can be but not limited to:
  • the first editor edits and obtains the first routing information of the first routing segment set, that is, the IPv6 Packet in the figure.
  • This IPv6 packet includes the protocol packet header IPv6 Header and two routing segments, and the two routing segments are stored in the protocol packet respectively.
  • each insertion is to encapsulate the IPv6 Packet into the SRv6 payload position, and set the offset offset value after insertion, cut off the 8-byte IPv6 Header, and leave the IPv6 DA and IPv6 SA, As an SRv6 SID.
  • the acquiring the first routing information corresponding to the first routing segment set edited by the first editor includes:
  • the target routing table determines the target routing path in a target routing table according to the destination routing node, wherein the target routing table stores the target routing path pointing to the destination routing node;
  • the first identifier is an identifier used to indicate the routing segment to be edited, and the first identifier may be the number of the routing segment in the routing path, or the information of the starting node of the routing segment Or the information of the termination node, etc., which is not limited in this solution.
  • the method for determining the routing information of the set of routing segments to be edited in the target routing path may be, but not limited to, based on the edited routing segments included in the message. It can also determine the information of the termination node of the edited routing segment included in the message, and then determine the information of the routing segment after the termination node in the target routing path according to the order of the routing segment , this scheme does not limit it.
  • the inserting the second routing information corresponding to the second routing segment set edited by the second editor into the first message includes:
  • the target routing table determines the target routing path in a target routing table according to the destination routing node, wherein the target routing table stores the target routing path pointing to the destination routing node;
  • the target location may be, but not limited to, the location immediately after the header of the protocol packet in the initial packet.
  • the adjusting the intermediate routing information to the target routing information to obtain the target message carrying the target routing information includes:
  • the first field of the initial routing packet header of the intermediate routing information is changed to obtain the routing packet header to be processed, wherein the first field is used to indicate the intermediate The field lengths of the multiple routing segments carried in the message;
  • the second field in the pending routing packet header to a target routing segment to obtain the target packet carrying the target routing information, wherein the target routing segment is sorted according to the target routing path
  • the second routing segment in the multiple routing segments, the second field is used to indicate the next routing segment of the message.
  • the second editor can also be used to edit the second routing information, that is, the routing message including the routing message header and the second routing segment set, and the second editor is used to edit the routing message , the second editor can edit two routing segments each time, the second routing segment set includes the routing segment of the starting node of the target routing path, inserts the second routing information into the initial message, and then inserts the first editor The edited first routing segment set is inserted into the initial message that has been inserted into the second routing information.
  • the first editor is used to edit the protocol message.
  • the target routing path includes 10 routing segments, according to the order from the start point to the end point of the routing path Respectively SID1, SID2, ..., SID9, SID10, then use the second editor to edit the routing information of SID1 and SID2,
  • Figure 8 is an optional first insertion routing message according to an embodiment of the present invention
  • the schematic diagram of the message, as shown in Figure 8 can include but is not limited to the protocol message header IPv6 Header of the initial message, and the protocol message header includes the destination routing node IPv6 DA0 of the target routing path and the initial routing node IPv6SA0 of the target routing path,
  • the inserted second routing information includes SRH, SID1 and SID2.
  • the first editor edits two routing segments at a time.
  • the first editor is for editing IPv6 format, wherein, because the field lengths of IPv6 DA and IPv6 SA of the first routing information of the first editor are both 128 bytes, which is equal to the byte length of SID, so let the first editor
  • the fields of IPv6 DA and IPv6 SA in the edited first routing information are corresponding routing segments, and after inserting the fields of IPv6 DA and IPv6 SA in the first routing information into the SRH field, intermediate routing information is obtained, as shown in Figure 9
  • SID3 to SID10 are the routing segments edited by calling the first editor. modify the fields in the SRH of the intermediate routing information to obtain the target message including the target routing information.
  • Fig. 10 is a flow chart of an optional target routing path editing method according to an embodiment of the present invention, which is used to enhance the editing capability of the switching chip to the SRv6 SID.
  • the IPv6 editing capability in conjunction with the chip loopback mechanism, realizes more layers of SRv6 SID editing capabilities, as shown in Figure 10, but is not limited to the following steps:
  • the chip receives the data packet, firstly performs message analysis processing, obtains message MACDA, MACSA, IPv6 DA, IPv6 SA and other information in the analysis module, and carries the message information obtained by analysis to the subsequent processing flow.
  • the chip maps data packets to different queues according to the Priority of the data packets, and schedules according to the outgoing port.
  • the chip will forward the NextHopPtr index in the table item search result to the next hop in the inbound direction IPE (Ingress Pipeline, entry channel), and complete IPv6 SA and IPv6 DA according to the IPv6 header edit table of the next hop Editing, and editing of the first 8 bytes of the IPv6 Header.
  • IPE Ingress Pipeline, entry channel
  • IPv6 SA and IPv6 SA are used as two SIDs in the SRv6 SRH. If you need to add more SRv6 SIDs, you need to return to the IPE pipeline for processing through chip loopback.
  • S1006 execute the switchback mechanism.
  • the outport, next hop and other information corresponding to the ACL search results are carried to the EPE (Egress Pipeline, egress channel) pipeline for processing.
  • EPE Egress Pipeline, egress channel
  • the next hop is used to index the SRv6-encapsulated edit table items
  • the next hop is used to index
  • the edit entry for IPv6 plus encapsulation, outport is used to identify the forwarding port, and the second time is pipelined in the outbound direction after Loop.
  • the first 8 bytes of the IPv6 header have been cut off from the IPv6 packet.
  • the chip will enter the NextHop index in the search result of the IPE ACL entry to the next hop, and complete the editing of IPv6 SA and IPv6 DA at the specified Offset position according to the IPv6 header edit table of the next hop.
  • Fig. 11 is a schematic diagram of an optional message loopback according to an embodiment of the present invention, which is applied to the chip in the flow chart of the routing path editing method in Fig. 10. As shown in Fig. 11, it may include but is not limited to the following content.
  • the IPv6 Packet In port of the switch is input to the IPE. After the message is parsed, the parsed information is carried to the EPE pipeline for processing, and a routing segment edit is completed. When it needs to be switched back, the message processed by the EPE is looped again.
  • TM Traffic Manage, scheduling management
  • TM Traffic Manage, scheduling management
  • the embodiment of the present invention uses the chip's IPv6 editing capability and cooperates with the chip loopback mechanism to realize more layers of SRv6 SID editing capabilities, solve the challenge of insufficient layers in one SRv6 SID editing of the chip, and reduce the chip's editing capability design. Cost and complexity; the chip IPv6 table entry and loopback mechanism are fully reused, one is to reduce the pressure on resource consumption of SRv6 Nexthop table entries, and the other is to realize each loopback without increasing the complexity of the chip design. Add 2 additional layers of 128bit SRv6 SID editing capability.
  • FIG. 12 is a structural block diagram of a device for editing routing information according to an embodiment of the present invention. As shown in FIG. 12 , the device includes:
  • the acquiring module 1202 is configured to acquire an initial packet to be routed, where the initial packet is used to indicate routing according to a routing path that matches the initial packet;
  • the first inserting module 1204 is configured to insert the first routing segment set edited by the first editor into the target position of the initial message to obtain the first message, wherein the first routing segment set includes The number of routing segments matches the routing segment editing attribute of the first editor, and the routing segment editing attribute is used to indicate the number of routing segments that are allowed to be edited when the editor edits routing information once, and the first editor uses for editing routing information in a format matched by the first editor;
  • the second inserting module 1206 is configured to insert the second routing information corresponding to the second routing segment set edited by the second editor into the first message, and obtain the intermediate message carrying the intermediate routing information
  • the second routing information is used to indicate routing according to the path corresponding to the second routing segment set
  • the plurality of routing segments include routing segments in the first routing segment set and the second routing segment set
  • the routing segment in the routing segment set, the number of routing segments included in the second routing segment set matches the routing segment editing attribute of the second editor, and the second editor is used for editing Routing information in a matched format
  • the multiple editors include the first editor and the second editor, the intermediate routing information has the same information as the first routing segment set and the second routing segment set Corresponding relationship, the target routing path represented by the routing segments in the first routing segment set and the second routing segment set matches the initial message;
  • the adjustment module 1208 is configured to adjust the intermediate routing information to target routing information to obtain a target packet carrying the target routing information, wherein the target routing information is used to indicate that the target packet is Routing according to the destination routing path described above.
  • the first insertion module includes: a first obtaining unit configured to obtain first routing information corresponding to the first routing segment set edited by the first editor, wherein the first routing information is used to indicate performing routing according to the path corresponding to the first routing segment set; a first inserting unit configured to insert the first routing segment set included in the first routing information into the target position of the initial message, Obtain the first packet.
  • the first inserting unit is configured to: insert the first routing information into a target position of the initial packet to obtain a second packet carrying the first routing information; Deleting the protocol packet header indicated by the target offset value from the second packet to obtain the first packet carrying the first routing segment set, wherein the first routing information includes the protocol packet header and The first set of routing segments.
  • the second insertion module includes: a second obtaining unit configured to obtain a destination routing node of the first message, wherein the destination routing node is an end point of a routing path; a first determining unit, For determining the target routing path in the target routing table according to the target routing node, wherein the target routing table stores the target routing path pointing to the target routing node; the second determining unit is set to The second identification of the routing information of the routing segment set to be edited is determined in the target routing path; the third obtaining unit is configured to obtain all the edited information of the second editor that matches the second identification.
  • the second routing information wherein the second routing information includes an initial routing packet header and the second routing segment set; a second insertion unit is configured to insert the second routing information into the first The destination of the message.
  • the adjusting module includes: a third determining unit configured to determine routing segment information corresponding to the plurality of routing segments carried in the intermediate message; a first modifying unit configured to The multiple routing segments of the target routing path change the first field of the initial routing packet header of the intermediate routing information to obtain the routing packet header to be processed, wherein the first field is used to indicate the intermediate packet The field lengths of the plurality of routing segments carried in the routing message; the second changing unit is configured to change the second field in the routing packet header to be processed to the target routing segment, and obtain the target routing segment carrying the target routing information The target message, wherein the target routing segment is the second routing segment among the plurality of routing segments sorted according to the target routing path, and the second field is used to indicate the next route of the message part.
  • the above-mentioned modules can be realized by software or hardware. For the latter, it can be realized by the following methods, but not limited to this: the above-mentioned modules are all located in the same processor; or, the above-mentioned modules can be combined in any combination The forms of are located in different processors.
  • Embodiments of the present invention also provide a computer-readable storage medium, in which a computer program is stored, wherein the computer program is set to execute the steps in any one of the above method embodiments when running.
  • the above-mentioned computer-readable storage medium may include but not limited to: U disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM) , mobile hard disk, magnetic disk or optical disk and other media that can store computer programs.
  • ROM read-only memory
  • RAM random access memory
  • mobile hard disk magnetic disk or optical disk and other media that can store computer programs.
  • An embodiment of the present invention also provides an electronic device, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.
  • the electronic device may further include a transmission device and an input and output device, wherein the transmission device is connected to the processor, and the input and output device is connected to the processor.
  • each module or each step of the above-mentioned embodiments of the present invention can be implemented by a general-purpose computing device, and they can be concentrated on a single computing device, or distributed among multiple computing devices. They may be implemented in program code executable by a computing device, stored in a storage device, executed by a computing device, and in some cases executed in an order different from that described herein.
  • the steps shown or described are realized by making them into respective integrated circuit modules, or making multiple modules or steps among them into a single integrated circuit module. As such, the present invention is not limited to any specific combination of hardware and software.

Abstract

Provided in the embodiments of the present invention are a routing information editing method and apparatus, and a storage medium and an electronic apparatus. The method comprises: acquiring an initial message to be routed, wherein the initial message is used for instructing the performing of routing according to a routing path that matches the initial message; inserting, into a target location of the initial message, a first routing segment set that is obtained by means of a first editor performing editing, so as to obtain a first message; inserting, into the first message, second routing information corresponding to a second routing segment set that is obtained by means of a second editor performing editing, so as to obtain an intermediate message carrying intermediate routing information; and adjusting the intermediate routing information to target routing information, so as to obtain a target message carrying the target routing information. By means of the present invention, the problem present in the related art of the editing efficiency of a message routing path being relatively low is solved, and the effect of improving the editing efficiency of a message routing path is achieved.

Description

路由信息的编辑方法、装置、存储介质及电子装置Routing information editing method, device, storage medium and electronic device
本发明要求于2021年12月27日提交中国专利局、申请号为202111621056.5、发明名称“路由信息的编辑方法、装置、存储介质及电子装置”的中国专利申请的优先权,其全部内容通过引用结合在本发明中。The present invention claims the priority of the Chinese patent application filed on December 27, 2021 with the application number 202111621056.5 and the title of the invention "routing information editing method, device, storage medium and electronic device", the entire contents of which are incorporated by reference incorporated in the present invention.
技术领域technical field
本发明实施例涉及报文处理领域,具体而言,涉及一种路由信息的编辑方法、装置、存储介质及电子装置。Embodiments of the present invention relate to the field of message processing, and in particular, relate to a routing information editing method, device, storage medium, and electronic device.
背景技术Background technique
Segment Routing(分段路由)是一种源路由技术,图1是相关技术中的Segment Routing转发面示意图,如图1所示,Segment Routing转发面分为:SR MPLS(Segment Routing Multi-Protocol Label Switching,多协议标签交换分段路由)数据面,SRv6(Segment Routing Internet Protocol Version 6,基于互联网协议第六版转发平面的段路由)数据面。SRv6是基于IPv6(Internet Protocol Version 6,互联网协议第六版)扩展的SR(Segment Routing,分段路由)解决方案。SRv6背靠IPv6数据面进一步增强了网络可编程能力,有利于支持网络和业务可编程,打通端到端的网络通道。Segment Routing (segment routing) is a source routing technology. Figure 1 is a schematic diagram of the Segment Routing forwarding plane in related technologies. As shown in Figure 1, the Segment Routing forwarding plane is divided into: SR MPLS (Segment Routing Multi-Protocol Label Switching , multi-protocol label switching segment routing) data plane, SRv6 (Segment Routing Internet Protocol Version 6, segment routing based on Internet Protocol Version 6 forwarding plane) data plane. SRv6 is an extended SR (Segment Routing, segment routing) solution based on IPv6 (Internet Protocol Version 6, Internet Protocol Version 6). Backed by the IPv6 data plane, SRv6 further enhances network programmability, which is conducive to supporting network and service programmability, and opening up end-to-end network channels.
图2是标准SRv6报文示意图,如图2所示标准的SRv6报文,包含SRH(Segment Routing Header,分段路由报文头),外层IPv6,其中,SRH分为两部分:一是SID List(Segment ID List,分段路由标识列表),长度为128bit,二是SRH的特征字段,比如:Segment Left,Last Entry(Last Entry,分段路由标识列表SID的数量)等。Figure 2 is a schematic diagram of a standard SRv6 message, as shown in Figure 2, a standard SRv6 message, including SRH (Segment Routing Header, segment routing header), the outer IPv6, wherein, SRH is divided into two parts: one is the SID List (Segment ID List, segment routing identification list), the length is 128bit, the second is the characteristic field of SRH, such as: Segment Left, Last Entry (Last Entry, the number of segment routing identification list SID), etc.
图3是SRv6 SID(Segment ID,分段路由标识)编辑示意图,如图3所示,当SRv6首节点SW-A接收到报文,会根据报文转发表项查找的结果决定是否加SRv6的封装。如果接收到的IPv6报文的MACDA(Media  Access Control Destination Address,媒体访问控制目的地址)为设备的路由MAC(Media Access Control,媒体访问控制)相同,且路由表项查找命中,下一跳为SRv6转发路径,SW-A会根据路由查找结果完成IPv6封装的编辑。Figure 3 is a schematic diagram of editing SRv6 SID (Segment ID, Segment Routing ID). encapsulation. If the MACDA (Media Access Control Destination Address, Media Access Control Destination Address) of the received IPv6 message is the same as the routing MAC (Media Access Control, Media Access Control) of the device, and the routing table entry is found, the next hop is SRv6 For forwarding path, SW-A will complete the editing of IPv6 encapsulation according to the route lookup result.
当前业界主流芯片支持的SRv6首节点的SRH加封装操作,是在交换芯片内部新增加一种SRv6类型的Nexthop(下一跳)来完成SRv6 SID List的编辑,支持SRv6转发传统网络设备在作为首节点,当入端口接收数据报文,处理过程,图4是相关技术中的SRv6首节点的SRH加封装操作示意图,如图4所示,针对芯片SRv6 SRH加封装和SID编辑的实施过程如下:The SRH encapsulation operation of the SRv6 first node supported by mainstream chips in the industry is to add a new type of SRv6 Nexthop (next hop) inside the switch chip to complete the editing of the SRv6 SID List, and to support SRv6 forwarding. Node, when the ingress port receives a data packet, the processing process, Figure 4 is a schematic diagram of the SRH encapsulation operation of the SRv6 head node in the related technology, as shown in Figure 4, the implementation process for chip SRv6 SRH encapsulation and SID editing is as follows:
1,芯片接收到数据包,首先进行报文解析处理,在解析模块获取报文MACDA,MACSA(Media Access Control Destination Address,媒体访问控制起始地址),IPv6 DA,IPv6 SA等信息,并将解析获取的报文信息携带到后续的处理流程。1. When the chip receives the data packet, it first performs message parsing and processing, and obtains message MACDA, MACSA (Media Access Control Destination Address, Media Access Control Start Address), IPv6 DA, IPv6 SA and other information in the parsing module, and parses The obtained message information is carried to the subsequent processing flow.
2,在入方向流水线,一是根据报文目的IP地址IPDA,查找转发表项,并根据查找结果对应的DestMap(目的地表),NexthopPtr(Next Hop Point Record,下一跳指针记录)等信息,携带到EPE流水线处理。其中,NexthopPtr(Next Hop Point Record,下一跳指针记录)用于索引SRv6加封装的编辑表项,DestMap用于标识转发出端口。2. In the pipeline in the inbound direction, one is to search forwarding table items according to the destination IP address IPDA of the message, and according to the information such as DestMap (destination table) and NexthopPtr (Next Hop Point Record) corresponding to the search results, Carried to the EPE pipeline for processing. Among them, NexthopPtr (Next Hop Point Record, next hop pointer record) is used to index the SRv6-encapsulated editing table item, and DestMap is used to identify the forwarding port.
3,在队列调度模块,芯片根据数据报文的Priority(优先)优先级,映射到不同的队列,并根据出端口调度。3. In the queue scheduling module, the chip maps to different queues according to the Priority (priority) of the data message, and schedules according to the outgoing port.
4,在出方向流水线,芯片会根据入方向IPE转发表项查找结果中的NextHopPtr索引到DsNexthop(下一跳加封装编辑表),并根据DsNexthop的SRv6 Edit(编选)表完成SRv6 SRH的加封装,以及多层SRv6 SID的编辑,完成报文编辑后,从出端口转发到下一跳网络设备。4. In the pipeline in the outbound direction, the chip will index to DsNexthop (next hop plus package editing table) according to the NextHopPtr in the search result of the IPE forwarding table in the inbound direction, and complete the SRv6 SRH package according to the SRv6 Edit (editing) table of DsNexthop , and edit the multi-layer SRv6 SID. After editing the message, forward it from the egress port to the next-hop network device.
在SRv6 SRH加封装处理时,当前支持SRv6的芯片也遇到的挑战,由于SRH中的SID List是由多个128bit长度的Segment List组成,超过3 个以上的SRv6 SID编辑,对交换芯片的Nexthop(下一跳)编辑表项资源消耗的压力很大。在部分场景下,对SRv6流量小,但编辑SID层数要求多的,只依靠扩展芯片Nexthop资源的方式代价较大。When SRv6 SRH is packaged and processed, chips that currently support SRv6 also encounter challenges. Since the SID List in SRH is composed of multiple 128-bit Segment Lists, more than 3 SRv6 SIDs are edited, and the Nexthop of the switching chip (Next hop) Editing table entries consumes a lot of pressure on resources. In some scenarios, where the SRv6 traffic is small but the number of SID layers edited is high, the cost of only relying on the expansion chip Nexthop resource is high.
针对相关技术中存在的报文转发路径的编辑效率较低的问题,目前尚未提出有效的解决方案。Aiming at the problem of low editing efficiency of the message forwarding path existing in the related art, no effective solution has been proposed yet.
发明内容Contents of the invention
本发明实施例提供了一种路由信息的编辑方法、装置、存储介质及电子装置,以至少解决相关技术中存在的报文转发路径的编辑效率较低的问题。Embodiments of the present invention provide a routing information editing method, device, storage medium, and electronic device, so as to at least solve the problem of low editing efficiency of message forwarding paths in the related art.
根据本发明的一个实施例,提供了一种路由信息的编辑方法,包括:获取待路由的初始报文,其中,所述初始报文用于指示按照与所述初始报文匹配的路由路径进行路由;将由第一编辑器编辑得到的第一路由段集合插入到所述初始报文的目标位置,得到第一报文,其中,所述第一路由段集合内包括的路由段数量与所述第一编辑器的路由段编辑属性匹配,所述路由段编辑属性用于指示编辑器单次编辑路由信息时所允许编辑的路由段的数量,所述第一编辑器用于编辑与所述第一编辑器所匹配格式的路由信息;将由第二编辑器编辑得到的第二路由段集合对应的第二路由信息插入到所述第一报文中,得到携带所述中间路由信息的所述中间报文,其中,所述第二路由信息用于指示按照所述第二路由段集合对应的路径进行路由,所述多个路由段包括所述第一路由段集合中的路由段以及所述第二路由段集合中的路由段,所述第二路由段集合内包括的路由段数量与所述第二编辑器的路由段编辑属性匹配,所述第二编辑器用于编辑与所述第二编辑器所匹配格式的路由信息,所述多个编辑器包括所述第一编辑器和所述第二编辑器,所述中间路由信息与所述第一路由段集合和所述第二路由段集合具有对应关系,所述第一路由段集合和所述第二路由段集合中的路由段所表示的目标路由路径与所述初始报文匹配;将所述中间路由信息调整为目标路由信息,得到携带有所述目标路由信息的目标报文,其中,所述 目标路由信息用于指示将所述目标报文按照所述目标路由路径进行路由。According to an embodiment of the present invention, a method for editing routing information is provided, including: acquiring an initial message to be routed, wherein the initial message is used to indicate that the routing path is followed by matching the initial message routing; inserting the first routing segment set edited by the first editor into the target position of the initial message to obtain the first message, wherein the number of routing segments included in the first routing segment set is the same as the The routing segment editing attribute of the first editor matches, and the routing segment editing attribute is used to indicate the number of routing segments that are allowed to be edited when the editor edits routing information once. Routing information in a format matched by the editor; inserting the second routing information corresponding to the second routing segment set edited by the second editor into the first message to obtain the intermediate message carrying the intermediate routing information In this document, the second routing information is used to indicate routing according to the path corresponding to the second routing segment set, and the plurality of routing segments include routing segments in the first routing segment set and the second routing segment set The routing segment in the routing segment set, the number of routing segments included in the second routing segment set matches the routing segment editing attribute of the second editor, and the second editor is used for editing Routing information in a matched format, the multiple editors include the first editor and the second editor, the intermediate routing information has the same information as the first routing segment set and the second routing segment set Corresponding relationship, the target routing path represented by the routing segments in the first routing segment set and the second routing segment set matches the initial message; adjust the intermediate routing information to the target routing information, and obtain the carried A target packet with the target routing information, wherein the target routing information is used to indicate that the target packet should be routed according to the target routing path.
可选地,所述将由第一编辑器编辑得到的第一路由段集合插入到所述初始报文的目标位置,得到第一报文包括:获取第一编辑器编辑的第一路由段集合对应的第一路由信息,其中,所述第一路由信息用于指示按照所述第一路由段集合对应的路径进行路由;将所述第一路由信息中包括的所述第一路由段集合插入到所述初始报文的目标位置,得到所述第一报文。Optionally, inserting the first routing segment set edited by the first editor into the target position of the initial message, and obtaining the first message includes: obtaining the first routing segment set edited by the first editor corresponding to the first routing information, wherein the first routing information is used to indicate routing according to the path corresponding to the first routing segment set; inserting the first routing segment set included in the first routing information into The target position of the initial packet is obtained from the first packet.
可选地,所述将所述第一路由信息中包括的所述第一路由段集合插入到所述初始报文的目标位置,得到所述第一报文包括:将所述第一路由信息插入到所述初始报文的目标位置,得到携带所述第一路由信息的第二报文;在所述第二报文中删除目标偏移值所指示的协议报文头,得到携带所述第一路由段集合的所述第一报文,其中,所述第一路由信息包括所述协议报文头和所述第一路由段集合。Optionally, inserting the first routing segment set included in the first routing information into the target position of the initial message, and obtaining the first message includes: inserting the first routing information Inserting into the target position of the initial message to obtain a second message carrying the first routing information; deleting the protocol header indicated by the target offset value in the second message to obtain the The first packet of the first routing segment set, wherein the first routing information includes the protocol packet header and the first routing segment set.
可选地,所述将由第二编辑器编辑得到的第二路由段集合对应的第二路由信息插入到所述第一报文中包括:获取所述第一报文的目的路由节点,其中,所述目的路由节点为路由路径的终点;根据所述目的路由节点在目标路由表中确定所述目标路由路径,其中,所述目标路由表中存储着指向所述目的路由节点的所述目标路由路径;在所述目标路由路径中确定出待编辑的路由段集合的路由信息的第二标识;获取与所述第二标识匹配的所述第二编辑器编辑的所述第二路由信息,其中,所述第二路由信息包括初始路由报文头和所述第二路由段集合;将所述第二路由信息插入到所述第一报文的目标位置。Optionally, inserting the second routing information corresponding to the second routing segment set edited by the second editor into the first message includes: obtaining the destination routing node of the first message, wherein, The destination routing node is an end point of a routing path; the destination routing path is determined in a destination routing table according to the destination routing node, wherein the destination routing table stores the destination routing pointing to the destination routing node path; determine the second identifier of the routing information of the routing segment set to be edited in the target routing path; obtain the second routing information edited by the second editor matching the second identifier, wherein , the second routing information includes an initial routing packet header and the second routing segment set; inserting the second routing information into the target position of the first packet.
可选地,所述将所述中间路由信息调整为目标路由信息,得到携带有所述目标路由信息的目标报文包括:确定所述中间报文中携带的与所述多个路由段对应的路由段信息;根据所述目标路由路径的所述多个路由段对所述中间路由信息的初始路由报文头的第一字段更改,得到待处理路由报文头,其中,所述第一字段用于指示中间报文中携带的所述多个路由段的字段长度;将所述待处理路由报文头中的第二字段更改为目标路由段,得 到携带有所述目标路由信息的所述目标报文,其中,所述目标路由段为按照所述目标路由路径排序的所述多个路由段中的第二段路由段,所述第二字段用于指示报文的下一路由段。Optionally, the adjusting the intermediate routing information to target routing information, and obtaining the target message carrying the target routing information includes: determining the routing information corresponding to the multiple routing segments carried in the intermediate message Routing section information; according to the multiple routing sections of the target routing path, the first field of the initial routing packet header of the intermediate routing information is changed to obtain the routing packet header to be processed, wherein the first field It is used to indicate the field lengths of the plurality of routing segments carried in the intermediate message; changing the second field in the routing message header to be processed to a target routing segment to obtain the target routing segment carrying the target routing information A target message, wherein the target routing segment is a second routing segment among the plurality of routing segments sorted according to the target routing path, and the second field is used to indicate the next routing segment of the message.
根据本发明的又一个实施例,还提供了一种路由信息的编辑装置,包括:获取模块,被设置为获取待路由的初始报文,其中,所述初始报文用于指示按照与所述初始报文匹配的路由路径进行路由;第一插入模块,被设置为将由第一编辑器编辑得到的第一路由段集合插入到所述初始报文的目标位置,得到第一报文,其中,所述第一路由段集合内包括的路由段数量与所述第一编辑器的路由段编辑属性匹配,所述路由段编辑属性用于指示编辑器单次编辑路由信息时所允许编辑的路由段的数量,所述第一编辑器用于编辑与所述第一编辑器所匹配格式的路由信息;第二插入模块,被设置为将由第二编辑器编辑得到的第二路由段集合对应的第二路由信息插入到所述第一报文中,得到携带所述中间路由信息的所述中间报文,其中,所述第二路由信息用于指示按照所述第二路由段集合对应的路径进行路由,所述多个路由段包括所述第一路由段集合中的路由段以及所述第二路由段集合中的路由段,所述第二路由段集合内包括的路由段数量与所述第二编辑器的路由段编辑属性匹配,所述第二编辑器用于编辑与所述第二编辑器所匹配格式的路由信息,所述多个编辑器包括所述第一编辑器和所述第二编辑器,所述中间路由信息与所述第一路由段集合和所述第二路由段集合具有对应关系,所述第一路由段集合和所述第二路由段集合中的路由段所表示的目标路由路径与所述初始报文匹配;调整模块,被设置为将所述中间路由信息调整为目标路由信息,得到携带有所述目标路由信息的目标报文,其中,所述目标路由信息用于指示将所述目标报文按照所述目标路由路径进行路由。According to yet another embodiment of the present invention, there is also provided a device for editing routing information, including: an acquisition module configured to acquire an initial message to be routed, wherein the initial message is used to indicate the The routing path matched by the initial message is routed; the first insertion module is configured to insert the first routing segment set edited by the first editor into the target position of the initial message to obtain the first message, wherein, The number of routing segments included in the first routing segment set matches the routing segment editing attribute of the first editor, and the routing segment editing attribute is used to indicate the routing segments that are allowed to be edited when the editor edits routing information once The first editor is used to edit the routing information in the format matched by the first editor; the second insertion module is set as the second corresponding to the second routing segment set edited by the second editor Inserting routing information into the first message to obtain the intermediate message carrying the intermediate routing information, wherein the second routing information is used to indicate routing according to the path corresponding to the second routing segment set , the multiple routing segments include routing segments in the first routing segment set and routing segments in the second routing segment set, the number of routing segments included in the second routing segment set is the same as the second routing segment set The routing segment editing attribute of the editor is matched, the second editor is used to edit the routing information in the format matched by the second editor, and the plurality of editors include the first editor and the second editor device, the intermediate routing information has a corresponding relationship with the first routing segment set and the second routing segment set, and the destination represented by the routing segments in the first routing segment set and the second routing segment set The routing path matches the initial message; the adjustment module is configured 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 for Instructing to route the target packet according to the target routing path.
根据本发明的又一个实施例,还提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行上述任一项方法实施例中的步骤。According to yet another embodiment of the present invention, a computer-readable storage medium is also provided, and a computer program is stored in the computer-readable storage medium, wherein the computer program is configured to perform any one of the above methods when running Steps in the examples.
根据本发明的又一个实施例,还提供了一种电子装置,包括存储器和 处理器,所述存储器中存储有计算机程序,所述处理器被设置为运行所述计算机程序以执行上述任一项方法实施例中的步骤。According to yet another embodiment of the present invention, there is also provided 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 perform any of the above Steps in the method examples.
通过本发明实施例,通过获取待路由的初始报文,其中,初始报文用于指示按照与初始报文匹配的路由路径进行路由;将由第一编辑器编辑得到的第一路由段集合插入到初始报文的目标位置,得到第一报文,其中,第一路由段集合内包括的路由段数量与第一编辑器的路由段编辑属性匹配,路由段编辑属性用于指示编辑器单次编辑路由信息时所允许编辑的路由段的数量,第一编辑器用于编辑与第一编辑器所匹配格式的路由信息;将由第二编辑器编辑得到的第二路由段集合对应的第二路由信息插入到第一报文中,得到携带中间路由信息的中间报文,其中,第二路由信息用于指示按照第二路由段集合对应的路径进行路由,多个路由段包括第一路由段集合中的路由段以及第二路由段集合中的路由段,第二路由段集合内包括的路由段数量与第二编辑器的路由段编辑属性匹配,第二编辑器用于编辑与第二编辑器所匹配格式的路由信息,多个编辑器包括第一编辑器和第二编辑器,中间路由信息与第一路由段集合和第二路由段集合具有对应关系,第一路由段集合和第二路由段集合中的路由段所表示的目标路由路径与初始报文匹配;将中间路由信息调整为目标路由信息,得到携带有目标路由信息的目标报文,其中,目标路由信息用于指示将目标报文按照目标路由路径进行路由,即,编辑器用于编辑与编辑器匹配格式的路由信息,当获取到用于指示按照与所述初始报文匹配的路由路径进行路由的初始报文时,通过第一编辑器和第二编辑器对初始报文的路由信息进行编辑,得到初始报文的路由路径对应的多个路由段,并将第一编辑器和第二编辑器编辑得到的多个路由段插入到初始报文中,进而得到携带与多个路由段具有对应关系的中间路由信息的中间报文,在对中间路由信息进行调节后,就能够得到携带目标路由信息的目标报文,实现了在对初始报文编辑路由路径时使用第一编辑器和第二编辑器编辑路由路径中的多个路由段,而不是仅使用一个编辑器对多个路由段进行编辑,从而减轻了编辑路由路径的路由信息时对设备的路由段编辑能力的要求,降低了编辑器的编辑资源的 压力,实现了通过较低的路由段编辑能力的设备完成较高的路由段编辑能力的业务需求,进而实现通过较低的路由段编辑能力完成将包括的路由段数量超过设备的路由段编辑能力的目标路由路径编辑到报文中,因此,解决了相关技术中存在的报文路由路径的编辑效率较低的问题,达到了提高报文路由路径的编辑效率的效果。Through the embodiment of the present invention, by obtaining the initial message to be routed, wherein the initial message is used to indicate routing according to the routing path matching the initial message; inserting the first routing segment set edited by the first editor into The target position of the initial message, to obtain the first message, wherein the number of routing segments included in the first routing segment set matches the routing segment editing attribute of the first editor, and the routing segment editing attribute is used to instruct the editor to edit once The number of routing segments that are allowed to be edited when routing information. The first editor is used to edit the routing information that matches the format of the first editor; insert the second routing information corresponding to the second routing segment set edited by the second editor In the first message, an intermediate message carrying intermediate routing information is obtained, wherein the second routing information is used to indicate routing according to the path corresponding to the second routing segment set, and the plurality of routing segments include the first routing segment set Routing segments and routing segments in the second routing segment set, the number of routing segments included in the second routing segment set matches the routing segment editing properties of the second editor, and the second editor is used to edit the format matched by the second editor The routing information of the multiple editors includes the first editor and the second editor, and the intermediate routing information has a corresponding relationship with the first routing segment set and the second routing segment set. In the first routing segment set and the second routing segment set The target routing path represented by the routing segment of the target matches the initial message; the intermediate routing information is adjusted to the target routing information to obtain the target message carrying the target routing information, wherein the target routing information is used to indicate that the target message is routed according to the target The routing path is used for routing, that is, the editor is used to edit the routing information that matches the format of the editor. Edit the routing information of the initial message with the second editor to obtain multiple routing segments corresponding to the routing path of the initial message, and insert the multiple routing segments edited by the first editor and the second editor into the initial In the message, the intermediate message carrying the intermediate routing information corresponding to multiple routing segments can be obtained. After the intermediate routing information is adjusted, the target message carrying the target routing information can be obtained. When editing the routing path, the first editor and the second editor are used to edit multiple routing segments in the routing path, instead of using only one editor to edit multiple routing segments, thereby reducing the burden of editing the routing information of the routing path The requirement for the routing segment editing capability of the device at the same time reduces the pressure on the editor's editing resources, and realizes the business requirements of higher routing segment editing capabilities through devices with lower routing segment editing capabilities. The editing ability of the routing section can complete the editing of the target routing path including the number of routing sections exceeding the routing section editing capability of the device into the message. Therefore, the problem of low editing efficiency of the routing path of the message existing in the related technology is solved. The effect of improving the editing efficiency of the message routing path is achieved.
附图说明Description of drawings
图1是相关技术中的Segment Routing转发面示意图;Figure 1 is a schematic diagram of the Segment Routing forwarding plane in the related art;
图2是标准SRv6报文示意图;Figure 2 is a schematic diagram of a standard SRv6 message;
图3是SRv6 SID编辑示意图;Figure 3 is a schematic diagram of SRv6 SID editing;
图4是相关技术中的SRv6首节点的SRH加封装操作示意图;FIG. 4 is a schematic diagram of an SRH encapsulation operation of an SRv6 first node in the related art;
图5是本发明实施例的路由信息的编辑方法的移动终端硬件结构框图;Fig. 5 is a block diagram of the mobile terminal hardware structure of the editing method of routing information according to the embodiment of the present invention;
图6是根据本发明实施例的路由信息的编辑方法的流程图;6 is a flowchart of a method for editing routing information according to an embodiment of the present invention;
图7是根据本发明实施例的一种可选的路由段插入示意图;FIG. 7 is a schematic diagram of an optional routing segment insertion according to an embodiment of the present invention;
图8是根据本发明实施例的一种可选的首次插入路由报文的报文示意图;FIG. 8 is a schematic diagram of an optional message for inserting a routing message for the first time according to an embodiment of the present invention;
图9是根据本发明实施例的一种可选的中间路由信息示意图;Fig. 9 is a schematic diagram of optional intermediate routing information according to an embodiment of the present invention;
图10是根据本发明实施例的一种可选的目标路由路径编辑方法流程图;FIG. 10 is a flow chart of an optional target routing path editing method according to an embodiment of the present invention;
图11是根据本发明实施例的一种可选的报文环回示意图;FIG. 11 is a schematic diagram of an optional message loopback according to an embodiment of the present invention;
图12是根据本发明实施例的路由信息的编辑装置的结构框图。Fig. 12 is a structural block diagram of a device for editing routing information according to an embodiment of the present invention.
具体实施方式Detailed ways
下文中将参考附图并结合实施例来详细说明本发明的实施例。Embodiments of the present invention will be described in detail below with reference to the drawings and in combination with the embodiments.
需要说明的是,本发明实施例的说明书和权利要求书及上述附图中的 术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。It should be noted that the terms "first" and "second" in the description and claims of the embodiments of the present invention and the above drawings are used to distinguish similar objects, but not necessarily to describe a specific order or sequence order.
本申请实施例中所提供的方法实施例可以在移动终端、计算机终端或者类似的运算装置中执行。以运行在移动终端上为例,图5是本发明实施例的路由信息的编辑方法的移动终端硬件结构框图。如图5所示,移动终端可以包括一个或多个(图5中仅示出一个)处理器502(处理器502可以包括但不限于微处理器MCU(Microcontroller Unit,微控制单元)或可编程逻辑器件FPGA(Field Programmable Gate Array,可编辑逻辑阵列)等的处理装置)和用于存储数据的存储器504,其中,上述移动终端还可以包括被设置为通信功能的传输设备506以及输入输出设备508。本领域普通技术人员可以理解,图5所示的结构仅为示意,其并不对上述移动终端的结构造成限定。例如,移动终端还可包括比图5中所示更多或者更少的组件,或者具有与图5所示不同的配置。The method embodiments provided in the embodiments of the present application may be executed in mobile terminals, computer terminals or similar computing devices. Taking the mobile terminal as an example, FIG. 5 is a block diagram of the hardware structure of the mobile terminal according to the routing information editing method according to the embodiment of the present invention. As shown in Figure 5, the mobile terminal may include one or more (only one is shown in Figure 5) processors 502 (the processor 502 may include but not limited to a microprocessor MCU (Microcontroller Unit, micro control unit) or programmable Processing devices such as logic devices FPGA (Field Programmable Gate Array, editable logic array) and a memory 504 for storing data, wherein the above-mentioned mobile terminal may also include a transmission device 506 and an input/output device 508 configured as a communication function . Those skilled in the art can understand that the structure shown in FIG. 5 is only for illustration, and it does not limit the structure of the above-mentioned mobile terminal. For example, the mobile terminal may also include more or fewer components than those shown in FIG. 5, or have a different configuration from that shown in FIG.
存储器504可被设置为存储计算机程序,例如,应用软件的软件程序以及模块,如本发明实施例中的路由信息的编辑方法对应的计算机程序,处理器502通过运行存储在存储器504内的计算机程序,从而执行各种功能应用以及数据处理,即实现上述的方法。存储器504可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器504可包括相对于处理器502远程设置的存储器,这些远程存储器可以通过网络连接至移动终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 504 can be set to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the routing information editing method in the embodiment of the present invention, the processor 502 runs the computer program stored in the memory 504 , so as to perform various functional applications and data processing, that is, to realize the above-mentioned method. The memory 504 may include high-speed random access memory, and may also include 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 504 may include memory located remotely from the processor 502, and these remote memories may be connected to the mobile terminal through a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
传输装置506被设置为经由一个网络接收或者发送数据。上述的网络实例可包括移动终端的通信供应商提供的无线网络。在一个实例中,传输装置506包括一个网络适配器(Network Interface Controller,简称为NIC),其可通过基站与其他网络设备相连从而可与互联网进行通讯。在一个实例中,传输装置506可以为射频(Radio Frequency,简称为RF)模块,其被设置为通过无线方式与互联网进行通讯。The transmission device 506 is arranged to receive or transmit data via a network. The aforementioned network example may include a wireless network provided by a mobile terminal's communication provider. In one example, the transmission device 506 includes a network interface controller (NIC for short), 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 506 may be a radio frequency (Radio Frequency, referred to as RF) module, which is configured to communicate with the Internet in a wireless manner.
在本实施例中提供了一种路由信息的编辑方法,图6是根据本发明实施例的路由信息的编辑方法的流程图,如图6所示,该流程包括如下步骤:In this embodiment, a method for editing routing information is provided. FIG. 6 is a flowchart of a method for editing routing information according to an embodiment of the present invention. As shown in FIG. 6, the process includes the following steps:
步骤S602,获取待转发的初始报文,其中,所述初始报文用于指示按照与所述初始报文匹配的路由路径进行路由;Step S602, acquiring an initial packet to be forwarded, wherein the initial packet is used to indicate routing according to a routing path matching the initial packet;
步骤S604,将由第一编辑器编辑得到的第一路由段集合插入到所述初始报文的目标位置,得到第一报文,其中,所述第一路由段集合内包括的路由段数量与所述第一编辑器的路由段编辑属性匹配,所述路由段编辑属性用于指示编辑器单次编辑路由信息时所允许编辑的路由段的数量,所述第一编辑器用于编辑与所述第一编辑器所匹配格式的路由信息;Step S604, inserting the first routing segment set edited by the first editor into the target position of the initial message to obtain the first message, wherein the number of routing segments included in the first routing segment set is the same as the number of routing segments included in the first routing segment set Match the routing segment editing attribute of the first editor, the routing segment editing attribute is used to indicate the number of routing segments that the editor is allowed to edit when editing routing information once, and the first editor is used to edit the Routing information in the format matched by the editor;
步骤S606,将由第二编辑器编辑得到的第二路由段集合对应的第二路由信息插入到所述第一报文中,得到携带所述中间路由信息的所述中间报文,其中,所述第二路由信息用于指示按照所述第二路由段集合对应的路径进行路由,所述多个路由段包括所述第一路由段集合中的路由段以及所述第二路由段集合中的路由段,所述第二路由段集合内包括的路由段数量与所述第二编辑器的路由段编辑属性匹配,所述第二编辑器用于编辑与所述第二编辑器所匹配格式的路由信息,所述中间路由信息与所述第一路由段集合和所述第二路由段集合具有对应关系,所述第一路由段集合和所述第二路由段集合中的路由段所表示的目标路由路径与所述初始报文匹配;Step S606, inserting the second routing information corresponding to the second routing segment set edited by the second editor into the first message to obtain the intermediate message carrying the intermediate routing information, wherein the The second routing information is used to indicate routing according to the path corresponding to the second routing segment set, and the multiple routing segments include routing segments in the first routing segment set and routes in the second routing segment set segment, the number of routing segments included in the second routing segment set matches the routing segment editing attribute of the second editor, and the second editor is used to edit routing information in a format matched by the second editor , the intermediate routing information has a corresponding relationship with the first routing segment set and the second routing segment set, and the target route represented by the routing segments in the first routing segment set and the second routing segment set The path matches the initial message;
步骤S608,将所述中间路由信息调整为目标路由信息,得到携带有所述目标路由信息的目标报文,其中,所述目标路由信息用于指示将所述目标报文按照所述目标路由路径进行路由。Step S608, 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 that the target message is routed according to the target routing path for routing.
通过上述步骤,编辑器用于编辑与编辑器匹配格式的路由信息,当获取到用于指示按照与所述初始报文匹配的路由路径进行路由的初始报文时,通过第一编辑器和第二编辑器对初始报文的路由信息进行编辑,得到初始报文的路由路径对应的多个路由段,并将第一编辑器和第二编辑器编辑得到的多个路由段插入到初始报文中,进而得到携带与多个路由段具有 对应关系的中间路由信息的中间报文,在对中间路由信息进行调节后,就能够得到携带目标路由信息的目标报文,实现了在对初始报文编辑路由路径时使用第一编辑器和第二编辑器编辑路由路径中的多个路由段,而不是仅使用一个编辑器对多个路由段进行编辑,从而减轻了编辑路由路径的路由信息时对设备的路由段编辑能力的要求,降低了编辑器的编辑资源的压力,实现了通过较低的路由段编辑能力的设备完成较高的路由段编辑能力的业务需求,进而实现通过较低的路由段编辑能力完成将包括的路由段数量超过设备的路由段编辑能力的目标路由路径编辑到报文中,因此,解决了相关技术中存在的报文路由路径的编辑效率较低的问题,达到了提高报文路由路径的编辑效率的效果。Through the above steps, the editor is used to edit the routing information matching the format of the editor. When the initial message indicating to route according to the routing path matching the initial message is obtained, the first editor and the second The editor edits the routing information of the initial message to obtain multiple routing segments corresponding to the routing path of the initial message, and inserts the multiple routing segments edited by the first editor and the second editor into the initial message , and then obtain the intermediate message carrying the intermediate routing information corresponding to multiple routing segments. After the intermediate routing information is adjusted, the target message carrying the target routing information can be obtained, and the editing of the initial message is realized. When routing paths, use the first editor and the second editor to edit multiple routing segments in the routing path, instead of using only one editor to edit multiple routing segments, thereby reducing the burden on the device when editing the routing information of the routing path The requirements for the ability to edit routing segments reduce the pressure on the editor’s editing resources, and realize the business requirements of higher editing capabilities for routing segments through devices with lower routing segment editing capabilities, and then realize the The editing ability completes the editing of the target routing path whose number of routing segments exceeds the routing segment editing capability of the device into the message. Therefore, the problem of low editing efficiency of the routing path of the message in the related technology is solved, and the improvement is achieved. The effect of editing efficiency on the packet routing path.
在上述步骤S602提供的技术方案中,初始报文可以是IPv6格式的报文,也可以是IPv4格式的报文,本方案对此不做限定。In the technical solution provided in step S602 above, the initial message may be a message in IPv6 format or a message in IPv4 format, which is not limited in this solution.
可选地,在本实施例中,初始报文可以携带有目标字段,根据该目标字段能够确定与初始报文的路由路径进行路由的信息,比如初始报文的报文头中携带有报文的目的路由节点和报文的起始路由节点,根据目的路由节点和起始路由节点就能够确定出匹配的路由路径,或者还可以是初始报文中携带有用于指示路径的标识信息,根据该标识信息能够确定与标识信息匹配的路由路径。Optionally, in this embodiment, the initial message may carry a target field, and according to the target field, the information for routing with the routing path of the initial message can be determined, for example, the message header of the initial message carries a message The destination routing node of the message and the starting routing node of the message, the matching routing path can be determined according to the destination routing node and the starting routing node, or the identification information used to indicate the path can also be carried in the initial message, according to the The identification information can determine a routing path matching the identification information.
在上述步骤S604提供的技术方案中,目标路由路径中可以只包括一个第一路由段集合,也可以包括多个第一路由段集合,当目标路由路径中包括多个第一路由段集合的情况下,只需重复调用第一编辑器进行编辑,从而得到多个第一路由段集合。In the technical solution provided in step S604 above, the target routing path may include only one first routing segment set, or may include multiple first routing segment sets, when the target routing path includes multiple first routing segment sets Next, you only need to repeatedly call the first editor for editing, so as to obtain multiple sets of first routing segments.
可选地,在本实施例中,编辑器是用于编辑路由信息的,编辑器可以是编辑表的形式,在该编辑表中,存储着编辑路由信息的固定字段,或者,编辑器还可以是分装好的包括用于编辑路由信息的代码的脚本包,本方案对此不做限定。Optionally, in this embodiment, the editor is used to edit routing information, and the editor may be in the form of an editing table, in which a fixed field for editing routing information is stored, or the editor may also be It is a packaged script package including codes for editing routing information, which is not limited in this solution.
在上述步骤S606提供的技术方案中,目标路由路径中可以只包括一 个第二路由段集合,也可以包括多个第二路由段集合,比如当目标路由段集合内包括两个第二路由段集合时,需要调用两次第二编辑器编辑第二路由段集合对应的第二路由信息,并通过设置偏移值将两个第二路由信息中第一次插入的第二路由信息的路由头删掉,本方案对第二路由段的数量不做限定。In the technical solution provided in step S606 above, the target routing path may include only one second routing segment set, or may include multiple second routing segment sets, for example, when the target routing segment set includes two second routing segment sets , the second editor needs to be called twice to edit the second routing information corresponding to the second routing segment set, and the routing header of the second routing information inserted for the first time in the two second routing information is deleted by setting the offset value. This solution does not limit the number of second routing segments.
可选地,在本实施例中,不同设备的第二编辑器的编辑能力不同,第二路由段集合内包括的路由段数量小于等于所述第二编辑器的路由段编辑属性所允许编辑的最大路由段数量,比如第二编辑器单次能够编辑3个路由段,则一个第二路由段集合内可以包括3个路由段,也可以包括两个路由段,本方案对此不做限定Optionally, in this embodiment, the editing capabilities of the second editors of different devices are different, and the number of routing segments included in the second routing segment set is less than or equal to the number of routing segments allowed to be edited by the routing segment editing properties of the second editor. The maximum number of routing segments. For example, the second editor can edit 3 routing segments at a time, and a second routing segment set can include 3 routing segments or two routing segments. This solution does not limit this
可选地,在本实施例中,中间路由信息中包括路由路径中的多个路由段以及目标格式的报文头,比如,中间路由信息可以包括目标路由路径包括的多个路由段以及SRH(Segment Routing Header,分段路由报文头)。Optionally, in this embodiment, the intermediate routing information includes multiple routing segments in the routing path and a packet header in the target format. For example, the intermediate routing information may include multiple routing segments included in the target routing path and the SRH( Segment Routing Header, segment routing header).
在上述步骤S608提供的技术方案中,将中间路由信息调整为目标路由信息可以是对报文头中的固定字段进行调节,或者还可以是对多个路由路径的排序进行调整,比如,中间路由信息为SRv6格式的路由信息,通过对SRH中的相关字段(比如:SL(Segment Left,分段路由标识剩余数量)、LE(Last Entry,分段路由标识列表SID的数量)等等)进行调整。In the technical solution provided by the above step S608, adjusting the intermediate routing information to the target routing information may be adjusting the fixed field in the packet header, or it may also be adjusting the ordering of multiple routing paths, for example, the intermediate routing The information is routing information in SRv6 format, which is adjusted by related fields in SRH (for example: SL (Segment Left, the remaining number of segment routing identifiers), LE (Last Entry, the number of segment routing identifier list SIDs), etc.) .
作为一种可选地实施例,所述将由第一编辑器编辑得到的第一路由段集合插入到所述初始报文的目标位置,得到第一报文包括:As an optional embodiment, inserting the first routing segment set edited by the first editor into the target position of the initial message, and obtaining the first message includes:
获取第一编辑器编辑的第一路由段集合对应的第一路由信息,其中,所述第一路由信息用于指示按照所述第一路由段集合对应的路径进行路由;Obtaining first routing information corresponding to the first routing segment set edited by the first editor, wherein the first routing information is used to indicate routing according to a path corresponding to the first routing segment set;
将所述第一路由信息中包括的所述第一路由段集合插入到所述初始报文的目标位置,得到所述第一报文。Inserting the first routing segment set included in the first routing information into the target position of the initial packet to obtain the first packet.
可选地,在本实施例中,将第一路由信息中可以但不限于包括报文头 和第一路由段集合中的路由段,将第一路由信息中包括的第一路由段集合插入到初始报文的目标位置可以是在第一编辑器中只获取第一路由段集合,也可以是将第一路由信息插入到所述初始报文中,并在插入初始报文的目标位置后删除第一路由信息中的报文头。Optionally, in this embodiment, the first routing information may include, but is not limited to, routing segments in the packet header and the first routing segment set, and insert the first routing segment set included in the first routing information into The target position of the initial message may be to obtain only the first routing segment set in the first editor, or insert the first routing information into the initial message, and delete it after inserting the target position of the initial message A packet header in the first routing information.
可选地,在本实施例中,目标位置可以但不限于是初始报文中紧邻协议报文头后的位置。Optionally, in this embodiment, the target location may be, but not limited to, the location immediately after the header of the protocol packet in the initial packet.
作为一种可选地实施例,所述将所述第一路由信息中包括的所述第一路由段集合插入到所述初始报文的目标位置,得到所述第一报文包括:As an optional embodiment, the inserting the first routing segment set included in the first routing information into the target position of the initial message, and obtaining the first message includes:
将所述第一路由信息插入到所述初始报文的目标位置,得到携带所述第一路由信息的第二报文;Inserting the first routing information into the target position of the initial message to obtain a second message carrying the first routing information;
在所述第二报文中删除目标偏移值所指示的协议报文头,得到携带所述第一路由段集合的所述第一报文,其中,所述第一路由信息包括所述协议报文头和所述第一路由段集合。Delete the protocol packet header indicated by the target offset value in the second packet to obtain the first packet carrying the first routing segment set, wherein the first routing information includes the protocol A packet header and the set of the first routing segment.
图7是根据本发明实施例的一种可选的路由段插入示意图,本实施例可以应用于通过IPv6协议报文编辑SRv6分段路由,如图7所示可以但不限于包括以下操作:通过第一编辑器编辑得到第一路由段集合的第一路由信息,即图中的IPv6 Packet,该IPv6 packet中包括协议报文头IPv6 Header和两个路由段,两个路由段分别存储在协议报文的IPv6 SA和IPv6 DA位置,每次插入都是将IPv6 Packet封装到SRv6 payload位置,并在插入后设置offset偏移值,砍掉8字节的IPv6 Header,留下IPv6 DA和IPv6 SA,作为SRv6 SID。Fig. 7 is a schematic diagram of an optional routing segment insertion according to an embodiment of the present invention. This embodiment can be applied to edit SRv6 segment routes through IPv6 protocol messages. As shown in Fig. 7, the following operations can be but not limited to: The first editor edits and obtains the first routing information of the first routing segment set, that is, the IPv6 Packet in the figure. This IPv6 packet includes the protocol packet header IPv6 Header and two routing segments, and the two routing segments are stored in the protocol packet respectively. The IPv6 SA and IPv6 DA positions of the text, each insertion is to encapsulate the IPv6 Packet into the SRv6 payload position, and set the offset offset value after insertion, cut off the 8-byte IPv6 Header, and leave the IPv6 DA and IPv6 SA, As an SRv6 SID.
作为一种可选地实施例,所述获取第一编辑器编辑的第一路由段集合对应的第一路由信息包括:As an optional embodiment, the acquiring the first routing information corresponding to the first routing segment set edited by the first editor includes:
获取所述初始报文的目的路由节点,其中,所述目的路由节点为路由路径的终点;Obtaining a destination routing node of the initial message, wherein the destination routing node is an end point of a routing path;
根据所述目的路由节点在目标路由表中确定所述目标路由路径,其中, 所述目标路由表中存储着指向所述目的路由节点的所述目标路由路径;determining the target routing path in a target routing table according to the destination routing node, wherein the target routing table stores the target routing path pointing to the destination routing node;
在所述目标路由路径中确定出待编辑的路由段集合的路由信息的第一标识;determining the first identifier of the routing information of the routing segment set to be edited in the target routing path;
获取与所述第一标识匹配的所述第一编辑器编辑的所述第一路由信息。Acquire the first routing information edited by the first editor that matches the first identifier.
可选地,在本实施例中,第一标识是用于指示待编辑的路由段的标识,第一标识可以是路由段在路由路径中的编号,还可以是路由段的起始节点的信息或者终止节点的信息等等,本方案对此不做限定。Optionally, in this embodiment, the first identifier is an identifier used to indicate the routing segment to be edited, and the first identifier may be the number of the routing segment in the routing path, or the information of the starting node of the routing segment Or the information of the termination node, etc., which is not limited in this solution.
可选地,在本实施例中,在目标路由路径中确定待编辑的路由段集合的路由信息的方法可以但不限于是根据对报文中包括的已编辑的路由段对目标路由路径中包括的路由段进行匹配确定的,还可以是确定报文中包括的已编辑的路由段的终止节点的信息,然后在目标路由路径中根据路由段的排序确定排在终止节点后的路由段的信息,本方案对此不做限定。Optionally, in this embodiment, the method for determining the routing information of the set of routing segments to be edited in the target routing path may be, but not limited to, based on the edited routing segments included in the message. It can also determine the information of the termination node of the edited routing segment included in the message, and then determine the information of the routing segment after the termination node in the target routing path according to the order of the routing segment , this scheme does not limit it.
作为一种可选地实施例,所述将由第二编辑器编辑得到的第二路由段集合对应的第二路由信息插入到所述第一报文中包括:As an optional embodiment, the inserting the second routing information corresponding to the second routing segment set edited by the second editor into the first message includes:
获取所述第一报文的目的路由节点,其中,所述目的路由节点为路由路径的终点;Obtaining a destination routing node of the first message, wherein the destination routing node is an end point of a routing path;
根据所述目的路由节点在目标路由表中确定所述目标路由路径,其中,所述目标路由表中存储着指向所述目的路由节点的所述目标路由路径;determining the target routing path in a target routing table according to the destination routing node, wherein the target routing table stores the target routing path pointing to the destination routing node;
在所述目标路由路径中确定出待编辑的路由段集合的路由信息的第二标识;determining a second identifier of the routing information of the routing segment set to be edited in the target routing path;
获取与所述第二标识匹配的所述第二编辑器编辑的所述第二路由信息,其中,所述第二路由信息包括初始路由报文头和所述第二路由段集合;Acquire the second routing information edited by the second editor that matches the second identifier, where the second routing information includes an initial routing header and the second routing segment set;
将所述第二路由信息插入到所述第一报文的目标位置。inserting the second routing information into the target position of the first packet.
可选地,在本实施例中,目标位置可以但不限于是初始报文中紧邻协 议报文头后的位置。Optionally, in this embodiment, the target location may be, but not limited to, the location immediately after the header of the protocol packet in the initial packet.
作为一种可选地实施例,所述将所述中间路由信息调整为目标路由信息,得到携带有所述目标路由信息的目标报文包括:As an optional embodiment, the adjusting the intermediate routing information to the target routing information to obtain the target message carrying the target routing information includes:
确定所述中间报文中携带的与所述多个路由段对应的路由段信息;determining routing segment information corresponding to the plurality of routing segments carried in the intermediate message;
根据所述目标路由路径的所述多个路由段对所述中间路由信息的初始路由报文头的第一字段更改,得到待处理路由报文头,其中,所述第一字段用于指示中间报文中携带的所述多个路由段的字段长度;According to the multiple routing segments of the target routing path, the first field of the initial routing packet header of the intermediate routing information is changed to obtain the routing packet header to be processed, wherein the first field is used to indicate the intermediate The field lengths of the multiple routing segments carried in the message;
将所述待处理路由报文头中的第二字段更改为目标路由段,得到携带有所述目标路由信息的所述目标报文,其中,所述目标路由段为按照所述目标路由路径排序的所述多个路由段中的第二段路由段,所述第二字段用于指示报文的下一路由段。changing the second field in the pending routing packet header to a target routing segment to obtain the target packet carrying the target routing information, wherein the target routing segment is sorted according to the target routing path The second routing segment in the multiple routing segments, the second field is used to indicate the next routing segment of the message.
可选地,在本实施例中,还可以先使用第二编辑器编辑第二路由信息,即包括路由报文头和第二路由段集合的路由报文,第二编辑器用于编辑路由报文,第二编辑器每次可以编辑两个路由段,该第二路由段集合包括目标路由路径的起始节点的路由段,将第二路由信息插入到初始报文中,再将第一编辑器编辑的第一路由段集合插入到已插入第二路由信息的初始报文中,第一编辑器用于编辑协议报文,比如目标路由路径包括10个路由段,按照路由路径的起点到终点的顺序分别为SID1、SID2、......、SID9、SID10,则使用第二编辑器编辑SID1和SID2的路由信息,图8是根据本发明实施例的一种可选的首次插入路由报文的报文示意图,如图8可以但不限于包括初始报文的协议报文头IPv6 Header,协议报文头中包括目标路由路径的目的路由节点IPv6 DA0和目标路由路径的起始路由节点IPv6SA0,插入的第二路由信息包括SRH、SID1和SID2,在插入第二路由信息后,使用第一编辑器编辑SID3至SID10,第一编辑器每次编辑两个路由段,第一编辑器为编辑IPv6格式的协议报文的编辑器,其中,因为第一编辑器的第一路由信息的IPv6 DA和IPv6 SA的字段长度都为128字节,与SID的字节长度相等,所以让第一编辑器编辑的第一路由信息中的IPv6  DA和IPv6 SA的字段为对应的路由段,并将第一路由信息中的IPv6 DA和IPv6 SA的字段插入到SRH字段后,得到中间路由信息,图9是根据本发明实施例的一种可选的中间路由信息示意图,如图9所示SID3至SID10是调用第一编辑器编辑的路由段,当得到包括中间路由信息的中间报文后,SID1至SID10的字段信息对中间路由信息的SRH中的字段进行修改,得到包括目标路由信息的目标报文。Optionally, in this embodiment, the second editor can also be used to edit the second routing information, that is, the routing message including the routing message header and the second routing segment set, and the second editor is used to edit the routing message , the second editor can edit two routing segments each time, the second routing segment set includes the routing segment of the starting node of the target routing path, inserts the second routing information into the initial message, and then inserts the first editor The edited first routing segment set is inserted into the initial message that has been inserted into the second routing information. The first editor is used to edit the protocol message. For example, the target routing path includes 10 routing segments, according to the order from the start point to the end point of the routing path Respectively SID1, SID2, ..., SID9, SID10, then use the second editor to edit the routing information of SID1 and SID2, Figure 8 is an optional first insertion routing message according to an embodiment of the present invention The schematic diagram of the message, as shown in Figure 8, can include but is not limited to the protocol message header IPv6 Header of the initial message, and the protocol message header includes the destination routing node IPv6 DA0 of the target routing path and the initial routing node IPv6SA0 of the target routing path, The inserted second routing information includes SRH, SID1 and SID2. After inserting the second routing information, use the first editor to edit SID3 to SID10. The first editor edits two routing segments at a time. The first editor is for editing IPv6 format, wherein, because the field lengths of IPv6 DA and IPv6 SA of the first routing information of the first editor are both 128 bytes, which is equal to the byte length of SID, so let the first editor The fields of IPv6 DA and IPv6 SA in the edited first routing information are corresponding routing segments, and after inserting the fields of IPv6 DA and IPv6 SA in the first routing information into the SRH field, intermediate routing information is obtained, as shown in Figure 9 According to a schematic diagram of an optional intermediate routing information according to an embodiment of the present invention, as shown in FIG. 9, SID3 to SID10 are the routing segments edited by calling the first editor. modify the fields in the SRH of the intermediate routing information to obtain the target message including the target routing information.
图10是根据本发明实施例的一种可选的目标路由路径编辑方法流程图,用于增强交换芯片对SRv6 SID的编辑能力的方案,在充分兼容已有芯片架构设计基础上,通过芯片的IPv6编辑能力,配合芯片环回机制,实现更多层数的SRv6 SID编辑能力,如图10可以但不限于包括如下步骤:Fig. 10 is a flow chart of an optional target routing path editing method according to an embodiment of the present invention, which is used to enhance the editing capability of the switching chip to the SRv6 SID. On the basis of being fully compatible with the existing chip architecture design, through the chip The IPv6 editing capability, in conjunction with the chip loopback mechanism, realizes more layers of SRv6 SID editing capabilities, as shown in Figure 10, but is not limited to the following steps:
S1001,芯片接收到数据包,首先进行报文解析处理,在解析模块获取报文MACDA,MACSA,IPv6 DA,IPv6 SA等信息,并将解析获取的报文信息携带到后续的处理流程。S1001, the chip receives the data packet, firstly performs message analysis processing, obtains message MACDA, MACSA, IPv6 DA, IPv6 SA and other information in the analysis module, and carries the message information obtained by analysis to the subsequent processing flow.
S1002,在入方向流水线,一是根据报文目的IP地址IPDA,查找转发表项,并根据查找结果对应的outport,NextHop等信息,携带到EPE流水线处理。其中,NextHop用于索引SRv6加封装的编辑表项,outport用于标识转发出端口。S1002, in the pipeline in the inbound direction, one is to search forwarding table items according to the destination IP address IPDA of the message, and carry it to the EPE pipeline for processing according to the outport, NextHop and other information corresponding to the search results. Among them, NextHop is used to index the SRv6-encapsulated editing table item, and outport is used to identify the forwarding port.
S1003,在队列调度模块,芯片根据数据报文的Priority优先级,映射到不同的队列,并根据出端口调度。S1003, in the queue scheduling module, the chip maps data packets to different queues according to the Priority of the data packets, and schedules according to the outgoing port.
S1004,在出方向流水线,芯片会入方向IPE(Ingress Pipeline,入口通道)转发表项查找结果中的NextHopPtr索引到下一跳,并根据下一跳的IPv6头部编辑表完成IPv6 SA和IPv6 DA的编辑,以及IPv6 Header前8字节的编辑。其中,这里的IPv6 DA和IPv6 SA是用于作为SRv6 SRH中的2个SID,如果需要增加更多的SRv6 SID需要通过芯片环回再次回到IPE流水线处理。S1004, in the outbound pipeline, the chip will forward the NextHopPtr index in the table item search result to the next hop in the inbound direction IPE (Ingress Pipeline, entry channel), and complete IPv6 SA and IPv6 DA according to the IPv6 header edit table of the next hop Editing, and editing of the first 8 bytes of the IPv6 Header. Among them, the IPv6 DA and IPv6 SA here are used as two SIDs in the SRv6 SRH. If you need to add more SRv6 SIDs, you need to return to the IPE pipeline for processing through chip loopback.
S1005,判断是否需要执行换回机制,如果不需要,则执行步骤S1007,如果需要,则执行步骤S1006。S1005, judge whether it is necessary to execute the switchback mechanism, if not, execute step S1007, and if necessary, execute step S1006.
S1006,执行换回机制,当再次环回到IPE流水线,仍然是先进行报文解析处理,在解析模块获取报文IPv6 DA,IPv6 SA等信息,并将解析获取的报文信息携带到后续的处理流程,第二次IPE入方向流水线,一是根据报文目的IP地址IPv6 DA,查找ACL表项,并根据查找结果中的Strip_offset=8表示砍掉对应offset偏移的IPv6 Header前8字节,此外,ACL查找结果对应的outport,下一跳等信息,携带到EPE(Egress Pipeline,出口通道)流水线处理。其中,当待IPv6编辑表编辑的SID全部编辑完成后,则下一跳用于索引SRv6加封装的编辑表项,当待IPv6编辑表编辑的SID未全部编辑完成,则下一跳用于索引IPv6加封装的编辑表项,outport用于标识转发出端口,Loop后第二次在出方向流水线,此时,IPv6报文已被砍掉IPv6 Header前8字节。芯片会入方向IPE ACL表项查找结果中的NextHop索引到下一跳,并根据下一跳的IPv6头部编辑表,在被指定的Offset位置完成IPv6 SA和IPv6 DA的编辑。S1006, execute the switchback mechanism. When looping back to the IPE pipeline again, the packet analysis process is still performed first, and the packet IPv6 DA, IPv6 SA and other information are obtained in the parsing module, and the packet information obtained by parsing is carried to the subsequent Processing flow, the second IPE inbound direction pipeline, one is to search for ACL entries according to the destination IP address IPv6 DA of the message, and cut off the first 8 bytes of the IPv6 Header corresponding to the offset according to Strip_offset=8 in the search result , In addition, the outport, next hop and other information corresponding to the ACL search results are carried to the EPE (Egress Pipeline, egress channel) pipeline for processing. Among them, when all the SIDs to be edited in the IPv6 edit table are edited, the next hop is used to index the SRv6-encapsulated edit table items, and when the SIDs to be edited in the IPv6 edit table are not all edited, the next hop is used to index The edit entry for IPv6 plus encapsulation, outport is used to identify the forwarding port, and the second time is pipelined in the outbound direction after Loop. At this time, the first 8 bytes of the IPv6 header have been cut off from the IPv6 packet. The chip will enter the NextHop index in the search result of the IPE ACL entry to the next hop, and complete the editing of IPv6 SA and IPv6 DA at the specified Offset position according to the IPv6 header edit table of the next hop.
S1007,输出携带目标路由路径的目标报文。S1007. Output a target message carrying a target routing path.
图11是根据本发明实施例的一种可选的报文环回示意图,应用于图10的路由路径编辑方法流程图的芯片,如图11所示可以但不限于包括以下内容,报文从交换机的IPv6 Packet In端口输入到IPE,完成报文的解析后,将解析后的信息携带到EPE流水线处理,并完成一次路由段编辑,当需要换回处理时,EPE处理后的报文再次环回到IPE流水线处理,TM(Traffic Manage,调度管理)用于队列调度,可根据数据报文的Priority优先级,映射到不同的队列,并根据出端口调度。Fig. 11 is a schematic diagram of an optional message loopback according to an embodiment of the present invention, which is applied to the chip in the flow chart of the routing path editing method in Fig. 10. As shown in Fig. 11, it may include but is not limited to the following content. The IPv6 Packet In port of the switch is input to the IPE. After the message is parsed, the parsed information is carried to the EPE pipeline for processing, and a routing segment edit is completed. When it needs to be switched back, the message processed by the EPE is looped again. Back to IPE pipeline processing, TM (Traffic Manage, scheduling management) is used for queue scheduling, which can be mapped to different queues according to the Priority of data packets, and scheduled according to the outgoing port.
本发明实施例通过芯片的IPv6编辑能力,配合芯片环回机制,实现更多层数的SRv6 SID编辑能力,解决芯片一次SRv6 SID编辑遇到层数不足的挑战,降低了芯片在编辑能力设计的代价和复杂度;充分复用了芯片IPv6表项和环回机制,一是降低了SRv6 Nexthop的表项资源消耗的压力,二是不需要增加芯片设计的复杂度的情况下,实现每次环回额外增加2层128bit SRv6 SID编辑能力。The embodiment of the present invention uses the chip's IPv6 editing capability and cooperates with the chip loopback mechanism to realize more layers of SRv6 SID editing capabilities, solve the challenge of insufficient layers in one SRv6 SID editing of the chip, and reduce the chip's editing capability design. Cost and complexity; the chip IPv6 table entry and loopback mechanism are fully reused, one is to reduce the pressure on resource consumption of SRv6 Nexthop table entries, and the other is to realize each loopback without increasing the complexity of the chip design. Add 2 additional layers of 128bit SRv6 SID editing capability.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is Better implementation. Based on such an understanding, the technical solutions of the embodiments of the present invention can be embodied in the form of software products, which are stored in a storage medium (such as ROM/RAM, magnetic CD, CD), including several instructions to make a terminal device (which may be a mobile phone, computer, server, or network device, etc.) execute the methods described in various embodiments of the present invention.
在本实施例中还提供了一种路由信息的编辑装置,图12是根据本发明实施例的路由信息的编辑装置的结构框图,如图12所示,该装置包括:In this embodiment, a device for editing routing information is also provided. FIG. 12 is a structural block diagram of a device for editing routing information according to an embodiment of the present invention. As shown in FIG. 12 , the device includes:
获取模块1202,被设置为获取待路由的初始报文,其中,所述初始报文用于指示按照与所述初始报文匹配的路由路径进行路由;The acquiring module 1202 is configured to acquire an initial packet to be routed, where the initial packet is used to indicate routing according to a routing path that matches the initial packet;
第一插入模块1204,被设置为将由第一编辑器编辑得到的第一路由段集合插入到所述初始报文的目标位置,得到第一报文,其中,所述第一路由段集合内包括的路由段数量与所述第一编辑器的路由段编辑属性匹配,所述路由段编辑属性用于指示编辑器单次编辑路由信息时所允许编辑的路由段的数量,所述第一编辑器用于编辑与所述第一编辑器所匹配格式的路由信息;The first inserting module 1204 is configured to insert the first routing segment set edited by the first editor into the target position of the initial message to obtain the first message, wherein the first routing segment set includes The number of routing segments matches the routing segment editing attribute of the first editor, and the routing segment editing attribute is used to indicate the number of routing segments that are allowed to be edited when the editor edits routing information once, and the first editor uses for editing routing information in a format matched by the first editor;
第二插入模块1206,被设置为将由第二编辑器编辑得到的第二路由段集合对应的第二路由信息插入到所述第一报文中,得到携带所述中间路由信息的所述中间报文,其中,所述第二路由信息用于指示按照所述第二路由段集合对应的路径进行路由,所述多个路由段包括所述第一路由段集合中的路由段以及所述第二路由段集合中的路由段,所述第二路由段集合内包括的路由段数量与所述第二编辑器的路由段编辑属性匹配,所述第二编辑器用于编辑与所述第二编辑器所匹配格式的路由信息,所述多个编辑器包括所述第一编辑器和所述第二编辑器,所述中间路由信息与所述第一路由段集合和所述第二路由段集合具有对应关系,所述第一路由段集合和所 述第二路由段集合中的路由段所表示的目标路由路径与所述初始报文匹配;The second inserting module 1206 is configured to insert the second routing information corresponding to the second routing segment set edited by the second editor into the first message, and obtain the intermediate message carrying the intermediate routing information In this document, the second routing information is used to indicate routing according to the path corresponding to the second routing segment set, and the plurality of routing segments include routing segments in the first routing segment set and the second routing segment set The routing segment in the routing segment set, the number of routing segments included in the second routing segment set matches the routing segment editing attribute of the second editor, and the second editor is used for editing Routing information in a matched format, the multiple editors include the first editor and the second editor, the intermediate routing information has the same information as the first routing segment set and the second routing segment set Corresponding relationship, the target routing path represented by the routing segments in the first routing segment set and the second routing segment set matches the initial message;
调整模块1208,被设置为将所述中间路由信息调整为目标路由信息,得到携带有所述目标路由信息的目标报文,其中,所述目标路由信息用于指示将所述目标报文按照所述目标路由路径进行路由。The adjustment module 1208 is configured to adjust the intermediate routing information to target routing information to obtain a target packet carrying the target routing information, wherein the target routing information is used to indicate that the target packet is Routing according to the destination routing path described above.
可选地,所述第一插入模块包括:第一获取单元,被设置为获取第一编辑器编辑的第一路由段集合对应的第一路由信息,其中,所述第一路由信息用于指示按照所述第一路由段集合对应的路径进行路由;第一插入单元,被设置为将所述第一路由信息中包括的所述第一路由段集合插入到所述初始报文的目标位置,得到所述第一报文。Optionally, the first insertion module includes: a first obtaining unit configured to obtain first routing information corresponding to the first routing segment set edited by the first editor, wherein the first routing information is used to indicate performing routing according to the path corresponding to the first routing segment set; a first inserting unit configured to insert the first routing segment set included in the first routing information into the target position of the initial message, Obtain the first packet.
可选地,所述第一插入单元被设置为:将所述第一路由信息插入到所述初始报文的目标位置,得到携带所述第一路由信息的第二报文;在所述第二报文中删除目标偏移值所指示的协议报文头,得到携带所述第一路由段集合的所述第一报文,其中,所述第一路由信息包括所述协议报文头和所述第一路由段集合。Optionally, the first inserting unit is configured to: insert the first routing information into a target position of the initial packet to obtain a second packet carrying the first routing information; Deleting the protocol packet header indicated by the target offset value from the second packet to obtain the first packet carrying the first routing segment set, wherein the first routing information includes the protocol packet header and The first set of routing segments.
可选地,所述第二插入模块包括:第二获取单元,被设置为获取所述第一报文的目的路由节点,其中,所述目的路由节点为路由路径的终点;第一确定单元,用于根据所述目的路由节点在目标路由表中确定所述目标路由路径,其中,所述目标路由表中存储着指向所述目的路由节点的所述目标路由路径;第二确定单元,被设置为在所述目标路由路径中确定出待编辑的路由段集合的路由信息的第二标识;第三获取单元,被设置为获取与所述第二标识匹配的所述第二编辑器编辑的所述第二路由信息,其中,所述第二路由信息包括初始路由报文头和所述第二路由段集合;第二插入单元,被设置为将所述第二路由信息插入到所述第一报文的目标位置。Optionally, the second insertion module includes: a second obtaining unit configured to obtain a destination routing node of the first message, wherein the destination routing node is an end point of a routing path; a first determining unit, For determining the target routing path in the target routing table according to the target routing node, wherein the target routing table stores the target routing path pointing to the target routing node; the second determining unit is set to The second identification of the routing information of the routing segment set to be edited is determined in the target routing path; the third obtaining unit is configured to obtain all the edited information of the second editor that matches the second identification. The second routing information, wherein the second routing information includes an initial routing packet header and the second routing segment set; a second insertion unit is configured to insert the second routing information into the first The destination of the message.
可选地,所述调整模块包括:第三确定单元,被设置为确定所述中间报文中携带的与所述多个路由段对应的路由段信息;第一更改单元,被设置为根据所述目标路由路径的所述多个路由段对所述中间路由信息的初 始路由报文头的第一字段更改,得到待处理路由报文头,其中,所述第一字段用于指示中间报文中携带的所述多个路由段的字段长度;第二更改单元,被设置为将所述待处理路由报文头中的第二字段更改为目标路由段,得到携带有所述目标路由信息的所述目标报文,其中,所述目标路由段为按照所述目标路由路径排序的所述多个路由段中的第二段路由段,所述第二字段用于指示报文的下一路由段。Optionally, the adjusting module includes: a third determining unit configured to determine routing segment information corresponding to the plurality of routing segments carried in the intermediate message; a first modifying unit configured to The multiple routing segments of the target routing path change the first field of the initial routing packet header of the intermediate routing information to obtain the routing packet header to be processed, wherein the first field is used to indicate the intermediate packet The field lengths of the plurality of routing segments carried in the routing message; the second changing unit is configured to change the second field in the routing packet header to be processed to the target routing segment, and obtain the target routing segment carrying the target routing information The target message, wherein the target routing segment is the second routing segment among the plurality of routing segments sorted according to the target routing path, and the second field is used to indicate the next route of the message part.
需要说明的是,上述各个模块是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器中;或者,上述各个模块以任意组合的形式分别位于不同的处理器中。It should be noted that the above-mentioned modules can be realized by software or hardware. For the latter, it can be realized by the following methods, but not limited to this: the above-mentioned modules are all located in the same processor; or, the above-mentioned modules can be combined in any combination The forms of are located in different processors.
本发明的实施例还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序,其中,该计算机程序被设置为运行时执行上述任一项方法实施例中的步骤。Embodiments of the present invention also provide a computer-readable storage medium, in which a computer program is stored, wherein the computer program is set to execute the steps in any one of the above method embodiments when running.
在一个示例性实施例中,上述计算机可读存储介质可以包括但不限于:U盘、只读存储器(Read-Only Memory,简称为ROM)、随机存取存储器(Random Access Memory,简称为RAM)、移动硬盘、磁碟或者光盘等各种可以存储计算机程序的介质。In an exemplary embodiment, the above-mentioned computer-readable storage medium may include but not limited to: U disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM) , mobile hard disk, magnetic disk or optical disk and other media that can store computer programs.
本发明的实施例还提供了一种电子装置,包括存储器和处理器,该存储器中存储有计算机程序,该处理器被设置为运行计算机程序以执行上述任一项方法实施例中的步骤。An embodiment of the present invention also provides an electronic device, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.
在一个示例性实施例中,上述电子装置还可以包括传输设备以及输入输出设备,其中,该传输设备和上述处理器连接,该输入输出设备和上述处理器连接。In an exemplary embodiment, the electronic device may further include a transmission device and an input and output device, wherein the transmission device is connected to the processor, and the input and output device is connected to the processor.
本实施例中的示例可以参考上述实施例及示例性实施方式中所描述的示例,本实施例在此不再赘述。For examples in this embodiment, reference may be made to the examples described in the foregoing embodiments and exemplary implementation manners, and details will not be repeated here in this embodiment.
显然,本领域的技术人员应该明白,上述的本发明实施例的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上, 或者分布在多个计算装置所组成的网络上,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。Obviously, those skilled in the art should understand that each module or each step of the above-mentioned embodiments of the present invention can be implemented by a general-purpose computing device, and they can be concentrated on a single computing device, or distributed among multiple computing devices. They may be implemented in program code executable by a computing device, stored in a storage device, executed by a computing device, and in some cases executed in an order different from that described herein. The steps shown or described are realized by making them into respective integrated circuit modules, or making multiple modules or steps among them into a single integrated circuit module. As such, the present invention is not limited to any specific combination of hardware and software.
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的原则之内,所作的任何修改、等同替换、改进等,均应包括在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and changes. 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 (10)

  1. 一种路由信息的编辑方法,包括:A method for editing routing information, comprising:
    获取待路由的初始报文,其中,所述初始报文用于指示按照与所述初始报文匹配的路由路径进行路由;Obtaining an initial packet to be routed, where the initial packet is used to indicate routing according to a routing path that matches the initial packet;
    将由第一编辑器编辑得到的第一路由段集合插入到所述初始报文的目标位置,得到第一报文,其中,所述第一路由段集合内包括的路由段数量与所述第一编辑器的路由段编辑属性匹配,所述路由段编辑属性用于指示编辑器单次编辑路由信息时所允许编辑的路由段的数量,所述第一编辑器用于编辑与所述第一编辑器所匹配格式的路由信息;Inserting the first routing segment set edited by the first editor into the target position of the initial message to obtain the first message, wherein the number of routing segments included in the first routing segment set is equal to the first The editor's routing segment editing attribute matches, the routing segment editing attribute is used to indicate the number of routing segments that the editor is allowed to edit when editing the routing information once, and the first editor is used to edit the same as the first editor Routing information in the matched format;
    将由第二编辑器编辑得到的第二路由段集合对应的第二路由信息插入到所述第一报文中,得到携带中间路由信息的中间报文,其中,所述第二路由信息用于指示按照所述第二路由段集合对应的路径进行路由,多个路由段包括所述第一路由段集合中的路由段以及所述第二路由段集合中的路由段,所述第二路由段集合内包括的路由段数量与所述第二编辑器的路由段编辑属性匹配,所述第二编辑器用于编辑与所述第二编辑器所匹配格式的路由信息,所述中间路由信息与所述第一路由段集合和所述第二路由段集合具有对应关系,所述第一路由段集合和所述第二路由段集合中的路由段所表示的目标路由路径与所述初始报文匹配;Inserting the second routing information corresponding to the second routing segment set edited by the second editor into the first message to obtain an intermediate message carrying intermediate routing information, wherein the second routing information is used to indicate Perform routing according to the path corresponding to the second routing segment set, the multiple routing segments include routing segments in the first routing segment set and routing segments in the second routing segment set, the second routing segment set The number of routing segments included in matches the routing segment editing properties of the second editor, and the second editor is used to edit the routing information in a format that matches the second editor, and the intermediate routing information is consistent with the The first routing segment set and the second routing segment set have a corresponding relationship, and the target routing path represented by the routing segments in the first routing segment set and the second routing segment set matches the initial packet;
    将所述中间路由信息调整为目标路由信息,得到携带有所述目标路由信息的目标报文,其中,所述目标路由信息用于指示将所述目标报文按照所述目标路由路径进行路由。Adjusting the intermediate routing information to target routing information to obtain a target packet carrying the target routing information, wherein the target routing information is used to indicate that the target packet is routed according to the target routing path.
  2. 根据权利要求1所述的方法,其中,所述将由第一编辑器编辑得到的第一路由段集合插入到所述初始报文的目标位置,得到第一报文包括:The method according to claim 1, wherein said inserting the first routing segment set edited by the first editor into the target position of the initial message, and obtaining the first message includes:
    获取第一编辑器编辑的第一路由段集合对应的第一路由信息,其中,所述第一路由信息用于指示按照所述第一路由段集合对应的路径进行路 由;Obtaining first routing information corresponding to the first routing segment set edited by the first editor, wherein the first routing information is used to indicate routing according to the path corresponding to the first routing segment set;
    将所述第一路由信息中包括的所述第一路由段集合插入到所述初始报文的目标位置,得到所述第一报文。Inserting the first routing segment set included in the first routing information into the target position of the initial packet to obtain the first packet.
  3. 根据权利要求2所述的方法,其中,所述将所述第一路由信息中包括的所述第一路由段集合插入到所述初始报文的目标位置,得到所述第一报文包括:The method according to claim 2, wherein the inserting the first routing segment set included in the first routing information into the target position of the initial message, and obtaining the first message includes:
    将所述第一路由信息插入到所述初始报文的目标位置,得到携带所述第一路由信息的第二报文;Inserting the first routing information into the target position of the initial message to obtain a second message carrying the first routing information;
    在所述第二报文中删除目标偏移值所指示的协议报文头,得到携带所述第一路由段集合的所述第一报文,其中,所述第一路由信息包括所述协议报文头和所述第一路由段集合。Delete the protocol packet header indicated by the target offset value in the second packet to obtain the first packet carrying the first routing segment set, wherein the first routing information includes the protocol A packet header and the set of the first routing segment.
  4. 根据权利要求1所述的方法,其中,所述将由第二编辑器编辑得到的第二路由段集合对应的第二路由信息插入到所述第一报文中包括:The method according to claim 1, wherein inserting the second routing information corresponding to the second routing segment set edited by the second editor into the first message includes:
    获取所述第一报文的目的路由节点,其中,所述目的路由节点为路由路径的终点;Obtaining a destination routing node of the first message, wherein the destination routing node is an end point of a routing path;
    根据所述目的路由节点在目标路由表中确定所述目标路由路径,其中,所述目标路由表中存储着指向所述目的路由节点的所述目标路由路径;determining the target routing path in a target routing table according to the destination routing node, wherein the target routing table stores the target routing path pointing to the destination routing node;
    在所述目标路由路径中确定出待编辑的路由段集合的路由信息的第二标识;determining a second identifier of the routing information of the routing segment set to be edited in the target routing path;
    获取与所述第二标识匹配的所述第二编辑器编辑的所述第二路由信息,其中,所述第二路由信息包括初始路由报文头和所述第二路由段集合;Acquire the second routing information edited by the second editor that matches the second identifier, where the second routing information includes an initial routing header and the second routing segment set;
    将所述第二路由信息插入到所述第一报文的目标位置。inserting the second routing information into the target position of the first packet.
  5. 根据权利要求1所述的方法,其中,所述将所述中间路由信息调整为目标路由信息,得到携带有所述目标路由信息的目标报文包括:The method according to claim 1, wherein said adjusting said intermediate routing information to target routing information, and obtaining a target message carrying said target routing information comprises:
    确定所述中间报文中携带的与所述多个路由段对应的路由段信息;determining routing segment information corresponding to the plurality of routing segments carried in the intermediate message;
    根据所述目标路由路径的所述多个路由段对所述中间路由信息的初始路由报文头的第一字段更改,得到待处理路由报文头,其中,所述第一字段用于指示中间报文中携带的所述多个路由段的字段长度;According to the multiple routing segments of the target routing path, the first field of the initial routing packet header of the intermediate routing information is changed to obtain the routing packet header to be processed, wherein the first field is used to indicate the intermediate The field lengths of the multiple routing segments carried in the message;
    将所述待处理路由报文头中的第二字段更改为目标路由段,得到携带有所述目标路由信息的所述目标报文,其中,所述目标路由段为按照所述目标路由路径排序的所述多个路由段中的第二段路由段,所述第二字段用于指示报文的下一路由段。changing the second field in the pending routing packet header to a target routing segment to obtain the target packet carrying the target routing information, wherein the target routing segment is sorted according to the target routing path The second routing segment in the multiple routing segments, the second field is used to indicate the next routing segment of the packet.
  6. 一种路由信息的编辑装置,包括:A device for editing routing information, comprising:
    获取模块,被设置为获取待路由的初始报文,其中,所述初始报文用于指示按照与所述初始报文匹配的路由路径进行路由;An obtaining module configured to obtain an initial message to be routed, wherein the initial message is used to indicate routing according to a routing path that matches the initial message;
    第一插入模块,被设置为将由第一编辑器编辑得到的第一路由段集合插入到所述初始报文的目标位置,得到第一报文,其中,所述第一路由段集合内包括的路由段数量与所述第一编辑器的路由段编辑属性匹配,所述路由段编辑属性用于指示编辑器单次编辑路由信息时所允许编辑的路由段的数量,所述第一编辑器用于编辑与所述第一编辑器所匹配格式的路由信息;The first insertion module is configured to insert the first routing segment set edited by the first editor into the target position of the initial message to obtain the first message, wherein the first routing segment set included in the The number of routing segments matches the routing segment editing attribute of the first editor, and the routing segment editing attribute is used to indicate the number of routing segments allowed to be edited when the editor edits the routing information once, and the first editor is used to Editing routing information in a format matched by the first editor;
    第二插入模块,被设置为将由第二编辑器编辑得到的第二路由段集合对应的第二路由信息插入到所述第一报文中,得到携带中间路由信息的中间报文,其中,所述第二路由信息用于指示按照所述第二路由段集合对应的路径进行路由,多个路由段包括所述第一路由段集合中的路由段以及所述第二路由段集合中的路由段,所述第二路由段集合内包括的路由段数量与所述第二编辑器的路由段编辑属性匹配,所述第二编辑器用于编辑与所述第二编辑器所匹配格式的路由信息,所述中间路由信息与所述第一路由段集合和所述第二路由段集合具有对应关系,所述第一路由段集合和所述第二路由段集合中的路由段所表示的目标路由路径与所述初始报文匹配;The second insertion module is configured to insert the second routing information corresponding to the second routing segment set edited by the second editor into the first message to obtain an intermediate message carrying intermediate routing information, wherein the The second routing information is used to indicate routing according to the path corresponding to the second routing segment set, and the multiple routing segments include routing segments in the first routing segment set and routing segments in the second routing segment set , the number of routing segments included in the second routing segment set matches the routing segment editing attribute of the second editor, and the second editor is used to edit routing information in a format matched by the second editor, The intermediate routing information has a corresponding relationship with the first routing segment set and the second routing segment set, and the target routing path represented by the routing segments in the first routing segment set and the second routing segment set Matching with the initial message;
    调整模块,被设置为将所述中间路由信息调整为目标路由信息,得到携带有所述目标路由信息的目标报文,其中,所述目标路由信息用于指示 将所述目标报文按照所述目标路由路径进行路由。An adjustment module, configured 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 that the target message is to be processed according to the Destination routing path for routing.
  7. 根据权利要求6所述的装置,其中,所述第一插入模块包括:The apparatus of claim 6, wherein the first plug-in module comprises:
    第一获取单元,被设置为获取第一编辑器编辑的第一路由段集合对应的第一路由信息,其中,所述第一路由信息用于指示按照所述第一路由段集合对应的路径进行路由;The first obtaining unit is configured to obtain the first routing information corresponding to the first routing segment set edited by the first editor, wherein the first routing information is used to indicate to follow the path corresponding to the first routing segment set routing;
    第一插入单元,被设置为将所述第一路由信息中包括的所述第一路由段集合插入到所述初始报文的目标位置,得到所述第一报文。The first inserting unit is configured to insert the first routing segment set included in the first routing information into a target position of the initial message to obtain the first message.
  8. 根据权利要求7所述的装置,其中,所述第一插入单元被设置为:The device according to claim 7, wherein the first plug-in unit is configured to:
    将所述第一路由信息插入到所述初始报文的目标位置,得到携带所述第一路由信息的第二报文;Inserting the first routing information into the target position of the initial message to obtain a second message carrying the first routing information;
    在所述第二报文中删除目标偏移值所指示的协议报文头,得到携带所述第一路由段集合的所述第一报文,其中,所述第一路由信息包括所述协议报文头和所述第一路由段集合。Delete the protocol packet header indicated by the target offset value in the second packet to obtain the first packet carrying the first routing segment set, wherein the first routing information includes the protocol A packet header and the set of the first routing segment.
  9. 一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,其中,所述计算机程序被处理器执行时实现所述权利要求1至5任一项中所述的方法的步骤。A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, wherein, when the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 5 are implemented .
  10. 一种电子装置,包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现所述权利要求1至5任一项中所述的方法的步骤。An electronic device, comprising a memory, a processor, and a computer program stored on the memory and operable on the processor, when the processor executes the computer program, any one of claims 1 to 5 is realized The steps of the method described in item.
PCT/CN2022/142480 2021-12-27 2022-12-27 Routing information editing method and apparatus, and storage medium and electronic apparatus WO2023125563A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111621056.5A CN116366516A (en) 2021-12-27 2021-12-27 Editing method and device of route information, storage medium and electronic device
CN202111621056.5 2021-12-27

Publications (1)

Publication Number Publication Date
WO2023125563A1 true WO2023125563A1 (en) 2023-07-06

Family

ID=86910388

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/142480 WO2023125563A1 (en) 2021-12-27 2022-12-27 Routing information editing method and apparatus, and storage medium and electronic apparatus

Country Status (2)

Country Link
CN (1) CN116366516A (en)
WO (1) WO2023125563A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140097869A1 (en) * 2012-10-08 2014-04-10 Tony Kai-Kit Ngai Heterogeneous segmented and direct routing architecture for field programmable gate array
CN105635167A (en) * 2016-01-25 2016-06-01 盛科网络(苏州)有限公司 Method and device for realizing message edition function by using hardware
US20170346720A1 (en) * 2014-12-23 2017-11-30 Telefonaktiebolaget Lm Ericsson (Publ) Path computation in a segment routing network
CN111314219A (en) * 2020-02-24 2020-06-19 盛科网络(苏州)有限公司 Efficient forwarding method and device for IPv6 segmented routing

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140097869A1 (en) * 2012-10-08 2014-04-10 Tony Kai-Kit Ngai Heterogeneous segmented and direct routing architecture for field programmable gate array
US20170346720A1 (en) * 2014-12-23 2017-11-30 Telefonaktiebolaget Lm Ericsson (Publ) Path computation in a segment routing network
CN105635167A (en) * 2016-01-25 2016-06-01 盛科网络(苏州)有限公司 Method and device for realizing message edition function by using hardware
CN111314219A (en) * 2020-02-24 2020-06-19 盛科网络(苏州)有限公司 Efficient forwarding method and device for IPv6 segmented routing

Also Published As

Publication number Publication date
CN116366516A (en) 2023-06-30

Similar Documents

Publication Publication Date Title
US11082342B2 (en) System and method to facilitate content forwarding using Bit Index Explicit Replication (BIER) in an Information-Centric Networking (ICN) environment
US11374848B2 (en) Explicit routing with network function encoding
US20220078114A1 (en) Method and Apparatus for Providing Service for Traffic Flow
WO2018000443A1 (en) Service function chaining (sfc)-based packet forwarding method, device and system
WO2016165492A1 (en) Method and apparatus for implementing service function chain
CN106992915B (en) Message de-encapsulation processing and data writing method and device
WO2021135468A1 (en) Segment identifier determining method and device
CN108933756B (en) Data packet processing method, access network equipment and computer readable storage medium
CN110224935B (en) Method and device for processing multicast data message
CN114189473A (en) Message sending method and device
US20230379244A1 (en) Ultra reliable segment routing
CN112491729A (en) Data processing method and device, storage medium and electronic device
US11882021B2 (en) Packet forwarding method, apparatus and system, network device and storage medium
WO2021197141A1 (en) Service processing method and apparatus, and device and storage medium
US20240106751A1 (en) Method and apparatus for processing detnet data packet
WO2021088813A1 (en) Packet encapsulating method and apparatus, and packet decapsulating method and apparatus
CN112910777B (en) Message processing method and device
WO2023125563A1 (en) Routing information editing method and apparatus, and storage medium and electronic apparatus
WO2020114083A1 (en) Method and apparatus for processing ioam information
WO2022198560A1 (en) In-site oam method and electronic device
WO2016197933A2 (en) Packet forwarding
CN110932968A (en) Flow forwarding method and device
WO2023024755A1 (en) Mpls packet encapsulation method and apparatus, and storage medium and electronic apparatus
KR100908843B1 (en) How to Configure a Forwarding Table in a Routing System
CN111835736B (en) Message transmission method and system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22914815

Country of ref document: EP

Kind code of ref document: A1