Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Jul 2008 05:26:48 GMT
From:      Victor Hugo Bilouro <bilouro@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 145458 for review
Message-ID:  <200807190526.m6J5QmZd025618@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=145458

Change 145458 by bilouro@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?
     """



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807190526.m6J5QmZd025618>