diff options
author | rstone <rstone@FreeBSD.org> | 2015-03-01 04:36:20 +0000 |
---|---|---|
committer | rstone <rstone@FreeBSD.org> | 2015-03-01 04:36:20 +0000 |
commit | 6d2b81bc2b6be4fb624d6c4c6ed85a8ec8c54409 (patch) | |
tree | 2279cce5127acad27ad30b80dd09913663ced4da /usr.bin | |
parent | 4d618165980908f03fe4c50ead4e8e37ec6aa0b2 (diff) | |
download | FreeBSD-src-6d2b81bc2b6be4fb624d6c4c6ed85a8ec8c54409.zip FreeBSD-src-6d2b81bc2b6be4fb624d6c4c6ed85a8ec8c54409.tar.gz |
MFC r272284
Fix integer truncation in affecting systat -ifstat
The "systat -ifstat" command was using a u_int to store byte counters.
With a 10Gbps or faster interface, this overflows within the default
5 second refresh period. Switch to using a uint64_t across the board,
which matches the size used for all counters as of r263102.
PR: 182448
MFC after: 1 week
Sponsored by: Sandvine Inc
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/systat/ifstat.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/usr.bin/systat/ifstat.c b/usr.bin/systat/ifstat.c index 1632890..56b8422 100644 --- a/usr.bin/systat/ifstat.c +++ b/usr.bin/systat/ifstat.c @@ -68,14 +68,14 @@ struct if_stat { struct ifmibdata if_mib; struct timeval tv; struct timeval tv_lastchanged; - u_long if_in_curtraffic; - u_long if_out_curtraffic; - u_long if_in_traffic_peak; - u_long if_out_traffic_peak; - u_long if_in_curpps; - u_long if_out_curpps; - u_long if_in_pps_peak; - u_long if_out_pps_peak; + uint64_t if_in_curtraffic; + uint64_t if_out_curtraffic; + uint64_t if_in_traffic_peak; + uint64_t if_out_traffic_peak; + uint64_t if_in_curpps; + uint64_t if_out_curpps; + uint64_t if_in_pps_peak; + uint64_t if_out_pps_peak; u_int if_row; /* Index into ifmib sysctl */ u_int if_ypos; /* 0 if not being displayed */ u_int display; @@ -263,8 +263,8 @@ fetchifstat(void) struct if_stat *ifp = NULL; struct timeval tv, new_tv, old_tv; double elapsed = 0.0; - u_int new_inb, new_outb, old_inb, old_outb = 0; - u_int new_inp, new_outp, old_inp, old_outp = 0; + uint64_t new_inb, new_outb, old_inb, old_outb = 0; + uint64_t new_inp, new_outp, old_inp, old_outp = 0; SLIST_FOREACH(ifp, &curlist, link) { /* |