Package: wmnd
Version: 0.4.16-1
Severity: important
Tags: upstream patch
wmnd shows no traffic when 32 bit counter overflows, 'cos sscanf() returns
4294967295 (0x) in that case.
-- System Information:
Debian Release: wheezy/sid
APT prefers oldstable
APT policy: (500, 'oldstable'), (500, 'testing'), (500, 'stable'), (90,
'experimental'), (90, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.39+vc+ipmi+ow+imq (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=ru_RU.CP1251 (charmap=CP1251)
Shell: /bin/sh linked to /bin/bash
Versions of packages wmnd depends on:
ii libc6 2.13-4 Embedded GNU C Library: Shared lib
ii libice6 2:1.0.7-1 X11 Inter-Client Exchange library
ii libsm62:1.2.0-1 X11 Session Management library
ii libx11-6 2:1.4.3-1 X11 client-side library
ii libxext6 2:1.3.0-1 X11 miscellaneous extension librar
ii libxpm4 1:3.5.9-1 X11 pixmap library
wmnd recommends no packages.
wmnd suggests no packages.
-- no debconf information
-- System Information:
Debian Release: wheezy/sid
APT prefers oldstable
APT policy: (500, 'oldstable'), (500, 'testing'), (500, 'stable'), (90,
'experimental'), (90, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.39+vc+ipmi+ow+imq (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=ru_RU.CP1251 (charmap=CP1251)
Shell: /bin/sh linked to /bin/bash
Versions of packages wmnd depends on:
ii libc6 2.13-4 Embedded GNU C Library: Shared lib
ii libice6 2:1.0.7-1 X11 Inter-Client Exchange library
ii libsm62:1.2.0-1 X11 Session Management library
ii libx11-6 2:1.4.3-1 X11 client-side library
ii libxext6 2:1.3.0-1 X11 miscellaneous extension librar
ii libxpm4 1:3.5.9-1 X11 pixmap library
wmnd recommends no packages.
wmnd suggests no packages.
-- no debconf information
>From 555735c28e773b651ed7ee1e803fc0dc7d03b842 Mon Sep 17 00:00:00 2001
From: Vladimir Prodan
Date: Sun, 5 Jun 2011 01:09:14 +0400
Subject: [PATCH 1/3] make byte/packet counters 64 bit
wmnd shows no traffic when 32 bit counter overflows, sscanf() return
4294967295 (0x) in that case. Simple test:
int main()
{
const char *str = "4294967296 4299967296";
{
unsigned long ib1, ib2;
sscanf(str, "%lu %lu", &ib1, &ib2);
printf("%lu %lu\n", ib1, ib2);
printf("%lu\n", ib2-ib1);
}
{
unsigned long long ib1, ib2;
sscanf(str, "%llu %llu", &ib1, &ib2);
printf("%llu %llu\n", ib1, ib2);
printf("%llu\n", ib2-ib1);
}
return 0;
}
Output:
4294967295 4294967295
0
4294967296 4299967296
500
---
configure.ac |2 +-
src/display.c | 22 +++---
src/display.h |2 +-
src/drivers.c | 54 --
src/drivers.h |4 ++--
src/wmnd.c| 52 ++--
src/wmnd.h| 26 +-
7 files changed, 82 insertions(+), 80 deletions(-)
diff --git a/configure.ac b/configure.ac
index c338cec..5b9b984 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,7 +29,7 @@ AC_SEARCH_LIBS(sin, m,, [AC_MSG_ERROR(math library is required)])
# X libraries
AC_PATH_XTRA
-CFLAGS="$CFLAGS $X_CFLAGS"
+CFLAGS="-W -Wall $CFLAGS $X_CFLAGS"
LDFLAGS="$LDFLAGS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS"
# check for XPM headers, libraries
diff --git a/src/display.c b/src/display.c
index 644a4a1..88c980f 100644
--- a/src/display.c
+++ b/src/display.c
@@ -72,7 +72,7 @@ trunc_normal(unsigned size, unsigned* rx, unsigned* tx)
#ifdef USE_DRW_TRADITIONAL
/* Traditional mode */
void
-drwTraditional(unsigned long* hist, unsigned mIn, unsigned mOut,
+drwTraditional(unsigned long long* hist, unsigned mIn, unsigned mOut,
unsigned size, unsigned long long rx_max, unsigned long long tx_max)
{
unsigned int k, txlev, rxlev, nolev;
@@ -98,7 +98,7 @@ drwTraditional(unsigned long* hist, unsigned mIn, unsigned mOut,
#ifdef USE_DRW_MGRAPH
/* MGraph mode */
void
-drwMGraph(unsigned long* hist, unsigned mIn, unsigned mOut,
+drwMGraph(unsigned long long* hist, unsigned mIn, unsigned mOut,
unsigned size, unsigned long long rx_max, unsigned long long tx_max)
{
/* max scale */
@@ -140,7 +140,7 @@ drwMGraph(unsigned long* hist, unsigned mIn, unsigned mOut,
#ifdef USE_DRW_WAVEFORM
/* Waveform mode */
void
-drwWaveform(unsigned long* hist, unsigned mIn, unsigned mOut,
+drwWaveform(unsigned long long* hist, unsigned mIn, unsigned mOut,
unsigned size, unsigned long long rx_max, unsigned long long tx_max)
{
unsigned int k, txlev,