diff --git a/scapy/layers/inet.py b/scapy/layers/inet.py index 7d07e67d7f70548591f27b4a3d839367bb0d2b1d..b1c04232d30668b211c8aea08fb109bc4c9861c6 100644 --- a/scapy/layers/inet.py +++ b/scapy/layers/inet.py @@ -525,7 +525,12 @@ class TCP(Packet): if not ((self.sport == other.dport) and (self.dport == other.sport)): return 0 - if (abs(other.seq-self.ack) > 2+len(other.payload)): + if abs(other.ack - self.seq) > 2: + return 0 + # Do not check ack value for RST packets when ack is 0 + if self.flags.R and not self.ack: + return 1 + if abs(other.seq - self.ack) > 2 + len(other.payload): return 0 return 1 def mysummary(self):