<div>Jimmy,</div>
<div>&nbsp;</div>
<div>your suggestion sounds good. I implemented the changes and tested them with my ssl analyzer. Everything worked as expected. :-)</div>
<div>&nbsp;</div>
<div>Attached you can find the patch for these changes (to be applied with -p0 in the bro directory, after applying all of the other binpac patches that I provided before). Could you test this further with whatever binpac analyzers you have got?
</div>
<div>&nbsp;</div>
<div>Anyone else any comments on this issue (Ruoming)?</div>
<div>&nbsp;</div>
<div>Tobias<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 5/30/07, <b class="gmail_sendername"><a href="mailto:jmzhou.ml@gmail.com">jmzhou.ml@gmail.com</a></b> &lt;<a href="mailto:jmzhou.ml@gmail.com">jmzhou.ml@gmail.com</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">On Tue, 29 May 2007, Tobias Kiesling wrote:<br><br>&gt; On 5/29/07, <a href="mailto:jmzhou.ml@gmail.com">jmzhou.ml@gmail.com
</a> &lt;<a href="mailto:jmzhou.ml@gmail.com">jmzhou.ml@gmail.com</a>&gt; wrote:<br>&gt;<br>&gt;&gt; Patch 6: I think there is another issue here: if some buffering request<br>&gt;&gt; has been sent to the flow buffer, and the flow buffer is not ready with
<br>&gt;&gt; partial data, we will end up with entering the loop - a waste of CPU<br>&gt;&gt; cycles.<br>&gt;<br>&gt;<br>&gt; Maybe you are right, but what would you suggest as change? Do you want to<br>&gt; check whether the buffer is ready before entering the loop? But then it has
<br>&gt; to be ensured that the buffer is properly initialized in any case.&nbsp;&nbsp;At the<br>&gt; moment I cannot see all the consequences of such a change. And do you think<br>&gt; that the impact on performance is really relevant?
<br><br>The cost can be a little bit expensive if there are many layers of parsing.<br>You end up with many unnecessary calls to parsing functions and condition<br>jumps. One possible approach is like this:<br><br>. add a new boolean member have_pending_request to FlowBuffer, initialized
<br>as false.<br><br>. set have_pending_request to true in call NewFrame and NewLine.<br><br>. reset have_pending_request to false in call DiscardData.<br><br>. change the while loop condition to:<br>&nbsp;&nbsp;&nbsp;&nbsp;while (flow_buffer-&gt;data_available() &amp;&amp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(!flow_buffer-&gt;have_pending_request() || flow_buffer-&gt;ready()))<br><br>Analysis:<br><br>&nbsp;&nbsp;1. The first time, data_available = true, !have_pending_request = true,<br>we enter into the loop. Good.<br><br>&nbsp;&nbsp;2. All data are consumed, data_available = false, we do not enter into
<br>the loop. Good.<br><br>&nbsp;&nbsp;3. A request is not satisfied because of partial data: data_available =<br>true, !have_pending_request = false, ready = false, we do not enter into<br>the loop. Good.<br><br>&nbsp;&nbsp;4. Parsing is forced to stop because of exception. data_available = false.
<br>We do not enter into the loop. Good.<br><br>&nbsp;&nbsp;5. Parsing current dataunit has finished, we still have residual data -<br>wrong data? data_available = true, !have_pending_request = false, ready =<br>true (from last parsing). We enter into the loop, and start a new round of
<br>parsing. As expected. Good.<br><br>So far so good. :-)<br><br>Jimmy<br><br>____________________________________________________________<br>The future is not set.&nbsp;&nbsp;There is no fate but what we make<br>for ourselves.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Terminator II, Judgment Day
<br>------------------------------------------------------------<br><br></blockquote></div><br>