[flow-tools] Repost of flowtools 0.63 core dump in ftstat.c
Mark Fullmer
maf@eng.oar.net
Thu, 30 Jan 2003 20:37:42 -0500
I assume this is because you fed flow-report 0 flows?
The fix is trivial, STD_CALC needs to look like
#define STD_CALC\
if (rpt->t_recs) {\
rpt->avg_pps /= (double)rpt->t_recs;\
rpt->avg_bps /= (double)rpt->t_recs;\
}\
There are a few other places where this could happen, will be fixed in 0.64.
mark
On Thu, Jan 30, 2003 at 01:14:09PM -0500, S Dawalt wrote:
>
> I got this while running flow-report. It's a divide-by-zero in ftstat.c.
> The STD_CALC macro is dividing by zero because rpt->t_recs is zero. The
> divide-by-zero patches noted in a December 3 posting are already applied
> to the 0.63 distribution I have. Below is GDB output with a print of the
> rpt struct.
>
> Thanks.
>
> ----------------------- snip ------------------------
>
> GNU gdb 5.2.1
> Copyright 2002 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB. Type "show warranty" for details.
> This GDB was configured as "alphaev56-dec-osf4.0e"...
> Core was generated by `flow-report'.
> Program terminated with signal 8, Arithmetic exception.
> Reading symbols from /usr/shlib/libc.so...done.
> Loaded symbols for /usr/shlib/libc.so
> #0 0x12001fef8 in ftstat_rpt_1_calc (rpt=0x14000e800) at ftstat.c:4876
>
> 4876 STD_CALC;
> (gdb) bt
> #0 0x12001fef8 in ftstat_rpt_1_calc (rpt=0x14000e800) at ftstat.c:4876
> #1 0x12001a05c in ftstat_def_calc (active_def=0x140011060) at ftstat.c:3150
> #2 0x12000ec90 in main (argc=5, argv=0x11ffff188) at flow-report.c:184
> (gdb) print *rpt
> $1 = {chain = {sle_next = 0x0}, outs = {stqh_first = 0x14000e140,
> stqh_last = 0x14000e140}, out = 0x0, format = FT_STAT_FMT_ASCII,
> name = 0x14000e100 "t1", format_name = 0x140003a78 "summary-detail",
> scale = 0, tag_mask_src = 0, tag_mask_dst = 0, options = 0,
> allowed_options = 255, allowed_fields = 16384, all_fields = 16384,
> ftfd = 0x0, xfields = 483, data = 0x14000db60,
> f_new = 0x12001e870 <ftstat_rpt_1_new>,
> f_accum = 0x12001e908 <ftstat_rpt_1_accum>,
> f_calc = 0x12001fe5c <ftstat_rpt_1_calc>,
> f_free = 0x120024d0c <ftstat_rpt_1_free>,
> f_dump = 0x120020374 <ftstat_rpt_1_dump>, t_ignores = 0, t_recs = 0,
> t_flows = 33498, t_octets = 317670881, t_packets = 1646469,
> t_duration = 156056728, t_count = 0, avg_pps = 0, min_pps = 0, max_pps = 0,
> avg_bps = 0, min_bps = 0, max_bps = 0, time_start = 1042835359,
> time_end = 1042865978, recs = 0, idx = 0}
> (gdb)
>
>
> Shane A. Dawalt
> ********************************************
> Network Engineer
> Wright State University
> Dayton, OH 45435 USA
> Phone: 937-775-4089
> Email: shane.dawalt@wright.edu
>
>
>
> _______________________________________________
> flow-tools@splintered.net
> http://www.splintered.net/sw/flow-tools