Response result sending method and device
By obtaining the MAC address of the target load balanner and the corresponding relationship of the session logo, the Web application firewall cannot be sent to the response result through the target load balancer, which improves the sending efficiency of the answering result and the stability of the TCP connection channel.
Patent Information
- Application Number
- CN202411326485.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2025-01-21
AI Technical Summary
The existing web application firewall cannot send response results to the client device through the target load balancer, resulting in low transmission efficiency of response results and poor stability of the TCP connection channel.
By obtaining the synchronization sequence number SYN packet sent by the target load balancer, obtain its MAC address, establish a TCP connection channel, associate the session ID with the connection channel, establish the corresponding relationship between the session ID and MAC address, and send the data packet to the server. And modify the destination MAC address in the response result to ensure that the target load balancer can correctly send the response result.
The web application firewall sends the response results to the client equipment through the target load balancer, which improves the sending efficiency of the response result and avoids the situation where the data packets on the TCP connection channel cannot be continuously continuously improved, thereby improving the stability of the TCP connection channel. sex.
Smart Images

Figure CN119342044A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application belong to the field of Internet technology, and in particular, relate to a method and device for sending a response result. Background Art
[0002] In high-concurrency scenarios, by configuring a target load balancer, network requests or data streams can be distributed more evenly to multiple servers, which helps to reduce the load pressure on a single server.
[0003] However, the existing Web application firewall cannot send the response result to the client device through the target load balancer, which is not conducive to improving the efficiency of sending the response result. The reason is that in the dynamic device pool, the correspondence between the IP address and the MAC address of the target load balancer may change with the addition, deletion or failover of the device. Therefore, the Web application firewall cannot obtain an accurate and stable MAC address to access the target load balancer based on the correspondence. Therefore, the Web application firewall cannot send the response result to the client device through the target load balancer, and the data packets on the TCP connection channel will not be continuous. Therefore, it is not conducive to improving the efficiency of sending the response result, nor is it conducive to improving the stability of the TCP connection channel. Summary of the invention
[0004] The embodiment of the present application provides a method and device for sending a response result, so as to solve the problem that the above-mentioned existing Web application firewall cannot send a response result to the client device through the target load balancer, which is not conducive to improving the efficiency of sending the response result.
[0005] In a first aspect, an embodiment of the present application provides a method for sending a response result, which is applied to a Web application firewall. The method for sending a response result includes:
[0006] Get the synchronization sequence number SYN packet sent by the target load balancer;
[0007] According to the SYN packet, obtain the MAC address of the target load balancer;
[0008] Establishing a TCP connection channel between the target load balancer and the device, associating the TCP connection channel with a session identifier, and acquiring a data packet on the TCP connection channel associated with the session identifier;
[0009] Establishing a correspondence between the session identifier and the MAC address, and sending the data packet to the server;
[0010] Receive a response result of the data packet returned by the server, and when the response result includes the session identifier, obtain the MAC address recorded in the corresponding relationship, change the destination MAC address in the response result to the recorded MAC address, obtain the modified response result, and send the modified response result to the target load balancer, so that the target load balancer sends the modified response result to the client device.
[0011] The beneficial effects of the embodiment of the present application lie in two aspects. On the one hand, by using the TCP connection channel associated with the session identifier, the response result of the data packet returned by the server is received, so that the Web application firewall can send the response result to the client device through the target load balancer, which is beneficial to improving the efficiency of sending the response result; on the other hand, by sending the response result, the situation where the data packets on the TCP connection channel cannot be continuous will not occur, which is beneficial to improving the stability of the TCP connection channel.
[0012] In a possible implementation manner of the first aspect, obtaining a synchronization sequence number SYN packet sent by a target load balancer includes:
[0013] Obtaining network data sent by the target load balancer, and parsing the network data;
[0014] The SYN packet is obtained from the parsed network data.
[0015] In the embodiment of the present application, the SYN packet is the first packet in the TCP three-way handshake process, which is sent by the client device to the server to initialize a TCP connection channel. Obtaining and correctly parsing the SYN packet can first ensure that a reliable, connection-oriented TCP connection channel is established between the client device and the server.
[0016] In a possible implementation manner of the first aspect, acquiring a MAC address of a target load balancer according to the SYN packet includes:
[0017] Get source address information;
[0018] In the source address information, the MAC address of the target load balancer is obtained according to the SYN packet.
[0019] In the embodiment of the present application, the MAC address is the unique identification mark of the network device in the physical network communication. In the source address information, the MAC address of the device sending the SYN packet is obtained, and the client device can be accurately identified.
[0020] In a possible implementation manner of the first aspect, establishing a TCP connection channel between the target load balancer and the device, associating the TCP connection channel with a session identifier, and obtaining a data packet on the TCP connection channel associated with the session identifier includes:
[0021] Establishing a TCP connection channel between the target load balancer and the device, associating the TCP connection channel with a session identifier, acquiring the TCP connection channel associated with the session identifier, and calling a data packet capture tool;
[0022] The data packet on the TCP connection channel associated with the session identifier is acquired through the data packet capture tool.
[0023] In the embodiment of the present application, the data packet capture tool ensures the integrity and accuracy of the data packet. In the complex environment of network communication, the data packet may pass through multiple intermediate nodes and processing processes, and the capture tool can capture the data packet in time before the data packet is further processed or discarded, thereby ensuring the originality and integrity of the data packet.
[0024] In a possible implementation manner of the first aspect, establishing a correspondence between the session identifier and the MAC address, and sending the data packet to the server includes:
[0025] Establishing a correspondence between the session identifier and the MAC address;
[0026] The corresponding relationship is saved in a preset file, and the data packet is sent to the server.
[0027] In the embodiment of the present application, the session identifier is a key component of the session and can uniquely identify a session of a user or device within a period of time. In this way, when data packets are transmitted in the network, whether passing through the target load balancer, the target load balancer, or the Web application firewall, the server can accurately identify which session these data packets belong to based on the session identifier, thereby ensuring that the data packets can be processed in the correct order and context.
[0028] In a possible implementation manner of the first aspect, the receiving a response result of the data packet returned by the server, when the response result includes the session identifier, obtaining the MAC address recorded in the corresponding relationship, changing the destination MAC address in the response result to the recorded MAC address, obtaining the modified response result, and sending the modified response result to the target load balancer, includes:
[0029] Receive a response result of the data packet returned by the server, and obtain the current state of the target load balancer;
[0030] When the current state is a normal state, the MAC address recorded in the corresponding relationship is obtained, the destination MAC address in the response result is changed to the recorded MAC address, the modified response result is obtained, and the modified response result is sent to the target load balancer.
[0031] In an embodiment of the present application, when the current state is a normal state, the MAC address recorded in the corresponding relationship is obtained, the destination MAC address in the response result is changed to the recorded MAC address, the modified response result is obtained, and the modified response result is sent to the target load balancer. Since the target load balancer itself is ensured to be in a normal state before executing the information sending task, service interruptions or data errors caused by problems with the normal state itself can be effectively avoided, which is conducive to improving stability and reliability.
[0032] In a possible implementation manner of the first aspect, in the receiving a response result of the data packet returned by the server, when the response result includes the session identifier, obtaining the MAC address recorded in the corresponding relationship, changing the destination MAC address in the response result to the recorded MAC address, obtaining the modified response result, and sending the modified response result to the target load balancer, the response result sending method includes:
[0033] The sending time of the data packet is obtained, the receiving time of the response result is obtained, and the response time of the data packet is generated according to the sending time and the receiving time.
[0034] In the embodiment of the present application, the response time of generating the data packet can quantitatively evaluate the performance of network communication. Short response time means fast data transmission speed and high system processing efficiency, which helps to improve user experience and meet the user's demand for fast response. If the response time is too long, it may indicate network congestion, equipment failure or improper configuration, etc., which need to be optimized and adjusted in time.
[0035] In a possible implementation manner of the first aspect, in the receiving a response result of the data packet returned by the server, when the response result includes the session identifier, obtaining the MAC address recorded in the corresponding relationship, changing the destination MAC address in the response result to the recorded MAC address, obtaining the modified response result, and sending the modified response result to the target load balancer, the response result sending method includes:
[0036] Acquire a preset storage device, and store the session identifier and the MAC address in the storage device.
[0037] In the embodiments of the present application, storing session identifiers is of great significance for ensuring data security and privacy. As a unique identifier of a user or device during a session, the session identifier can be used for identity authentication and authorization. By storing and managing session identifiers, the system can ensure that only legitimate users or devices can access corresponding resources, preventing the risk of unauthorized access and data leakage.
[0038] In a possible implementation manner of the first aspect, in the receiving a response result of the data packet returned by the server, when the response result includes the session identifier, obtaining the MAC address recorded in the corresponding relationship, changing the destination MAC address in the response result to the recorded MAC address, obtaining the modified response result, and sending the modified response result to the target load balancer, the response result sending method includes:
[0039] The response result is tested, a test result is generated, and the test result is sent to the target system.
[0040] In the embodiment of the present application, by sending the test results to the target system, it can be ensured that the target system can obtain the test results in the first time, which helps the target system to quickly understand the current situation, assess potential risks, and take corresponding countermeasures.
[0041] In a second aspect, an embodiment of the present application provides a response result sending device, which is applied to a Web application firewall, and the response result sending device includes:
[0042] A first acquisition module is used to acquire a synchronization sequence number SYN packet sent by a target load balancer;
[0043] A second acquisition module, used to acquire a MAC address of a target load balancer according to the SYN packet;
[0044] A third acquisition module is used to establish a TCP connection channel between the target load balancer and the device, associate the TCP connection channel with a session identifier, obtain a session identifier corresponding to the TCP connection channel associated with the session identifier, and obtain a data packet on the TCP connection channel;
[0045] A generating module, used to establish a corresponding relationship between the session identifier and the MAC address, and send the data packet to the server;
[0046] A sending module is used to receive a response result of the data packet returned by the server, and when the response result includes the session identifier, obtain the MAC address recorded in the corresponding relationship, change the destination MAC address in the response result to the recorded MAC address, obtain the modified response result, and send the modified response result to the target load balancer, so that the target load balancer sends the modified response result to the client device.
[0047] The beneficial effects of the embodiment of the present application lie in two aspects. On the one hand, by using the TCP connection channel associated with the session identifier, the response result of the data packet returned by the server is received, so that the Web application firewall can send the response result to the client device through the target load balancer, which is beneficial to improving the efficiency of sending the response result; on the other hand, by sending the response result, the situation where the data packets on the TCP connection channel cannot be continuous will not occur, which is beneficial to improving the stability of the TCP connection channel. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. Some specific embodiments of the present application will be described in detail in an illustrative and non-restrictive manner with reference to the drawings. The same reference numerals in the drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the drawings:
[0049] Figure 1 It is a flowchart of the method for sending a response result provided in an embodiment of the present application;
[0050] Figure 2 A schematic block diagram of a response result sending device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application.
[0052] The generation method provided in the embodiment of the present application can be applied to a Web application firewall, and the embodiment of the present application does not impose any restrictions on the specific type of the Web application firewall.
[0053] Figure 1 Flowchart of the response result sending method provided in the embodiment of the present application, which is applied to a Web application firewall, such as Figure 1 As shown, the generation method provided in the embodiment of the present application includes the following steps, which are described in detail as follows:
[0054] S101, obtaining a synchronization sequence number SYN packet sent by a target load balancer;
[0055] The SYN packet is the full name of the synchronization sequence number in Chinese and the full name of the English is Synchronize Sequence Numbers. It is the handshake signal used by the TCP protocol to establish a connection. It is used to synchronize the connection between the two parties during the first handshake to prevent the influence of historical connections.
[0056] When a client device wants to establish a TCP connection channel with a server, it will first send a SYN packet to the server. The SYN packet contains an initial sequence number, which is used to identify the data packets sent subsequently. After receiving the SYN packet, the server will reply with a synchronization confirmation packet, indicating that it has received the client device's request and is ready to establish a TCP connection channel. Finally, the client device sends another confirmation packet to complete the establishment of the TCP connection channel.
[0057] The sequence number in the SYN packet is used to synchronize the sequence numbers of both parties to prevent the disorder and duplication of data packets. Through the sequence number, the receiver can accurately identify the order of each data packet and whether it has been received.
[0058] Exemplarily, the network topology structure applied by the response result sending method is as follows:
[0059] The client device connects to the Web application firewall through the target load balancer, and the Web application firewall connects to the server.
[0060] Among them, a web application firewall is a security device or service specifically designed to protect web applications. It is located between web applications and the Internet, and its main task is to identify and block malicious traffic and protect web applications from cross-site scripting and DDoS attacks.
[0061] Among them, DDoS attack, the full name of which is Distributed Denial of Service attack, is a common network security attack method.
[0062] The target load balancer is a load balancer that receives a synchronization sequence number SYN packet sent by the client device.
[0063] For the sake of illustration, an example is given below:
[0064] For example, there are three load balancers in the network, namely load balancer A, load balancer B, and load balancer C;
[0065] Load balancer A receives the synchronization sequence number SYN packet sent by the client device, and load balancer A serves as the target load balancer;
[0066] For the sake of illustration, an example is given below:
[0067] For example, there are 5 load balancers in the network, namely load balancer A, load balancer B, load balancer C, load balancer D, and load balancer E;
[0068] Load balancer B receives the synchronization sequence number SYN packet sent by the client device, and load balancer B serves as the target load balancer.
[0069] The step of obtaining a synchronization sequence number SYN packet sent by a target load balancer includes:
[0070] Obtaining network data sent by the target load balancer, and parsing the network data;
[0071] The SYN packet is obtained from the parsed network data.
[0072] In the embodiment of the present application, the SYN packet is the first packet in the TCP three-way handshake process, which is sent by the client device to the server to initialize a TCP connection channel. Obtaining and correctly parsing the SYN packet can first ensure that a reliable, connection-oriented TCP connection channel is established between the client device and the server.
[0073] S102, obtaining a MAC address of a target load balancer according to the SYN packet; wherein obtaining a MAC address of a target load balancer according to the SYN packet includes:
[0074] Get source address information;
[0075] In the source address information, the MAC address of the target load balancer is obtained according to the SYN packet.
[0076] Exemplarily, in the source address information, obtaining the MAC address of the target load balancer according to the SYN packet includes:
[0077] From the source address information, obtain the MAC address of the target load balancer that sends the SYN packet.
[0078] In the embodiment of the present application, the MAC address is a unique identification mark of a network device in physical network communication. In the source address information, the MAC address of the target load balancer that sends the SYN packet is obtained, so that the target load balancer can be accurately identified.
[0079] S103, establishing a TCP connection channel between the target load balancer and the device, associating the TCP connection channel with a session identifier, and acquiring a data packet on the TCP connection channel associated with the session identifier;
[0080] Exemplarily, this device is a Web application firewall with proxy mode enabled.
[0081] Among them, after the Web application firewall turns on the proxy mode, the target load balancer establishes a TCP connection channel with the Web application firewall. The Web application firewall uses its own IP address to establish a request relationship with the server. Since the server is hidden behind the Web application firewall, the target load balancer can only rely on the Web application firewall to access the server. This architecture can hide the structure of the internal network and the real address of the server, thereby increasing the difficulty for attackers and helping to improve the security of the internal network.
[0082] The step of establishing a TCP connection channel between the target load balancer and the device, associating the TCP connection channel with a session identifier, and obtaining a data packet on the TCP connection channel associated with the session identifier includes:
[0083] Establishing a TCP connection channel between the target load balancer and the device, associating the TCP connection channel with a session identifier, acquiring the TCP connection channel associated with the session identifier, and calling a data packet capture tool;
[0084] The data packet on the TCP connection channel associated with the session identifier is acquired through the data packet capture tool.
[0085] The TCP connection channel is a communication link established based on the TCP protocol, which is used to transmit data between two endpoints in the network. The TCP protocol is a connection-oriented, reliable, byte stream-based communication protocol and is one of the core protocols of the Internet protocol suite.
[0086] In the embodiment of the present application, the data packet capture tool ensures the integrity and accuracy of the data packet. In the complex environment of network communication, the data packet may pass through multiple intermediate nodes and processing processes, and the capture tool can capture the data packet in time before the data packet is further processed or discarded, thereby ensuring the originality and integrity of the data packet.
[0087] There are two ways to associate the TCP connection channel with the session identifier, as described in detail below:
[0088] Obtaining a plurality of randomly generated numbers, selecting any one of the numbers as a session identifier, and associating the TCP connection channel with the session identifier; or,
[0089] The mapping value of the MAC address is obtained, a session identifier is generated according to a predefined instruction and the mapping value of the MAC address, and the TCP connection channel is associated with the session identifier.
[0090] For illustration purposes, the predefined directives are:
[0091] mark = uint32(len(Map)+1);
[0092] Among them, mark is the session identifier, Map is the mapping value of the MAC address, and uint32 is an unsigned 32-bit integer type.
[0093] The value range of uint32 is 0 to 4294967295. len is a built-in function used to get the length of the Map.
[0094] S104, establishing a correspondence between the session identifier and the MAC address, and sending the data packet to the server;
[0095] The step of establishing a correspondence between the session identifier and the MAC address and sending the data packet to the server includes:
[0096] Establishing a correspondence between the session identifier and the MAC address;
[0097] The corresponding relationship is saved in a preset file, and the data packet is sent to the server.
[0098] In the embodiment of the present application, the session identifier is a key component of the session and can uniquely identify a session of a user or device within a period of time. In this way, when data packets are transmitted in the network, whether passing through the target load balancer, the target load balancer, or the Web application firewall, the server can accurately identify which session these data packets belong to based on the session identifier, thereby ensuring that the data packets can be processed in the correct order and context.
[0099] S105, receiving a response result of the data packet returned by the server, and when the response result includes the session identifier, obtaining the MAC address recorded in the corresponding relationship, changing the destination MAC address in the response result to the recorded MAC address, obtaining the modified response result, and sending the modified response result to the target load balancer, so that the target load balancer sends the modified response result to the client device.
[0100] The MAC address of the target load balancer is unique, so even if the IP address of the target load balancer changes, the MAC address of the target load balancer remains unchanged. This enables the Web Application Firewall to accurately identify the target load balancer in the device pool, thereby ensuring that the traffic from the target load balancer will return to the target load balancer.
[0101] Among them, the target load balancer turns on the Auto-last hop function. Auto-last hop in Chinese can be directly translated as automatically recording the previous hop, and its full English name is Auto-last hop.
[0102] The target load balancer sends the response result to the client device according to the information recorded by the Auto-last hop function.
[0103] The receiving a response result of the data packet returned by the server, when the response result includes the session identifier, obtaining the MAC address recorded in the corresponding relationship, changing the destination MAC address in the response result to the recorded MAC address, obtaining the modified response result, and sending the modified response result to the target load balancer, comprises:
[0104] Receive a response result of the data packet returned by the server, and obtain the current state of the target load balancer;
[0105] When the current state is a normal state, the MAC address recorded in the corresponding relationship is obtained, the destination MAC address in the response result is changed to the recorded MAC address, the modified response result is obtained, and the modified response result is sent to the target load balancer. In the data link layer, the destination MAC address is the MAC address of the receiver, and the destination MAC address is changed to the recorded MAC address, so that the target load balancer is the receiver, and therefore, the target load balancer can receive the modified response result.
[0106] In an embodiment of the present application, when the current state is a normal state, the MAC address recorded in the corresponding relationship is obtained, the destination MAC address in the response result is changed to the recorded MAC address, the modified response result is obtained, and the modified response result is sent to the target load balancer. Since the target load balancer itself is ensured to be in a normal state before executing the information sending task, service interruptions or data errors caused by problems with the normal state itself can be effectively avoided, which is conducive to improving stability and reliability.
[0107] In a possible implementation manner of the first aspect, in the receiving a response result of the data packet returned by the server, when the response result includes the session identifier, obtaining the MAC address recorded in the corresponding relationship, changing the destination MAC address in the response result to the recorded MAC address, obtaining the modified response result, and sending the modified response result to the target load balancer, the response result sending method includes:
[0108] The sending time of the data packet is obtained, the receiving time of the response result is obtained, and the response time of the data packet is generated according to the sending time and the receiving time.
[0109] In the embodiment of the present application, the response time of generating the data packet can quantitatively evaluate the performance of network communication. Short response time means fast data transmission speed and high system processing efficiency, which helps to improve user experience and meet the user's demand for fast response. If the response time is too long, it may indicate network congestion, equipment failure or improper configuration, etc., which need to be optimized and adjusted in time.
[0110] In a possible implementation manner of the first aspect, in the receiving a response result of the data packet returned by the server, when the response result includes the session identifier, obtaining the MAC address recorded in the corresponding relationship, changing the destination MAC address in the response result to the recorded MAC address, obtaining the modified response result, and sending the modified response result to the target load balancer, the response result sending method includes:
[0111] Acquire a preset storage device, and store the session identifier and the MAC address in the storage device.
[0112] In the embodiments of the present application, storing session identifiers is of great significance for ensuring data security and privacy. As a unique identifier of a user or device during a session, the session identifier can be used for identity authentication and authorization. By storing and managing session identifiers, the system can ensure that only legitimate users or devices can access corresponding resources, preventing the risk of unauthorized access and data leakage.
[0113] In a possible implementation manner of the first aspect, in the receiving a response result of the data packet returned by the server, when the response result includes the session identifier, obtaining the MAC address recorded in the corresponding relationship, changing the destination MAC address in the response result to the recorded MAC address, obtaining the modified response result, and sending the modified response result to the target load balancer, the response result sending method includes:
[0114] The response result is tested, a test result is generated, and the test result is sent to the target system.
[0115] In the embodiment of the present application, by sending the test results to the target system, it can be ensured that the target system can obtain the test results in the first time, which helps the target system to quickly understand the current situation, assess potential risks, and take corresponding countermeasures.
[0116] The beneficial effects of the embodiment of the present application lie in two aspects. On the one hand, the response result of the data packet returned by the server is received through the TCP connection channel associated with the session identifier, so that the Web application firewall can send the response result to the client device through the target load balancer, which is beneficial to improving the efficiency of sending the response result; on the other hand, by sending the response result, the situation where the data packets on the TCP connection channel cannot be continuous will not occur, which is beneficial to improving the stability of the TCP connection channel.
[0117] Corresponding to the response result sending method described in the above embodiment, it is applied to the Web application firewall, please refer to Figure 2 , Figure 2 A schematic block diagram of a response result sending device provided in an embodiment of the present application, Figure 2 The generating device 200 shown in the figure can be applied to the above-mentioned Web application firewall. Figure 2 The generating device 200 shown is described in detail. The generating device 200 may include a first obtaining module 201, a second obtaining module 202, a third obtaining module 203, a generating module 204, and a sending module 205.
[0118] The first acquisition module 201 is used to acquire a synchronization sequence number SYN packet sent by a target load balancer;
[0119] A second acquisition module 202, configured to acquire a MAC address of a target load balancer according to the SYN packet;
[0120] The third acquisition module 203 is used to establish a TCP connection channel between the target load balancer and the device, associate the TCP connection channel with a session identifier, obtain a session identifier corresponding to the TCP connection channel associated with the session identifier, and obtain a data packet on the TCP connection channel;
[0121] A generating module 204, configured to establish a correspondence between the session identifier and the MAC address, and send the data packet to the server;
[0122] The sending module 205 is used to receive the response result of the data packet returned by the server, and when the response result includes the session identifier, obtain the MAC address recorded in the corresponding relationship, change the destination MAC address in the response result to the recorded MAC address, obtain the modified response result, and send the modified response result to the target load balancer, so that the target load balancer sends the modified response result to the client device.
[0123] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0124] The beneficial effects of the embodiment of the present application lie in two aspects. On the one hand, the response result of the data packet returned by the server is received through the TCP connection channel associated with the session identifier, so that the Web application firewall can send the response result to the client device through the target load balancer, which is beneficial to improving the efficiency of sending the response result; on the other hand, by sending the response result, the situation where the data packets on the TCP connection channel cannot be continuous will not occur, which is beneficial to improving the stability of the TCP connection channel.
[0125] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for sending a response result, characterized in that: The response result sending method comprises: Get the synchronization sequence number SYN packet sent by the target load balancer; According to the SYN packet, obtain the MAC address of the target load balancer; Establishing a TCP connection channel between the target load balancer and the device, associating the TCP connection channel with a session identifier, and acquiring a data packet on the TCP connection channel associated with the session identifier; Establishing a correspondence between the session identifier and the MAC address, and sending the data packet to the server; Receive a response result of the data packet returned by the server, and when the response result includes the session identifier, obtain the MAC address recorded in the corresponding relationship, change the destination MAC address in the response result to the recorded MAC address, obtain the modified response result, and send the modified response result to the target load balancer, so that the target load balancer sends the modified response result to the client device.
2. The response result sending method according to claim 1, characterized in that: The step of obtaining a synchronization sequence number SYN packet sent by a target load balancer includes: Obtaining network data sent by the target load balancer, and parsing the network data; The SYN packet is obtained from the parsed network data.
3. The response result sending method according to claim 1, characterized in that: The step of obtaining the MAC address of the target load balancer according to the SYN packet includes: Get source address information; In the source address information, the MAC address of the target load balancer is obtained according to the SYN packet.
4. The response result sending method according to claim 1, characterized in that: The step of establishing a TCP connection channel between the target load balancer and the device, associating the TCP connection channel with a session identifier, and obtaining a data packet on the TCP connection channel associated with the session identifier includes: Establishing a TCP connection channel between the target load balancer and the device, associating the TCP connection channel with a session identifier, acquiring the TCP connection channel associated with the session identifier, and calling a data packet capture tool; The data packet on the TCP connection channel associated with the session identifier is acquired through the data packet capture tool.
5. According to claim 1, it is characterized in that The establishing of the correspondence between the session identifier and the MAC address and sending the data packet to the server includes: Establishing a correspondence between the session identifier and the MAC address; The corresponding relationship is saved in a preset file, and the data packet is sent to the server.
6. The response result sending method according to claim 1, characterized in that: The receiving a response result of the data packet returned by the server, when the response result includes the session identifier, obtaining the MAC address recorded in the corresponding relationship, changing the destination MAC address in the response result to the recorded MAC address, obtaining the modified response result, and sending the modified response result to the target load balancer, comprises: Receive a response result of the data packet returned by the server, and obtain the current state of the target load balancer; When the current state is a normal state, the MAC address recorded in the corresponding relationship is obtained, the destination MAC address in the response result is changed to the recorded MAC address, the modified response result is obtained, and the modified response result is sent to the target load balancer.
7. The response result sending method according to any one of claims 1 to 5, characterized in that: In the receiving of the response result of the data packet returned by the server, when the response result includes the session identifier, obtaining the MAC address recorded in the corresponding relationship, changing the destination MAC address in the response result to the recorded MAC address, obtaining the modified response result, and sending the modified response result to the target load balancer, the response result sending method includes: The sending time of the data packet is obtained, the receiving time of the response result is obtained, and the response time of the data packet is generated according to the sending time and the receiving time.
8. The response result sending method according to any one of claims 1 to 5, characterized in that: In the receiving of the response result of the data packet returned by the server, when the response result includes the session identifier, obtaining the MAC address recorded in the corresponding relationship, changing the destination MAC address in the response result to the recorded MAC address, obtaining the modified response result, and sending the modified response result to the target load balancer, the response result sending method includes: Acquire a preset storage device, and store the session identifier and the MAC address in the storage device.
9. The response result sending method according to any one of claims 1 to 5, characterized in that: In the receiving of the response result of the data packet returned by the server, when the response result includes the session identifier, obtaining the MAC address recorded in the corresponding relationship, changing the destination MAC address in the response result to the recorded MAC address, obtaining the modified response result, and sending the modified response result to the target load balancer, the response result sending method includes: The response result is tested, a test result is generated, and the test result is sent to the target system.
10. A response result sending device, characterized in that: The response result sending device comprises: A first acquisition module is used to acquire a synchronization sequence number SYN packet sent by a target load balancer; A second acquisition module, used to acquire a MAC address of a target load balancer according to the SYN packet; A third acquisition module is used to establish a TCP connection channel between the target load balancer and the device, associate the TCP connection channel with a session identifier, obtain a session identifier corresponding to the TCP connection channel associated with the session identifier, and obtain a data packet on the TCP connection channel; A generating module, used to establish a corresponding relationship between the session identifier and the MAC address, and send the data packet to the server; A sending module is used to receive a response result of the data packet returned by the server, and when the response result includes the session identifier, obtain the MAC address recorded in the corresponding relationship, change the destination MAC address in the response result to the recorded MAC address, obtain the modified response result, and send the modified response result to the target load balancer, so that the target load balancer sends the modified response result to the client device.