summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Volkov <pva@gentoo.org>2009-01-05 20:07:22 +0000
committerPeter Volkov <pva@gentoo.org>2009-01-05 20:07:22 +0000
commit3bbb8a8b5f09317a72dbf2bcce1663d7bf4bd187 (patch)
tree3821026865e2b47d54113698d431004e7de70eab
parentBump to 20081231 (diff)
downloadgentoo-2-3bbb8a8b5f09317a72dbf2bcce1663d7bf4bd187.tar.gz
gentoo-2-3bbb8a8b5f09317a72dbf2bcce1663d7bf4bd187.tar.bz2
gentoo-2-3bbb8a8b5f09317a72dbf2bcce1663d7bf4bd187.zip
Version bump, added patch to make darkstat workable on OpenVPN interfaces, thank Anton S. Ustyuzhanin for all this work, bug #251348.
(Portage version: 2.2_rc20/cvs/Linux 2.6.26-openvz.git-89451f9 i686)
-rw-r--r--net-analyzer/darkstat/ChangeLog11
-rw-r--r--net-analyzer/darkstat/darkstat-3.0.712.ebuild63
-rw-r--r--net-analyzer/darkstat/files/darkstat-3.0.712-dlt_raw.patch51
3 files changed, 123 insertions, 2 deletions
diff --git a/net-analyzer/darkstat/ChangeLog b/net-analyzer/darkstat/ChangeLog
index 33184ba0c725..e41a314ae423 100644
--- a/net-analyzer/darkstat/ChangeLog
+++ b/net-analyzer/darkstat/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for net-analyzer/darkstat
-# Copyright 2000-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-analyzer/darkstat/ChangeLog,v 1.34 2008/09/10 10:41:52 pva Exp $
+# Copyright 2000-2009 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/darkstat/ChangeLog,v 1.35 2009/01/05 20:07:19 pva Exp $
+
+*darkstat-3.0.712 (05 Jan 2009)
+
+ 05 Jan 2009; Peter Volkov <pva@gentoo.org>
+ +files/darkstat-3.0.712-dlt_raw.patch, +darkstat-3.0.712.ebuild:
+ Version bump, added patch to make darkstat workable on OpenVPN interfaces,
+ thank Anton S. Ustyuzhanin for all this work, bug #251348.
10 Sep 2008; Peter Volkov <pva@gentoo.org> darkstat-3.0.707-r1.ebuild:
enewuser/enewgroup die on their own, no need to || die
diff --git a/net-analyzer/darkstat/darkstat-3.0.712.ebuild b/net-analyzer/darkstat/darkstat-3.0.712.ebuild
new file mode 100644
index 000000000000..749438f7b4bd
--- /dev/null
+++ b/net-analyzer/darkstat/darkstat-3.0.712.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/darkstat/darkstat-3.0.712.ebuild,v 1.1 2009/01/05 20:07:19 pva Exp $
+
+inherit eutils
+
+DESCRIPTION="darkstat is a network traffic analyzer"
+HOMEPAGE="http://dmr.ath.cx/net/darkstat/"
+SRC_URI="http://dmr.ath.cx/net/darkstat/${P}.tar.bz2"
+
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE=""
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND="net-libs/libpcap"
+
+DARKSTAT_CHROOT_DIR=${DARKSTAT_CHROOT_DIR:-/var/lib/darkstat}
+
+src_unpack() {
+ unpack ${A}
+ epatch "${FILESDIR}/${P}-dlt_raw.patch"
+}
+
+src_compile() {
+ econf --with-privdrop-user=darkstat \
+ --with-chroot-dir="${DARKSTAT_CHROOT_DIR}"
+ emake || die "compilation failed."
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "installation failed."
+
+ dodoc AUTHORS README THANKS NEWS || die
+
+ newinitd "${FILESDIR}"/darkstat-init.new darkstat || die
+ newconfd "${FILESDIR}"/darkstat-confd.new darkstat || die
+
+ sed -i -e "s:__CHROOT__:${DARKSTAT_CHROOT_DIR}:g" "${D}"/etc/conf.d/darkstat
+ sed -i -e "s:__CHROOT__:${DARKSTAT_CHROOT_DIR}:g" "${D}"/etc/init.d/darkstat
+
+ keepdir "${DARKSTAT_CHROOT_DIR}"
+ chown darkstat:0 "${D}${DARKSTAT_CHROOT_DIR}"
+}
+
+pkg_preinst() {
+ enewuser darkstat
+}
+
+pkg_postinst() {
+ # Workaround bug #141619
+ DARKSTAT_CHROOT_DIR=`sed -n 's/^#CHROOT=\(.*\)/\1/p' "${ROOT}"etc/conf.d/darkstat`
+ chown darkstat:0 "${ROOT}${DARKSTAT_CHROOT_DIR}"
+
+ elog "WARNING: the darkstat init script has changed"
+ elog "To start different darkstat instances which will listen on a different"
+ elog "interfaces create in /etc/init.d directory the 'darkstat.if' symlink to"
+ elog "darkstat script where 'if' is the name of the interface."
+ elog "Also in /etc/conf.d directory copy darkstat to darkstat.if"
+ elog "and edit it to change default values."
+ elog
+ elog "darkstat's default chroot directory is: \"${ROOT}${DARKSTAT_CHROOT_DIR}\""
+}
diff --git a/net-analyzer/darkstat/files/darkstat-3.0.712-dlt_raw.patch b/net-analyzer/darkstat/files/darkstat-3.0.712-dlt_raw.patch
new file mode 100644
index 000000000000..96ad00a56938
--- /dev/null
+++ b/net-analyzer/darkstat/files/darkstat-3.0.712-dlt_raw.patch
@@ -0,0 +1,51 @@
+diff -Nuar darkstat-3.0.712.orig/decode.c darkstat-3.0.712/decode.c
+--- darkstat-3.0.712.orig/decode.c 2008-11-29 11:39:55.000000000 +0600
++++ darkstat-3.0.712/decode.c 2008-12-18 01:06:08.000000000 +0600
+@@ -67,6 +67,8 @@
+ pktsummary *sm);
+ static void decode_linux_sll(u_char *, const struct pcap_pkthdr *,
+ const u_char *);
++static void decode_raw(u_char *, const struct pcap_pkthdr *,
++ const u_char *);
+ static void decode_ip(const u_char *pdata, const uint32_t len,
+ pktsummary *sm);
+
+@@ -85,6 +87,7 @@
+ #ifdef DLT_LINUX_SLL
+ { DLT_LINUX_SLL, SLL_HDR_LEN, decode_linux_sll },
+ #endif
++ { DLT_RAW, RAW_HDR_LEN, decode_raw },
+ { -1, -1, NULL }
+ };
+
+@@ -300,6 +303,19 @@
+ }
+
+ static void
++decode_raw(u_char *user _unused_,
++ const struct pcap_pkthdr *pheader,
++ const u_char *pdata)
++{
++ pktsummary sm;
++ memset(&sm, 0, sizeof(sm));
++
++ decode_ip(pdata, pheader->caplen, &sm);
++ sm.time = pheader->ts.tv_sec;
++ acct_for(&sm);
++}
++
++static void
+ decode_ip(const u_char *pdata, const uint32_t len, pktsummary *sm)
+ {
+ const struct ip *hdr = (const struct ip *)pdata;
+diff -Nuar darkstat-3.0.712.orig/decode.h darkstat-3.0.712/decode.h
+--- darkstat-3.0.712.orig/decode.h 2008-11-29 11:39:55.000000000 +0600
++++ darkstat-3.0.712/decode.h 2008-12-18 00:49:14.000000000 +0600
+@@ -18,6 +18,7 @@
+ #define NULL_HDR_LEN 4
+ #define PPPOE_HDR_LEN 8
+ #define SLL_HDR_LEN 16
++#define RAW_HDR_LEN 0
+
+ #ifndef ETHER_ADDR_LEN
+ #define ETHER_ADDR_LEN 6