PERFORCE change 145458 for review
Victor Hugo Bilouro
bilouro at FreeBSD.org
Sat Jul 19 05:26:49 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=145458
Change 145458 by bilouro at bilouro_tcptest on 2008/07/19 05:26:02
Adding assertReset method. (open)
Affected files ...
.. //depot/projects/soc2008/bilouro_tcptest/src/scripts/tests/tcptest.py#3 edit
Differences ...
==== //depot/projects/soc2008/bilouro_tcptest/src/scripts/tests/tcptest.py#3 (text+ko) ====
@@ -83,6 +83,34 @@
assertExpectedSequence(self, tcb, tcp, from_, to)
+def assertReset(self, tcb, tcp, from_, to):
+ """
+ RFC 793 - Section 3.4 Establishing a Connection
+ Page 36
+
+ If the incoming segment has an ACK field, the reset takes its
+ sequence number from the ACK field of the segment, otherwise the
+ reset has sequence number zero and the ACK field is set to the sum
+ of the sequence number and segment length of the incoming segment.
+ The connection remains in the CLOSED state.
+ """
+ #it must be a reset
+ self.failIf(tcp.rst <1, 'rst bit must be set')
+
+ #"*If* the incoming segment has..."
+ if (tcb.sequence[ to ] == Null or tcb.tcpsequence[ to ] <= 0):
+ #the only moment a segment has no ack is at syn where
+ #we don't know the receiver sequence, in other words, we only get the
+ #receiver sequence number at the first segment received back(syn+ack of
+ #3way handshake)
+ #Assuming that "incoming segment" has *NO* ACK Field we need assert that:
+ #(1)has sequence number zero
+ #(2)ACK field set to the sum of the sequence number and segment length
+
+ else: #(tcb.sequence[ to ] > 0):
+ #Assuming that "incoming segment" has ACK Field we need assert that:
+ #(1)sequence number set to the ACK sent
+
def assertFin(self, tcp):
"""is fin flag on?
"""
More information about the p4-projects
mailing list