recv SYN after FIN or RST is considered to be TCP port reuse

This commit is contained in:
luwenpeng
2024-05-17 17:38:08 +08:00
parent 32ae4618ef
commit c22e4e5955
5 changed files with 36 additions and 19 deletions

View File

@@ -243,7 +243,7 @@ int build_tcp_packet(const struct packet *first, uint16_t ip_id, uint8_t ip_ttl,
switch (curr->type)
{
case LAYER_TYPE_TCP:
trim = curr->hdr_len + curr->pld_len - sizeof(struct tcphdr) + pld_len;
trim = curr->hdr_len + curr->pld_len - sizeof(struct tcphdr) - pld_len;
if (len - trim > buff_size)
{
return -ENOMEM;
@@ -330,7 +330,7 @@ int build_udp_packet(const struct packet *first, const char *udp_pld, int pld_le
switch (curr->type)
{
case LAYER_TYPE_UDP:
trim = curr->hdr_len + curr->pld_len - sizeof(struct udphdr) + pld_len;
trim = curr->hdr_len + curr->pld_len - sizeof(struct udphdr) - pld_len;
if (len - trim > buff_size)
{
return -ENOMEM;