CN111262786B - Gateway control method, gateway device, electronic device and storage medium - Google Patents

Gateway control method, gateway device, electronic device and storage medium Download PDF

Info

Publication number
CN111262786B
CN111262786B CN202010033214.4A CN202010033214A CN111262786B CN 111262786 B CN111262786 B CN 111262786B CN 202010033214 A CN202010033214 A CN 202010033214A CN 111262786 B CN111262786 B CN 111262786B
Authority
CN
China
Prior art keywords
interface
request information
target
processor
sending
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010033214.4A
Other languages
Chinese (zh)
Other versions
CN111262786A (en
Inventor
于文超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202010033214.4A priority Critical patent/CN111262786B/en
Publication of CN111262786A publication Critical patent/CN111262786A/en
Application granted granted Critical
Publication of CN111262786B publication Critical patent/CN111262786B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a gateway control method, gateway equipment, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring first request information sent by first equipment, wherein the first request information is received through a first interface, and the first interface is bound with a target processor in processors; querying a target forwarding table corresponding to the target processor to determine a second interface corresponding to the first interface, wherein the second interface is bound with the target processor; sending the first request information to the second equipment through the second interface; and under the condition of receiving first response information returned by the second equipment according to the first request information, sending the first response information to the first equipment through the first interface. By setting forwarding tables only containing the association relation with the binding interfaces thereof for each processor in the gateway equipment, the forwarding flows of the same session are all processed by the same processor, the data processing resources required for maintaining the forwarding tables are saved, and the performance of the gateway equipment is improved.

Description

Gateway control method, gateway device, electronic device and storage medium
Technical Field
The present invention relates to the field of network technologies, and in particular, to a gateway control method, a gateway device, an electronic device, and a storage medium.
Background
The NAT (Network Address Translation) technology is a technology in which NAT software is installed in a gateway connected to the Internet in a private Network, so that when a private Network host communicates with the Internet, a private Network IP (Internet Protocol Address) on a packet is switched to an Internet IP, and when a packet is transmitted to the private Network host from the Internet, a reverse proxy can be realized by using techniques such as an SNAT (Source Network Address Translation) and a DNAT (Destination Network Address Translation) technology, thereby realizing intercommunication between a host inside the private Network and a host on the Internet. From the network structure, the NAT gateway device connects two different networks, so the NAT gateway device is easily a bottleneck of the network communication system.
In the prior art, usually a forwarding table is set in a NAT gateway device, a CPU (Central Processing Unit) will add a received data packet into a corresponding sending queue according to the forwarding table for forwarding, and the current forwarding table has two forms: the first is a global forwarding table, that is, all CPUs access the same forwarding table, and this forwarding table needs to use a locking mode to protect the global forwarding table from being damaged when being accessed by multiple CPUs; the second is a forwarding table of each CPU, that is, a global forwarding table is copied on each CPU, and each CPU can directly use a local forwarding table during forwarding.
Although the above-mentioned forwarding table in the first form can protect the global forwarding table from being damaged, contention of the CPU for the lock increases with the increase of the core number of the CPU, and the performance of the NAT gateway device also decreases accordingly; although the forwarding table in the second form can avoid the influence of the CPU on the performance of the NAT gateway device due to the lock, the NAT gateway device is required to synchronize the changed forwarding table to all CPUs each time the forwarding table is changed, and the performance of the NAT gateway device is reduced due to the occupation of excessive data processing resources of the NAT gateway device.
Disclosure of Invention
In view of this, the present invention provides a gateway control method, a gateway device, an electronic device, and a storage medium, so as to solve the problem in the prior art that the performance of the NAT gateway device is degraded due to too many data processing resources occupied by maintaining a forwarding table.
According to a first aspect of the present invention, there is provided a gateway control method applied to a gateway device, the gateway device including a plurality of processors, the method including:
acquiring first request information sent by first equipment, wherein the first request information is received through a first interface, and the first interface is bound with a target processor in the processors;
Querying a target forwarding table corresponding to the target processor to determine a second interface corresponding to the first interface, wherein the second interface is bound to the target processor;
sending the first request information to a second device through the second interface;
and under the condition of receiving first response information returned by the second equipment according to the first request information, sending the first response information to the first equipment through the first interface.
Optionally, the step of determining a second interface corresponding to the first interface includes:
confirming a target interface corresponding to the first interface as a second interface under the condition that the target interface exists in the target forwarding table;
and under the condition that the target interface corresponding to the first interface does not exist in the target forwarding table, distributing a corresponding second interface to the first interface according to a preset distribution strategy.
Optionally, the step of allocating a corresponding second interface to the first interface according to a preset allocation policy includes:
and selecting a free interface from an interface list corresponding to the target processor as a second interface corresponding to the first interface, wherein the interface list comprises interfaces bound with the target processor.
Optionally, the step of allocating a corresponding second interface to the first interface according to a preset allocation policy includes:
and selecting an interface corresponding to the address format of the first interface from an interface list corresponding to the target processor according to a preset format rule, and using the interface as a second interface corresponding to the first interface.
Optionally, the step of querying the target forwarding table corresponding to the target processor includes:
adding the first request information to a first receiving queue corresponding to a first interface, wherein the first receiving queue and the target processor are bound with each other;
extracting the first request information from the first receiving queue and forwarding the first request information to the target processor;
and inquiring a target forwarding table corresponding to the target processor according to the first request information.
Optionally, the step of sending the first request information to the second device through the second interface includes:
and adding the first request information to a first sending queue corresponding to the second interface so as to send the first request information to the second device through the second interface, wherein the first sending queue and the target processor are bound with each other.
Optionally, before the step of sending the first response information to the first device through the first interface, the method further includes:
and adding the first response information to a second receiving queue corresponding to a second interface, wherein the second receiving queue and the target processor are bound with each other.
Optionally, the step of sending the first response information to the first device through the first interface includes:
and adding the first response information to a second sending queue corresponding to the first interface so as to send the first response information to the first device through the second interface, wherein the second sending queue and the target processor are bound with each other.
According to a second aspect of the present invention, there is provided a gateway device comprising a plurality of processors, comprising:
an obtaining module, configured to obtain first request information sent by a first device, where the first request information is received through a first interface, and the first interface is bound to a target processor in the processors;
a determining module, configured to query a target forwarding table corresponding to the target processor to determine a second interface corresponding to the first interface, where the second interface and the target processor are bound to each other;
The sending module is used for sending the first request information to second equipment through the second interface;
and the return module is used for sending the first response information to the first equipment through the first interface under the condition of receiving the first response information returned by the second equipment according to the first request information.
Optionally, the determining module includes:
a first determining submodule, configured to determine, when a target interface corresponding to the first interface exists in the target forwarding table, the target interface as a second interface;
and the second determining submodule is used for allocating a corresponding second interface to the first interface according to a preset allocation strategy under the condition that a target interface corresponding to the first interface does not exist in the target forwarding table.
Optionally, the second determining sub-module includes:
and the first determining unit is used for selecting a free interface from an interface list corresponding to the target processor as a second interface corresponding to the first interface, wherein the interface list comprises interfaces bound with the target processor.
Optionally, the second determining sub-module includes:
And the second determining unit is used for selecting an interface corresponding to the address format of the first interface from the interface list corresponding to the target processor according to a preset format rule, and the interface is used as a second interface corresponding to the first interface.
Optionally, the determining module includes:
the first adding submodule is used for adding the first request information to a first receiving queue corresponding to a first interface, and the first receiving queue and the target processor are bound with each other;
the first extraction submodule is used for extracting the first request information from the first receiving queue and forwarding the first request information to the target processor;
and the query submodule is used for querying a target forwarding table corresponding to the target processor according to the first request information.
Optionally, the sending module includes:
and the sending submodule is used for adding the first request information to a first sending queue corresponding to the second interface so as to send the first request information to the second equipment through the second interface, and the first sending queue and the target processor are bound with each other.
Optionally, the apparatus further includes:
And the second adding submodule is used for adding the first response information to a second receiving queue corresponding to a second interface, and the second receiving queue is bound with the target processor.
Optionally, the return module includes:
and the return submodule is used for adding the first response information to a second sending queue corresponding to the first interface so as to send the first response information to the first equipment through the second interface, and the second sending queue is bound with the target processor.
According to a third aspect of the present invention, there is provided an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the gateway control method according to any one of the first aspect when executing the computer program.
According to a fourth aspect of the present invention, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the gateway control method of any of the first aspects described above.
Aiming at the prior art, the invention has the following advantages:
The invention provides a gateway control method, gateway equipment, electronic equipment and a storage medium, wherein the method comprises the following steps: the method is applied to gateway equipment, the gateway equipment comprises a plurality of processors and is used for acquiring first request information sent by first equipment, the first request information is received through a first interface, and the first interface is bound with one target processor in the processors; querying a target forwarding table corresponding to the target processor to determine a second interface corresponding to the first interface, wherein the second interface is bound to the target processor; sending the first request information to second equipment through the second interface; and under the condition of receiving first response information returned by the second equipment according to the first request information, sending the first response information to the first equipment through the first interface. By setting forwarding tables only containing the association relation with the binding interfaces thereof for each processor in the gateway equipment, the forwarding flows of the same session are all processed by the same processor, the data processing resources required for maintaining the forwarding tables are saved, and the performance of the gateway equipment is improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various additional advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart illustrating steps of a first gateway control method according to an embodiment of the present invention;
fig. 2 is a schematic data transmission diagram of a gateway control method according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating steps of a second gateway control method according to an embodiment of the present invention;
fig. 4 is a block diagram of a gateway device according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
Fig. 1 is a first gateway control method provided in an embodiment of the present invention, which is applied to a gateway device, where the gateway device includes multiple processors, and the method includes:
step 101, obtaining first request information sent by a first device, where the first request information is received through a first interface, and the first interface is bound to a target processor in the processors.
In the embodiment of the present invention, the gateway device is used to connect two different networks, and communication traffic between the two networks needs to pass through the gateway device. The first device is an electronic device with a data transmission function at a user side, is an initiator of a session, and can communicate with devices in other networks or devices in external networks (such as the internet) through the gateway device.
The forwarding stream of each gateway device is split into two connections at the working moment: the user side connection is formed by an SIP (Source IP Address )/SPORT (Source Port, Source Port) and a VIP (Virtual IP Address )/VPORT (Virtual Port, Virtual Port for communication between the gateway device and the first device), and the service side connection is formed by an LIP (Local IP Address )/LPORT (Local Port, Local Port for communication between the gateway device and the second device) and a DIP (Destination IP Address )/DPORT (Destination Port, Destination Port, final service Address).
The first interface refers to a VPORT that the first device connects to the gateway device, that is, a target port accessed by a user, and is fixed for a specific service. The gateway device binds each first interface with each processor in advance, and one first interface can only establish a binding relationship with one processor. If the processor supports multiple cores, the first interface assigned to the processor may be further assigned to each core of the processor, and the processors in the following description are all referred to as single-core processors.
After receiving first request information sent by a first device, the gateway device puts the first request information into a receiving queue of a network card corresponding to the first interface for being extracted by a target processor bound by the first interface.
Step 102, querying a target forwarding table corresponding to the target processor to determine a second interface corresponding to the first interface, where the second interface and the target processor are bound to each other.
In the embodiment of the present invention, the target processor allocates an area in the memory of the gateway device for storing the target forwarding tables corresponding to the target processor one by one, and different from the corresponding relationship between all interfaces included in the full forwarding table in the prior art, the target forwarding table in the embodiment of the present invention only stores the association relationship between the first interface and the second interface bound to the target processor, and the corresponding target processor only needs to maintain the association relationship between the first interface and the second interface bound to the corresponding target processor. It is understood that the association relationship between the first interface and the second interface stored in the target forwarding table is actually in the form of a quadruple. Since the first interface VPORT is an interface to which the first device and the gateway device are connected, and corresponds to a port source interface on the first device side, and the second interface LPORT is an interface to which the second device to be accessed by the first request information and the gateway device are connected, and corresponds to a DPORT target interface on the second device side, the stored association relationship of the target forwarding table is actually a quadruple association relationship between the port, VPORT, LPORT and DPORT.
And the target processor extracts the first request information received by the first interface from a receiving queue of the network card of the gateway equipment and inquires a second interface associated with the first interface in a corresponding target forwarding table. Because the forwarding table corresponding to each processor only contains the association relation between the interfaces bound with the processor, the gateway device does not need to set and maintain a full forwarding table containing the association relation of the interfaces, thereby not only saving the processing resources of the gateway device, but also avoiding the problem that the performance of the gateway device is reduced because the full forwarding table is called among the processors and competition for locks is required when the shared full forwarding table is only set in the memory.
Step 103, sending the first request information to a second device through the second interface.
In this embodiment of the present invention, after querying a second interface associated with the first interface from a target forwarding table, a target processor in the gateway device uses RSS (Receive Side Scaling, a network card Flow classification technology based on a hash algorithm) technology or FDIR (Flow Director, a markable network card Flow classification technology) technology to send the changed first request information to the second device through the second interface by placing the first request information into a sending queue of a network card corresponding to the second interface.
If the second device and the first device both belong to the same internal network, the target interface address in the first request message can be changed, and the second interface address and the first interface address are both in the interface address format of the internal network, which is a local area network deployed and managed by the user; if the second device is a device in the internet, the target interface address in the first request information is determined by the second device and cannot be changed through the gateway device, and the second interface address needs to be an interface address in an internet format, so that the first request information is sent to the second device through the internet.
It can be understood that, after the first request information is sent to the second device through the gateway device, it is determined that the forwarding stream of the session between the first device and the second device is established, and the gateway device allocates the forwarding stream of the session to the same processor for processing according to the binding relationship between the first interface, the second interface, and the target processor.
The RSS technology is a network card driving technology which can efficiently distribute received messages among a plurality of processors in a multiprocessor system, and sends the received data packets to different network card queues according to the results of Hash operation on the information of two, three and four layers of network data packets. The FDIR technology realizes more accurate Flow control than the RSS technology through a customized filter, for example, a Flow Director rule filter may be set, and a data packet of a target port of a specific target address received on the network card is sent to a specific network card queue.
And step 104, sending the first response information to the first device through the first interface under the condition that the first response information returned by the second device according to the first request information is received.
In this embodiment, after receiving the changed first request message, the second device returns corresponding first response message to the second interface of the gateway device, where a source interface address of the changed first request message is the second interface, and a destination interface address of the first response message is also the second interface.
And the gateway equipment adopts an RSS reverse operation technology or an FDIR technology to place the first response information into a receiving queue of a network card corresponding to the second interface so that a target processor corresponding to the second interface can extract the first response information. After extracting the first response information, the target processor of the gateway device queries the corresponding target forwarding table to confirm the first interface corresponding to the second interface, modifies the source interface address of the first response information into the second interface, changes the target interface address into the sip/sport user side interface address of the first device of the gateway device, and then adds the changed first response information into a sending queue corresponding to the first interface, so as to return the first response data to the first device, and the first device can perform the next round of communication or end the session after receiving the first response information.
For example, referring to fig. 2, a data transmission schematic diagram of a gateway control method according to the present application is shown, where a network card a11 and a network card a12 are disposed in a gateway device a1, the network card a11 is responsible for connection with a first device a2 through a first interface included therein, and the network card a12 is responsible for connection with a second device A3 through a second interface included therein.
When the first device a2 needs to initiate a session to the second device A3, after the first device a2 sends the first request information to the gateway device a1 through the first interface of the network card a11, the network card a11 puts the first request information into a first receiving queue, and then distributes the first request information to the CPU1 corresponding to the first request information in the processor a4 through RSS technology or FDIR.
The CPU1 determines a second interface corresponding to the first interface by querying a target forwarding table corresponding to the first interface in the memory, and adds the first request information to a first sending queue in the network card a12 where the second interface is located through an RSS technology or an FDIR technology, so as to send the first request information to the second device A3 through the second interface.
After receiving the first request message, the second device A3 returns corresponding first response information to the second interface of the gateway device a1, and the gateway device a1 adds the first response information to the second receive queue of the network card a12 where the second interface is located through RSS reverse operation technology or FDIR technology, so that the CUP1 can extract the first response information.
The CPU1 determines the first interface associated with the second interface by querying the target forwarding table bound to the target forwarding table in the memory, and adds the first response information to the second sending queue of the first network card a11 where the first interface is located by using the RSS reverse operation technique or the FDIR technique, so as to send the first response information to the first device a2 through the first interface.
Wherein the first receive queue and the first transmit queue form a first forward flow, the second receive queue and the second transmit queue form a second forward flow, and the first forward flow and the second forward flow are both processed on the processor CPU 1. Of course, for convenience of description, if the first device a2 and the second device A3 are in the same network environment, the network card a11 and the network card a12 may be the same physical network card, and conversely, the network cards a11 and a12 are different.
The first gateway control method provided by the invention is applied to gateway equipment, the gateway equipment comprises a plurality of processors, and the method comprises the following steps: acquiring first request information sent by first equipment, wherein the first request information is received through a first interface, and the first interface is bound with a target processor in the processors; querying a target forwarding table corresponding to the target processor to determine a second interface corresponding to the first interface, wherein the second interface is bound to the target processor; sending the first request information to a second device through the second interface; and under the condition of receiving first response information returned by the second equipment according to the first request information, sending the first response information to the first equipment through the first interface. By setting forwarding tables only containing the association relation with the binding interfaces thereof for each processor in the gateway equipment, the forwarding flows of the same session are all processed by the same processor, the data processing resources required for maintaining the forwarding tables are saved, and the performance of the gateway equipment is improved.
Fig. 3 is a second gateway control method provided in an embodiment of the present invention, which is applied to a gateway device, where the gateway device includes multiple processors, and the method includes:
step 201, obtaining first request information sent by a first device, where the first request information is received through a first interface, and the first interface is bound to a target processor in the processors.
This step can refer to the detailed description of step 101, which is not repeated herein.
Step 202, adding the first request information to a first receiving queue corresponding to a first interface, where the first receiving queue and the target processor are bound to each other.
In the embodiment of the present invention, the first interface is disposed on a network card of a gateway device, the network card is provided with a first receiving queue, and the first receiving queue is responsible for storing the request information received by the first interface and allowing a bound target processor to extract the received request information.
Step 203, extracting the first request information from the first receiving queue, and forwarding the first request information to the target processor.
In the embodiment of the present invention, according to the processing sequence of the first receive queue, the first request information is transferred to the memory corresponding to the target processor, so that the target processor performs subsequent processing.
Step 204, querying a target forwarding table corresponding to the target processor according to the first request information.
In the embodiment of the present invention, the target processor queries a target forwarding table corresponding to the target processor in a memory, and queries a second interface corresponding to the first interface in the target forwarding table.
Step 205, in case that a target interface corresponding to the first interface exists in the target forwarding table, confirming the target interface as a second interface.
In the embodiment of the invention, the target forwarding table is traversed, and a second interface corresponding to the first interface is confirmed.
And step 206, in the case that the target interface corresponding to the first interface does not exist in the target forwarding table, selecting a free interface from an interface list corresponding to the target processor as a second interface corresponding to the first interface, where the interface list includes interfaces bound to the target processor.
In the embodiment of the present invention, an RSS reverse technology adopts a cache queue implementation manner, each processor in a gateway device is associated with a corresponding interface list, the interface list includes an available second interface, and if a second interface corresponding to the first interface does not exist in the target forwarding table, an idle interface is selected from the interface list as the second interface corresponding to the first interface in a trial and error manner, so as to establish a session connection between the first device and the second device. Further, if the connection between the first interface and the second interface in the target forwarding table is overtime, the target processor cancels the binding relationship between the first interface and the second interface, and recovers the second interface into the interface list, thereby facilitating the subsequent quick establishment of the connection of other sessions on the target processor. The trial and error method is to match the first interface with the second interface randomly, and if the first interface is not matched with the second interface, the remaining second interfaces are used to continue to be configured with the first interface randomly until the first interface is matched with a proper second interface, namely an idle interface.
Step 207, according to a preset format rule, selecting an interface corresponding to the address format of the first interface from the interface list corresponding to the target processor as a second interface corresponding to the first interface.
In the embodiment of the present invention, when the FDIR technology is adopted, the second interfaces included in the gateway device may be divided into equal parts in advance according to the number of processors, and a corresponding interface list may be allocated to each processor, so that each processor corresponds to a continuous address segment of the second interface, and a preset format rule adapted to the FDIR may be configured, where the preset format rule may be matched according to formats of interface addresses of the first interface and the second interface, so as to establish an association relationship between the first interface and the second interface. For example: the first interface with the last bit of 0 of the interface address is matched with the second interface with the last bit of 9 of the interface address, the first interface with the last bit of 1 of the interface address is matched with the second interface with the last bit of 8 of the interface address, the first interface with the last bit of 2 of the interface address is matched with the second interface with the last bit of 7 of the interface address, and so on. By the preset format rule suitable for the FDIR technology, the distribution rule is different from the distribution rule in the application process of the traditional excessively complicated FDIR technology, a corresponding second interface does not need to be distributed to a first interface during connection establishment, and the distribution process is adjusted to the time when a target forwarding table is initialized, so that the connection establishment efficiency is optimized.
Step 208, adding the first request information to a first sending queue corresponding to the second interface, so as to send the first request information to the second device through the second interface, where the first sending queue and the target processor are bound to each other.
In the embodiment of the present invention, the target processor in the gateway device changes the source interface address of the first request message to the interface address of the second interface, and adds the changed first request message to the first sending queue corresponding to the second interface, so as to forward the changed first request message to the second device.
Step 209, when receiving a first response message returned by the second device according to the first request message, adding the first response message to a second receive queue corresponding to a second interface, where the second receive queue is bound to the target processor.
In this embodiment of the present invention, the gateway device adds the first response information sent by the second device to an interface queue corresponding to the second interface, so that the target processor extracts the second response information.
Step 210, adding the first response information to a second sending queue corresponding to the first interface, so as to send the first response information to the first device through the second interface, where the second sending queue and the target processor are bound to each other.
In this embodiment of the present invention, the target processor in the gateway device confirms the first interface corresponding to the second interface by querying the corresponding target forwarding table, changes the source interface address of the first response message to the first interface, and changes the destination interface address to an interface address of the first device side connected to the gateway device, so as to send the changed first response message to the first device.
The second gateway control method provided by the invention is applied to gateway equipment, the gateway equipment comprises a plurality of processors, and the method comprises the following steps: acquiring first request information sent by first equipment, wherein the first request information is received through a first interface, and the first interface is bound with a target processor in the processors; querying a target forwarding table corresponding to the target processor to determine a second interface corresponding to the first interface, wherein the second interface is bound to the target processor; sending the first request information to second equipment through the second interface; and under the condition of receiving first response information returned by the second equipment according to the first request information, sending the first response information to the first equipment through the first interface. By setting forwarding tables only containing the association relation with the binding interfaces thereof for each processor in the gateway equipment, the forwarding flows of the same session are all processed by the same processor, the data processing resources required for maintaining the forwarding tables are saved, and the performance of the gateway equipment is improved.
Fig. 4 is a gateway device 30 provided in an embodiment of the present invention, where the gateway device 30 includes multiple processors, and includes:
an obtaining module 301, configured to obtain first request information sent by a first device, where the first request information is received through a first interface, and the first interface is bound to a target processor in the processors.
A determining module 302, configured to query a target forwarding table corresponding to the target processor to determine a second interface corresponding to the first interface, where the second interface and the target processor are bound to each other.
A sending module 303, configured to send the first request message to a second device through the second interface.
A returning module 304, configured to send, through the first interface, the first response information to the first device when receiving first response information returned by the second device according to the first request information.
Optionally, the determining module 302 includes:
a first determining sub-module 3021, configured to determine, when a target interface corresponding to the first interface exists in the target forwarding table, the target interface as a second interface.
A second determining submodule 3022, configured to, when a destination interface corresponding to the first interface does not exist in the destination forwarding table, allocate a corresponding second interface to the first interface according to a preset allocation policy.
Optionally, the second determining submodule 3022 includes:
a first determining unit 30221, configured to select a free interface from an interface list corresponding to the target processor, as the second interface corresponding to the first interface, where the interface list includes interfaces bound to the target processor.
Optionally, the second determining submodule 3022 includes:
a second determining unit 30222, configured to select, according to a preset format rule, an interface corresponding to the address format of the first interface from the interface list corresponding to the target processor, as a second interface corresponding to the first interface.
Optionally, the determining module 302 includes:
an adding submodule 3023, configured to add the first request information to a first receiving queue corresponding to a first interface, where the first receiving queue and the target processor are bound to each other.
A first extracting sub-module 3024, configured to extract the first request information from the first receiving queue and forward the first request information to the target processor.
A query submodule 3025, configured to query the target forwarding table corresponding to the target processor according to the first request information.
Optionally, the sending module 303 includes:
the sending submodule 3031 is configured to add the first request information to a first sending queue corresponding to the second interface, so as to send the first request information to the second device through the second interface, where the first sending queue and the target processor are bound to each other.
Optionally, the apparatus further includes:
an adding module 305, configured to add the first response information to a second receive queue corresponding to a second interface, where the second receive queue and the target processor are bound to each other.
Optionally, the return module 304 includes:
a returning sub-module 3041, configured to add the first response information to a second sending queue corresponding to the first interface, so as to send the first response information to the first device through the second interface, where the second sending queue and the target processor are bound to each other.
The invention provides a gateway device, which comprises a plurality of processors and comprises: an obtaining module, configured to obtain first request information sent by a first device, where the first request information is received through a first interface, and the first interface is bound to a target processor in the processors; a determining module, configured to query a target forwarding table corresponding to the target processor to determine a second interface corresponding to the first interface, where the second interface and the target processor are bound to each other; the sending module is used for sending the first request information to second equipment through the second interface; and the return module is used for sending the first response information to the first equipment through the first interface under the condition of receiving the first response information returned by the second equipment according to the first request information. By setting forwarding tables only containing the association relation with the binding interfaces thereof for each processor in the gateway equipment, the forwarding flows of the same session are all processed by the same processor, the data processing resources required for maintaining the forwarding tables are saved, and the performance of the gateway equipment is improved.
As for the above embodiment of the gateway device, since it is basically similar to the method embodiment, the description is relatively simple, and reference may be made to part of the description of the method embodiment for relevant points.
In addition, an embodiment of the present invention further provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, where the computer program, when executed by the processor, implements each process of the above-described gateway control method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the above-mentioned gateway control method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The embodiments in the present specification are all described in a progressive manner, and each embodiment focuses on differences from other embodiments, and portions that are the same and similar between the embodiments may be referred to each other.
As readily imaginable to the person skilled in the art: any combination of the above embodiments is possible, and thus any combination between the above embodiments is an embodiment of the present invention, but the present disclosure is not necessarily detailed herein for reasons of space.
A gateway control method provided herein is not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with the teachings herein. The structure required to construct a system incorporating aspects of the present invention will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed to reflect the intent: rather, the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
Various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of a gateway control method according to embodiments of the present invention. The present invention may also be embodied as devices or gateway device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several gateway devices, several of these gateway devices may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (11)

1. A gateway control method applied to a gateway device, the gateway device comprising a plurality of processors, the method comprising:
acquiring first request information sent by first equipment, wherein the first request information is received through a first interface, and the first interface is bound with a target processor in the processors;
Querying a target forwarding table corresponding to the target processor to determine a second interface corresponding to the first interface, wherein the second interface is bound to the target processor;
sending the first request information to second equipment through the second interface;
under the condition of receiving first response information returned by the second equipment according to the first request information, sending the first response information to the first equipment through the first interface;
the target forwarding table only includes a correspondence between the first interface and the second interface.
2. The method of claim 1, wherein the step of determining the second interface corresponding to the first interface comprises:
determining a second interface corresponding to the first interface when the second interface exists in the target forwarding table;
and under the condition that a second interface corresponding to the first interface does not exist in the target forwarding table, distributing the corresponding second interface to the first interface according to a preset distribution strategy.
3. The method according to claim 2, wherein the step of allocating the corresponding second interface to the first interface according to the preset allocation policy comprises:
And selecting a free interface from an interface list corresponding to the target processor as a second interface corresponding to the first interface, wherein the interface list comprises interfaces bound with the target processor.
4. The method according to claim 2, wherein the step of allocating the corresponding second interface to the first interface according to the preset allocation policy comprises:
and selecting an interface corresponding to the address format of the first interface from an interface list corresponding to the target processor according to a preset format rule, and using the interface as a second interface corresponding to the first interface.
5. The method of claim 1, wherein the step of querying a destination forwarding table corresponding to the destination processor comprises:
adding the first request information to a first receiving queue corresponding to a first interface, wherein the first receiving queue and the target processor are bound with each other;
extracting the first request information from the first receiving queue and forwarding the first request information to the target processor;
and inquiring a target forwarding table corresponding to the target processor according to the first request information.
6. The method of claim 1, wherein the step of sending the first request message to the second device via the second interface comprises:
and adding the first request information to a first sending queue corresponding to the second interface so as to send the first request information to the second device through the second interface, wherein the first sending queue and the target processor are bound with each other.
7. The method of claim 1, wherein the step of sending the first response message to the first device via the first interface is preceded by:
and adding the first response information to a second receiving queue corresponding to a second interface, wherein the second receiving queue and the target processor are bound with each other.
8. The method of claim 1, wherein the step of sending the first response message to the first device via the first interface comprises:
and adding the first response information to a second sending queue corresponding to the first interface so as to send the first response information to the first device through the first interface, wherein the second sending queue and the target processor are bound with each other.
9. A gateway device, the gateway device comprising a plurality of processors, comprising:
an obtaining module, configured to obtain first request information sent by a first device, where the first request information is received through a first interface, and the first interface is bound to a target processor in the processors;
a determining module, configured to query a target forwarding table corresponding to the target processor to determine a second interface corresponding to the first interface, where the second interface and the target processor are bound to each other; the target forwarding table only comprises the corresponding relation between the first interface and the second interface;
the sending module is used for sending the first request information to second equipment through the second interface;
and the return module is used for sending the first response information to the first equipment through the first interface under the condition of receiving the first response information returned by the second equipment according to the first request information.
10. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the gateway control method of any one of claims 1 to 8 when executing the computer program.
11. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the gateway control method of any one of claims 1 to 8.
CN202010033214.4A 2020-01-13 2020-01-13 Gateway control method, gateway device, electronic device and storage medium Active CN111262786B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010033214.4A CN111262786B (en) 2020-01-13 2020-01-13 Gateway control method, gateway device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010033214.4A CN111262786B (en) 2020-01-13 2020-01-13 Gateway control method, gateway device, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN111262786A CN111262786A (en) 2020-06-09
CN111262786B true CN111262786B (en) 2022-05-27

Family

ID=70949010

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010033214.4A Active CN111262786B (en) 2020-01-13 2020-01-13 Gateway control method, gateway device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN111262786B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102325073A (en) * 2011-07-06 2012-01-18 杭州华三通信技术有限公司 VPLS (Virtual Private Local Area Network Service)-based message processing method and device thereof
CN107819677A (en) * 2017-10-26 2018-03-20 新华三技术有限公司 A kind of message forwarding method and device

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103546380B (en) * 2013-11-05 2016-08-17 迈普通信技术股份有限公司 A kind of message forwarding method based on policybased routing and device
EP3062230A4 (en) * 2013-12-04 2016-12-14 Huawei Tech Co Ltd Data processing method, device, storage controller and equipment cabinet
CN105743851B (en) * 2014-12-09 2019-06-21 阿里巴巴集团控股有限公司 Method for processing business, device and service server
CN104883302B (en) * 2015-03-18 2018-11-09 华为技术有限公司 A kind of method, apparatus and system of data packet forwarding
US20170237704A1 (en) * 2016-02-16 2017-08-17 Le Holdings (Beijing) Co., Ltd. Addressing communication method and electronic device based on media access control address
CN107612840B (en) * 2017-09-26 2020-10-30 东软集团股份有限公司 Data processing method and device of four-layer load balancing equipment
CN107786450B (en) * 2017-10-17 2020-09-08 新华三技术有限公司 Data message transmission method and device and machine-readable storage medium
CN110177047B (en) * 2019-05-27 2022-03-04 北京字节跳动网络技术有限公司 Message sending method, device, electronic equipment and computer readable storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102325073A (en) * 2011-07-06 2012-01-18 杭州华三通信技术有限公司 VPLS (Virtual Private Local Area Network Service)-based message processing method and device thereof
CN107819677A (en) * 2017-10-26 2018-03-20 新华三技术有限公司 A kind of message forwarding method and device

Also Published As

Publication number Publication date
CN111262786A (en) 2020-06-09

Similar Documents

Publication Publication Date Title
CN111460460B (en) Task access method, device, proxy server and machine-readable storage medium
JP4053967B2 (en) VLAN server
US6549538B1 (en) Computer method and apparatus for managing network ports cluster-wide using a lookaside list
CN1954576B (en) Technique device and system for handling initiation requests
CN108494891A (en) A kind of domain name analytic method, server and system
EP2692095B1 (en) Method, apparatus and computer program product for updating load balancer configuration data
US9191317B2 (en) Method and system for implementing interconnection between internet protocol version 4 network and new network
CN101442493A (en) Method for distributing IP message, cluster system and load equalizer
JP6920472B2 (en) CGN transfer / control separation
KR20110036573A (en) Providing access over an ip network to a server application program
CN109525684B (en) Message forwarding method and device
US8739270B1 (en) Trusted, cross domain information sharing between multiple legacy and IP based devices
CN109660578A (en) CDN's returns source processing method and processing device, system
CN101325552A (en) Triangle forwarding method for access request and GLB server
CN110365759B (en) Data forwarding method, device, system, gateway equipment and storage medium
CN107580079A (en) A kind of message transmitting method and device
US20210112029A1 (en) Intelligently routing a response packet along a same connection as a request packet
US20080298273A1 (en) Method For Establishing a Communication Relationship in at Least One Communication Network
US6735220B1 (en) Using a centralized server to coordinate assignment of identifiers in a distributed system
CN111614792B (en) Transparent transmission method, system, server, electronic device and storage medium
US20140189793A1 (en) Virtual file system for interworking between content server and information-centric network server and operating method thereof
CN111262786B (en) Gateway control method, gateway device, electronic device and storage medium
CN102984696A (en) IP communication method, equipment and system based on mobile terminals
CN101557336B (en) Method for establishing network tunnel, data processing method and relevant equipment
WO2022089412A1 (en) Communication method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant