Initial import
authorDaniel Ahlberg <aliz@gentoo.org>
Fri, 8 Nov 2002 13:07:26 +0000 (13:07 +0000)
committerDaniel Ahlberg <aliz@gentoo.org>
Fri, 8 Nov 2002 13:07:26 +0000 (13:07 +0000)
net-analyzer/trafd/ChangeLog [new file with mode: 0644]
net-analyzer/trafd/files/digest-trafd-3.0.1 [new file with mode: 0644]
net-analyzer/trafd/files/trafd-3.0.1-gentoo.diff [new file with mode: 0644]
net-analyzer/trafd/files/trafd.conf [new file with mode: 0644]
net-analyzer/trafd/files/trafd.init [new file with mode: 0644]
net-analyzer/trafd/trafd-3.0.1.ebuild [new file with mode: 0644]

diff --git a/net-analyzer/trafd/ChangeLog b/net-analyzer/trafd/ChangeLog
new file mode 100644 (file)
index 0000000..4447c3a
--- /dev/null
@@ -0,0 +1,8 @@
+# ChangeLog for net-analyzer/trafd
+# Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/trafd/ChangeLog,v 1.1 2002/11/08 13:07:26 aliz Exp $
+
+*trafd-3.0.1 (08 Nov 2002)
+
+  08 Nov 2002; Daniel Ahlberg <aliz@gentoo.org> :
+  Initial import. Ebuild contributed by Asen Kurin <asen@warlock.ru> in #8446.
diff --git a/net-analyzer/trafd/files/digest-trafd-3.0.1 b/net-analyzer/trafd/files/digest-trafd-3.0.1
new file mode 100644 (file)
index 0000000..4a9e624
--- /dev/null
@@ -0,0 +1,2 @@
+MD5 6a5abb246e95b68f0d53ebf789bda4fb trafd-3.0.1.tgz 35365
+MD5 c61d8f5b9824763bd5b93708048f4727 tcpdump-richard-1.7.tar.gz 198587
diff --git a/net-analyzer/trafd/files/trafd-3.0.1-gentoo.diff b/net-analyzer/trafd/files/trafd-3.0.1-gentoo.diff
new file mode 100644 (file)
index 0000000..c1abcbb
--- /dev/null
@@ -0,0 +1,206 @@
+--- ./trafd/trafdump   1993-12-09 16:53:56.000000000 +0300
++++ ./trafd/trafdump   2002-09-26 20:12:59.000000000 +0400
+@@ -1,3 +1,4 @@
++#!/bin/sh
+ #
+ #     trafdump        Copyright (c)1993 CAD lab
+ #
+@@ -18,6 +19,7 @@
+ for iface in $*; do
+       PID_FILE=$WHERE_PID$iface
+       if [ -f $PID_FILE ]; then
++              echo dumping $iface ...
+               kill -HUP `cat $PID_FILE`
+               if [ $? = 0 ]; then
+                       echo `date +"%b %e %H:%M:%S"` `hostname -s` trafdump: \
+--- ./trafd/trafsave   1993-11-06 14:37:30.000000000 +0300
++++ ./trafd/trafsave   2002-09-26 20:12:43.000000000 +0400
+@@ -1,3 +1,4 @@
++#!/bin/sh
+ #
+ #     trafsave        Copyright (c)1993 CAD lab
+ #
+@@ -19,6 +20,7 @@
+ for iface in $*; do
+       PID_FILE=$WHERE_PID$iface
+       if [ -f $PID_FILE ]; then
++              echo saving $iface ...
+               kill -INT `cat $PID_FILE`
+               if [ $? = 0 ]; then
+                       echo `date +"%b %e %H:%M:%S"` `hostname -s` trafsave: \
+--- ./trafd/trafstart  1999-10-27 13:47:01.000000000 +0400
++++ ./trafd/trafstart  2002-09-26 21:41:08.000000000 +0400
+@@ -1,3 +1,4 @@
++#!/bin/sh
+ #
+ #     trafstart       Copyright (c)1993 CAD lab
+ #
+@@ -18,7 +19,8 @@
+ #trafd -r -i sl0
+ #     count all ftp traffic passthrough ne0 interface -
+ #trafd -i ne0 port ftp or ftp-data
+-./trafd -p -r -i xl0
++echo starting trafd eth0 ...
++/usr/bin/trafd -p -r -i eth0
+ #
+ #echo I am storage, before use invoke editor and edit as your need.
+ #trafd -?
+--- ./trafd/trafstop   1993-11-06 14:39:56.000000000 +0300
++++ ./trafd/trafstop   2002-09-26 20:22:50.000000000 +0400
+@@ -1,3 +1,4 @@
++#!/bin/sh
+ #
+ #     trafstop        Copyright (c)1993 CAD lab
+ #
+@@ -19,6 +20,7 @@
+ for iface in $*; do
+       PID_FILE=$WHERE_PID$iface
+       if [ -f $PID_FILE ]; then
++              echo stopping $iface ...
+               kill -TERM `cat $PID_FILE`
+               if [ $? = 0 ]; then
+                       echo `date +"%b %e %H:%M:%S"` `hostname -s` trafstop: \
+--- trafd/traffic.c.buggy      Mon Aug  7 18:45:54 2000
++++ trafd/traffic.c    Mon Aug  7 18:46:42 2000
+@@ -253,7 +253,7 @@
+               t.p_port = tp->th_sport, t.who_srv = 1;
+       else if (tp->th_sport > tp->th_dport)
+               t.p_port = tp->th_dport, t.who_srv = 2;
+-      else if (tp->th_sport = tp->th_dport)
++      else if (tp->th_sport == tp->th_dport)
+               t.p_port = tp->th_sport, t.who_srv = 3;
+       if (t.p_port > IPPORT_RESERVED) {
+               if (s_port_big[tp->th_sport & (IPPORT_RESERVED-1)] & IPPROTO_TCP) {
+@@ -263,7 +263,7 @@
+                               t.p_port = tp->th_dport;
+                               t.who_srv = 2;
+                       }
+-              if (tp->th_sport = tp->th_dport) t.who_srv = 3;
++              if (tp->th_sport == tp->th_dport) t.who_srv = 3;
+       }
+       traf_add(insertentry(&t), t.n_bytes, t.n_psize);
+ 
+@@ -300,7 +300,7 @@
+               t.p_port = up->uh_sport, t.who_srv = 1;
+       else if (up->uh_sport > up->uh_dport)
+               t.p_port = up->uh_dport, t.who_srv = 2;
+-      else if (up->uh_sport = up->uh_dport)
++      else if (up->uh_sport == up->uh_dport)
+               t.p_port = up->uh_sport, t.who_srv = 3;
+       if (t.p_port > IPPORT_RESERVED) {
+               if (s_port_big[up->uh_sport & (IPPORT_RESERVED-1)] & IPPROTO_UDP) {
+@@ -310,7 +310,7 @@
+                               t.p_port = up->uh_dport;
+                               t.who_srv = 2;
+                       }
+-              if (up->uh_sport = up->uh_dport) t.who_srv = 3;
++              if (up->uh_sport == up->uh_dport) t.who_srv = 3;
+       }
+       traf_add(insertentry(&t), t.n_bytes, t.n_psize);
+ 
+
+--- ./Makefile 1999-11-25 14:38:29.000000000 +0300
++++ ./Makefile 2002-09-26 20:20:01.000000000 +0400
+@@ -12,22 +12,27 @@
+ #
+ 
+ # Target directory for install execution files.
+-PATH_BINDIR=/usr/local/bin
++PATH_BINDIR=/usr/bin
++
++# Installation path
++PATH_BINDIR_INSTALL=${DESTDIR}usr/bin
++PATH_CONF_INSTALL=${DESTDIR}etc
+ 
+ # Target directory for install man pages.
+-PATH_MANDIR=/usr/local/man/man1
++PATH_MANDIR=/usr/share/man/man1
++PATH_INSTALL_DOC=${DESTDIR}usr/share/doc/trafd-3.0.1
+ 
+ # Trailing slash directory, summary traffic log files will be put there.
+ PATH_TOSAVE=/var/trafd/
+ 
+ # Full pathname where locate tarfstat program.
+-PATH_TRAFSTAT=/usr/local/bin/trafstat
++PATH_TRAFSTAT=/usr/bin/trafstat
+ 
+ # Where locate trafstatd log file, if you want log then file must exist.
+ PATH_TRAFSTAT_LOG=/var/log/trafstat.log
+ 
+ # File with user defined descriptions of the traflog output format.
+-PATH_TRAFLOG_FMT=/usr/local/etc/traflog.format
++PATH_TRAFLOG_FMT=/etc/traflog.format
+ 
+ # Only group wheel can execute binary files.
+ SHELL = /bin/sh
+@@ -42,9 +47,9 @@
+ #DEFINE += -DHAVE_MEMORY_H=1
+ #DEFINE += -DHAVE_MALLOC_H=1
+ 
+-LDFLAGS       = -L../lib -lbpft -lpcap -lcurses -ltermcap -ll
++LDFLAGS       = -L../lib -lbpft -lpcap -lcurses -ltermcap -lfl
+ 
+-INCLUDE       = -I../include
++INCLUDE       = -I../include -I../../tcpdump-richard-1.7/linux-include
+ CFLAGS        = ${FLAGS} ${INCLUDE} ${DEFINE} \
+       -DPATH_TOSAVE=\"${PATH_TOSAVE}\"\
+       -DPATH_TRAFSTAT=\"${PATH_TRAFSTAT}\"\
+@@ -64,15 +69,17 @@
+       @echo "Done."
+ 
+ install: all
+-      install -s -o root -g ${GROUP} -m ${MODE} trafd/trafd ${PATH_BINDIR}
+-      install -c -o root -g ${GROUP} -m ${MODE} trafd/trafstart ${PATH_BINDIR}
+-      install -c -o root -g ${GROUP} -m ${MODE} trafd/trafstop ${PATH_BINDIR}
+-      install -c -o root -g ${GROUP} -m ${MODE} trafd/trafsave ${PATH_BINDIR}
+-      install -c -o root -g ${GROUP} -m ${MODE} trafd/trafdump ${PATH_BINDIR}
+-      install -s -o root -g ${GROUP} -m ${MODE} trafstat/trafstat ${PATH_BINDIR}
+-      install -s -o root -g ${GROUP} -m ${MODE} trafstatd/trafstatd ${PATH_BINDIR}
+-      install -s -o root -g ${GROUP} -m ${MODE} traflog/traflog ${PATH_BINDIR}
+-      install -c -o root -g ${GROUP} -m ${MODE} traflog/traflog.format ${PATH_TRAFLOG_FMT}
++      install -s -o root -g ${GROUP} -m ${MODE} trafd/trafd ${PATH_BINDIR_INSTALL}
++      install -c -o root -g ${GROUP} -m ${MODE} trafd/trafstart ${PATH_BINDIR_INSTALL}
++      install -c -o root -g ${GROUP} -m ${MODE} trafd/trafstop ${PATH_BINDIR_INSTALL}
++      install -c -o root -g ${GROUP} -m ${MODE} trafd/trafsave ${PATH_BINDIR_INSTALL}
++      install -c -o root -g ${GROUP} -m ${MODE} trafd/trafdump ${PATH_BINDIR_INSTALL}
++      install -c -o root -g ${GROUP} -m ${MODE} traflog/traflog ${PATH_BINDIR_INSTALL}
++      install -s -o root -g ${GROUP} -m ${MODE} trafstat/trafstat ${PATH_BINDIR_INSTALL}
++      install -s -o root -g ${GROUP} -m ${MODE} trafstatd/trafstatd ${PATH_BINDIR_INSTALL}
++      install -s -o root -g ${GROUP} -m ${MODE} traflog/traflog ${PATH_BINDIR_INSTALL}
++      install -c -o root -g ${GROUP} -m ${MODE} traflog/traflog.format ${PATH_CONF_INSTALL}
++      install -c -o root -g ${GROUP} -m 644 README ${PATH_INSTALL_DOC}
+       @echo Done.
+ 
+ clean:
+--- traflog/Makefile   1999-10-27 12:11:25.000000000 +0400
++++ traflog/Makefile   2002-09-26 17:16:45.000000000 +0400
+@@ -5,7 +5,7 @@
+ PROG  = traflog
+ SRC   = main.c traflog.c
+ OBJ   = $(SRC:.c=.o)
+-LIB   = -L../lib -lbpft -ll -lpcap
++LIB   = -L../lib -lbpft -lfl -lpcap
+ CC    = gcc
+ FLAGS = -g
+ DEFINE        =
+--- trafd/Makefile     1999-11-25 13:19:07.000000000 +0300
++++ trafd/Makefile     2002-09-26 17:17:14.000000000 +0400
+@@ -5,7 +5,7 @@
+ PROG  = trafd
+ SRC   = main.c traffic.c
+ OBJ   = $(SRC:.c=.o)
+-LIB   = -lpcap -ll
++LIB   = -lpcap -lfl
+ CC    = gcc
+ FLAGS = -g
+ DEFINE        =
+--- traflog/main.c     1999-11-25 14:10:25.000000000 +0300
++++ traflog/main.c     2002-09-26 17:07:09.000000000 +0400
+@@ -42,6 +42,7 @@
+ #include <sys/stat.h>
+ #include <sys/param.h>
+ #include <pcap.h>
++#include <time.h>
+ 
+ #include "../include/interface.h"
+ #include "../include/addrtoname.h"
diff --git a/net-analyzer/trafd/files/trafd.conf b/net-analyzer/trafd/files/trafd.conf
new file mode 100644 (file)
index 0000000..03da040
--- /dev/null
@@ -0,0 +1,2 @@
+# what interface to run on
+IFACE=eth0
diff --git a/net-analyzer/trafd/files/trafd.init b/net-analyzer/trafd/files/trafd.init
new file mode 100644 (file)
index 0000000..64edfbb
--- /dev/null
@@ -0,0 +1,23 @@
+#!/sbin/runscript
+# Copyright 1999-2002 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/trafd/files/trafd.init,v 1.1 2002/11/08 13:07:26 aliz Exp $
+
+depend() {
+       need net
+       use cupsd
+}
+
+start() {
+       ebegin "Starting trafd"
+       /usr/bin/trafd -p -r -i eth0
+       result=$?
+       eend $result
+}
+
+stop() {
+       ebegin "Stopping trafd"
+       /usr/bin/trafstop eth0 > /dev/null
+       result=$?
+       eend $result
+}
diff --git a/net-analyzer/trafd/trafd-3.0.1.ebuild b/net-analyzer/trafd/trafd-3.0.1.ebuild
new file mode 100644 (file)
index 0000000..ce78e3c
--- /dev/null
@@ -0,0 +1,45 @@
+# Copyright 1999-2002 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/trafd/trafd-3.0.1.ebuild,v 1.1 2002/11/08 13:07:26 aliz Exp $
+
+S=${WORKDIR}/${P}
+DESCRIPTION="The BPF Traffic Collector"
+SRC_URI="ftp://ftp.riss-telecom.ru/pub/dev/trafd/${P}.tgz 
+       http://metalab.unc.edu/pub/Linux/system/network/management/tcpdump-richard-1.7.tar.gz"
+HOMEPAGE="ftp://ftp.riss-telecom.ru/pub/dev/trafd/"
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~x86"
+
+# -lbpft/*Ó×ÏÑ*/ -lpcap -lcurses -ltermcap -lfl
+DEPEND="net-libs/libpcap
+       sys-libs/ncurses
+       sys-devel/flex"
+
+RDEPEND=$DEPEND
+
+src_unpack() {
+       unpack ${A}
+       cd ${S}
+       patch -p0 < ${FILESDIR}/${PF}-gentoo.diff
+
+       mv Makefile Makefile.orig
+       sed "44s/-O2$/${CFLAGS}/" Makefile.orig >Makefile
+}
+
+src_compile() {
+       emake || die 
+}
+
+src_install () {
+       dodir /usr/bin /etc /usr/share/doc/trafd-3.0.1 /var/trafd
+       make install DESTDIR=${D} || die
+       exeinto /etc/init.d ; newexe ${FILESDIR}/trafd.init trafd
+       insinto /etc/conf.d ; newins ${FILESDIR}/trafd.conf trafd
+}
+
+pkg_postinst() {
+    ewarn "NOTE: if you want to run trafd on boot then execute"
+    ewarn "rc-update add trafd default"
+    ewarn "change interfaces in /etc/conf.d/trafd (default is eth0)"
+}