Patent ID: 9313225
Filing Date: 2016-04-12
CPC Classification: H04L

Claim Text:
1. A method for packet processing, comprising: when receiving a first handshake (SYN) packet of connection request from a connection requesting side, establishing a first handshake-acknowledge (SYN-ACK) packet using a defense module of a hardware memory of an electronic device, and responding the connection requesting side by sending the first handshake-acknowledge packet to the connection requesting side; when receiving a first acknowledging (ACK) packet from the connection requesting side, creating a second handshake packet with the same SEQ number and the same ACK number with the first handshake packet, and sending the second handshake packet to a packet processing module of the hardware memory of the electronic device through a transmission control protocol/internet protocol (TCP/IP) protocol stack, wherein the second handshake packet comprises a SEQ number Y of the first handshake-acknowledge packet; the TCP/IP protocol stack receiving a second handshake-acknowledge packet from the packet processing module, and modifying a SEQ number Z of the second handshake-acknowledge packet to the SEQ number Y of the first handshake-acknowledge packet, and sending the modified second handshake-acknowledge packet to the defense module, at the same time storing a difference value R of SEQ numbers, wherein R=Z−Y; when receiving the modified second handshake-acknowledge packet, establishing a second acknowledge packet with an ACK number Y+1 by using the defense module, and sending the second acknowledge packet to the TCP/IP protocol stack; and the TCP/IP protocol stack modifying the ACK number of the second acknowledge packet to Z+1 according to the difference value R of SEQ numbers, and sending the modified second acknowledge packet to the packet processing module, so that handshake between the defense module and the packet processing module succeeds, and connection between the connection requesting side and the packet processing module is created; wherein if the number of first handshake packets to be processed is equal to or smaller than a first predetermined value, the defense module processes new first handshake packets; if the number of the first handshake packets to be processed is larger than the first predetermined value and equal to or smaller than a second predetermined value, the defense module processes unrecorded first handshake packets, wherein the unrecorded first handshake packets is the first handshake packets with no packet information recorded in the defense module; and if the number of the first handshake packets to be processed is larger than the second predetermined value, the defense module does not process the new first handshake packets.