CN103825683B - Kernel proxy method and device based on TCP (transmission control protocol) retransmission mechanism - Google Patents

Kernel proxy method and device based on TCP (transmission control protocol) retransmission mechanism Download PDF

Info

Publication number
CN103825683B
CN103825683B CN201410099474.6A CN201410099474A CN103825683B CN 103825683 B CN103825683 B CN 103825683B CN 201410099474 A CN201410099474 A CN 201410099474A CN 103825683 B CN103825683 B CN 103825683B
Authority
CN
China
Prior art keywords
kernel
message
carry out
application layer
agency
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.)
Expired - Fee Related
Application number
CN201410099474.6A
Other languages
Chinese (zh)
Other versions
CN103825683A (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 JIKEJIKE TECHNOLOGY Co Ltd
Original Assignee
BEIJING JIKEJIKE 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 JIKEJIKE TECHNOLOGY Co Ltd filed Critical BEIJING JIKEJIKE TECHNOLOGY Co Ltd
Priority to CN201410099474.6A priority Critical patent/CN103825683B/en
Publication of CN103825683A publication Critical patent/CN103825683A/en
Application granted granted Critical
Publication of CN103825683B publication Critical patent/CN103825683B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention provides a kernel proxy method and a kernel proxy device based on a TCP (transmission control protocol) retransmission mechanism. The method comprises the steps of not performing proxy processing under triple communication, and analyzing a first data message of an application layer in a kernel so as to determine whether to perform the proxy processing when a fourth data message is received in the kernel; triggering the TCP retransmission mechanism through a fake data message in the need of the proxy processing, and sending the data message to a user mode for processing. The invention provides a high-efficiency application layer proxy solution by using the TCP retransmission mechanism, so that the problem of low user experience, complicated design or low performance of the conventional application layer proxy solution is solved.

Description

Kernel proxy method and device based on TCP retransmission mechanism
Technical field
The invention belongs to computer communication technology field, and in particular to a kind of kernel proxy side based on TCP retransmission mechanism Method and device.
Background technology
Agency refers to add agency to process logic in the communication process of original client and server, so, visitor Family end is really being communicated with agency, then acts on behalf of the data forwarding for again sending over client to server;Service Communication between device and client is also to be forwarded by agency, therefore, agency can be monitored between client and server Communication, and data therein are changed, to meet the demand of upper strata miscellaneous service.Application layer refers to transport layer in network protocol stack Last layer, application level proxy refer to application layer add Agent logic, with process we care business datum.This is one Individual general technology, but different designs, the complexity of impact, code to performance, extensibility are different.Current Universal design is in kernel, all of TCP message to be passed through into network address translation(Network Address Translation, abbreviation NAT) mechanism is sent to User space and goes to process, and so, the data whether application layer is paid close attention to all can be by It is sent to User space to go to process, although process succinct, but performance can be reduced, while agency's easily error;Another kind of scheme is Agency is directly realized in kernel, such volume coding difficulty is larger, and safeguards very difficult, is difficult extension.
Retransmission timeout is another important mechanisms that Transmission Control Protocol ensures data reliability, and its principle is:Sending some A timer is switched on after data, if not obtaining the message of the datagram of transmission within a certain period of time, then just heavy It is new to send data, till transmission success.Data will be sent to User space go to be needed in TCP layer, first to three-way handshake Individual message is just sent upwards by NAT or other means, but after the completion of TCP three-way handshake, we can just see application layer Data, namely when we have seen that application layer data, then act as agent, evening.
Current universal design is in kernel, all of TCP message to be sent to into User space by NAT mechanism and goes to process, So, the data that whether application layer is paid close attention to can all be sent to User space and go to process, although process brief introduction, but can reduce using , there is agency's error in performance;Another kind of scheme is that directly realization is processed in kernel, and so, coding difficulty is big, and hardly possible is safeguarded, no Easily extension.
The content of the invention
The present invention provides a kind of kernel proxy method and device based on TCP retransmission mechanism, solves traditional application layer generation Reason solution Consumer's Experience is bad, or design is complicated, or the problem of poor performance.
For achieving the above object, the present invention provides a kind of kernel proxy method based on TCP retransmission mechanism, the method bag Include:
Process is analyzed to first data message of application layer in kernel, to decide whether to carry out agency's process;
When needing to carry out agency's process, TCP retransmission mechanism is triggered by data falsification message, data message is sent to into use Family state goes to process.
Alternatively, when needing to carry out agency's process, TCP retransmission mechanism is triggered by data falsification message, by datagram Text is sent to User space and goes process to include:
Three-way handshake does not carry out agency's process, when kernel receives fourth data message, to application layer data letter is carried out Single analysis, records the IP address of this server, a handshake message is forged in kernel and issues client, and client is sent out again Send handshake message;
When kernel finds that the IP address of server is identical with current record, send it to User space and go to process.
Alternatively, the method also includes:When agency's process need not be carried out, then normal Message processing flow process is carried out.
For achieving the above object, the present invention provides a kind of kernel proxy device based on TCP retransmission mechanism, including:
Analytic unit, for being analyzed process to first data message of application layer in kernel, to decide whether Carry out agency's process;
Processing unit, for when needing to carry out agency's process, by data falsification message TCP retransmission mechanism being triggered, will Data message is sent to User space and goes to process.
Alternatively, the processing unit, for when needing to carry out agency's process, by data falsification message TCP being triggered Retransmission mechanism, is sent to data message User space and goes process to include:
Three-way handshake does not carry out agency's process, when kernel receives fourth data message, to application layer data letter is carried out Single analysis, records the IP address of this server, a handshake message is forged in kernel and issues client, and client is sent out again Send handshake message;
When kernel finds that the IP address of server is identical with current record, send it to User space and go to process.
Alternatively, when the analytic unit is analyzed and need not carry out agency's process, then the processing unit is carried out normally Message processing flow process.
In the kernel proxy method and device based on TCP retransmission mechanism that the present invention is provided, three-way handshake is not acted as agent, this If individual server is problematic, client can have soon found that problem, strengthen Consumer's Experience, when receiving fourth data in kernel During message, application layer data can simply be analyzed, if process need not be acted on behalf of, continue to walk normal Message processing Flow process, have no performance loss;If desired the process acted on behalf of, just records the IP address of server, and the forgery one in kernel Handshake message issues client, shakes hands unsuccessful to cheat client and say, client can resend handshake message, when in kernel It was found that the IP address of server and early stage record it is identical when, just send it to User space and go to process.Offer technology of the present invention Scheme can identify a need for the application layer data acted on behalf of, and be sent in User space and go to process, and other great majority are not required to The data to be acted on behalf of directly pass through, and while kernel processes terseness is kept, improve core performance, and reduce at kernel The probability of reason error.
Description of the drawings
Fig. 1 is the schematic flow sheet of the kernel proxy method based on TCP retransmission mechanism that the embodiment of the present invention one is provided;
Fig. 2 is the structural representation of the kernel proxy device based on TCP retransmission mechanism that the embodiment of the present invention two is provided.
Specific embodiment
To make those skilled in the art more fully understand technical scheme, below in conjunction with the accompanying drawings and specific embodiment party Formula is described in further detail to the present invention.
Fig. 1 is the schematic flow sheet of the kernel proxy method based on TCP retransmission mechanism that the embodiment of the present invention one is provided, such as Shown in Fig. 1, the method includes:
Step S101, three-way handshake do not carry out agency's process, when fourth data message is received in kernel, in kernel In process is analyzed to first data message of application layer, to decide whether to carry out agency's process.
Specifically, data will be sent to User space and go be needed in TCP layer, and first message of three-way handshake is just passed through NAT or other means are sent upwards.But after the completion of the three-way handshake of TCP, we can just see the data of application layer.Change speech It, when we have seen that application layer data, then acts as agent, it appears that late.
Do not act as agent in three-way handshake in technical scheme, if this server is problematic, client energy Enough pinpointing the problems quickly, strengthen Consumer's Experience.When kernel receives the 4th data message, letter can be carried out to application layer data Single analysis, if process need not be acted on behalf of, continues the flow process for walking normal Message processing, has no performance and saves consumption.If desired generation The process of reason, just records the IP of this server, and one handshake message of forgery issues client in kernel, to cheat client Say shake hands it is unsuccessful.So, client can resend handshake message, when kernel finds the phase that the IP of server is recorded with early stage Meanwhile, just sending it to User space and go to process, all of processing procedure is quite succinct in kernel.
Step S102, when need carry out agency process when, by data falsification message trigger TCP retransmission mechanism, by data Message is sent to User space and goes to process.
Specifically, when needing to carry out agency's process, three-way handshake does not carry out agency's process, when kernel receives the 4th number During according to message, application layer data is simply analyzed, recorded the IP address of this server, forged one in kernel and shake hands Message issues client, and client resends handshake message;
When kernel finds that the IP address of server is identical with current record, send it to User space and go to process.
In the present embodiment, the application layer data acted on behalf of is recognized the need for, be sent to User space and go to process, other great majority are not required to The data to be acted on behalf of directly are let slip, and while terseness is kept, improve performance, and reduce the probability for ging wrong, and are needed The message of agency, can quickly detect whether network is unobstructed, strengthens Consumer's Experience.
Fig. 2 is the structural representation of the kernel proxy device based on TCP retransmission mechanism that the embodiment of the present invention two is provided, such as Shown in Fig. 2, the device includes:Analytic unit 201 and processing unit 202, analytic unit 201 is used for, and processing unit 202 is used for Process is analyzed to first data message of application layer in kernel, to decide whether to carry out agency's process;202 processing units For when needing to carry out agency's process, by data falsification message TCP retransmission mechanism being triggered, data message is sent to into User space Go to process.
Specifically, data will be sent to User space and go be needed in TCP layer, and first message of three-way handshake is just passed through NAT or other means are sent upwards.But after the completion of the three-way handshake of TCP, we can just see the data of application layer.Change speech It, when we have seen that application layer data, then acts as agent, it appears that late.
In the kernel proxy method and device based on TCP retransmission mechanism that the present invention is provided, three-way handshake is not acted as agent, this If individual server is problematic, client can have soon found that problem, strengthen Consumer's Experience, when receiving fourth data in kernel During message, application layer data can simply be analyzed, if process need not be acted on behalf of, continue to walk normal Message processing Flow process, have no performance loss;If desired the process acted on behalf of, just records the IP address of server, and the forgery one in kernel Handshake message issues client, shakes hands unsuccessful to cheat client and say, client can resend handshake message, when in kernel It was found that the IP address of server and early stage record it is identical when, just send it to User space and go to process.Offer technology of the present invention Scheme can identify a need for the application layer data acted on behalf of, and be sent in User space and go to process, and other great majority are not required to The data to be acted on behalf of directly pass through, and while kernel processes terseness is kept, improve core performance, and reduce at kernel The probability of reason error.
It is understood that the embodiment of above principle being intended to be merely illustrative of the present and the exemplary enforcement for adopting Mode, but the invention is not limited in this.For those skilled in the art, in the essence without departing from the present invention In the case of god and essence, various modifications and improvement can be made, these modifications and improvement are also considered as protection scope of the present invention.

Claims (4)

1. a kind of kernel proxy method based on TCP retransmission mechanism, it is characterised in that include:
Three-way handshake does not carry out agency's process, when fourth data message is received in kernel, to application layer in kernel First data message is analyzed process, to decide whether to carry out agency's process;
When needing to carry out agency's process, application layer data is simply analyzed, recorded the IP address of this server, including A handshake message is forged in core and issues client, client resends handshake message, when kernel finds the IP ground of server When location is identical with current record, the handshake message that client resends is sent to into User space and goes to process.
2. method according to claim 1, it is characterised in that also include:When agency's process need not be carried out, then carry out Normal Message processing flow process.
3. a kind of kernel proxy device based on TCP retransmission mechanism, it is characterised in that include:
Analytic unit, for being analyzed process to first data message of application layer in kernel, to decide whether to carry out Agency is processed;
Processing unit, for when needing to carry out agency's process, three-way handshake not to carry out agency's process, when kernel receives the 4th During data message, application layer data is simply analyzed, recorded the IP address of this server, forged one in kernel and hold Handss message issues client, and client resends handshake message, when kernel finds the IP address and current record of server When identical, the handshake message that client resends be sent to into User space and go to process.
4. device according to claim 3, it is characterised in that the analytic unit is analyzed need not carry out agency's process When, then the processing unit carries out normal Message processing flow process.
CN201410099474.6A 2014-03-17 2014-03-17 Kernel proxy method and device based on TCP (transmission control protocol) retransmission mechanism Expired - Fee Related CN103825683B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410099474.6A CN103825683B (en) 2014-03-17 2014-03-17 Kernel proxy method and device based on TCP (transmission control protocol) retransmission mechanism

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410099474.6A CN103825683B (en) 2014-03-17 2014-03-17 Kernel proxy method and device based on TCP (transmission control protocol) retransmission mechanism

Publications (2)

Publication Number Publication Date
CN103825683A CN103825683A (en) 2014-05-28
CN103825683B true CN103825683B (en) 2017-05-17

Family

ID=50760537

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410099474.6A Expired - Fee Related CN103825683B (en) 2014-03-17 2014-03-17 Kernel proxy method and device based on TCP (transmission control protocol) retransmission mechanism

Country Status (1)

Country Link
CN (1) CN103825683B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104506490A (en) * 2014-11-27 2015-04-08 北京极科极客科技有限公司 Agent method and device under router kernel
CN106788911A (en) 2015-11-25 2017-05-31 华为技术有限公司 A kind of method and apparatus of message retransmission
CN109842511B (en) * 2017-11-28 2022-07-08 网宿科技股份有限公司 Method and system for determining TCP performance parameters

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7277963B2 (en) * 2002-06-26 2007-10-02 Sandvine Incorporated TCP proxy providing application layer modifications
US7664857B2 (en) * 2007-01-26 2010-02-16 Citrix Systems, Inc. Systems and methods of using an IP ID field for automatic WAN/LAN detection
CN101340322B (en) * 2008-08-29 2010-09-22 陈玲玲 Error prompt method for WEB access
CN101924771B (en) * 2010-08-26 2013-11-06 北京天融信科技有限公司 Core-level TCP adhering junction method for accelerating application proxy
CN103491065B (en) * 2012-06-14 2018-08-14 南京中兴软件有限责任公司 A kind of Transparent Proxy and its implementation

Also Published As

Publication number Publication date
CN103825683A (en) 2014-05-28

Similar Documents

Publication Publication Date Title
US9003053B2 (en) Message acceleration
CN102045772B (en) Data transmission method and device
US20150127853A1 (en) Communication across network address translation
US20130329732A1 (en) Filtering of unsolicited incoming packets to electronic devices
CN103825683B (en) Kernel proxy method and device based on TCP (transmission control protocol) retransmission mechanism
CN102655481A (en) Webpape-based instant messaging chat content looking-up method and system
WO2009045498A1 (en) Thin client discovery
US20060271680A1 (en) Method For Transmitting Window Probe Packets
CN104518968B (en) The method and Transparent proxy server of a kind of Message processing
CN107682125A (en) A kind of data capture method, device, computer equipment and storage medium
CN104283716B (en) Data transmission method, equipment and system
CN107528923A (en) The data transmission method and network adapter of a kind of network adapter
CN111385068B (en) Data transmission method, device, electronic equipment and communication system
CN107566213A (en) A kind of keep-alive detection method and device
CN107040427A (en) A kind of method and device of network card configuration
US10554429B2 (en) Efficient error control techniques for TCP-based multicast networks
CN107786350A (en) A kind of method, apparatus and the network equipment of the configuration of dispatching from the factory for recovering the network equipment
CN104541491B (en) Method for pushing, device and the terminal of Webpage
US10476919B2 (en) System and method for reliable messaging between application sessions across volatile networking conditions
EP2348770A1 (en) Mobile wireless communication terminal and wireless communication method
US10321395B2 (en) Data packet processing method and related device
CN104333515B (en) A kind of SWIFT message processing methods and device
CN101355483A (en) Method and equipment for transmitting data packet by multiple network ports
CN106789878A (en) A kind of file towards large traffic environment also original system and method
CN111225038A (en) Server access method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Kernel proxy method and device based on TCP (transmission control protocol) retransmission mechanism

Effective date of registration: 20180625

Granted publication date: 20170517

Pledgee: Beijing first financing Company limited by guarantee

Pledgor: BEIJING JIKEJIKE TECHNOLOGY CO., LTD.

Registration number: 2018990000486

PE01 Entry into force of the registration of the contract for pledge of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20170517

Termination date: 20210317

CF01 Termination of patent right due to non-payment of annual fee