aboutsummaryrefslogtreecommitdiff
path: root/net/traff
diff options
context:
space:
mode:
authorMarcus Alves Grando <mnag@FreeBSD.org>2005-09-28 16:34:40 +0000
committerMarcus Alves Grando <mnag@FreeBSD.org>2005-09-28 16:34:40 +0000
commit5402fcdd5e0047ba1896230c22992fd915091617 (patch)
treedf16f8d97df1c1814b80f13f555d3487e7f8bbee /net/traff
parentedbaf6e8fec804e62616bc890503e6714a25e7f5 (diff)
downloadports-5402fcdd5e0047ba1896230c22992fd915091617.tar.gz
ports-5402fcdd5e0047ba1896230c22992fd915091617.zip
Notes
Diffstat (limited to 'net/traff')
-rw-r--r--net/traff/Makefile55
-rw-r--r--net/traff/distinfo2
-rw-r--r--net/traff/files/patch-Makefile20
-rw-r--r--net/traff/files/patch-readconfig.h11
-rw-r--r--net/traff/files/patch-traff.c28
-rw-r--r--net/traff/files/patch-traff.conf18
-rw-r--r--net/traff/files/traff.sh.in39
-rw-r--r--net/traff/pkg-descr10
-rw-r--r--net/traff/pkg-plist3
9 files changed, 186 insertions, 0 deletions
diff --git a/net/traff/Makefile b/net/traff/Makefile
new file mode 100644
index 000000000000..e6c5bebfb963
--- /dev/null
+++ b/net/traff/Makefile
@@ -0,0 +1,55 @@
+# New ports collection makefile for: traff
+# Date created: 2005-09-26
+# Whom: Dan Caescu <daniel at freebsd.ro>
+#
+# $FreeBSD$
+#
+
+PORTNAME= traff
+PORTVERSION= 0.6.1
+CATEGORIES= net net-mgmt
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
+MASTER_SITE_SUBDIR= traff
+DISTNAME= ${PORTNAME}-${PORTVERSION}
+
+MAINTAINER= daniel@freebsd.ro
+COMMENT= Libpcab based fast traffic accounting program
+
+USE_RC_SUBR= traff.sh
+USE_GMAKE= yes
+USE_REINPLACE= yes
+
+CFLAGS+= ${PTHREAD_CFLAGS}
+LFLAGS= ${PTHREAD_LIBS}
+
+OPTIONS= MYSQL "Enable MYSQL storage" on \
+ PGSQL "Enable PGSQL storage" off
+
+.include <bsd.port.pre.mk>
+
+.if !defined(WITHOUT_MYSQL)
+USE_MYSQL= yes
+CFLAGS+= -DwithMYSQL -I${LOCALBASE}/include
+LFLAGS+= -L${LOCALBASE}/lib/mysql -lmysqlclient_r
+.endif
+
+.if defined(WITH_PGSQL)
+USE_PGSQL= yes
+CFLAGS+= -DwithPGSQL -I${LOCALBASE}/include
+LFLAGS+= -L${LOCALBASE}/lib -lpq
+.endif
+
+MAKE_ARGS+= EXTRA_LIBS="${LFLAGS}"
+
+post-patch:
+ @${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" \
+ ${WRKSRC}/Makefile ${WRKSRC}/traff.c
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/traff ${PREFIX}/sbin
+. if !exists(${PREFIX}/etc/traff.conf)
+ ${INSTALL_DATA} ${WRKSRC}/traff.conf ${PREFIX}/etc
+. endif
+ ${INSTALL_DATA} ${WRKSRC}/traff.conf ${PREFIX}/etc/traff.conf.default
+
+.include <bsd.port.post.mk>
diff --git a/net/traff/distinfo b/net/traff/distinfo
new file mode 100644
index 000000000000..7a0895f7cd81
--- /dev/null
+++ b/net/traff/distinfo
@@ -0,0 +1,2 @@
+MD5 (traff-0.6.1.tar.gz) = f631f4e16a81538b5dda1ae7540902f7
+SIZE (traff-0.6.1.tar.gz) = 26371
diff --git a/net/traff/files/patch-Makefile b/net/traff/files/patch-Makefile
new file mode 100644
index 000000000000..748e8e238343
--- /dev/null
+++ b/net/traff/files/patch-Makefile
@@ -0,0 +1,20 @@
+--- Makefile.orig Tue Sep 27 19:11:33 2005
++++ Makefile Tue Sep 27 19:12:24 2005
+@@ -5,13 +5,13 @@
+ #LFLAGS= -lcurses
+
+ # Directories
+-BINDIR = /usr/local/sbin
+-ETCDIR = /etc
++BINDIR = %%PREFIX%%/sbin
++ETCDIR = %%PREFIX%%/etc
+
+ # fuer i386 auskommentieren
+-CFLAGS = -g -D_REENTRANT -DwithMYSQL -DwithPGSQL
++#CFLAGS = -g -D_REENTRANT -DwithMYSQL -DwithPGSQL
+
+-LFLAGS = -lpcap -lpthread -lpq -lmysqlclient
++LFLAGS = -lpcap $(EXTRA_LIBS)
+
+ MODULES = traff.o readconfig.o ip_table.o
+
diff --git a/net/traff/files/patch-readconfig.h b/net/traff/files/patch-readconfig.h
new file mode 100644
index 000000000000..36d7ea44b00f
--- /dev/null
+++ b/net/traff/files/patch-readconfig.h
@@ -0,0 +1,11 @@
+--- readconfig.h.orig Wed Feb 13 06:54:06 2002
++++ readconfig.h Tue Sep 27 19:33:19 2005
+@@ -14,7 +14,7 @@
+ #endif
+
+ #if withPGSQL
+-#include <postgresql/libpq-fe.h>
++#include <libpq-fe.h>
+ #endif
+
+ #include <pcap.h>
diff --git a/net/traff/files/patch-traff.c b/net/traff/files/patch-traff.c
new file mode 100644
index 000000000000..358781742942
--- /dev/null
+++ b/net/traff/files/patch-traff.c
@@ -0,0 +1,28 @@
+--- traff.c.orig Fri Feb 1 16:10:22 2002
++++ traff.c Tue Sep 27 18:04:32 2005
+@@ -135,7 +135,7 @@
+ DEBUG(printf("Reading Config\n");)
+ config = (t_config *) malloc(sizeof(t_config));
+ // reading config file
+- config_init(config,"/etc/traff.conf"); // this function will initialize configuration
++ config_init(config,"%%PREFIX%%/etc/traff.conf"); // this function will initialize configuration
+ config->dt = time(0);
+
+ DEBUG(print_config();)
+@@ -467,14 +467,8 @@
+ bzero(my_query, QUERYLENGTH);
+ DEBUG(printf("Initializing Mysql\n");)
+ mysql_init(&mysql);
+- DEBUG(printf("Connecting to host %s, db %s, table %s using login %s, password %s\n",cat->sql->host,cat->sql->db, cat->sql->table,cat->sql->user,cat->sql->password);)
+- mysql_connect(&mysql,cat->sql->host,cat->sql->user,cat->sql->password);
+- if (mysql_errno(&mysql)) {
+- fprintf(stderr,"Error connecting to Mysql-Database in category %s:\n%d, %s\n",cat->name, mysql_errno(&mysql),mysql_error(&mysql));
+- syslog(LOG_ERR,"Error connecting to Mysql-Database in category %s:\n%d, %s\n",cat->name, mysql_errno(&mysql),mysql_error(&mysql));
+- return 1;
+- }
+- mysql_select_db(&mysql,cat->sql->db);
++ DEBUG(printf("Connecting to host %s, db %s, table %s using login %s, password %s\n",cat->sql->host,cat->sql->db, cat->sql->table,cat->sql->user,cat->sql->password,cat->sql->db,0,NULL,0);)
++ mysql_real_connect(&mysql,cat->sql->host,cat->sql->user,cat->sql->password,cat->sql->db,0,NULL,0);
+ if (mysql_errno(&mysql)) {
+ fprintf(stderr,"Error connecting to Mysql-Database in category %s:\n%d, %s\n",cat->name, mysql_errno(&mysql),mysql_error(&mysql));
+ syslog(LOG_ERR,"Error connecting to Mysql-Database in category %s:\n%d, %s\n",cat->name, mysql_errno(&mysql),mysql_error(&mysql));
diff --git a/net/traff/files/patch-traff.conf b/net/traff/files/patch-traff.conf
new file mode 100644
index 000000000000..540929016337
--- /dev/null
+++ b/net/traff/files/patch-traff.conf
@@ -0,0 +1,18 @@
+--- traff.conf.orig Fri Feb 1 16:11:44 2002
++++ traff.conf Tue Sep 27 17:34:05 2005
+@@ -1,13 +1,13 @@
+ # SAmple configuration File
+ # Lines starting with a # are comments
+
+-Devices eth0 eth1 #Diveces where traff should listen to
++Devices fxp0 fxp1 #Diveces where traff should listen to
+ Period 30 #Time in seconds in witch table is dumped
+ #Buffersize 800 # At the moment hardcoded to 500. This will work
+
+
+ Cat Test
+- primary account 127.0.0.0 255.255.255.0 0
++ primary account 0.0.0.0 0.0.0.0 0 # define here your class
+ secondary account 0.0.0.0 0.0.0.0 0
+ timedivider 300
+ bytedivider 1
diff --git a/net/traff/files/traff.sh.in b/net/traff/files/traff.sh.in
new file mode 100644
index 000000000000..b37a8b173fc4
--- /dev/null
+++ b/net/traff/files/traff.sh.in
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+#
+# PROVIDE: traff
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable traff:
+#
+# traff_enable="YES"
+#
+#
+
+. %%RC_SUBR%%
+
+name=traff
+rcvar=`set_rcvar`
+
+
+command=%%PREFIX%%/sbin/traff
+pidfile=/var/run/traff.pid
+required_files=%%PREFIX%%/etc/traff.conf
+
+stop_postcmd=stop_postcmd
+
+stop_postcmd()
+{
+ rm -f $pidfile
+}
+
+# set defaults
+
+traff_enable=${traff_enable:-"NO"}
+
+load_rc_config $name
+run_rc_command "$1"
+
diff --git a/net/traff/pkg-descr b/net/traff/pkg-descr
new file mode 100644
index 000000000000..fab23bef9743
--- /dev/null
+++ b/net/traff/pkg-descr
@@ -0,0 +1,10 @@
+WHAT IS IT?
+ Traff is a program that attaches itself to one or more
+ network interfaces, sniffs all IP-packages passing at it and
+ accounts each packets size. The collected information can be
+ dumped to a mysql-Database, for further processing.
+ The configuration is very flexible, allowing you to create
+ different/multiple accounting rules.
+COPYRIGHT
+ Copyright (C) 2001 - Hans Marcus Kr<FC>ger <hanskruger at iname.com>,
+ Porter - Dan Caescu <dan.caescu at netcaetera.ro> <daniel at freebsd.ro>
diff --git a/net/traff/pkg-plist b/net/traff/pkg-plist
new file mode 100644
index 000000000000..64422a1f38b6
--- /dev/null
+++ b/net/traff/pkg-plist
@@ -0,0 +1,3 @@
+@unexec if cmp -s %D/etc/traff.conf %D/etc/traff.conf.default; then rm -f %D/etc/traff.conf; fi
+etc/traff.conf.default
+sbin/traff