[flow-tools] patch for support.c

Mark Fullmer maf@eng.oar.net
Wed, 26 Sep 2001 22:53:07 -0400


Thanks.  I've had a few core dumps that pointed 
to the index going negative, never had a chance
to track it down.

mark

On Tue, Sep 25, 2001 at 10:00:34AM -0500, Paul Lustgraaf wrote:
> I just recently upgraded from version 0.32 to version 0.55.
> I've been plagued by segmentation faults in flow-stats since.
> Anyway, I traced them down and it appears to be coming from routine
> sort_64uint64 in support.c.
> 
> I seem to have fixed it by the following change:
> 
> diff support.c.old support.c
> 342,343c342,343
> <         while (a[index[++i]] < v);
> <         while (a[index[--j]] > v);
> ---
> >         while ((a[index[++i]] < v) & (i < r));
> >         while ((a[index[--j]] > v) & (j > 0));
> 
> I think the j>0 test is the critical one.  The i<r test is an
> optimization I learned somewhere, perhaps Knuth's book on sorting.
> 
> I really appreciate the simplicity of flow-tools.  It has avoided the
> creeping featuritis of some of the other Netflow tools.  It enables
> an old Fortran hack like me to understand what it is doing.
> 
> 
> Paul Lustgraaf                   "Change is inevitable.  Progress is not."
> Manager of Network Services
> Iowa State University Academic Information Technologies   grpjl@iastate.edu
> Ames, IA  50011                                           515-294-0324
> 
> _______________________________________________
> flow-tools@splintered.net
> http://www.splintered.net/sw/flow-tools