<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[wolfSSL - Embedded SSL Library — Question about sniffer application TCP reconstruction - AdjustSequence]]></title>
		<link>https://www.wolfssl.com/forums/topic119-question-about-sniffer-application-tcp-reconstruction-adjustsequence.html</link>
		<atom:link href="https://www.wolfssl.com/forums/feed-rss-topic119.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Question about sniffer application TCP reconstruction - AdjustSequence.]]></description>
		<lastBuildDate>Thu, 02 Jun 2011 19:46:37 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Question about sniffer application TCP reconstruction - AdjustSequence]]></title>
			<link>https://www.wolfssl.com/forums/post260.html#p260</link>
			<description><![CDATA[<p>SheldonC,</p><p>Correct, <strong>sslFrame</strong> points to the current frame to process, whereas <strong>sslBytes</strong> is the data we haven&#039;t processed yet.</p><div class="codebox"><pre><code>if (newEnd &gt; reassemblyList-&gt;begin) {
    Trace(OVERLAP_REASSEMBLY_BEGIN_STR);
                    
        /* remove bytes already on reassembly list */
        *sslBytes -= newEnd - reassemblyList-&gt;begin;
}</code></pre></div><p>To address the section you had in bold, shown above, newEnd is equal to the sequence number we expect plus the SSL bytes we need to consume. We check to see if newEnd is past the beginning of our first reassemblyList item.&nbsp; If so, we might have frames that will be processed twice, so we want to remove those duplicates from being processed again (in sslBytes).</p><p><strong>reassemblyList-&gt;end</strong> is not the same as <strong>*expected</strong> - they differ in purpose. The reassemblyList (a linked-list of pointers) caches packets which are out of order and can&#039;t be processed yet. reassemblyList-&gt;end is the end of the first item in the list, where *expected is the next sequence number we need to process.</p><div class="codebox"><pre><code>if (newEnd &gt; reassemblyList-&gt;end) {
    Trace(OVERLAP_REASSEMBLY_END_STR);
                    
    /* may be past reassembly list end (could have more on list)
       so try to add what&#039;s past the front-&gt;end */
    AddToReassembly(session-&gt;flags.side, reassemblyList-&gt;end +1,
        *sslFrame + reassemblyList-&gt;end - *expected + 1,
        newEnd - reassemblyList-&gt;end, session, error);
}</code></pre></div><p>In the next block of code, shown above, we test whether newEnd is greater than the end of the first item in our reassemblyList. If it is, we may need to add that data into the reassemblyList (if it is not already there). This is done by the AddToReassembly function.</p><p>Does this help clear things up?</p><p>- Chris</p>]]></description>
			<author><![CDATA[null@example.com (chrisc)]]></author>
			<pubDate>Thu, 02 Jun 2011 19:46:37 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post260.html#p260</guid>
		</item>
		<item>
			<title><![CDATA[Question about sniffer application TCP reconstruction - AdjustSequence]]></title>
			<link>https://www.wolfssl.com/forums/post257.html#p257</link>
			<description><![CDATA[<p>hey all,<br />I&#039;ve been working with the sniffer application, and the following line baffles me:<br />(sniffer.c, AdjustSequence function):<br />~line 2090:<br /></p><div class="codebox"><pre><code>static int AdjustSequence(...)


if(real &lt; *expected){
    int overlap = *expected - real;
    *sslFrame += overlap;
    *sslBytes -= overlap;
}

if(reassemblyList) {
    word32 newEnd = *expected + *sslBytes*
  [b] if(newEnd &gt; reassemblyList-&gt;begin){

        /* remove bytes already on reassembly list */
        *sslBytes -= newEnd - reassemblyList-&gt;begin;
    }[/b]</code></pre></div><p>to my understanding, after performing the overlap shifting in the beginning of the function, the sslFrame pointer points exactly to where NEW data begins and the sslBytes holds the number of NEW bytes (that is, the number of bytes in the packet which were not previously handled).<br />I am not sure to we have to perform the part in BOLD. it says, to what i understand - check whether the newly arrived packet ENDS after the last treated data BEGINS. </p><p>I think I lack the understanding to why reassemblyList-&gt;end is not exactly like *expected...</p><p>thanks in advance,</p><p>SheldonC</p>]]></description>
			<author><![CDATA[null@example.com (SheldonCooper)]]></author>
			<pubDate>Wed, 01 Jun 2011 09:05:19 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post257.html#p257</guid>
		</item>
	</channel>
</rss>
