Message forwarding method and device, switch equipment and storage medium
By combining the port ring and port isolation technology on the switch, the three -layer forwarding function of the packet under the HSR/PRP protocol is realized, solving the problem of high cost, low efficiency and CPU consumption in existing technology, and achieved efficient efficiency. Three layers of forwarding.
Patent Information
- Application Number
- CN202411443765.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-01-24
AI Technical Summary
The existing HSR/PRP protocol faces the problems of high cost, low efficiency and high CPU consumption when implementing layer three forwarding of packets. It is difficult to implement layer three forwarding function without increasing network construction costs and reducing CPU consumption.
By combining port ring back and port isolation technology, the three -layer forwarding function of HSR/PRP packets is implemented on a switch. Specific methods include obtaining the status of the message, reposting according to the preset state, and replicating and backup transmission through the network transmission protocol module.
Without increasing network construction costs and reducing CPU consumption, the three-layer packet forwarding function under the HSR/PRP protocol is implemented, improving efficiency and reducing CPU consumption.
Smart Images

Figure CN119363687A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of message forwarding, and in particular to a message forwarding method, device, switch equipment and storage medium. Background Art
[0002] The HSR / PRP redundancy protocol is a high-reliability technology protocol that can achieve zero packet loss and is widely used in power, trains, and industrial Ethernet. Figure 1 In the logical diagram of the HSR / PRP switch shown in the figure, PortA and PortB are two backup ports of the HSR / PRP protocol. When the interlink Port receives a message, it will copy it into two copies and send them to PortA and PortB respectively. After receiving the two duplicate messages from PortA and PortB, the HSR / PRP module will not process the switching forwarding module, but will eliminate the duplicate messages by itself before forwarding them to the interlink Port. In the switch, PortA and PortB can communicate with the CPU and interlink ports, but cannot communicate with the non-HSR / PRP ports of the switch (for example, port1...port n). At the same time, the interlink port of HSR / PRP can communicate with all ports, including the CPU.
[0003] That is, due to the high complexity of the message forwarding technology field, the current HSR / PRP protocol faces the following challenges when implementing Layer 3 message forwarding: First, the interlink port is connected to another Layer 3 switch, which is responsible for Layer 3 forwarding. At the same time, on this switch, all messages (including messages after Layer 3 forwarding) are backed up through the interlink port. This method requires an additional Layer 3 switch, which increases the cost of network construction. Second, using the communication capabilities of PortA, PortB and the interlink port with the CPU, the CPU processes the message and then forwards it to the interlink port, PortA and PortB. This method requires the CPU to not only process the message, but also eliminate duplicate messages for the messages of PortA and PortB. This method that relies on the CPU for software processing cannot achieve line-speed forwarding, is inefficient, and consumes a lot of CPU.
[0004] Therefore, how to realize the Layer 3 forwarding function of packets under the HSR / PRP protocol without increasing the cost of network construction and reducing CPU consumption has become an important issue that needs to be solved urgently. Summary of the invention
[0005] In view of this, the embodiments of the present application provide a message forwarding method, device, switch device and storage medium, which can effectively solve the problems in the prior art that the three-layer message forwarding function under the HSR / PRP protocol cannot be realized, and the network construction cost is high and the efficiency is low.
[0006] In a first aspect, an embodiment of the present application provides a message forwarding method, including:
[0007] When the message arrives at the switch and is successfully received, obtaining the status of the message;
[0008] When the state of the message is a preset state, forwarding the message from the first port of the switch to the second port of the switch;
[0009] When the second port of the switch receives the message, the forwarding decision of the message is obtained, the message is forwarded according to the forwarding decision of the message and a forwarding exit of the message is obtained;
[0010] When the forwarding exit of the message is a preset exit, the message is forwarded to the first port of the switch through the second port of the switch, so that the message is sent to the network transmission protocol module of the switch for replication, and the replicated message is sent to the backup port of the switch to complete the backup transmission.
[0011] In some embodiments, the switch is configured with a Marvell switch chip; when the message arrives at the switch and is successfully received, before obtaining the status of the message, the method includes:
[0012] The Marvell switching chip is used to disconnect the backup port from the switching processing module and the CPU module in the switch.
[0013] In some embodiments, when the message arrives at the switch and is successfully received, obtaining the status of the message further includes:
[0014] Determine whether the state of the message is a duplicate state;
[0015] When the state of the message is a duplicate state, executing a discard action strategy for the message;
[0016] When the state of the message is a non-repetitive state, the message is forwarded according to the forwarding strategy.
[0017] In some embodiments, forwarding the message according to the forwarding decision of the message and obtaining the egress of the message further includes:
[0018] When the forwarding decision of the message is layer 2 forwarding, performing layer 2 forwarding on the message and obtaining an egress of the message after performing layer 2 forwarding;
[0019] When the forwarding decision of the message is layer-3 forwarding, the message is forwarded at layer-3 and an egress of the message after the layer-3 forwarding is performed is obtained.
[0020] In some embodiments, when the forwarding decision of the message is layer 2 forwarding, after performing layer 2 forwarding on the message and obtaining the exit of performing layer 2 forwarding message, it also includes:
[0021] When the forwarding exit of the message that has been forwarded at the second layer does not match the preset exit, the message that has been forwarded at the second layer is forwarded to a common port of the switch.
[0022] In some embodiments, when the forwarding decision of the message is layer-3 forwarding, after performing layer-3 forwarding on the message and obtaining the egress of the message after performing layer-3 forwarding, the method further includes:
[0023] When the forwarding exit of the message that has been forwarded at the third layer matches the preset exit, the message that has been forwarded at the third layer is forwarded to the first port of the switch through the second port of the switch.
[0024] In some embodiments, when the forwarding outlet of the message is a preset outlet, after forwarding the message to the first port of the switch through the second port of the switch, the method further includes:
[0025] When the first port of the switch receives the message that has been forwarded at the third layer, the message that has been forwarded at the third layer is sent to the network transmission protocol module for replication;
[0026] The copied three-layer forwarding message is forwarded to the backup port of the switch; the backup port is used for network backup transmission.
[0027] In a second aspect, an embodiment of the present application provides a message forwarding device, including:
[0028] A message status acquisition module, used for acquiring the status of the message when the message arrives at the switch and is successfully received;
[0029] A message forwarding module, used for forwarding the message from the first port of the switch to the second port of the switch when the state of the message is a preset state;
[0030] A message type acquisition module, used for acquiring a forwarding decision of the message when the second port of the switch receives the message, forwarding the message according to the forwarding decision of the message and acquiring a forwarding exit of the message;
[0031] The backup transmission module is used to forward the message to the first port of the switch through the second port of the switch when the forwarding exit of the message is the preset exit, so as to send the message to the network transmission protocol module of the switch for replication, and send the replicated message to the backup port of the switch to complete the backup transmission.
[0032] In a third aspect, an embodiment of the present application provides a switch device, the switch device comprising a processor and a memory, the memory storing a computer program, the processor being used to execute the computer program to implement the message forwarding method of the first aspect above; the switch device comprising a first port and a second port; the first port of the switch device is connected to the second port of the switch device.
[0033] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, and when the computer program is executed on a processor, the message forwarding method of the first aspect described above is implemented.
[0034] The embodiments of the present application have the following beneficial effects:
[0035] The present application discloses a message forwarding method, device, switch device and storage medium. When a message arrives at a switch and is successfully received, the network transmission protocol module of the switch obtains the status of the message. If the status of the message is consistent with the preset status, the message is forwarded from the first port of the switch to the second port. When the second port receives the message, the switch processing module obtains the forwarding decision of the message and determines the forwarding exit of the message according to the forwarding decision. If the forwarding exit of the message is consistent with the preset exit, the message is forwarded to the first port through the second port and sent to the network transmission protocol module of the switch for copying, and then sent to the backup port of the switch to complete the backup transmission. The present application discloses a message forwarding method, device, switch device and storage medium. Under the premise of not increasing the network construction cost and reducing the CPU consumption, the three-layer forwarding function of HSR / PRP messages is realized on a switch by combining port loopback and port isolation technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 A conventional HSR / PRP switch logic diagram of a message forwarding method according to an embodiment of the present application is shown;
[0038] Figure 2 A flow chart of a message forwarding method according to an embodiment of the present application is shown;
[0039] Figure 3 A logical schematic diagram of an HSR / PRP switch of a message forwarding method according to an embodiment of the present application is shown;
[0040] Figure 4 Another flow chart of a message forwarding method according to an embodiment of the present application is shown;
[0041] Figure 5 Another flow chart of a message forwarding method according to an embodiment of the present application is shown;
[0042] Figure 6 Another flow chart of a message forwarding method according to an embodiment of the present application is shown;
[0043] Figure 7 A schematic structural diagram of a message forwarding device according to an embodiment of the present application is shown.
[0044] Description of main component symbols: 100: network transmission protocol module; 110: switching processing module; 120: CPU module; 130: first port; 140: second port; 150: backup port. DETAILED DESCRIPTION
[0045] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0046] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0047] Hereinafter, the terms "including", "having" and their cognates that can be used in various embodiments of the present application are intended only to indicate specific features, numbers, steps, operations, elements, components or a combination of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or a combination of the foregoing items or increasing the possibility of one or more features, numbers, steps, operations, elements, components or a combination of the foregoing items. In addition, the terms "first", "second", "third" and the like are only used to distinguish descriptions and cannot be understood as indicating or implying relative importance.
[0048] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.
[0049] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0050] Considering that the current existing technology cannot realize the three-layer forwarding function of the message under the HSR / PRP protocol, and the network construction cost is high, it is too dependent on the CPU, and the efficiency is low, a message forwarding method, device, switch equipment and storage medium are proposed. When the message arrives at the switch and is successfully received, the network transmission protocol module of the switch will obtain the status of the message. If the status of the message is consistent with the preset state, the message is forwarded from the first port of the switch to the second port. When the second port receives the message, the switch processing module will obtain the forwarding decision of the message and determine the forwarding exit of the message according to the forwarding decision. If the forwarding exit of the message is consistent with the preset exit, the message is forwarded to the first port through the second port, and sent to the network transmission protocol module of the switch for copying, and then sent to the backup port of the switch to complete the backup transmission. A message forwarding method, device, switch equipment and storage medium of the present application realize the three-layer forwarding function of HSR / PRP messages on a switch by combining port loopback and port isolation technology without increasing the network construction cost and reducing CPU consumption.
[0051] Figure 2 A flow chart of a message forwarding method according to an embodiment of the present application is shown. The message forwarding method comprises the following steps:
[0052] Step S100: When the message arrives at the switch and is successfully received, the status of the message is obtained.
[0053] For example, Figure 3 As shown, when the network transmission protocol module 100 on the switch receives a message through the backup port 150, the network transmission protocol module 100 first checks the received message to determine its current state. For example, check whether the message is intact, whether it is repeated, whether there is an error flag, whether it needs further processing, etc. The status information of the message is crucial to determine how to process the message next, for example, whether it needs to be forwarded to other destinations, whether it needs to be discarded, etc. The protocol in the network transmission protocol module 100 refers to the HSR / PRP protocol, which is a redundant protocol for improving network reliability. The HSR / PRP protocol ensures reliable data transmission by creating redundant exits in the network.
[0054] In an optional embodiment, the switch is configured with a Marvell switch chip. When a message arrives at the switch and is successfully received, before obtaining the status of the message, the following steps are performed:
[0055] The switch is configured using the Marvell switch chip to disconnect the backup port 150 from the switch processing module 110 and the CPU module 120 in the switch.
[0056] For example, in order to prevent loop formation and storms, the present application uses Marvell switching chips to configure switches to achieve port isolation. For example, the port isolation function provided by Marvell's switching chip DX1508 is used to isolate the three ports of the network transmission protocol module 100 from the switching processing module 110 and the CPU module 120, and logically disconnect the three ports of the network transmission protocol module 100 from the switching processing module 110 and the CPU module 120, see Figure 3 The dotted lines ②③④ shown in the figure disable the traffic forwarding between {backup port 150A, second port 140A}…{backup port 150A, second port 140N}, {backup port 150A, CPU}; and {second port 140A, backup port 150A}…{second port 140N, backup port 150A}, {CPU, backup port 150A}, and the same applies to the backup port 150B and the first port 130.
[0057] It is worth noting that port isolation is a mechanism to enable / disable traffic forwarding between any {input port, output port} in the system.
[0058] In an optional embodiment, if Figure 4As shown, in step S100, when the message arrives at the switch and is successfully received, the status of the message is obtained, which also includes:
[0059] Step S401, determining whether the message status is a duplicate status;
[0060] Exemplarily, after a message arrives at a switch and is successfully received, the network transmission protocol module 100 on the switch checks the state of the message to determine whether the message is a duplicate message that has been processed. For example, this is accomplished by checking certain fields of the message (such as a sequence number, a timestamp, a checksum, etc.) to determine whether the message is duplicate data.
[0061] Step S402: When the message state is a duplicate state, the message is discarded.
[0062] Exemplarily, if the message has been processed before and is identified as a duplicate message, the network transmission protocol module 100 of the switch will execute a discard action strategy to discard the message to avoid problems caused by duplicate data in the network, such as data packet storms, resource waste, etc.
[0063] Step S403: When the message state is a non-duplicate state, the message is forwarded according to the forwarding strategy.
[0064] Exemplarily, if the message is not a duplicate message, the network transmission protocol module 100 of the switch will execute the forwarding strategy, for example, forward the message according to the established rules, and send it to the correct network exit according to the destination address, port number and other information of the message.
[0065] Step S200: when the state of the message is a preset state, forwarding the message from the first port 130 of the switch to the second port 140 of the switch.
[0066] Exemplarily, the "preset state" refers to one or more predefined state conditions, and subsequent actions are triggered only when the state of the message meets these preset conditions.
[0067] In this application, the preset state refers to the message state being a non-repetitive state, that is, see Figure 3 As shown in the connection ①, when the message is in a non-repetitive state, the message is forwarded from the first port 130 of the network transmission protocol module 100 to the second port 140A of the switch through the external connection line ①.
[0068] Step S300: When the second port 140 of the switch receives a message, a forwarding decision of the message is obtained, and an egress of the message is determined according to the forwarding decision of the message.
[0069] Exemplarily, when the second port 140 of the switch receives a message, it enters the switch processing module 110 to parse it, and obtains a forwarding decision based on the header information of the message (for example, the destination address, the source address, the VLAN tag, etc.) and the internal configuration and policy of the switch. The forwarding decision is used to determine whether the message is forwarded at layer 2 or layer 3. Further, after determining the forwarding type, the egress of the message is obtained, and finally, the message is forwarded out through the obtained egress. Among them, the egress may be another physical port of the switch, a virtual interface (such as a VLAN interface), or an egress sent to a remote node through some form of tunnel or encapsulation.
[0070] In an optional embodiment, if Figure 5 As shown, in step S300, when the second port 140 of the switch receives a message, a forwarding decision of the message is obtained, and the message is forwarded according to the forwarding decision of the message and an egress of the message is obtained, which also includes:
[0071] Step S501, when the forwarding decision of the message is layer 2 forwarding, the message is forwarded at layer 2 and the egress of the message after the layer 2 forwarding is obtained;
[0072] Exemplarily, if the destination MAC address of the message is in the MAC address table of the switch device, and the corresponding egress port is different from the port receiving the message, the switching processing module 110 performs Layer 2 forwarding, searches the MAC address table for the egress port corresponding to the destination MAC address, and uses the port as the egress of the message.
[0073] Step S502: When the forwarding decision of the message is layer-3 forwarding, perform layer-3 forwarding on the message and obtain the egress of the message after layer-3 forwarding.
[0074] Exemplarily, if the destination MAC address of the message is unknown, or the message needs to be transmitted across different VLANs or subnets, the switch device will perform an IP routing lookup and decide to perform layer 3 forwarding, determining the next hop address or egress interface of the message based on the IP routing table.
[0075] In an optional embodiment, when the forwarding decision of the message is layer 2 forwarding, after performing layer 2 forwarding on the message and obtaining an egress for performing layer 2 forwarding on the message, the method further includes:
[0076] When the outlet of the message to be forwarded at Layer 2 does not match the preset outlet, the message is forwarded to the common port of the switch.
[0077] For example, Figure 3As shown, the preset egress refers to the second port 140A. When the egress of the message that has been forwarded at layer 2 is not the second port 140A, the message that has been forwarded at layer 2 is forwarded to a common port other than the second port 140A, such as the second port 140B, the second port 140N, etc.
[0078] In an optional embodiment, when the forwarding decision of the message is layer-3 forwarding, performing layer-3 forwarding on the message and obtaining an egress for performing layer-3 forwarding of the message further includes:
[0079] When the egress of the message that has been forwarded at layer 3 is consistent with the preset egress, the message that has been forwarded at layer 3 is forwarded to the first port 130 of the switch through the second port 140 of the switch.
[0080] Exemplarily, when the egress of the message that has been forwarded at layer 3 is the second port 140, the message that has been forwarded at layer 3 is forwarded to the first port 130 through the second port 140 by the external connection ① loopback connection, such as Figure 3 shown.
[0081] Step S400, when the egress of the message is the preset egress, the message is forwarded to the first port 130 of the switch through the second port 140 of the switch, so that the message is sent to the network transmission protocol module 100 of the switch for replication, and the replicated message is sent to the backup port 150 of the switch to complete the backup transmission.
[0082] Exemplarily, the preset exit is a predefined configuration that specifies the exit interface to which certain specific messages should be forwarded. The preset exit is set based on various attributes of the message (e.g., source IP address, destination IP address, protocol type, etc.). It is determined whether the exit of the message is the preset exit. If the exit of the message is consistent with the preset exit, the corresponding MAC address and ARP information are learned to the second port 140, then the switch will perform a specific forwarding operation to copy the message, and after copying the message, send the copied message to the backup port 150 of the network transmission protocol module 100, thereby completing the backup.
[0083] In an optional embodiment, Figure 6 As shown, in step S400, when the forwarding outlet of the message is the preset outlet, the message is forwarded to the first port 130 of the switch through the second port 140 of the switch, so that the message is sent to the network transmission protocol module 100 of the switch for replication, and the replicated message is sent to the backup port 150 of the switch to complete the backup transmission, including:
[0084] Step S601: When the first port 130 of the switch receives a message that has been forwarded at layer 3, the message that has been forwarded at layer 3 is sent to the network transmission protocol module 100 for replication.
[0085] Exemplarily, when the message that has been forwarded at layer 3 arrives at the first port 130, it will be sent to the network transmission protocol module 100 responsible for processing various network protocols, and the message that has been forwarded at layer 3 will be copied by the network transmission protocol module 100.
[0086] Step S602, forwarding the copied message to the backup port 150 of the switch; the backup port 150 is used for network backup transmission.
[0087] Exemplarily, after copying the message that has been forwarded at layer 3, the copied message is sent to the backup port 150 of the switch. The backup port 150 is a port dedicated to redundant transmission to ensure that the backup message can be received and processed when the original transmission outlet fails.
[0088] In other embodiments, in addition to utilizing port isolation to logically disconnect the forwarding between the ports in the network transmission protocol module 100 and the ports of other modules to prevent loop formation, port isolation can also be achieved by configuring different VLANs, and using separate VLAN IDs for the three ports of the network transmission protocol module 100, for example: 4095, and the VLAN attribute is untag, and other ports including the CPU module 120 do not belong to this VLAN. Therefore, inside the switch, messages from other ports will not be forwarded to the ports of the network transmission protocol module 100 through VLAN filtering. Similarly, messages from the ports of the network transmission protocol module 100 will not be forwarded to other ports, and when the VLAN ID is 4095, the attribute of the first port 130 is untag, and the message will not carry the VLAN after being forwarded from the first port 130. At this time, when the message is connected through an external connection (such as Figure 3 When the line ①) shown enters the switch and passes through the second port 140 , its VLAN tag is determined by the configuration of the second port 140 .
[0089] A message forwarding method, device, switch device and storage medium of an embodiment of the present application, when a message arrives at the switch and is successfully received, the network transmission protocol module 100 of the switch will obtain the status of the message. If the status of the message is consistent with the preset status, the message is forwarded from the first port 130 of the switch to the second port 140. When the second port 140 receives the message, the switch processing module 110 will obtain the forwarding decision of the message and determine the forwarding exit of the message according to the forwarding decision. If the forwarding exit of the message is consistent with the preset exit, the message is forwarded back to the first port 130 through the second port 140, and sent to the network transmission protocol module 100 of the switch for copying, and then sent to the backup port 150 of the switch to complete the backup transmission. A message forwarding method, device, switch device and storage medium of the present application realizes the three-layer forwarding function of HSR / PRP messages on a switch by combining port loopback and port isolation technology without increasing the network construction cost and reducing CPU consumption.
[0090] The present application also proposes a message forwarding device, such as Figure 7 As shown, the message forwarding device includes:
[0091] A message status acquisition module 71, used for acquiring the status of the message when the message arrives at the switch and is successfully received;
[0092] A message forwarding module 72, configured to forward the message from the first port of the switch to the second port of the switch when the message is in the first state;
[0093] A message type acquisition module 73, configured to acquire the type of the message when the second port of the switch receives the message, and forward the message to a corresponding egress according to the message type;
[0094] The backup transmission module 74 is used to forward the message to the first port of the switch through the second port of the switch when the exit of the message is the preset exit, so as to send the message to the network transmission protocol module of the switch for replication, and send the replicated message to the backup port of the switch to complete the backup transmission.
[0095] It can be understood that the device of this embodiment corresponds to a message forwarding method of the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described repeatedly here.
[0096] The present application also provides a switch device. Exemplarily, the switch device includes a processor and a memory, wherein the memory stores a computer program, and the processor enables a terminal device to execute the functions of each module in the above-mentioned message forwarding method or the above-mentioned message forwarding device by running the computer program; the switch device includes a first port 130 and a second port 140; the first port 130 of the switch device is connected to the second port 140 of the switch device, thereby realizing port loopback on the switch device.
[0097] For example, Figure 3 As shown in the connection ①, on the switch, the first port 130 and the second port 140 are connected. At this time, the MAC address of the message sent by the first port 130 will also be learned by the second port 140.
[0098] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU) and a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or at least one of other programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.
[0099] The memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The memory is used to store a computer program, and the processor may execute the computer program accordingly after receiving an execution instruction.
[0100] The present application also provides a computer-readable storage medium for storing the computer program used in the above-mentioned terminal device. For example, the computer-readable storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0101] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0102] In addition, the functional modules or units in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0103] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a switch device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
[0104] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A message forwarding method, characterized in that: Applied to a switch, the method comprises: When the message arrives at the switch and is successfully received, obtaining the status of the message; When the state of the message is a preset state, forwarding the message from the first port of the switch to the second port of the switch; When the second port of the switch receives the message, the forwarding decision of the message is obtained, the message is forwarded according to the forwarding decision of the message and a forwarding exit of the message is obtained; When the forwarding exit of the message is a preset exit, the message is forwarded to the first port of the switch through the second port of the switch, so that the message is sent to the network transmission protocol module of the switch for replication, and the replicated message is sent to the backup port of the switch to complete the backup transmission.
2. The message forwarding method according to claim 1, characterized in that: The switch is configured with a Marvell switch chip; when the message arrives at the switch and is successfully received, before obtaining the status of the message, the method includes: The Marvell switching chip is used to disconnect the backup port from the switching processing module and the CPU module in the switch.
3. The message forwarding method according to claim 1, characterized in that: When the message arrives at the switch and is successfully received, obtaining the status of the message also includes: Determine whether the state of the message is a duplicate state; When the state of the message is a duplicate state, executing a discard action strategy for the message; When the state of the message is a non-repetitive state, the message is forwarded according to the forwarding strategy.
4. The message forwarding method according to claim 1, characterized in that: The forwarding according to the forwarding decision of the message and obtaining the egress of the message further includes: When the forwarding decision of the message is layer 2 forwarding, performing layer 2 forwarding on the message and obtaining an egress of the message after performing layer 2 forwarding; When the forwarding decision of the message is layer-3 forwarding, the message is forwarded at layer-3 and an egress of the message after the layer-3 forwarding is performed is obtained.
5. The message forwarding method according to claim 4, characterized in that: When the forwarding decision of the message is layer 2 forwarding, after executing layer 2 forwarding on the message and obtaining the exit of executing layer 2 forwarding message, the method further includes: When the forwarding exit of the message that has been forwarded at the second layer does not match the preset exit, the message that has been forwarded at the second layer is forwarded to a common port of the switch.
6. The message forwarding method according to claim 4, characterized in that: When the forwarding decision of the message is layer-3 forwarding, after performing layer-3 forwarding on the message and obtaining the egress of the message after performing layer-3 forwarding, the method further includes: When the forwarding exit of the message that has been forwarded at the third layer matches the preset exit, the message that has been forwarded at the third layer is forwarded to the first port of the switch through the second port of the switch.
7. The message forwarding method according to claim 1, characterized in that: When the forwarding outlet of the message is a preset outlet, after forwarding the message to the first port of the switch through the second port of the switch, the method further includes: When the first port of the switch receives the message that has been forwarded at the third layer, the message that has been forwarded at the third layer is sent to the network transmission protocol module for replication; The copied three-layer forwarding message is forwarded to the backup port of the switch; the backup port is used for network backup transmission.
8. A message forwarding device, characterized in that: The message forwarding device comprises: A message status acquisition module, used for acquiring the status of the message when the message arrives at the switch and is successfully received; A message forwarding module, used for forwarding the message from the first port of the switch to the second port of the switch when the state of the message is a preset state; A message type acquisition module, used for acquiring a forwarding decision of the message when the second port of the switch receives the message, forwarding the message according to the forwarding decision of the message and acquiring a forwarding exit of the message; The backup transmission module is used to forward the message to the first port of the switch through the second port of the switch when the forwarding exit of the message is the preset exit, so as to send the message to the network transmission protocol module of the switch for replication, and send the replicated message to the backup port of the switch to complete the backup transmission.
9. A switch device, characterized in that: The switch device includes a processor and a memory, the memory stores a computer program, and the processor is used to execute the computer program to implement the message forwarding method described in any one of claims 1 to 7; the switch device includes a first port and a second port; the first port of the switch device is connected to the second port of the switch device.
10. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed on a processor, implements the message forwarding method according to any one of claims 1 to 7.