From 2f48dd150e51c3e4c962c0c050ee316d2e25bccb Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 29 Aug 2013 11:16:18 +0200 Subject: ifpps: Don't bug out if interface went down In case the interface ifpps is running on went down, ifpps bugged out because the stats didn't look plausible anymore, due to the IRQ count being reset: ifpps: ifpps.c:563: stats_diff: Assertion `!((new->irqs[i] - old->irqs[i]) > (new->irqs[i]))' failed Fix this by setting the difference to 0 in this case. ifpps will thus display a irqs/t value of 0 instead of bugging out. This fixes #74. Reported-by: Jon Schipp Signed-off-by: Tobias Klauser --- ifpps.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ifpps.c b/ifpps.c index 9d86602..1a67551 100644 --- a/ifpps.c +++ b/ifpps.c @@ -528,8 +528,11 @@ static int stats_wireless(const char *ifname, struct ifstat *stats) if (sizeof(diff->member) != sizeof(new->member) || \ sizeof(diff->member) != sizeof(old->member)) \ bug(); \ - bug_on((new->member - old->member) > (new->member)); \ - DIFF1(member); \ + if ((new->member - old->member) > (new->member)) { \ + diff->member = 0; \ + } else { \ + DIFF1(member); \ + } \ } while (0) static void stats_diff(struct ifstat *old, struct ifstat *new, -- cgit v1.2.3-54-g00ecf