# US 2021/0067534 A1 · Counting syn packets

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0067534 A1
- Document ID: US20210067534A1
- Status: Published application
- Kind: A1
- Application number: 17/005,792
- Filed: 2020-08-28
- Published: 2021-03-04
- Earliest claimed: 2019-08-30
- Assignees: Hangzhou DPtech Technologies Co., Ltd.
- Applicants: Hangzhou DPtech Technologies Co., Ltd.
- Inventors: Yan MI; Zhe WANG
- Web page: https://patentgrep.com/patent/US20210067534A1

## CPC

- H04L 63/1425: {Traffic logging, e.g. anomaly detection}
- G06F 11/0709: {in a distributed system consisting of a plurality of standalone computer nodes, e.g. clusters, client-server systems}
- G06F 11/076: {by exceeding a count or rate limit, e.g. word- or bit count limit}
- H04L 45/74: Address processing for routing
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Methods for counting synchronization (SYN) packets to identify a SYN attack, applicable to network device, are provided. The network device includes a field programmable gate array (FPGA) for counting the total number of received SYN packets and a high-speed hardware memory connected to the FPGA. One of the methods includes: periodically traversing the count entries stored in the high-speed hardware memory, and aging any count entry for which a time difference between a current time and a creation time reaches a preset aging time interval; obtaining a first number of SYN packets and a second number of SYN packets; and updating the total number of the received SYN packets with a sum of the first number of SYN packets and the second number of SYN packets.

## Claims

### Claim 1

A method of counting synchronization (SYN) packets to identify a SYN attack, which is applicable to a network device,
wherein the network device comprises a field programmable gate array (FPGA) for counting a total number of received SYN packets and a high-speed hardware memory connected to the FPGA; and
the high-speed hardware memory is stored with a plurality of count entries corresponding to respective source internet protocol (IP) addresses in the received SYN packets, each of the count entries comprising a creation time when the count entry is created, a source IP address corresponding to the count entry, and a cumulative number of a part of the received SYN packets corresponding to the source IP address,
the method comprising:
periodically traversing the count entries stored in the high-speed hardware memory, and aging any one of the traversed count entries for which a time difference between a current time and the creation time reaches a preset aging time interval;
obtaining a first number of SYN packets by cumulating the cumulative number in each of one or more of the count entries which is traversed in a current traversal period and for which the time difference between the current time and the creation time does not reach the preset aging time interval, and obtaining a second number of SYN packets by cumulating a value added to the cumulative number in each of the count entries during and after traversing the count entries in the current traversal period; and
updating the total number of the received SYN packets counted by the FPGA with a sum of the first number of SYN packets and the second number of SYN packets.

### Claim 2 (depends on 1)

The method of claim 1, wherein obtaining the first number of SYN packets comprises:
for each of the traversed count entries, determining whether the time difference between the current time and the creation time in the count entry reaches the preset aging time interval and, in response to the time difference between the current time and the creation time in the count entry not reaching the preset aging time interval, recording the cumulative number in the count entry; and
obtaining the first number of SYN packets by accumulating the recorded cumulative number.

### Claim 3 (depends on 1)

The method of claim 1, wherein
the high-speed hardware memory is divided in advance into a plurality of storage address units respectively corresponding to the plurality of count entries;
a first error correction counter is preset in the network device; and
obtaining the second number of SYN packets comprises:
determining whether a first serial number of a storage address of a target count entry corresponding to the source IP address in each SYN packet to be written into the high-speed hardware memory in the current traversal period is less than or equal to a second serial number of a storage address of a count entry currently being traversed and, in response to the first serial number being less than or equal to the second serial number, updating the cumulative number in the target count entry and incrementing a first count result in the preset first error correction counter, wherein the current traversal period starts when the FPGA sends a first storage address read command to the high-speed hardware memory and ends when the FPGA receives a last storage address readback result from the high-speed hardware memory; and
upon the current traversal period ending, reading the first count result in the first error correction counter as the second number of SYN packets.

### Claim 4 (depends on 1)

The method of claim 1, wherein
the high-speed hardware memory is divided in advance into a plurality of storage address units respectively corresponding to the plurality of count entries;
a second error correction counter is preset in the network device; and
obtaining the second number of SYN packets comprises:
determining whether a first serial number of a storage address of a target count entry corresponding to the source IP address of each SYN packet to be written into the high-speed hardware memory in the current traversal period is less than a second serial number of a storage address of a count entry next to a count entry currently being traversed and, in response to the first serial number being less than the second serial number, updating the cumulative number in the target count entry and incrementing a second count result in the preset second error correction counter, wherein the current traversal period starts when the FPGA sends a first storage address read command to the high-speed hardware memory and ends when the FPGA receives a last storage address readback result from the high-speed hardware memory; and
upon the current traversal period ending, reading the second count result in the second error correction counter as the second number of SYN packets.

### Claim 5 (depends on 4)

The method of claim 4, wherein a third error correction counter is preset in the network device,
the method further comprising:
during a process of traversing a last storage address unit in the current traversal period, incrementing a third count result in the preset third error correction counter whenever a SYN packet is written into the high-speed hardware memory; and
upon the current traversal period ending, obtaining a sum of the second count result in the second error correction counter and the third count result in the third error correction counter as the second number of SYN packets.

### Claim 6 (depends on 5)

The method of claim 5, wherein the process of traversing the last storage address unit starts when the FPGA sends a last storage address read command to the high-speed hardware memory and ends when the FPGA receives a last storage address readback result from the high-speed hardware memory.

### Claim 7

A network device for counting SYN packets to identify a SYN attack, comprising:
an FPGA for counting a total number of received SYN packets; and
a high-speed hardware memory connected to the FPGA,
wherein the high-speed hardware memory is stored with a plurality of count entries corresponding to respective source IP addresses in the received SYN packets, each of the count entries comprising a creation time when the count entry is created, a source IP address corresponding to the count entry, and a cumulative number of a part of the received SYN packets corresponding to the source IP address; and
the FPGA is configured to perform operations comprising:
periodically traversing the count entries stored in the high-speed hardware memory, and aging any one of the traversed count entries for which a time difference between a current time and the creation time reaches a preset aging time interval;
obtaining a first number of SYN packets by cumulating the cumulative number in each of one or more of the count entries which is traversed in a current traversal period and for which the time difference between the current time and the creation time does not reach the preset aging time interval, and obtaining a second number of SYN packets by cumulating a value added to the cumulative number in each of the count entries during and after traversing the count entries in the current traversal period; and
updating the total number of the received SYN packets counted by the FPGA with a sum of the first number of SYN packets and the second number of SYN packets.

### Claim 8 (depends on 7)

The network device of claim 7, wherein obtaining the first number of SYN packets comprises:
for each of the traversed count entries, determining whether the time difference between the current time and the creation time in the count entry reaches the preset aging time interval and, in response to the time difference between the current time and the creation time in the count entry not reaching the preset aging time interval, recording the cumulative number in the count entry; and
obtaining the first number of SYN packets by accumulating the recorded cumulative number.

### Claim 9 (depends on 7)

The network device of claim 7, wherein
the high-speed hardware memory is divided in advance into a plurality of storage address units respectively corresponding to the plurality of count entries;
a first error correction counter is preset in the network device; and
obtaining the second number of SYN packets comprises:
determining whether a first serial number of a storage address of a target count entry corresponding to the source IP address in each SYN packet to be written into the high-speed hardware memory in the current traversal period is less than or equal to a second serial number of a storage address of a count entry currently being traversed and, in response to the first serial number being less than or equal to the second serial number, updating the cumulative number in the target count entry and incrementing a first count result in the preset first error correction counter, wherein the current traversal period starts when the FPGA sends a first storage address read command to the high-speed hardware memory and ends when the FPGA receives a last storage address readback result from the high-speed hardware memory; and
upon the current traversal period ending, reading the first count result in the first error correction counter as the second number of SYN packets.

### Claim 10 (depends on 7)

The network device of claim 7, wherein
the high-speed hardware memory is divided in advance into a plurality of storage address units respectively corresponding to the plurality of count entries;
a second error correction counter is preset in the network device; and
obtaining the second number of SYN packets comprises:
determining whether a first serial number of a storage address of a target count entry corresponding to the source IP address in each SYN packet to be written into the high-speed hardware memory in the current traversal period is less than a second serial number of a storage address of a count entry next to a count entry currently being traversed and, in response to the first serial number being less than the second serial number, updating the cumulative number in the target count entry and incrementing a second count result in the preset second error correction counter, wherein the current traversal period starts when the FPGA sends a first storage address read command to the high-speed hardware memory and ends when the FPGA receives a last storage address readback result from the high-speed hardware memory; and
upon the current traversal period ending, reading the second count result in the second error correction counter as the second number of SYN packets.

### Claim 11 (depends on 10)

The network device of claim 10, wherein a third error correction counter is preset in the network device,
the operations further comprising:
during a process of traversing a last storage address unit in the current traversal period, incrementing a third count result in the preset third error correction counter whenever a SYN packet is written into the high-speed hardware memory; and
upon the current traversal period ending, obtaining a sum of the second count result in the second error correction counter and the third count result in the third error correction counter as the second number of SYN packets.

### Claim 12 (depends on 11)

The network device of claim 11, wherein the process of traversing the last storage address unit starts when the FPGA sends a last storage address read command to the high-speed hardware memory and ends when the FPGA receives a last storage address readback result from the high-speed hardware memory.
