summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-05-23 00:46:30 +0000
committerMike Frysinger <vapier@gentoo.org>2005-05-23 00:46:30 +0000
commitb31abca4aebbc358bab42634aaead8cd5fd9b7e3 (patch)
treecc9a0fe4e9743cc2a5e231560c2f4a90a1f21af9 /net-analyzer/vnstat
parentStable on SPARC. (diff)
downloadgentoo-2-b31abca4aebbc358bab42634aaead8cd5fd9b7e3.tar.gz
gentoo-2-b31abca4aebbc358bab42634aaead8cd5fd9b7e3.tar.bz2
gentoo-2-b31abca4aebbc358bab42634aaead8cd5fd9b7e3.zip
Add patch by Aleksey Fedoseev to support ifaces with long names.
(Portage version: 2.0.51.22-r1)
Diffstat (limited to 'net-analyzer/vnstat')
-rw-r--r--net-analyzer/vnstat/ChangeLog10
-rw-r--r--net-analyzer/vnstat/files/digest-vnstat-1.4-r11
-rw-r--r--net-analyzer/vnstat/files/vnstat-1.4-long_iface_name.patch49
-rw-r--r--net-analyzer/vnstat/vnstat-1.4-r1.ebuild65
4 files changed, 123 insertions, 2 deletions
diff --git a/net-analyzer/vnstat/ChangeLog b/net-analyzer/vnstat/ChangeLog
index ebbe2eca3138..fd6b9e67b702 100644
--- a/net-analyzer/vnstat/ChangeLog
+++ b/net-analyzer/vnstat/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for net-analyzer/vnstat
-# Copyright 2000-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-analyzer/vnstat/ChangeLog,v 1.9 2005/03/03 00:46:15 ka0ttic Exp $
+# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/vnstat/ChangeLog,v 1.10 2005/05/23 00:46:30 vapier Exp $
+
+*vnstat-1.4-r1 (23 May 2005)
+
+ 23 May 2005; Mike Frysinger <vapier@gentoo.org>
+ +files/vnstat-1.4-long_iface_name.patch, +vnstat-1.4-r1.ebuild:
+ Add patch by Aleksey Fedoseev to support ifaces with long names.
02 Mar 2005; Aaron Walker <ka0ttic@gentoo.org> vnstat-1.4.ebuild:
Fix pkg_postinst messages wrt to cron script name for bug 83825.
diff --git a/net-analyzer/vnstat/files/digest-vnstat-1.4-r1 b/net-analyzer/vnstat/files/digest-vnstat-1.4-r1
new file mode 100644
index 000000000000..c2424fe6d2b1
--- /dev/null
+++ b/net-analyzer/vnstat/files/digest-vnstat-1.4-r1
@@ -0,0 +1 @@
+MD5 9184f79b5e60499bc059f670032291e5 vnstat-1.4.tar.gz 26237
diff --git a/net-analyzer/vnstat/files/vnstat-1.4-long_iface_name.patch b/net-analyzer/vnstat/files/vnstat-1.4-long_iface_name.patch
new file mode 100644
index 000000000000..ba869b6fb7dd
--- /dev/null
+++ b/net-analyzer/vnstat/files/vnstat-1.4-long_iface_name.patch
@@ -0,0 +1,49 @@
+Interface names can be more than 7 chars long.
+
+Patch by Aleksey Fedoseev.
+
+--- vnstat-1.4/src/proc.c
++++ vnstat-1.4/src/proc.c
+@@ -64,6 +64,7 @@
+ void parseproc(int newdb)
+ {
+ char temp[64];
++ char* colon_pos;
+ uint64_t rx, tx, rxchange=0, txchange=0, btime; /* rxchange = rx change in MB */
+ uint64_t krxchange=0, ktxchange=0; /* krxchange = rx change in kB */
+ time_t current;
+@@ -86,12 +87,22 @@
+
+ current=time(NULL);
+
+- /* get rx from procline, easy since it's always procline+7 */
++ /* get rx position, then get it from procline */
++
++ colon_pos = strchr(procline, ':');
++ if (colon_pos == NULL) {
++ if (debug) {
++ printf("Bad /proc/net/dev string");
++ }
++ return;
++ }
++
++ colon_pos++;
+
+ #ifdef BLIMIT
+- rx=strtoull(procline+7, (char **)NULL, 0);
++ rx=strtoull(colon_pos, (char **)NULL, 0);
+ #else
+- rx=strtoul(procline+7, (char **)NULL, 0);
++ rx=strtoul(colon_pos, (char **)NULL, 0);
+ #endif
+
+ if (newdb!=1) {
+@@ -116,7 +127,7 @@
+
+
+ /* get tx from procline, ugly hack */
+- sscanf(procline+7,"%s %s %s %s %s %s %s %s %s",temp,temp,temp,temp,temp,temp,temp,temp,temp);
++ sscanf(colon_pos, "%s %s %s %s %s %s %s %s %s",temp,temp,temp,temp,temp,temp,temp,temp,temp);
+
+ #ifdef BLIMIT
+ tx=strtoull(temp, (char **)NULL, 0);
diff --git a/net-analyzer/vnstat/vnstat-1.4-r1.ebuild b/net-analyzer/vnstat/vnstat-1.4-r1.ebuild
new file mode 100644
index 000000000000..f5ae2a21ca58
--- /dev/null
+++ b/net-analyzer/vnstat/vnstat-1.4-r1.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/vnstat/vnstat-1.4-r1.ebuild,v 1.1 2005/05/23 00:46:30 vapier Exp $
+
+inherit eutils
+
+DESCRIPTION="Console-based network traffic monitor that keeps statistics of network usage"
+HOMEPAGE="http://humdi.net/vnstat/"
+SRC_URI="http://humdi.net/vnstat/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
+IUSE=""
+
+RDEPEND="virtual/cron"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-long_iface_name.patch
+}
+
+src_compile() {
+ emake CFLAGS="${CFLAGS}" || die
+}
+
+src_install() {
+ keepdir /var/lib/vnstat
+
+ dobin src/vnstat || die
+ exeinto /etc/cron.hourly
+ doexe "${FILESDIR}"/vnstat.cron vnstat
+ doman man/vnstat.1
+
+ newdoc pppd/vnstat_ip-down ip-down.example
+ newdoc pppd/vnstat_ip-up ip-up.example
+ dodoc CHANGES INSTALL README UPGRADE FAQ
+}
+
+pkg_postinst() {
+ # compatibility for 1.1 ebuild
+ if [[ -d ${ROOT}/var/spool/vnstat ]] ; then
+ mv -f "${ROOT}"/var/spool/vnstat/* "${ROOT}"/var/lib/vnstat/ \
+ && rmdir "${ROOT}"/var/spool/vnstat
+ einfo "vnStat db files moved from /var/spool/vnstat to /var/lib/vnstat"
+ fi
+
+ einfo "Repeat the following command for every interface you"
+ einfo "wish to monitor (replace eth0):"
+ einfo " vnstat -u -i eth0"
+ einfo
+ einfo "Note: if an interface transfers more than ~4GB in"
+ einfo "the time between cron runs, you may miss traffic"
+ einfo
+
+ if [[ -e ${ROOT}/etc/cron.d/vnstat ]] ; then
+ einfo "vnstat\'s cron script is now installed as /etc/cron.hourly/vnstat."
+ einfo "Please remove /etc/cron.d/vnstat."
+ else
+ einfo "A cron script has been installed to /etc/cron.hourly/vnstat.cron."
+ fi
+ einfo "To update your interface database automatically with"
+ einfo "cron, uncomment the lines in /etc/cron.hourly/vnstat.cron."
+}