Message forwarding method, device, electronic device, and computer-readable medium
By dividing the forwarding address into high-order and low-order address fragments for combined processing, the problem of insufficient register storage space is solved, the utilization of storage space is improved, and more efficient address forwarding is achieved.
Patent Information
- Application Number
- CN202211515691.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-29
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-11-29
AI Technical Summary
In the prior art, when registers store address transfer tables, they easily lead to insufficient storage space, waste storage resources, reduce storage space utilization, and cannot store addresses corresponding to new transfer interfaces when storing a large number of transfer addresses.
By dividing the forwarding address into high-order address fragments and low-order address fragments and utilizing combined processing to generate the physical interface address, the storage requirement for the address forwarding table is reduced and the utilization of storage space is improved.
This reduces the waste of storage resources, improves the utilization of storage space, and avoids the problem of insufficient storage space.
Smart Images

Figure CN115883491B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and more particularly to a message forwarding method, device, electronic device, and computer-readable medium. Background Art
[0002] When forwarding a message, it is necessary to search an address forwarding table (Media Access Control Address forwarding table, MAC forwarding table) for forwarding. As the number of forwarded messages continues to increase, how to store the addresses included in the address forwarding table has become an important research topic. Currently, when storing the addresses included in the address forwarding table, the commonly used method is to use registers to store the addresses included in the address forwarding table.
[0003] However, when the above method is used to store the addresses included in the address forwarding table, the following technical problems often occur:
[0004] First, when a large number of addresses are stored in a register, insufficient storage space of the register may result. Different editing tables will be used to store the same address, wasting the storage resources of the register and reducing the utilization of the storage space.
[0005] Second, when forwarding a message, the source forwarding address in the message needs to be replaced with the outgoing address of the corresponding outgoing interface. However, when storing a large number of outgoing addresses, insufficient storage space may result. When adding a new outgoing interface, the outgoing address corresponding to the new outgoing interface cannot be stored. Summary of the Invention
[0006] The content of this disclosure is used to briefly introduce concepts that will be described in detail in the detailed description section below. The content of this disclosure is not intended to identify 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 message forwarding method, apparatus, electronic device, and computer-readable medium to solve one or more of the technical problems mentioned in the above background technology section.
[0008] In a first aspect, some embodiments of the present disclosure provide a message forwarding method, which includes: receiving a message to be forwarded; in response to determining that the three-layer forwarding interface corresponding to the above-mentioned message to be forwarded is valid, determining the three-layer interface identifier of the above-mentioned three-layer forwarding interface in a preset three-layer interface table; selecting a high-order address fragment corresponding to the above-mentioned three-layer interface identifier from the high-order address fragment group as the first target high-order address fragment; combining the above-mentioned first target high-order address fragment with the first preset low-order address fragment to generate a first physical interface address; forwarding the above-mentioned message to be forwarded according to the destination physical interface address and the above-mentioned first physical interface address included in the above-mentioned information to be forwarded.
[0009] In a second aspect, some embodiments of the present disclosure provide a message forwarding device, which includes: a receiving unit configured to receive a message to be forwarded; a determining unit configured to determine the three-layer interface identifier of the three-layer forwarding interface in a preset three-layer interface table in response to determining that the three-layer forwarding interface corresponding to the above-mentioned message to be forwarded is valid; a selecting unit configured to select a high-order address fragment corresponding to the above-mentioned three-layer interface identifier from the high-order address fragment group as the first target high-order address fragment; a combining unit configured to combine the above-mentioned first target high-order address fragment with the first preset low-order address fragment to generate a first physical interface address; and a forwarding unit configured to forward the above-mentioned message to be forwarded according to the destination physical interface address and the above-mentioned first physical interface address included in the above-mentioned information to be forwarded.
[0010] In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by one or more processors, the one or more processors implement the method described in any implementation of the first aspect above.
[0011] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation of the first aspect is implemented.
[0012] The above-described embodiments of the present disclosure have the following beneficial effects: Through the message forwarding methods of some embodiments of the present disclosure, waste of memory storage resources is reduced and storage space utilization is improved. Specifically, the reason for the waste of memory storage resources and reduced storage space utilization is that when a register stores a large number of addresses, the register storage space may be insufficient. When storing the same address, different editing tables are used for storage, wasting register storage resources and reducing storage space utilization. Based on this, the message forwarding methods of some embodiments of the present disclosure first receive a message to be forwarded; in response to determining that the Layer 3 forwarding interface corresponding to the message to be forwarded is valid, determine the Layer 3 interface identifier of the Layer 3 forwarding interface in a preset Layer 3 interface table. Thus, the MAC address corresponding to the Layer 3 forwarding interface can be determined. Next, a high-order address segment corresponding to the Layer 3 interface identifier is selected from a high-order address segment group as a first target high-order address segment; and the first target high-order address segment is combined with a first preset low-order address segment to generate a first physical interface address. Thus, by dividing the forwarding address into high-order address fragments and low-order address fragments, the forwarding address to be forwarded can be determined by combining them. This eliminates the need to store every address in the address forwarding table, thereby reducing the waste of register storage resources and improving storage space utilization. Finally, the message to be forwarded is forwarded based on the destination physical interface address and the first physical interface address included in the forwarding information. This completes the forwarding process for the message to be forwarded. This reduces the waste of register storage resources and improves storage space utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. 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 that components and elements are not necessarily drawn to scale.
[0014] Figure 1 is a flow chart of some embodiments of the message forwarding method according to the present disclosure;
[0015] Figure 2 is a schematic structural diagram of some embodiments of the message forwarding device according to the present disclosure;
[0016] Figure 3 It is a structural diagram of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION
[0017] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0018] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other.
[0019] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0020] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".
[0021] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0022] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0023] Continuing with the figure, a process 100 of some embodiments of the message forwarding method according to the present disclosure is shown. The message forwarding method includes the following steps:
[0024] Step 101: Receive a message to be forwarded.
[0025] In some embodiments, an execution subject (e.g., a switching chip) of a message forwarding method may receive a message to be forwarded. In practice, the execution subject may receive the message to be forwarded from an associated terminal device via a wired or wireless connection. The message to be forwarded may be a message that needs to be forwarded by the execution subject.
[0026] Optionally, after step 101, the message to be forwarded is parsed to generate parsing information.
[0027] In some embodiments, the execution entity may parse the message to be forwarded to generate parsing information. The parsing information may include a virtual local area network, a destination physical interface address, an input interface, and a destination network protocol address. The parsing process may include parsing the field values of the fields included in the message to be forwarded. The destination physical interface address may be a destination MAC (Media Access Control Address) address. The input interface may be an interface corresponding to the destination physical interface address.
[0028] Optionally, after step 101, it is determined whether the layer-3 forwarding interface is valid based on the virtual local area network and the inbound interface included in the parsed information.
[0029] In some embodiments, the execution entity may determine whether the Layer 3 forwarding interface is valid based on the virtual local area network (VLAN) and inbound interface included in the parsed information. In practice, the Layer 3 forwarding interface is determined to be valid in response to the virtual local area network (VLAN) and routing sub-interface included in any preset Layer 3 forwarding interface in the preset Layer 3 forwarding interface group being the same as the virtual local area network (VLAN) and inbound interface.
[0030] Optionally, after step 101, in response to the above-mentioned layer-3 forwarding interface being invalid, the above-mentioned message to be forwarded is subjected to layer-2 forwarding processing.
[0031] In some embodiments, the above-mentioned execution subject may, in response to the invalidity of the above-mentioned three-layer forwarding interface, perform a two-layer forwarding process on the above-mentioned message to be forwarded. In practice, the above-mentioned execution subject may, in response to the fact that the above-mentioned three-layer forwarding interface is different from each preset three-layer forwarding interface in the preset three-layer forwarding interface group, determine the above-mentioned three-layer forwarding interface as an invalid three-layer forwarding interface. Among them, the preset three-layer forwarding interface in the preset three-layer forwarding interface group may be a pre-stored three-layer forwarding interface. The above-mentioned two-layer forwarding process may be to determine the mask of the above-mentioned destination network protocol address (destination IP address) through the above-mentioned destination network protocol address, and send the above-mentioned message to be forwarded to the device corresponding to the above-mentioned mask through the above-mentioned mask.
[0032] Step 102: In response to determining that the layer-3 forwarding interface corresponding to the message to be forwarded is valid, determine a layer-3 interface identifier of the layer-3 forwarding interface in a preset layer-3 interface table.
[0033] In some embodiments, the execution entity may, in response to determining that the Layer 3 forwarding interface corresponding to the message to be forwarded is valid, select a Layer 3 interface identifier corresponding to the Layer 3 forwarding interface from a preset Layer 3 interface table. The Layer 3 interface identifier may uniquely represent a specific Layer 3 forwarding interface. The preset Layer 3 interface table may be a data table for storing Layer 3 forwarding interfaces and Layer 3 interface identifiers.
[0034] Step 103 : Select a high-order address fragment corresponding to the Layer 3 interface identifier from the high-order address fragment group as a first target high-order address fragment.
[0035] In some embodiments, the execution subject may select a high-order address fragment corresponding to the above-mentioned three-layer interface identifier from the high-order address fragment group as the first target high-order address fragment. The high-order address fragment in the above-mentioned high-order address fragment group may be a high routing address bit address fragment. The high-order address fragment in the above-mentioned high-order address fragment group corresponds to a three-layer interface identifier and an outgoing interface identifier. The above-mentioned outgoing interface representation can uniquely represent a certain outgoing interface. The high routing address bit of the above-mentioned high routing address bit address fragment may be a pre-set high routing address bit. For example, the above-mentioned high routing address bit may be a high 40 bit, while the total routing address bit is 48 bits, and thus the low routing address bit is 8 bits.
[0036] Step 104 : Combine the first target high-order address fragment and the first preset low-order address fragment to generate a first physical interface address.
[0037] In some embodiments, the execution entity may combine the first target high-order address fragment with the first preset low-order address fragment to generate the first physical interface address. The first preset low-order address fragment may be a low routing address bit address fragment. The low routing address bit of the low routing address bit address fragment may be a preset low routing address bit. For example, the low routing address bit may be the lower 8 bits.
[0038] As an example, the upper address segment may be [48:8] = 0x0200c18a1e, and the first preset lower address segment may be [7:0] = 0xfe. The upper address segment "0x0200c18a1e" and the first preset lower address segment "0xfe" may be combined to generate the first physical interface address "0x0200c18a1efe." The "0x" included in the upper address segment and the first preset lower address segment indicates that the following value is in hexadecimal, and the number of bits is not counted.
[0039] Step 105 : forwarding the message according to the destination physical interface address and the first physical interface address included in the information to be forwarded.
[0040] In some embodiments, the execution entity may forward the message to be forwarded according to the destination physical interface address and the first physical interface address included in the information to be forwarded.
[0041] In practice, the execution entity may forward the message to be forwarded by following the steps below:
[0042] The first step is to determine the outbound interface identifier of the target outbound interface in the preset information editing table, wherein the preset information editing table may be a pre-set editing table for storing the correspondence between outbound interface identifiers and outbound interfaces.
[0043] In the second step, a high-order address fragment corresponding to the outgoing interface identifier is selected from the high-order address fragment group as a second target high-order address fragment.
[0044] In the third step, the second high-order address fragment and the second preset low-order address fragment are combined to generate a second physical interface address, wherein the combination process can be a splicing process.
[0045] The fourth step is to replace the source physical forwarding address in the message to be forwarded with the second physical interface address to generate a replaced message to be forwarded.
[0046] Step 5: Perform layer 3 forwarding processing on the replaced forwarded message.
[0047] In practice, the execution entity may perform Layer 3 forwarding processing on the replaced forwarded message through the following sub-steps:
[0048] The first sub-step is to determine whether a routing forwarding address corresponding to the destination network protocol address exists in a routing forwarding table. The routing forwarding table may be a Routing Information Base (RIB). The routing forwarding table may store the association between the routing forwarding address and the network protocol address.
[0049] The second sub-step is to modify the destination physical interface address in the replaced forwarding message to the routing forwarding address in response to the routing forwarding address corresponding to the destination network protocol address in the routing forwarding table to generate a first modified message to be forwarded.
[0050] The third sub-step is to forward the first modified message to be forwarded according to the routing forwarding address.
[0051] The fourth sub-step is to generate routing broadcast information in response to the absence of a routing forwarding address corresponding to the destination network protocol address in the routing forwarding table. The routing broadcast information includes the destination network protocol address. The routing broadcast information may be ARP (Address Resolution Protocol) information.
[0052] A fifth sub-step, in response to receiving a broadcast reply message corresponding to the destination network protocol address, determines the physical forwarding address corresponding to the destination network protocol address based on the broadcast reply message, and modifies the destination physical interface address in the replaced message to be forwarded to the physical forwarding address, thereby generating a second modified message to be forwarded. The broadcast reply message may be a message replying to the routing broadcast message. The broadcast reply message includes the physical forwarding address from which the broadcast reply message was sent.
[0053] The sixth sub-step is to forward the second modified message to be forwarded according to the physical forwarding address included in the broadcast reply information.
[0054] The relevant content of steps 1-5 above, as an inventive point of the present disclosure, solves the second technical problem mentioned in the background technology: "When forwarding a message, the source forwarding address in the message needs to be replaced with the outgoing address of the corresponding outgoing interface. However, storing a large number of outgoing addresses may result in insufficient storage space, and when adding a new outgoing interface, the outgoing address corresponding to the new outgoing interface cannot be stored." The factors that cause insufficient storage space and the inability to store the outgoing address corresponding to the new outgoing interface are often as follows: When forwarding a message, the source forwarding address in the message needs to be replaced with the outgoing address of the corresponding outgoing interface. However, storing a large number of outgoing addresses may result in insufficient storage space, and when adding a new outgoing interface, the outgoing address corresponding to the new outgoing interface cannot be stored. If the above factors are solved, the effect of avoiding insufficient storage space and storing the outgoing address corresponding to the new outgoing interface can be achieved. To achieve this effect, first, in response to the destination physical interface address being the same as the first physical interface address, the outgoing interface corresponding to the inbound interface is determined as the target outbound interface; and the outbound interface identifier of the target outbound interface in the preset information editing table is determined. The physical interface address that needs to be modified can thus be generated using the outgoing interface identifier. Secondly, a high-order address fragment corresponding to the outgoing interface identifier is selected from the above-mentioned high-order address fragment group as the second target high-order address fragment; the above-mentioned second high-order address fragment is combined with the second preset low-order address fragment to generate a second physical interface address. Thus, the outgoing address can be divided into high-order address fragments and low-order address fragments, and the outgoing address can be determined by combining them. This eliminates the need to store all outgoing addresses, thereby avoiding insufficient storage space and allowing the outgoing address corresponding to the new outgoing interface to be stored. Then, the source physical forwarding address in the message to be forwarded is replaced with the above-mentioned second physical interface address to generate a replaced message to be forwarded. Thus, the message to be forwarded with the modified source MAC address can be subjected to Layer 3 forwarding. Finally, the replaced forwarded message is subjected to Layer 3 forwarding. Thus, the forwarding process for the message to be forwarded is completed. This avoids insufficient storage space and allows the outgoing address corresponding to the new outgoing interface to be stored.
[0055] In the fourth step, in response to the fact that the destination physical interface address is different from the first physical interface address, performing layer 2 forwarding processing on the message to be forwarded.
[0056] The above-described embodiments of the present disclosure have the following beneficial effects: Through the message forwarding methods of some embodiments of the present disclosure, waste of memory storage resources is reduced and storage space utilization is improved. Specifically, the reason for the waste of memory storage resources and reduced storage space utilization is that when a register stores a large number of addresses, the register storage space may be insufficient. When storing the same address, different editing tables are used for storage, wasting register storage resources and reducing storage space utilization. Based on this, the message forwarding methods of some embodiments of the present disclosure first receive a message to be forwarded; in response to determining that the Layer 3 forwarding interface corresponding to the message to be forwarded is valid, determine the Layer 3 interface identifier of the Layer 3 forwarding interface in a preset Layer 3 interface table. Thus, the MAC address corresponding to the Layer 3 forwarding interface can be determined. Next, a high-order address segment corresponding to the Layer 3 interface identifier is selected from a high-order address segment group as a first target high-order address segment; and the first target high-order address segment is combined with a first preset low-order address segment to generate a first physical interface address. Thus, by dividing the forwarding address into high-order address fragments and low-order address fragments, the forwarding address to be forwarded can be determined by combining them. This eliminates the need to store every address in the address forwarding table, thereby reducing the waste of register storage resources and improving storage space utilization. Finally, the message to be forwarded is forwarded based on the destination physical interface address and the first physical interface address included in the forwarding information. This completes the forwarding process for the message to be forwarded. This reduces the waste of register storage resources and improves storage space utilization.
[0057] Further references Figure 2 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 are similar to Figure 1 Corresponding to the method embodiments shown, the message forwarding device can be specifically applied to various electronic devices.
[0058] like Figure 2As shown, some embodiments of the message forwarding device 200 include: a receiving unit 201, a determining unit 202, a selecting unit 203, a combining unit 204, and a forwarding unit 205. The receiving unit 201 is configured to receive a message to be forwarded; the determining unit 202 is configured to, in response to determining that the Layer 3 forwarding interface corresponding to the message to be forwarded is valid, determine the Layer 3 interface identifier of the Layer 3 forwarding interface in a preset Layer 3 interface table; the selecting unit 203 is configured to select a high-order address segment corresponding to the Layer 3 interface identifier from a high-order address segment group as a first target high-order address segment; the combining unit 204 is configured to combine the first target high-order address segment with a first preset low-order address segment to generate a first physical interface address; and the forwarding unit 205 is configured to forward the message to be forwarded based on the destination physical interface address and the first physical interface address included in the information to be forwarded.
[0059] It is understandable that the units described in the message forwarding device 200 are similar to those described in the reference Figure 1 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the device 200 and the units included therein, and will not be repeated here.
[0060] Reference below Figure 3 , which shows an electronic device suitable for implementing some embodiments of the present disclosure (such as Figure 1 The structural diagram of the computing device 101)300 is shown. Figure 3 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0061] like Figure 3 As shown, the electronic device 300 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage device 308 into a random access memory (RAM) 303. Various programs and data required for the operation of the electronic device 300 are also stored in the RAM 303. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0062] Typically, the following devices may be connected to the I / O interface 305: an input device 305 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 308 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 309. The communication device 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 3 The electronic device 300 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead. Figure 3 Each block shown in the figure may represent one device, or may represent multiple devices as needed.
[0063] In particular, 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 comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from a network via the communication device 309, or installed from the storage device 308, or installed from the ROM 302. When the computer program is executed by the processing device 301, the above-mentioned functions defined in the method of some embodiments of the present disclosure are performed.
[0064] It should be noted that the computer-readable medium described in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with 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, device, or device. In some embodiments of the present disclosure, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport 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 suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0065] In some embodiments, the client and server can communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0066] The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist independently without being assembled into the electronic device. The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: receives the message to be forwarded. In response to determining that the three-layer forwarding interface corresponding to the above-mentioned message to be forwarded is valid, the three-layer interface identifier of the above-mentioned three-layer forwarding interface in the preset three-layer interface table is determined. The high-order address fragment corresponding to the above-mentioned three-layer interface identifier is selected from the high-order address fragment group as the first target high-order address fragment. The above-mentioned first target high-order address fragment is combined with the first preset low-order address fragment to generate a first physical interface address. The above-mentioned message to be forwarded is forwarded according to the destination physical interface address and the above-mentioned first physical interface address included in the above-mentioned information to be forwarded.
[0067] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, 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 cases involving 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 (e.g., through the Internet using an Internet service provider).
[0068] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession 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 block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0069] The units described in some embodiments of the present disclosure may be implemented in software or hardware. The units described may also be provided in a processor. For example, they may be described as follows: a processor includes a receiving unit, a determining unit, a selecting unit, a combining unit, and a forwarding unit. The names of these units do not, in some cases, constitute limitations on the units themselves. For example, the receiving unit may also be described as a "unit that receives a message to be forwarded."
[0070] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0071] The above description is only an illustration of some preferred embodiments of the present disclosure and the technical principles used. 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-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure.
Claims
1. A message forwarding method, applied to a switching chip, comprising: Receive messages to be forwarded; In response to determining that the layer-3 forwarding interface corresponding to the to-be-forwarded message is valid, determining a layer-3 interface identifier of the layer-3 forwarding interface in a preset layer-3 interface table; Selecting a high-order address fragment corresponding to the layer-3 interface identifier from the high-order address fragment group as a first target high-order address fragment; Combining the first target high-order address fragment with a first preset low-order address fragment to generate a first physical interface address; forwarding the message to be forwarded according to the destination physical interface address and the first physical interface address included in the message to be forwarded; The forwarding process of the message to be forwarded according to the destination physical interface address and the first physical interface address included in the message to be forwarded includes: In response to the destination physical interface address being the same as the first physical interface address, determining an outbound interface corresponding to an inbound interface as a target outbound interface, the inbound interface being the interface corresponding to the destination physical interface address; Determining an outbound interface identifier of the target outbound interface in a preset information editing table, wherein the preset information editing table is a preset editing table for storing correspondences between outbound interface identifiers and outbound interfaces; Selecting a high-order address fragment corresponding to the outgoing interface identifier from the high-order address fragment group as a second target high-order address fragment; Combining the second target high-order address fragment with the second preset low-order address fragment to generate a second physical interface address; Replacing the source physical forwarding address in the message to be forwarded with the second physical interface address to generate a replaced message to be forwarded; Performing layer 3 forwarding processing on the replaced message to be forwarded; The performing layer-3 forwarding processing on the replaced message to be forwarded includes: Determine whether there is a routing forwarding address corresponding to the destination network protocol address in the routing forwarding table; In response to the existence of a routing forwarding address corresponding to the destination network protocol address in the routing forwarding table, modifying the destination physical interface address in the replaced message to be forwarded to the routing forwarding address to generate a first modified message to be forwarded; The first modified message to be forwarded is forwarded according to the routing forwarding address.
2. The method according to claim 1, wherein After receiving the message to be forwarded, the method further includes: Parsing the message to be forwarded to generate parsing information, wherein the parsing information includes a virtual local area network and an inbound interface; Determine whether the layer-3 forwarding interface is valid based on the virtual local area network and the inbound interface included in the parsed information.
3. The method according to claim 2, wherein: After determining whether the layer-3 forwarding interface is valid based on the virtual local area network and the inbound interface included in the parsed information, the method further includes: In response to the invalidity of the layer 3 forwarding interface, the to-be-forwarded message is subjected to layer 2 forwarding processing.
4. The method according to claim 1, wherein The method further comprises: In response to the absence of a routing forwarding address corresponding to the destination network protocol address in the routing forwarding table, generating routing broadcast information, wherein the routing broadcast information includes the destination network protocol address; In response to receiving a broadcast reply message corresponding to the destination network protocol address, determining a physical forwarding address corresponding to the destination network protocol address according to the broadcast reply message, and modifying the destination physical interface address in the replaced message to be forwarded to the physical forwarding address to generate a second modified message to be forwarded; The second modified message to be forwarded is forwarded according to the physical forwarding address.
5. The method according to claim 1, wherein The method further comprises: In response to the destination physical interface address being different from the first physical interface address, performing layer 2 forwarding processing on the message to be forwarded.
6. A message forwarding device, comprising: a receiving unit, configured to receive a message to be forwarded; a determining unit configured to, in response to determining that the layer-3 forwarding interface corresponding to the to-be-forwarded message is valid, determine a layer-3 interface identifier of the layer-3 forwarding interface in a preset layer-3 interface table; a selecting unit configured to select, from the group of upper address fragments, an upper address fragment corresponding to the layer-3 interface identifier as a first target upper address fragment; a combining unit configured to combine the first target high-order address fragment and a first preset low-order address fragment to generate a first physical interface address; a forwarding unit configured to forward the message to be forwarded according to the destination physical interface address and the first physical interface address included in the message to be forwarded; and the forwarding unit is further configured to: In response to the destination physical interface address being the same as the first physical interface address, determining an outbound interface corresponding to an inbound interface as a target outbound interface, the inbound interface being the interface corresponding to the destination physical interface address; Determining an outbound interface identifier of the target outbound interface in a preset information editing table, wherein the preset information editing table is a preset editing table for storing correspondences between outbound interface identifiers and outbound interfaces; Selecting a high-order address fragment corresponding to the outgoing interface identifier from the high-order address fragment group as a second target high-order address fragment; Combining the second target high-order address fragment with the second preset low-order address fragment to generate a second physical interface address; Replacing the source physical forwarding address in the message to be forwarded with the second physical interface address to generate a replaced message to be forwarded; Performing layer 3 forwarding processing on the replaced message to be forwarded; The performing layer-3 forwarding processing on the replaced message to be forwarded includes: Determine whether there is a routing forwarding address corresponding to the destination network protocol address in the routing forwarding table; In response to the existence of a routing forwarding address corresponding to the destination network protocol address in the routing forwarding table, modifying the destination physical interface address in the replaced message to be forwarded to the routing forwarding address to generate a first modified message to be forwarded; The first modified message to be forwarded is forwarded according to the routing forwarding address.
7. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon; 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 5.
8. A computer-readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Routing lookup method and device
CN104539537A
Method and device for coordinating and switching layer 2 and layer 3 virtual private networks in bridging apparatus
CN104683206A