Skip to content

Conversation

@wenquan2015
Copy link

@wenquan2015 wenquan2015 commented Dec 26, 2025

Summary

According to RFC793, the flags of TCP reply packet should be as follows:

  1. RST if flags of request packet has ACK
  2. RST|ACK if flags of request packet has no ACK, at the same time, the sequence should be set to zero.

Impact

tcp reset packet

Testing

python test code:
from scapy.all import *

syn_pkt = IP(dst="10.0.1.2")/TCP(
    dport=800,
    flags="S",
    seq= 123456,
    ack= 654321
)

send(syn_pkt, verbose=1)

syn_ack_pkt = IP(dst="10.0.1.2")/TCP(
    dport=800,
    flags="SA",
    seq= 123456,
    ack= 654321
)
send(syn_ack_pkt, verbose=1)

test log:

10:34:17.027825 ARP, Request who-has 10.0.1.2 tell 10.0.1.1, length 28
10:34:17.034566 ARP, Reply 10.0.1.2 is-at 00:e0:de:ad:be:ef, length 28
10:34:17.040816 IP 10.0.1.1.20 > 10.0.1.2.800: Flags [S], seq 123456, win 8192, length 0
10:34:17.044677 IP 10.0.1.2.800 > 10.0.1.1.20: Flags [R.], seq 0, ack 1, win 0, length 0
10:34:17.060826 IP 10.0.1.1.20 > 10.0.1.2.800: Flags [S.], seq 123456, ack 654321, win 8192, length 0
10:34:17.064675 IP 10.0.1.2.800 > 10.0.1.1.20: Flags [R], seq 654321, win 0, length 0
10:34:25.263222 IP 10.0.1.2 > 119.29.29.29: ICMP echo request, id 12, seq 0, length 88
10:34:25.271558 IP 119.29.29.29 > 10.0.1.2: ICMP echo reply, id 12, seq 0, length 88

@wenquan2015 wenquan2015 requested a review from yamt as a code owner December 26, 2025 02:37
@github-actions github-actions bot added Area: Networking Effects networking subsystem Size: S The size of the change in this PR is small labels Dec 26, 2025
@github-actions github-actions bot added the Size: XS The size of the change in this PR is very small label Dec 29, 2025
According to RFC793, the flags of TCP reply packet should be as follows:
1. `RST` if flags of request packet has `ACK`
2. `RST|ACK` if flags of request packet has no `ACK`, at the same time, the sequence should be set to zero.

Signed-off-by: wenquan1 <[email protected]>
@xiaoxiang781216 xiaoxiang781216 merged commit ee50092 into apache:master Dec 30, 2025
50 of 56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Networking Effects networking subsystem Size: S The size of the change in this PR is small Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants