summaryrefslogtreecommitdiff
path: root/ifpps.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2013-08-29 11:16:18 +0200
committerTobias Klauser <tklauser@distanz.ch>2013-08-29 11:23:02 +0200
commit2f48dd150e51c3e4c962c0c050ee316d2e25bccb (patch)
tree87a73e692c57faf93013b498b38d803bf4419bbd /ifpps.c
parent01443208f148701af9bf6cd40249dbe3028f9272 (diff)
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 <jonschipp@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'ifpps.c')
-rw-r--r--ifpps.c7
1 files 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,