mirror_iproute2/misc
Phil Sutter dd81ee04ed ifstat, nstat: fix daemon mode
Since the relevant code (and it's bugs) is identical in both files, fix
them in one go. This patch fixes multiple issues:

* Using 'int' for the 'tdiff' variable does not suffice on 64bit
  systems, the assigned initial time difference makes it wrap and
  contain a negative value afterwards. Instead use the more appropriate
  'time_t' type.

* As far as I understood the code, poll() is supposed to time out just
  at the right time to trigger update_db() in the configured interval.
  Therefore it's timeout must be set to the desired interval *minus* the
  time that has already passed since then.

* With the last change to the algorithm in place, it does not make sense
  to call update_db() before returning data to the connected client.
  Actually, it never does otherwise we could skip the periodic updates
  in the first place.

Signed-off-by: Phil Sutter <phil@nwl.cc>
2016-03-06 12:49:05 -08:00
..
.gitignore Add ignore files to make using git easier 2006-08-08 12:04:38 -07:00
arpd.c get rid of unnecessary fgets() buffer size limitation 2015-11-29 11:48:24 -08:00
ifstat.c ifstat, nstat: fix daemon mode 2016-03-06 12:49:05 -08:00
lnstat_util.c lnstat: fix error handling 2015-12-30 17:28:11 -08:00
lnstat.c lnstat: fix header displaying mechanism 2015-11-23 15:54:05 -08:00
lnstat.h iproute2: various header include fixes for compiling with musl libc 2014-05-28 16:51:39 -07:00
Makefile misc/Makefile: use PKG_CONFIG 2015-11-23 15:25:50 -08:00
nstat.c ifstat, nstat: fix daemon mode 2016-03-06 12:49:05 -08:00
rtacct.c ip: make local functions static 2013-02-12 11:38:35 -08:00
ss.c ss: support closing inet sockets via SOCK_DESTROY. 2016-01-18 11:47:03 -08:00
ssfilter.h misc: remove extra blank line 2015-11-23 15:42:34 -08:00
ssfilter.y ss: Allow to specify sport/dport without ':' 2015-03-15 12:11:42 -07:00