fix gcc-4.x compile for bug #152548 and cross-compilation
authorCédric Krier <cedk@gentoo.org>
Thu, 16 Nov 2006 20:46:55 +0000 (20:46 +0000)
committerCédric Krier <cedk@gentoo.org>
Thu, 16 Nov 2006 20:46:55 +0000 (20:46 +0000)
Package-Manager: portage-2.1.1-r1

net-analyzer/trafd/ChangeLog
net-analyzer/trafd/Manifest
net-analyzer/trafd/files/digest-trafd-3.0.1
net-analyzer/trafd/files/digest-trafd-3.0.1-r1 [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-r1.ebuild [new file with mode: 0644]

index 492b9939e01adc48b9ce0985a0f08a1a71f5cfa4..74b153033acaee1063da5a3f0a7906c1c247209f 100644 (file)
@@ -1,6 +1,13 @@
 # ChangeLog for net-analyzer/trafd
 # Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-analyzer/trafd/ChangeLog,v 1.9 2006/02/17 16:26:25 jokey Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/trafd/ChangeLog,v 1.10 2006/11/16 20:46:55 cedk Exp $
+
+*trafd-3.0.1-r1 (16 Nov 2006)
+
+  16 Nov 2006; Cedric Krier <ced@ced.homedns.org>
+  +files/trafd-3.0.1-gentoo.diff, +files/trafd.conf, +files/trafd.init,
+  +trafd-3.0.1-r1.ebuild:
+  fix gcc-4.x compile for bug #152548 and cross-compilation
 
   17 Feb 2006; Markus Ullmann <jokey@gentoo.org> trafd-3.0.1.ebuild:
   Removing virtual/libpcap wrt bug #117898
index 49eced32ad8f86605da7e892dc5c8bab381908cb..09a60c8ed48d1fd882d8659f6be1feb7a892b978 100644 (file)
@@ -1,12 +1,37 @@
-MD5 27b4b61655abfb2b0ab2f4c141a443aa ChangeLog 1204
-RMD160 71bd6cfb1a1966435427f71557414b978f770063 ChangeLog 1204
-SHA256 aedc99e4e7ed7ad530ee807f76a622117827c7e747825ed92036e4fb1c057f2c ChangeLog 1204
-MD5 1572089bdb3922ea1a0ff41ba2abdc5d files/digest-trafd-3.0.1 199
-RMD160 e44c280c329adc95b0cb20cdce7298bf76427c2a files/digest-trafd-3.0.1 199
-SHA256 c541a65b5124ffb4075e38c4b25f95ab08110388969335344f2dc734bbcee49d files/digest-trafd-3.0.1 199
-MD5 a76a71fdeb3c4668250f466c21a19183 metadata.xml 220
-RMD160 f7c01782f5cbc1de4faf7a38972be07e939fd710 metadata.xml 220
-SHA256 f76ea89f0c19f325e6d893b73a9fefd441c7debc1399713dbd96fb2727aa6668 metadata.xml 220
+AUX trafd-3.0.1-gentoo.diff 10155 RMD160 523fd80dfa7846f088a02e545e2ef22977fcbca0 SHA1 1b6a958f79a388700350b76466e02b3da417796b SHA256 467fb00cc73bed3a2fb6901f2585c4b862b1b40a35353a91d6103ce7cad32265
+MD5 160a3c03126e251d2ea6ce20f4216d14 files/trafd-3.0.1-gentoo.diff 10155
+RMD160 523fd80dfa7846f088a02e545e2ef22977fcbca0 files/trafd-3.0.1-gentoo.diff 10155
+SHA256 467fb00cc73bed3a2fb6901f2585c4b862b1b40a35353a91d6103ce7cad32265 files/trafd-3.0.1-gentoo.diff 10155
+AUX trafd.conf 38 RMD160 dd35d814a0067c4f029316ee26ec841cd09d83c9 SHA1 c8573337fd5783c092b8f9aeb136417141c5bc7d SHA256 008fa932bb003fbaa5d0bac1a3e28efbc2bd5548d5cb6de90dccd54ced131dc2
+MD5 23f0f2567787e35f0e6da761cbb04a84 files/trafd.conf 38
+RMD160 dd35d814a0067c4f029316ee26ec841cd09d83c9 files/trafd.conf 38
+SHA256 008fa932bb003fbaa5d0bac1a3e28efbc2bd5548d5cb6de90dccd54ced131dc2 files/trafd.conf 38
+AUX trafd.init 491 RMD160 e761c77eb2f9b16efd734aa3d6fa5d11d87b5bf5 SHA1 6880723aa2a2026abdbc2028026e698355764a83 SHA256 9d4cd4782924d63feb19375cdfd7893d9df3883d52b734ef105d758f3e92d85b
+MD5 333fa26d24c929d659695d96bfbcf5ae files/trafd.init 491
+RMD160 e761c77eb2f9b16efd734aa3d6fa5d11d87b5bf5 files/trafd.init 491
+SHA256 9d4cd4782924d63feb19375cdfd7893d9df3883d52b734ef105d758f3e92d85b files/trafd.init 491
+DIST tcpdump-richard-1.7.tar.gz 198587 RMD160 1a1d9adc6bee35eeab84d34f807f12dafa43f6c1 SHA1 89dd27c67673ff61d3c185e2e5b45e36fff92f37 SHA256 572a6544182fa57ec7c89e5093f0fd972be751a0145bfd13b93ef4063168c99a
+DIST trafd-3.0.1-gentoo.tar.bz2 2618 RMD160 4399242036aa3c6e1196bd6070eeb5c6653729b0 SHA1 ee6d809ada06a7cffce6deed2ea505fa491e970e SHA256 45904e1251772e703da24b7e51f298f6cfbb4c84bb4dc0f812da5f3a01ca26db
+DIST trafd-3.0.1.tgz 35365 RMD160 65ac4b09cbb6f014ce6e643f3607a280d13dcd7f SHA1 729bd2a21cb88aec9d78a34617995cd63c473270 SHA256 29164f69e6fcfeeefa6fe7f3bb07f415de03a45fa7985cfc76a99c423bc39db9
+EBUILD trafd-3.0.1-r1.ebuild 1209 RMD160 aa46a4097e06a720ab5afb16d8f11d99eb5ad80d SHA1 11be8935e603395aa60ad2158a426191daadd59e SHA256 cc259182a92f1e022d41cf9cfdc897cf77800e98f0fa38cd1018e38324b746b5
+MD5 7f4d7e69a4f703dd19888a11acdc0586 trafd-3.0.1-r1.ebuild 1209
+RMD160 aa46a4097e06a720ab5afb16d8f11d99eb5ad80d trafd-3.0.1-r1.ebuild 1209
+SHA256 cc259182a92f1e022d41cf9cfdc897cf77800e98f0fa38cd1018e38324b746b5 trafd-3.0.1-r1.ebuild 1209
+EBUILD trafd-3.0.1.ebuild 1289 RMD160 6df6f4b34f609d5d9c6e9e32f9147df28353fb9a SHA1 61e2454b995e11564e2c1c877276bdf8e7912474 SHA256 76e8e3b574be2b998acb64a05b2a7194fb882c5c4980f0fbced14b11c200a6a9
 MD5 4d7eb9e8e3375668cfa18c11b6313da5 trafd-3.0.1.ebuild 1289
 RMD160 6df6f4b34f609d5d9c6e9e32f9147df28353fb9a trafd-3.0.1.ebuild 1289
 SHA256 76e8e3b574be2b998acb64a05b2a7194fb882c5c4980f0fbced14b11c200a6a9 trafd-3.0.1.ebuild 1289
+MISC ChangeLog 1444 RMD160 efc5d4525c63d483b491fcc19f75dc8a9840f9d5 SHA1 80ab02c4af01130bddafc92d09a3c1cb766f269d SHA256 75f1bc1117c8af84f5fac52a8e7a7be15facf19cab1d87ab6ff3b9b4215a1126
+MD5 1554513eb21c9ed0824a7e09d390b473 ChangeLog 1444
+RMD160 efc5d4525c63d483b491fcc19f75dc8a9840f9d5 ChangeLog 1444
+SHA256 75f1bc1117c8af84f5fac52a8e7a7be15facf19cab1d87ab6ff3b9b4215a1126 ChangeLog 1444
+MISC metadata.xml 220 RMD160 f7c01782f5cbc1de4faf7a38972be07e939fd710 SHA1 d283aed4760423ca755bd2a92b3512d68e1b8b68 SHA256 f76ea89f0c19f325e6d893b73a9fefd441c7debc1399713dbd96fb2727aa6668
+MD5 a76a71fdeb3c4668250f466c21a19183 metadata.xml 220
+RMD160 f7c01782f5cbc1de4faf7a38972be07e939fd710 metadata.xml 220
+SHA256 f76ea89f0c19f325e6d893b73a9fefd441c7debc1399713dbd96fb2727aa6668 metadata.xml 220
+MD5 eaaaea086cca225aeddf2415cf5abf5e files/digest-trafd-3.0.1 735
+RMD160 4374c5dcc8e806de3d2ea0f19b134d001647f2ef files/digest-trafd-3.0.1 735
+SHA256 af27c06d2854750c20e270e552e803ac2a846c49975e93e10a960dd6488b3aa4 files/digest-trafd-3.0.1 735
+MD5 86d9e338f8f917410627000b6e91dadc files/digest-trafd-3.0.1-r1 482
+RMD160 ac8f0e50d7b1730e885811bb3eeb6e6a4e9b327f files/digest-trafd-3.0.1-r1 482
+SHA256 94cf41931ca3622f5b154ab434fcec3d6747fe5c759cc03527ba7f79789c6f10 files/digest-trafd-3.0.1-r1 482
index 0a1757da8f031053bf56b186022006809ee472c9..ab004b6650755195892e859d8975d150dfce6518 100644 (file)
@@ -1,3 +1,9 @@
-MD5 6a5abb246e95b68f0d53ebf789bda4fb trafd-3.0.1.tgz 35365
 MD5 c61d8f5b9824763bd5b93708048f4727 tcpdump-richard-1.7.tar.gz 198587
+RMD160 1a1d9adc6bee35eeab84d34f807f12dafa43f6c1 tcpdump-richard-1.7.tar.gz 198587
+SHA256 572a6544182fa57ec7c89e5093f0fd972be751a0145bfd13b93ef4063168c99a tcpdump-richard-1.7.tar.gz 198587
 MD5 4b6f61f2b3fd985efc935d1ec1f52ce2 trafd-3.0.1-gentoo.tar.bz2 2618
+RMD160 4399242036aa3c6e1196bd6070eeb5c6653729b0 trafd-3.0.1-gentoo.tar.bz2 2618
+SHA256 45904e1251772e703da24b7e51f298f6cfbb4c84bb4dc0f812da5f3a01ca26db trafd-3.0.1-gentoo.tar.bz2 2618
+MD5 6a5abb246e95b68f0d53ebf789bda4fb trafd-3.0.1.tgz 35365
+RMD160 65ac4b09cbb6f014ce6e643f3607a280d13dcd7f trafd-3.0.1.tgz 35365
+SHA256 29164f69e6fcfeeefa6fe7f3bb07f415de03a45fa7985cfc76a99c423bc39db9 trafd-3.0.1.tgz 35365
diff --git a/net-analyzer/trafd/files/digest-trafd-3.0.1-r1 b/net-analyzer/trafd/files/digest-trafd-3.0.1-r1
new file mode 100644 (file)
index 0000000..e536c2d
--- /dev/null
@@ -0,0 +1,6 @@
+MD5 c61d8f5b9824763bd5b93708048f4727 tcpdump-richard-1.7.tar.gz 198587
+RMD160 1a1d9adc6bee35eeab84d34f807f12dafa43f6c1 tcpdump-richard-1.7.tar.gz 198587
+SHA256 572a6544182fa57ec7c89e5093f0fd972be751a0145bfd13b93ef4063168c99a tcpdump-richard-1.7.tar.gz 198587
+MD5 6a5abb246e95b68f0d53ebf789bda4fb trafd-3.0.1.tgz 35365
+RMD160 65ac4b09cbb6f014ce6e643f3607a280d13dcd7f trafd-3.0.1.tgz 35365
+SHA256 29164f69e6fcfeeefa6fe7f3bb07f415de03a45fa7985cfc76a99c423bc39db9 trafd-3.0.1.tgz 35365
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..a90fdfd
--- /dev/null
@@ -0,0 +1,304 @@
+diff -ru trafd-3.0.1~/lib/interfaces.c trafd-3.0.1/lib/interfaces.c
+--- trafd-3.0.1~/lib/interfaces.c      2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/lib/interfaces.c       2006-11-16 21:22:18.000000000 +0100
+@@ -43,6 +43,7 @@
+ #include <stdio.h>
+ #include <pcap.h>
++#include <string.h>
+ #include "ethertype.h"
+ #include "interface.h"
+diff -ru trafd-3.0.1~/lib/savestr.c trafd-3.0.1/lib/savestr.c
+--- trafd-3.0.1~/lib/savestr.c 2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/lib/savestr.c  2006-11-16 21:22:18.000000000 +0100
+@@ -29,6 +29,7 @@
+ #endif
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include "gnuc.h"
+diff -ru trafd-3.0.1~/Makefile trafd-3.0.1/Makefile
+--- trafd-3.0.1~/Makefile      2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/Makefile       2006-11-16 21:34:14.000000000 +0100
+@@ -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 -I../../tcpdump-richard-1.7/libpcap-0.0/bpf/
+ 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 -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 -o root -g ${GROUP} -m ${MODE} trafstat/trafstat ${PATH_BINDIR_INSTALL}
++      install -o root -g ${GROUP} -m ${MODE} trafstatd/trafstatd ${PATH_BINDIR_INSTALL}
++      install -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:
+diff -ru trafd-3.0.1~/trafd/main.c trafd-3.0.1/trafd/main.c
+--- trafd-3.0.1~/trafd/main.c  2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/trafd/main.c   2006-11-16 21:22:18.000000000 +0100
+@@ -86,7 +86,7 @@
+ static pcap_t *pd;
+-void
++int
+ main(argc, argv)
+       int argc;
+       char **argv;
+diff -ru trafd-3.0.1~/trafd/Makefile trafd-3.0.1/trafd/Makefile
+--- trafd-3.0.1~/trafd/Makefile        2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/trafd/Makefile 2006-11-16 21:31:43.000000000 +0100
+@@ -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        =
+diff -ru trafd-3.0.1~/trafd/trafdump trafd-3.0.1/trafd/trafdump
+--- trafd-3.0.1~/trafd/trafdump        2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/trafd/trafdump 2006-11-16 21:22:18.000000000 +0100
+@@ -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: \
+diff -ru trafd-3.0.1~/trafd/traffic.c trafd-3.0.1/trafd/traffic.c
+--- trafd-3.0.1~/trafd/traffic.c       2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/trafd/traffic.c        2006-11-16 21:22:18.000000000 +0100
+@@ -56,10 +56,10 @@
+ #include <netinet/tcpip.h>
+ #include <netdb.h>
+ #include <pcap.h>
++#include <stdlib.h>
+ #include "interface.h"
+ #include "traffic.h"
+-#include "trafd.h"
+ #ifdef USE_PIPE
+ static jmp_buf after_pipe;
+@@ -72,6 +72,8 @@
+ static struct timeval begin_time;
+ static u_char s_port_big[IPPORT_RESERVED];
++#include "trafd.h"
++
+ /*
+  * Initialize traffic collector.
+  */
+@@ -214,7 +216,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) {
+@@ -224,7 +226,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);
+@@ -261,7 +263,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) {
+@@ -271,7 +273,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);
+diff -ru trafd-3.0.1~/trafd/trafsave trafd-3.0.1/trafd/trafsave
+--- trafd-3.0.1~/trafd/trafsave        2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/trafd/trafsave 2006-11-16 21:22:18.000000000 +0100
+@@ -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: \
+diff -ru trafd-3.0.1~/trafd/trafstart trafd-3.0.1/trafd/trafstart
+--- trafd-3.0.1~/trafd/trafstart       2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/trafd/trafstart        2006-11-16 21:22:18.000000000 +0100
+@@ -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 -?
+diff -ru trafd-3.0.1~/trafd/trafstop trafd-3.0.1/trafd/trafstop
+--- trafd-3.0.1~/trafd/trafstop        2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/trafd/trafstop 2006-11-16 21:22:18.000000000 +0100
+@@ -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: \
+diff -ru trafd-3.0.1~/traflog/main.c trafd-3.0.1/traflog/main.c
+--- trafd-3.0.1~/traflog/main.c        2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/traflog/main.c 2006-11-16 21:22:18.000000000 +0100
+@@ -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 -ru trafd-3.0.1~/traflog/Makefile trafd-3.0.1/traflog/Makefile
+--- trafd-3.0.1~/traflog/Makefile      2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/traflog/Makefile       2006-11-16 21:22:18.000000000 +0100
+@@ -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        =
+diff -ru trafd-3.0.1~/traflog/traflog.c trafd-3.0.1/traflog/traflog.c
+--- trafd-3.0.1~/traflog/traflog.c     2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/traflog/traflog.c      2006-11-16 21:22:18.000000000 +0100
+@@ -48,6 +48,7 @@
+ #include <arpa/inet.h>
+ #include <netdb.h>
+ #include <pcap.h>
++#include <time.h>
+ #include "interface.h"
+ #include "addrtoname.h"
+diff -ru trafd-3.0.1~/trafstat/main.c trafd-3.0.1/trafstat/main.c
+--- trafd-3.0.1~/trafstat/main.c       2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/trafstat/main.c        2006-11-16 21:22:18.000000000 +0100
+@@ -72,7 +72,7 @@
+ static jmp_buf after_alarm;
+-void
++int
+ main(argc, argv)
+       int argc;
+       char **argv;
+diff -ru trafd-3.0.1~/trafstatd/trafstatd.c trafd-3.0.1/trafstatd/trafstatd.c
+--- trafd-3.0.1~/trafstatd/trafstatd.c 2006-11-16 21:21:56.000000000 +0100
++++ trafd-3.0.1/trafstatd/trafstatd.c  2006-11-16 21:22:18.000000000 +0100
+@@ -39,7 +39,7 @@
+ #define       LINELEN         1024
+ #define       ENTRIES         50
+-void
++int
+ main()
+ {
+       register FILE *fp;
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..9c8dc4f
--- /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.3 2006/11/16 20:46:55 cedk Exp $
+
+depend() {
+       need net
+       use cupsd
+}
+
+start() {
+       ebegin "Starting trafd"
+       /usr/bin/trafd -p -r -i ${IFACE}
+       result=$?
+       eend $result
+}
+
+stop() {
+       ebegin "Stopping trafd"
+       /usr/bin/trafstop ${IFACE} > /dev/null
+       result=$?
+       eend $result
+}
diff --git a/net-analyzer/trafd/trafd-3.0.1-r1.ebuild b/net-analyzer/trafd/trafd-3.0.1-r1.ebuild
new file mode 100644 (file)
index 0000000..015a94c
--- /dev/null
@@ -0,0 +1,43 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/trafd/trafd-3.0.1-r1.ebuild,v 1.1 2006/11/16 20:46:55 cedk Exp $
+
+inherit eutils toolchain-funcs
+
+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/"
+
+SLOT="0"
+LICENSE="BSD"
+KEYWORDS="~x86"
+IUSE=""
+
+# -lbpft -lpcap -lcurses -ltermcap -lfl
+DEPEND="net-libs/libpcap
+       sys-libs/ncurses
+       sys-devel/flex"
+
+src_unpack() {
+       unpack ${A}
+       cd "${S}"
+       epatch "${FILESDIR}/${P}-gentoo.diff"
+}
+
+src_compile() {
+       emake FLAGS="${CFLAGS}" CC="$(tc-getCC)" || die "emake failed"
+}
+
+src_install () {
+       dodir /usr/bin /etc /usr/share/doc/trafd-3.0.1 /var/trafd
+       emake install DESTDIR="${D}" || die "emake install failed"
+       newinitd "${FILESDIR}/trafd.init" trafd
+       newconfd "${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)"
+}