Message forwarding method, device, equipment, readable medium and computer program product

By receiving the packets to be forwarded and generating parsed information, determining the routing forwarding address, the insufficient storage space and resource waste caused by the tri-state content addressing memory is solved, and more efficient storage space utilization is achieved.

CN115941597BActive Publication Date: 2025-07-08北京东土军悦科技有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211517835.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-29
Publication Date
2025-07-08
Estimated Expiration
2042-11-29

AI Technical Summary

Technical Problem

In the prior art, when using three-state content addressing memory to store forwarding addresses of the three-layer interface, it is easy to lead to insufficient storage space and waste of resources, and reduce the utilization rate of storage space.

Method used

By receiving the message to be forwarded, the parsing process is performed to generate the parsing information, and the routing forwarding address is determined in response to the preset conditions, all forwarding addresses are avoided and the utilization of storage space is improved.

Benefits of technology

It effectively avoids the waste of storage resources, improves the utilization rate of storage space, and solves the problem of insufficient storage space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115941597B_ABST
    Figure CN115941597B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure disclose a message forwarding method, apparatus, device, readable medium, and computer program product. A specific implementation of the method includes: receiving a message to be forwarded; performing parsing processing on the message to be forwarded to generate parsing information; in response to the parsing information meeting a first preset condition, determining a routing forwarding address according to a first configuration value; and performing forwarding processing on the message to be forwarded according to the parsing information and the routing forwarding address. This implementation avoids waste of storage resources in the memory and improves the utilization rate of the storage space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of computer technologies, and more particularly, to a method, apparatus, device, readable medium, and computer program product for packet forwarding. Background Art

[0002] When performing three-layer forwarding on a packet, it is usually necessary to determine whether the destination forwarding address in the packet is the same as the forwarding address of a three-layer interface (a three-layer physical port). How to store the forwarding address of the three-layer interface has become an important research topic. Currently, when storing the forwarding address of the three-layer interface, the commonly used method is to use a ternary content addressable memory (TCAM) to store the forwarding address of the three-layer interface.

[0003] However, when storing the forwarding address of the three-layer interface in the above manner, the following technical problems often exist:

[0004] First, when using a ternary content addressable memory to store a large number of addresses, it may cause insufficient storage space in the memory. When storing the same address, different editing tables may be used for storage, wasting the storage resources of the memory and reducing the utilization rate of the storage space.

[0005] Second, when forwarding a packet, it is necessary to replace the source forwarding address in the packet with the forwarding address of the corresponding three-layer interface in the outgoing address table. When there are a large number of forwarding addresses stored in the outgoing address table, it may cause insufficient storage space, and when adding a new three-layer interface, it is impossible to store the forwarding address corresponding to the new three-layer interface. Summary of the Invention

[0006] This section of the present disclosure is used to briefly introduce concepts, which will be described in detail in the following detailed implementation section. This section of the present disclosure is not intended to identify the key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.

[0007] Some embodiments of the present disclosure provide a method, apparatus, electronic device, computer-readable medium, and computer program product for packet forwarding to solve the technical problems mentioned in the above background art section.

[0008] In a first aspect, some embodiments of the present disclosure provide a method for packet forwarding, the method including: receiving a packet to be forwarded; performing parsing processing on the packet to be forwarded to generate parsing information; in response to the parsing information satisfying a first preset condition, determining a routing forwarding address according to a first configuration value; and performing forwarding processing on the packet to be forwarded according to the parsing information and the routing forwarding address.

[0009] In a second aspect, some embodiments of the present disclosure provide a message forwarding device, the device including: a receiving unit configured to receive a message to be forwarded; a parsing and processing unit configured to parse and process the message to be forwarded to generate parsing information; a determining unit configured to, in response to the parsing information satisfying a first preset condition, determine a routing and forwarding address according to a first configuration value; and a forwarding unit configured to perform a forwarding process on the message to be forwarded according to the parsing information and the routing and forwarding address.

[0010] In a third aspect, some embodiments of the present disclosure provide an electronic device, including: one or more processors; a storage device having stored thereon one or more programs, which when executed by the one or more processors cause the one or more processors to implement the method described in any implementation manner of the first aspect above.

[0011] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having stored thereon a computer program, wherein the program, when executed by a processor, implements the method described in any implementation manner of the first aspect above.

[0012] In a fifth aspect, some embodiments of the present disclosure provide a computer program product, including a computer program, which when executed by a processor, implements the method described in any implementation manner of the first aspect above.

[0013] The above-mentioned various embodiments of the present disclosure have the following beneficial effects: Through the packet forwarding method of some embodiments of the present disclosure, the waste of storage resources of the memory is avoided, and the utilization rate of the storage space is improved. Specifically, the reasons for wasting the storage resources of the memory and reducing the utilization rate of the storage space are as follows: When using a ternary content addressable memory to store a large number of addresses, it may lead to insufficient storage space of the memory. When storing the same address, different editing tables are used for storage, wasting the storage resources of the memory and reducing the utilization rate of the storage space. Based on this, in the packet forwarding method of some embodiments of the present disclosure, first, a packet to be forwarded is received; the packet to be forwarded is parsed to generate parsing information. Thus, it can be determined whether the three-layer forwarding interface is valid, and when the three-layer forwarding interface is valid, the routing forwarding address is determined. Then, in response to the parsing information satisfying a first preset condition, according to a first configuration value, the routing forwarding address is determined. Thus, the routing forwarding address can be determined by a pre-configured value, without storing all existing routing forwarding addresses, avoiding the waste of storage resources of the memory and improving the utilization rate of the storage space. Finally, according to the parsing information and the routing forwarding address, the packet to be forwarded is forwarded. Thus, the source forwarding address of the report can be replaced by another pre-configured value, without storing all existing source forwarding addresses. Avoiding the waste of storage resources of the memory and improving the utilization rate of the storage space. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In combination with the accompanying drawings and referring to the following specific embodiments, the above and other features, advantages and aspects of the various embodiments of the present disclosure will become more obvious. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the elements and elements are not necessarily drawn to scale.

[0015] Figure 1 is a schematic diagram of an application scenario of a packet forwarding method according to some embodiments of the present disclosure;

[0016] Figure 2 is a flowchart of some embodiments of the packet forwarding method according to the present disclosure;

[0017] Figure 3 is a flowchart of some other embodiments of the packet forwarding method according to the present disclosure;

[0018] Figure 4 is a schematic structural diagram of some embodiments of the packet forwarding device according to the present disclosure;

[0019] Figure 5 is a schematic structural diagram of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0020] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. On the contrary, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not used to limit the protection scope of the present disclosure.

[0021] In addition, it should be noted that for the sake of convenience of description, only parts related to the relevant invention are shown in the drawings. Without conflict, the embodiments in the present disclosure and the features in the embodiments can be combined with each other.

[0022] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or mutual dependence relationship of the functions performed by these devices, modules or units.

[0023] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly specified in the context, it should be understood as "one or more".

[0024] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes and are not used to limit the scope of these messages or information.

[0025] The present disclosure will be described in detail below with reference to the drawings and in combination with embodiments.

[0026] Figure 1 It is a schematic diagram of an application scenario of a data transmission method according to some embodiments of the present disclosure.

[0027] In Figure 1 the application scenario, first, the computing device 101 can receive the packet to be forwarded 102. Secondly, the computing device 101 can perform parsing processing on the above-mentioned packet to be forwarded 102 to generate parsing information 103. Then, the computing device 101 can, in response to the above-mentioned parsing information 103 satisfying the first preset condition 104, determine a routing forwarding address 106 according to the first configuration value 105. Finally, the computing device 101 can perform forwarding processing on the above-mentioned packet to be forwarded 102 according to the above-mentioned parsing information 103 and the above-mentioned routing forwarding address 106.

[0028] It should be noted that the above computing device 101 can be hardware or software. When the computing device is hardware, it can be implemented as a distributed cluster composed of multiple servers or terminal devices, or as a single server or a single terminal device. When the computing device is embodied as software, it can be installed in the above-listed hardware devices. It can be implemented as, for example, multiple software or software modules for providing distributed services, or as a single software or software module. No specific limitation is made here.

[0029] It should be understood that Figure 1 the number of computing devices in [] is merely illustrative. According to the implementation requirements, there can be any number of computing devices.

[0030] Figure 2 The flowchart 200 of some embodiments of the message forwarding method according to the present disclosure is shown. The message forwarding method includes the following steps:

[0031] Step 201, receiving the message to be forwarded.

[0032] In some embodiments, the execution subject (such as a server) of the message forwarding method can receive the message to be forwarded sent by the associated terminal device through a wired connection or a wireless connection. Among them, the above message to be forwarded can be a message that needs to be forwarded.

[0033] Step 202, parsing and processing the message to be forwarded to generate parsing information.

[0034] In some embodiments, the above execution subject can parse and process the above message to be forwarded to generate parsing information. Among them, the above parsing process can be to determine each field included in the message to be forwarded as parsing information.

[0035] Optionally, after step 202, in response to the parsing information not meeting the first preset condition, perform layer 2 forwarding processing on the above message to be forwarded.

[0036] In some embodiments, the execution entity may perform layer-2 forwarding processing on the to-be-forwarded packet in response to the parsing information not satisfying the first preset condition. In practice, in response to the parsing information not satisfying the first preset condition, the execution entity may perform layer-2 forwarding processing on the to-be-forwarded packet according to the layer-2 forwarding table stored in the switching chip. Among them, the above layer-2 forwarding processing may be to forward the to-be-forwarded packet out of the switching chip in a layer-2 forwarding manner. The above first preset condition may be that the layer-3 forwarding interface included in the execution entity is valid. The above layer-3 forwarding interface may be a layer-3 Ethernet interface. Here, the execution entity may determine whether the layer-3 forwarding interface is valid according to the field representing the virtual local area network in the parsing information. As an example, in response to the field value of the field representing the virtual local area network being 0xffff, it may indicate that the layer-3 interface is invalid. In response to the field value of the field representing the virtual local area network being 0 to 0xfffe, it may indicate that the layer-3 interface is valid.

[0037] Step 203, in response to the parsing information satisfying the first preset condition, determine the routing forwarding address according to the first configuration value.

[0038] In some embodiments, the execution entity may determine the routing forwarding address according to the first configuration value in response to the parsing information satisfying the first preset condition. Among them, the above first configuration value may be a preset value. For example, the above first configuration value may be 0.

[0039] In practice, the execution entity may determine the routing forwarding address through the following steps:

[0040] The first step, in response to the first configuration value being the same as the first preset value, obtain the global routing forwarding address and determine the global routing forwarding address as the routing forwarding address. Among them, the above first preset value may be a preset value representing that the routing forwarding address is the global routing forwarding address. The above global routing forwarding address may be a pre-set basic MAC (Media Access Control Address) address.

[0041] The second step, in response to the first configuration value being the same as the second preset value, obtain the global routing forwarding address and the forwarding interface code. Among them, the above second preset value may be another preset value. The above forwarding interface code may be the code of the layer-3 physical port of the switching chip. The above code may uniquely represent a certain layer-3 physical port.

[0042] Step 3: Combine the above global routing forwarding address and the above forwarding interface code for processing to generate a first combined address as the routing forwarding address. In practice, first, the above execution entity can perform a base conversion process on the forwarding interface code to generate a converted forwarding interface code. Second, the above execution entity can perform a conversion process on the converted forwarding interface code and the above global routing forwarding address to generate a first combined address as the routing forwarding address. Among them, the above combination process can be a merging process. The above base conversion process can be converting a decimal number to a hexadecimal number.

[0043] As an example, the above forwarding interface code can be 10. The above global routing forwarding address can be MAC[48:12]=0x0200c18a1. At this time, the global routing forwarding address can be the high-order MAC address, and "0x" indicates that the characters after "0x" are hexadecimal numbers. Thus, it can be known that the forwarding interface code is the low-order 12-bit address of the MAC address. First, the above forwarding interface code "10" can be subjected to a base conversion process to generate a converted forwarding interface code "a". Among them, the above base conversion process can be converting a decimal number to a hexadecimal number. Second, the above global routing forwarding address "0x0200c18a1" and the above converted forwarding interface code "a" can be combined for processing to generate a first combined address as the routing forwarding address. Here, since the forwarding interface code is the low-order 12-bit address of the MAC, and the converted forwarding interface code "a" is 4 bits, thus, "00" needs to be added before the converted forwarding interface code "a" to reach 12 bits, thereby generating a first combined address "0x0200c18a100a" as the routing forwarding address.

[0044] Step 4: In response to the above first configuration value being the same as the third preset value, obtain the virtual local area network code and the global routing forwarding address. Among them, the above virtual local area network code can uniquely represent a certain virtual local area network port. The above first preset value, second preset value, and third preset value are different.

[0045] Step 5: Combine the above global routing forwarding address and the above virtual local area network code for processing to generate a second combined address as the routing forwarding address.

[0046] Step 204: Forward the packet to be forwarded according to the parsing information and the routing forwarding address.

[0047] In some embodiments, the above-mentioned execution entity may forward the to-be-forwarded packet according to the above-mentioned parsing information and the above-mentioned routing forwarding address. In practice, first, the above-mentioned execution entity may, in response to the field value of the field representing the destination forwarding address included in the above-mentioned parsing information being the same as the above-mentioned routing forwarding address, replace the field value of the field representing the source forwarding address included in the above-mentioned to-be-forwarded packet with the above-mentioned routing forwarding address. Second, the destination forwarding address corresponding to the above-mentioned to-be-forwarded packet may be determined through the ARP protocol (Address Resolution Protocol). Third, the above-mentioned to-be-forwarded packet is forwarded to the network device corresponding to the above-mentioned destination forwarding address. Among them, the above-mentioned network device may be a terminal device with network functions. For example, the above-mentioned network device may include, but is not limited to, one of the following: mobile phone, computer.

[0048] The above-mentioned various embodiments of the present disclosure have the following beneficial effects: Through the packet forwarding method of some embodiments of the present disclosure, the waste of storage resources of the memory is avoided, and the utilization rate of the storage space is improved. Specifically, the reasons for wasting the storage resources of the memory and reducing the utilization rate of the storage space are as follows: When using a ternary content addressable memory to store a large number of addresses, it may cause the storage space of the memory to be insufficient, and different editing tables will be used to store the same address, wasting the storage resources of the memory and reducing the utilization rate of the storage space. Based on this, in the packet forwarding method of some embodiments of the present disclosure, first, a to-be-forwarded packet is received; the above-mentioned to-be-forwarded packet is parsed to generate parsing information. Thus, it can be determined whether the three-layer forwarding interface is valid, and the routing forwarding address is determined when the three-layer forwarding interface is valid. Then, in response to the above-mentioned parsing information satisfying the first preset condition, the routing forwarding address is determined according to the first configuration value. Thus, the routing forwarding address can be determined through the pre-configured value, without storing all existing routing forwarding addresses, avoiding the waste of storage resources of the memory and improving the utilization rate of the storage space. Finally, the above-mentioned to-be-forwarded packet is forwarded according to the above-mentioned parsing information and the above-mentioned routing forwarding address. Thus, the source forwarding address of the report can be replaced by another pre-configured value, without storing all existing source forwarding addresses. Avoid the waste of storage resources of the memory and improve the utilization rate of the storage space.

[0049] Further referring to Figure 3 , a flowchart 300 showing another embodiment of the packet forwarding method according to the present disclosure is shown. The packet forwarding method includes the following steps:

[0050] Step 301, receive a to-be-forwarded packet.

[0051] Step 302, parse the to-be-forwarded packet to generate parsing information.

[0052] Step 303: In response to the parsing information satisfying the first preset condition, determine the routing forwarding address according to the first configuration value.

[0053] In some embodiments, the specific implementation manners and the technical effects brought by steps 301-303 may refer to steps 201-203 in the corresponding embodiments, which will not be elaborated herein. Figure 2 The corresponding steps 201-203 in those embodiments will not be elaborated herein.

[0054] Step 304: In response to the above parsing information and the above routing forwarding address satisfying the second preset condition, modify the above packet to be forwarded according to the second configuration value to generate a modified packet.

[0055] In some embodiments, the above execution entity may, in response to the above parsing information and the above routing forwarding address satisfying the second preset condition, modify the above packet to be forwarded according to the second configuration value to generate a modified packet. Among them, the above second preset condition may be that the field value of the field representing the routing forwarding address in the above parsing information is the same as the above routing forwarding address. The above second configuration value may be another preset value.

[0056] In practice, the above execution entity may modify the above packet to be forwarded through the following steps to generate a modified packet:

[0057] First step: In response to the above second configuration value being the same as the above first preset value, replace the field value of the field representing the source forwarding address (source MAC address) in the above packet to be forwarded with the above global routing forwarding address to modify the above packet to be forwarded and obtain a modified packet.

[0058] Second step: In response to the above second configuration value being the same as the above second preset value, replace the field value of the field representing the source forwarding address in the above packet to be forwarded with the above first combined address to modify the above packet to be forwarded and obtain a modified packet.

[0059] Third step: In response to the above second configuration value being the same as the above third preset value, replace the field value of the field representing the source forwarding address in the above packet to be forwarded with the above second combined address to modify the above packet to be forwarded and obtain a modified packet.

[0060] Step 305: Forward the above modified packet.

[0061] In some embodiments, the above execution entity may forward the above modified packet. Among them, the above forwarding process may be a three-layer forwarding process.

[0062] Optionally, after step 305, in response to the above parsing information and the above routing forwarding address not satisfying the above second preset condition, perform layer-2 forwarding processing on the above to-be-forwarded message.

[0063] In some embodiments, the above execution subject may, in response to the above parsing information and the above routing forwarding address not satisfying the above second preset condition, perform layer-2 forwarding processing on the above to-be-forwarded message.

[0064] The relevant content in the above steps 304-305 is an inventive point of the present disclosure, which solves the second technical problem mentioned in the background art: "When forwarding a message, it is necessary to replace the source forwarding address in the message with the forwarding-out address of the corresponding layer-3 interface in the forwarding-out address table. When there are many forwarding-out addresses stored in the forwarding-out address table, it may cause insufficient storage space, and when adding a new layer-3 interface, it is impossible to store the forwarding-out address corresponding to the new layer-3 interface." The factors causing insufficient storage space and being unable to store the forwarding-out address corresponding to the new layer-3 interface are usually as follows: When forwarding a message, it is necessary to replace the source forwarding address in the message with the forwarding-out address of the corresponding layer-3 interface in the forwarding-out address table. When there are many forwarding-out addresses stored in the forwarding-out address table, it may cause insufficient storage space, and when adding a new layer-3 interface, it is impossible to store the forwarding-out address corresponding to the new layer-3 interface. If the above factors are solved, the effect of avoiding insufficient storage space and being able to store the forwarding-out address corresponding to the new layer-3 interface can be achieved. To achieve this effect, first, in response to the above parsing information and the above routing forwarding address satisfying the second preset condition, modify the above to-be-forwarded message according to the second configuration value to generate a modified message. Thus, each forwarding-out address in the forwarding-out address table can be generated through the encoding of the layer-3 interface and the global routing address, which can reduce the number of bytes stored, thereby avoiding insufficient storage space and being able to store the forwarding-out address corresponding to the new layer-3 interface. Second, perform forwarding processing on the above modified message. Thus, the storage of each forwarding-out address in the forwarding-out address table is completed, avoiding insufficient storage space and being able to store the forwarding-out address corresponding to the new layer-3 interface.

[0065] From Figure 3 it can be seen that compared with Figure 2 the description of some corresponding embodiments, Figure 3 the process 300 of the message forwarding method in some corresponding embodiments avoids insufficient storage space and can store the forwarding-out address corresponding to the new layer-3 interface.

[0066] Further referring to Figure 4 , as an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a message forwarding device. These device embodiments correspond to Figure 2 the those method embodiments shown, and the device can be specifically applied to various electronic devices.

[0067] As shown Figure 4 in FIG. 1, the message forwarding apparatus 400 of some embodiments includes: a receiving unit 401, a parsing and processing unit 402, a determining unit 403, and a forwarding unit 404. Among them, the receiving unit 401 is configured to receive the message to be forwarded; the parsing and processing unit 402 is configured to parse and process the above-mentioned message to be forwarded to generate parsing information; the determining unit 403 is configured to determine a routing forwarding address according to a first configuration value in response to the above-mentioned parsing information satisfying a first preset condition; the forwarding unit 404 is configured to perform a forwarding process on the above-mentioned message to be forwarded according to the above-mentioned parsing information and the above-mentioned routing forwarding address.

[0068] It can be understood that the units described in the apparatus 400 correspond to the respective steps in the method described with reference Figure 2 to. Thus, the operations, features, and beneficial effects described above for the method also apply to the apparatus 400 and the units included therein, and will not be elaborated herein.

[0069] Next, with reference Figure 5 to FIG. 2, there is shown a schematic structural diagram of an electronic device 500 suitable for use in implementing some embodiments of the present disclosure. The electronic devices in some embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not impose any limitation on the functions and usage scope of the embodiments of the present disclosure.

[0070] As shown Figure 5 in FIG. 2, the electronic device 500 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 501, which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0071] Typically, the following devices can be connected to the I / O interface 505: input devices 506 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; and a communication device 509. The communication device 509 can allow the electronic device 500 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 5 the electronic device 500 with various devices is shown, it should be understood that it is not required to implement or have all the shown devices. Instead, more or fewer devices can be implemented or had. Figure 5 Each block shown in

[0072] Specifically, according to some embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product that includes a computer program carried on a computer-readable medium, and the computer program contains program codes for executing the methods shown in the flowcharts. In such some embodiments, the computer program can be downloaded and installed from a network through the communication device 509, or installed from the storage device 508, or installed from the ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the methods of some embodiments of the present disclosure are executed.

[0073] It should be noted that the computer-readable media described in some embodiments of the present disclosure may be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0074] In some embodiments, the client and the server may communicate using any currently known or future-developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.

[0075] The above computer-readable medium may be included in the above electronic device; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by the electronic device, the electronic device is caused to: receive a message to be forwarded. Parse and process the above message to be forwarded to generate parsing information. In response to the above parsing information satisfying a first preset condition, determine a routing and forwarding address according to a first configuration value. Forward and process the above message to be forwarded according to the above parsing information and the above routing and forwarding address.

[0076] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages or combinations thereof. The above programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (for example, by connecting through an Internet service provider via the Internet).

[0077] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, may be implemented by a dedicated hardware-based system for performing the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.

[0078] The units described in some embodiments of the present disclosure can be implemented in software or in hardware. The described units can also be provided in a processor. For example, it can be described as: a processor includes a receiving unit, a parsing and processing unit, a determining unit, and a forwarding unit. Among them, the names of these units do not constitute a limitation on the unit itself in some cases. For example, the receiving unit can also be described as "the unit for receiving packets to be forwarded".

[0079] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that can be used include: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Product (ASSP), System on Chip (SOC), Complex Programmable Logic Device (CPLD), and so on.

[0080] Some embodiments of the present disclosure also provide a computer program product, including a computer program, which implements any of the above packet forwarding methods when executed by a processor.

[0081] The above description is only some preferred embodiments of the present disclosure and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the technical solutions formed by mutually replacing the above features with the (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure.

Claims

1. A message forwarding method, comprising: Receiving a message to be forwarded; Performing parsing processing on the message to be forwarded to generate parsing information; In response to the parsing information satisfying a first preset condition, determining a routing forwarding address according to a first configuration value, wherein the first preset condition is that a three-layer forwarding interface is valid; Wherein, the determining the routing forwarding address according to the first configuration value includes: In response to the first configuration value being the same as a first preset value, obtaining a global routing forwarding address and determining the global routing forwarding address as the routing forwarding address; In response to the first configuration value being the same as a second preset value, obtaining a global routing forwarding address and a forwarding interface code; Performing combination processing on the global routing forwarding address and the forwarding interface code to generate a routing forwarding address; In response to the first configuration value being the same as a third preset value, obtaining a virtual local area network code and a global routing forwarding address; Performing combination processing on the global routing forwarding address and the virtual local area network code to generate a routing forwarding address; Forwarding the message to be forwarded according to the parsing information and the routing forwarding address.

2. The method according to claim 1, wherein, After performing the parsing processing on the message to be forwarded to generate parsing information, the method further includes: In response to the parsing information not satisfying the first preset condition, performing two-layer forwarding processing on the message to be forwarded.

3. The method according to claim 1, wherein, The forwarding the message to be forwarded according to the parsing information and the routing forwarding address includes: In response to the parsing information and the routing forwarding address satisfying a second preset condition, performing modification processing on the message to be forwarded according to a second configuration value to generate a modified message, wherein the second preset condition is that the field value of the field representing the routing forwarding address in the parsing information is the same as the routing forwarding address; Performing forwarding processing on the modified message.

4. A message forwarding device, comprising: A receiving unit configured to receive a message to be forwarded; A parsing processing unit configured to perform parsing processing on the message to be forwarded to generate parsing information; A determining unit configured to, in response to the parsing information satisfying a first preset condition, determine a routing forwarding address according to a first configuration value, wherein the first preset condition is that a three-layer forwarding interface is valid; the determining unit is further configured to: In response to the first configuration value being the same as a first preset value, obtain a global routing forwarding address and determine the global routing forwarding address as the routing forwarding address; In response to the first configuration value being the same as a second preset value, obtain a global routing forwarding address and a forwarding interface code; Perform combination processing on the global routing forwarding address and the forwarding interface code to generate a routing forwarding address; In response to the first configuration value being the same as a third preset value, obtain a virtual local area network code and a global routing forwarding address; Perform combination processing on the global routing forwarding address and the virtual local area network code to generate a routing forwarding address; A forwarding unit configured to forward the message to be forwarded according to the parsing information and the routing forwarding address.

5. An electronic device, comprising: One or more processors; A storage device on which one or more programs are stored; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 3.

6. A computer-readable medium having a computer program stored thereon, wherein, When the program is executed by the processor, the method according to any one of claims 1 to 3 is implemented.

7. A computer program product, comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Message forwarding method and device, electronic equipment and medium

    CN111107007A