summaryrefslogtreecommitdiff
path: root/openwrt/package/rrdcollect
diff options
context:
space:
mode:
authorOliver Ertl <oliver@ertl-net.net>2006-01-22 11:44:35 +0000
committerOliver Ertl <oliver@ertl-net.net>2006-01-22 11:44:35 +0000
commitcdde6b3d42357cb6c675bdb12e836648be335048 (patch)
treea2f7d5602285f5974ce3f32a857b8aa365988561 /openwrt/package/rrdcollect
parent76c0ef53e43bbeb0a4419e3d0bffcb24af813a50 (diff)
downloadmtk-20170518-cdde6b3d42357cb6c675bdb12e836648be335048.zip
mtk-20170518-cdde6b3d42357cb6c675bdb12e836648be335048.tar.gz
mtk-20170518-cdde6b3d42357cb6c675bdb12e836648be335048.tar.bz2
fix rrdcollect bug (closes #220)
SVN-Revision: 3033
Diffstat (limited to 'openwrt/package/rrdcollect')
-rw-r--r--openwrt/package/rrdcollect/files/rrdcollect.conf12
-rw-r--r--openwrt/package/rrdcollect/patches/rrdcollect-scan.patch66
2 files changed, 72 insertions, 6 deletions
diff --git a/openwrt/package/rrdcollect/files/rrdcollect.conf b/openwrt/package/rrdcollect/files/rrdcollect.conf
index 1b37454..e34c9bf 100644
--- a/openwrt/package/rrdcollect/files/rrdcollect.conf
+++ b/openwrt/package/rrdcollect/files/rrdcollect.conf
@@ -19,15 +19,15 @@ exec:///bin/df
# LAN: vlan0, WAN: vlan1, WIFI: eth1
file:///proc/net/dev
-"vlan0: %d %d %*d %*d %*d %*d %*d %*d %d %d" IF.rrd:Labi,Lapi,Labo,Lapo
-"vlan1: %d %d %*d %*d %*d %*d %*d %*d %d %d" IF.rrd:Wabi,Wapi,Wabo,Wapo
-"eth1: %d %d %*d %*d %*d %*d %*d %*d %d %d" IF.rrd:Wibi,Wipi,Wibo,Wipo
-#"tun0: %d %d %*d %*d %*d %*d %*d %*d %d %d" IF.rrd:tbi,tpi,tbo,tpo
+" vlan0:%d %d %*d %*d %*d %*d %*d %*d %d %d" IF.rrd:Labi,Lapi,Labo,Lapo
+" vlan1:%d %d %*d %*d %*d %*d %*d %*d %d %d" IF.rrd:Wabi,Wapi,Wabo,Wapo
+" eth1:%d %d %*d %*d %*d %*d %*d %*d %d %d" IF.rrd:Wibi,Wipi,Wibo,Wipo
+#" tun0:%d %d %*d %*d %*d %*d %*d %*d %d %d" IF.rrd:tbi,tpi,tbo,tpo
file:///proc/slabinfo
"ip_conntrack %d %*d %*d %*d %*d %*d" SYS.rrd:con
"arp_cache %d %*d %*d %*d %*d %*d" SYS.rrd:arp
file:///proc/interrupts
-"4: %d MIPS eth1" SYS.rrd:irw
-"5: %d MIPS eth0" SYS.rrd:ire
+" 4: %d MIPS eth1" SYS.rrd:irw
+" 5: %d MIPS eth0" SYS.rrd:ire
diff --git a/openwrt/package/rrdcollect/patches/rrdcollect-scan.patch b/openwrt/package/rrdcollect/patches/rrdcollect-scan.patch
new file mode 100644
index 0000000..f47301e
--- /dev/null
+++ b/openwrt/package/rrdcollect/patches/rrdcollect-scan.patch
@@ -0,0 +1,66 @@
+diff -ruN rrdcollect-0.2.3.orig/src/scan.c rrdcollect-0.2.3/src/scan.c
+--- rrdcollect-0.2.3.orig/src/scan.c 2005-01-20 18:42:17.000000000 +0100
++++ rrdcollect-0.2.3/src/scan.c 2006-01-22 00:51:52.000000000 +0100
+@@ -74,6 +74,11 @@
+ } while (isdigit(*fmt));
+ }
+
++ /* skip white spaces like scanf does */
++ if (strchr("difuoxX", *fmt))
++ while (isspace(*buf))
++ buf++;
++
+ /* FIXME: we should check afterward:
+ * if (start == buf || start == '-' && buf-start == 1)
+ * die("WTF??? zero-length number???");
+@@ -150,27 +155,22 @@
+ buf++, length--;
+ }
+
+- /* ignore if value not found */
+- if(value == 0)
+- return 0;
+-
+ if (!ignore)
+- counter[i++]->value = valuedup(value);
++ counter[i++]->value = strndup(start, buf - start);
+ break;
+
+ case 'c':
++ if (length < 0)
++ length = 1; // default length is 1
++
+ while (*buf && length > 0) {
+ buf++, length--;
+ }
+ if (length > 0)
+ return 2;
+
+- /* ignore if value not found */
+- if(value == 0)
+- return 0;
+-
+ if (!ignore)
+- counter[i++]->value = valuedup(value);
++ counter[i++]->value = strndup(start, buf - start);
+ break;
+
+
+@@ -192,7 +192,7 @@
+ case '\f':
+ case '\v':
+ /* don't match if not at least one space */
+- if(!isspace(*(buf)))
++ if(!isspace(*buf))
+ return 0;
+ else
+ buf++;
+@@ -208,7 +208,7 @@
+ case '\v':
+ break;
+ default:
+- while (isspace(*(buf)))
++ while (isspace(*buf))
+ buf++;
+ }
+ fmt++;