From oddbjorn@tricknology.org Fri Mar 19 16:26:17 1999 Return-Path: Received: from tricknology.org (ti21a96-0131.dialup.online.no [130.67.198.3]) by hub.freebsd.org (Postfix) with ESMTP id DCD9914FED for ; Fri, 19 Mar 1999 16:26:02 -0800 (PST) (envelope-from oddbjorn@tricknology.org) Received: (from oddbjorn@localhost) by tricknology.org (8.9.2/8.8.8) id AAA41151; Sat, 20 Mar 1999 00:21:52 +0100 (CET) (envelope-from oddbjorn) Message-Id: <199903192321.AAA41151@tricknology.org> Date: Sat, 20 Mar 1999 00:21:52 +0100 (CET) From: Oddbjorn Steffensen Reply-To: oddbjorn@tricknology.org To: FreeBSD-gnats-submit@freebsd.org Subject: new port for bpft-2.0 X-Send-Pr-Version: 3.2 >Number: 10679 >Category: ports >Synopsis: new port for bpft-2.0 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: closed >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Mar 19 16:30:00 PST 1999 >Closed-Date: Fri Apr 2 17:50:43 PST 1999 >Last-Modified: Fri Apr 2 17:51:19 PST 1999 >Originator: Oddbjorn Steffensen >Release: FreeBSD 3.1-STABLE i386 >Organization: >Environment: FreeBSD 3.1-STABLE >Description: A new port for bpft -- the BPF Traffic Collector. A few of notes : 1. bpft is a superset of trafshow, which is already in the ports collection. I'm not sure what is the best way of resolving this potential conflict -- we can set MANUAL_PACKAGE_BUILD, we can add a warning in pkg/MESSAGE or something even more elaborate. However, I can't see that for instance the various apache ports take this into account. 2. There are two patches for trafshow; I've added one of these, but the other seems to be in part implemented by this version of bpft, and the patch seem to be PPP-related, and I have no easy way to test it. I suggest that people try out this port, and we deal with the problems if they pop up. 3. The package is poorly documented, with only one man page for trafshow. The rest is documented in the README, which I copy into /usr/local/share/doc/bpft. However, I'll try to hack together some real man pages as soon as possible. 4. This is my first port, so be gentle.. :-) >How-To-Repeat: n/a >Fix: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # bpft # bpft/Makefile # bpft/README.html # bpft/files # bpft/files/md5 # bpft/patches # bpft/patches/patch-aa # bpft/patches/patch-ab # bpft/patches/patch-ac # bpft/pkg # bpft/pkg/COMMENT # bpft/pkg/DESCR # bpft/pkg/PLIST # echo c - bpft mkdir -p bpft > /dev/null 2>&1 echo x - bpft/Makefile sed 's/^X//' >bpft/Makefile << 'END-of-bpft/Makefile' X# New ports collection makefile for: bpft X# Version required: 2.0 X# Date created: 17 March 1999 X# Whom: oddbjorn@tricknology.org X# X# $Id$ X# X XDISTNAME= bpft-2.0 XCATEGORIES= net XMASTER_SITES= ftp://ftp.nsk.su/pub/unix/ XEXTRACT_SUFX= .tgz X XMAINTAINER= oddbjorn@tricknology.org X XMAN1= trafshow.1 X Xpost-install: X.if !defined(NOPORTDOCS) X ${MKDIR} ${PREFIX}/share/doc/bpft X ${INSTALL_MAN} ${WRKSRC}/README ${PREFIX}/share/doc/bpft/README X.endif X X.include END-of-bpft/Makefile echo x - bpft/README.html sed 's/^X//' >bpft/README.html << 'END-of-bpft/README.html' X X The FreeBSD Ports Collection (net/bpft) X

The FreeBSD Ports Collection ("net/bpft")


X X X

You are now in the directory for the port "net/bpft" (package name "trafshow-2.0"). X X

This is the one-line description for this port: X X


XThe BPF Traffic Collector. X


X X

Please read the file "pkg/DESCR" for a Xlonger description. X X

Go to the top of the ports tree for Xa summary on how to use the ports collection. X X

X X

X X X


X Go up one level X| X Go to top of ports tree X X END-of-bpft/README.html echo c - bpft/files mkdir -p bpft/files > /dev/null 2>&1 echo x - bpft/files/md5 sed 's/^X//' >bpft/files/md5 << 'END-of-bpft/files/md5' XMD5 (bpft-2.0.tgz) = b7a13bc81e5893931ff4662311ee744f END-of-bpft/files/md5 echo c - bpft/patches mkdir -p bpft/patches > /dev/null 2>&1 echo x - bpft/patches/patch-aa sed 's/^X//' >bpft/patches/patch-aa << 'END-of-bpft/patches/patch-aa' X*** Makefile.orig Wed Oct 30 12:38:00 1996 X--- Makefile Fri Mar 19 23:42:26 1999 X*************** X*** 11,16 **** X--- 11,17 ---- X X # Target directory for install execution files. X PATH_BINDIR=/usr/local/bin X+ PATH_SBINDIR=/usr/local/sbin X X # Target directory for install man pages. X PATH_MANDIR=/usr/local/man/man1 X*************** X*** 18,24 **** X # Trailing slash directory, summary traffic log files will be put there. X PATH_TOSAVE=/var/log/ X X! # Full pathname where locate tarfstat program. X PATH_TRAFSTAT=/usr/local/bin/trafstat X X # Where locate trafstatd log file, if you want log then file must exist. X--- 19,25 ---- X # Trailing slash directory, summary traffic log files will be put there. X PATH_TOSAVE=/var/log/ X X! # Full pathname where locate trafstat program. X PATH_TRAFSTAT=/usr/local/bin/trafstat X X # Where locate trafstatd log file, if you want log then file must exist. X*************** X*** 56,79 **** X $(MAKE) CC=$(CC) CFLAGS='$(CFLAGS)' LIB='$(LIB)') X @(cd trafstatd; echo "Build trafstatd in `pwd`"; \ X $(MAKE) CC=$(CC) CFLAGS='$(CFLAGS)' LIB='$(LIB)') X! @(cd traflog; echo "Build tarflog in `pwd`"; \ X $(MAKE) CC=$(CC) CFLAGS='$(CFLAGS)' LIB='$(LIB)') X @(cd trafshow; echo "Build trafshow in `pwd`"; \ X $(MAKE) CC=$(CC) CFLAGS='$(CFLAGS)' LIB='$(LIB)') X @echo Done. X X install: all X! install -s -o root -g $(GROUP) -m $(MODE) trafd/trafd $(PATH_BINDIR) X! install -c -o root -g $(GROUP) -m $(MODE) trafd/trafstart $(PATH_BINDIR) X! install -c -o root -g $(GROUP) -m $(MODE) trafd/trafstop $(PATH_BINDIR) X! install -c -o root -g $(GROUP) -m $(MODE) trafd/trafsave $(PATH_BINDIR) X! install -c -o root -g $(GROUP) -m $(MODE) trafd/trafdump $(PATH_BINDIR) X install -s -o root -g $(GROUP) -m $(MODE) trafstat/trafstat $(PATH_BINDIR) X! install -s -o root -g $(GROUP) -m $(MODE) trafstatd/trafstatd $(PATH_BINDIR) X! install -s -o root -g $(GROUP) -m $(MODE) traflog/traflog $(PATH_BINDIR) X install -c -o root -g $(GROUP) -m $(MODE) traflog/traflog.format $(PATH_TRAFLOG_FMT) X install -s -o root -g $(GROUP) -m $(MODE) trafshow/trafshow $(PATH_BINDIR) X! install -c -m 644 trafshow/trafshow.1 $(PATH_MANDIR) X @echo Done. X X clean: X--- 57,80 ---- X $(MAKE) CC=$(CC) CFLAGS='$(CFLAGS)' LIB='$(LIB)') X @(cd trafstatd; echo "Build trafstatd in `pwd`"; \ X $(MAKE) CC=$(CC) CFLAGS='$(CFLAGS)' LIB='$(LIB)') X! @(cd traflog; echo "Build traflog in `pwd`"; \ X $(MAKE) CC=$(CC) CFLAGS='$(CFLAGS)' LIB='$(LIB)') X @(cd trafshow; echo "Build trafshow in `pwd`"; \ X $(MAKE) CC=$(CC) CFLAGS='$(CFLAGS)' LIB='$(LIB)') X @echo Done. X X install: all X! install -s -o root -g $(GROUP) -m $(MODE) trafd/trafd $(PATH_SBINDIR) X! install -c -o root -g $(GROUP) -m $(MODE) trafd/trafstart $(PATH_BINDIR) X! install -c -o root -g $(GROUP) -m $(MODE) trafd/trafstop $(PATH_BINDIR) X! install -c -o root -g $(GROUP) -m $(MODE) trafd/trafsave $(PATH_BINDIR) X! install -c -o root -g $(GROUP) -m $(MODE) trafd/trafdump $(PATH_BINDIR) X install -s -o root -g $(GROUP) -m $(MODE) trafstat/trafstat $(PATH_BINDIR) X! install -s -o root -g $(GROUP) -m $(MODE) trafstatd/trafstatd $(PATH_SBINDIR) X! install -s -o root -g $(GROUP) -m $(MODE) traflog/traflog $(PATH_BINDIR) X install -c -o root -g $(GROUP) -m $(MODE) traflog/traflog.format $(PATH_TRAFLOG_FMT) X install -s -o root -g $(GROUP) -m $(MODE) trafshow/trafshow $(PATH_BINDIR) X! install -c -m 644 trafshow/trafshow.1 $(PATH_MANDIR) X @echo Done. X X clean: END-of-bpft/patches/patch-aa echo x - bpft/patches/patch-ab sed 's/^X//' >bpft/patches/patch-ab << 'END-of-bpft/patches/patch-ab' X*** trafd/trafstop.orig Fri Mar 19 21:03:06 1999 X--- trafd/trafstop Fri Mar 19 21:04:13 1999 X*************** X*** 6,12 **** X # X # usage: trafstop interfaces... X # X! PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin X WHERE_PID=/var/run/trafd. X LOG_FILE=/var/log/traffic.log X X--- 6,12 ---- X # X # usage: trafstop interfaces... X # X! PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin X WHERE_PID=/var/run/trafd. X LOG_FILE=/var/log/traffic.log X END-of-bpft/patches/patch-ab echo x - bpft/patches/patch-ac sed 's/^X//' >bpft/patches/patch-ac << 'END-of-bpft/patches/patch-ac' X--- lib/addrtoname.c Fri Jan 12 17:42:37 1996 X+++ lib/addrtoname.c Thu Jul 25 07:37:56 1996 X@@ -294,8 +294,8 @@ X #ifdef ETHER_SERVICE X if (!nflag) { X- cp = ETHER_ntohost(ep); X- if (cp) { X- tp->e_name = cp; X- return cp; X+ char buf[128]; X+ if (ether_ntohost(buf, ep) == 0) { X+ tp->e_name =strdup(buf); X+ return tp->e_name; X } X } X--- lib/gencode.c Wed Jan 10 12:27:13 1996 X+++ lib/gencode.c Thu Jul 25 07:43:16 1996 X@@ -841,4 +841,5 @@ X struct block *b, *tmp; X int port, real_proto; X+ static char wrk[6]; X X switch (q.addr) { X@@ -854,6 +855,9 @@ X case Q_HOST: X if (proto == Q_LINK) { X /* XXX Should lookup hw addr based on link layer */ X- eaddr = ETHER_hostton(name); X+ if (ether_hostton(name, wrk) == 0) X+ eaddr = wrk; X+ else X+ eaddr = 0; X if (eaddr == 0) X error("unknown ether host '%s'", name); X@@ -896,5 +901,9 @@ X X case Q_GATEWAY: X- eaddr = ETHER_hostton(name); X+ /* XXX Should lookup hw addr based on link layer */ X+ if (ether_hostton(name, wrk) == 0) X+ eaddr = wrk; X+ else X+ eaddr = 0; X if (eaddr == 0) X error("unknown ether host: %s", name); END-of-bpft/patches/patch-ac echo c - bpft/pkg mkdir -p bpft/pkg > /dev/null 2>&1 echo x - bpft/pkg/COMMENT sed 's/^X//' >bpft/pkg/COMMENT << 'END-of-bpft/pkg/COMMENT' XThe BPF Traffic Collector. END-of-bpft/pkg/COMMENT echo x - bpft/pkg/DESCR sed 's/^X//' >bpft/pkg/DESCR << 'END-of-bpft/pkg/DESCR' Xbpft is a superset of trafshow, and extends it by adding a daemon Xwhich collects data about network connections (src, dst, protocol Xand length). The resulting data can be dumped to a file for later Xprocessing. X XRead /usr/local/share/doc/bpft/README after installation for more Xinformation. X XTo use bpft, your kernel must be rebuilt with the following line Xadded to your kernel config file (/sys/i386/conf/): X Xpseudo-device bpfilter 4 # Berkeley packet filter X XThe number after bpfilter is the number of interfaces that can be Xexamined simultaneously. See section 6.1 of the Handbook for details. X X- oddbjorn Xoddbjorn@tricknology.org END-of-bpft/pkg/DESCR echo x - bpft/pkg/PLIST sed 's/^X//' >bpft/pkg/PLIST << 'END-of-bpft/pkg/PLIST' Xbin/trafdump Xbin/traflog Xbin/trafsave Xbin/trafshow Xbin/trafstart Xbin/trafstat Xbin/trafstop Xetc/traflog.format Xsbin/trafd Xsbin/trafstatd Xshare/doc/bpft/README X@dirrm share/doc/bpft END-of-bpft/pkg/PLIST exit >Release-Note: >Audit-Trail: State-Changed-From-To: open->closed State-Changed-By: steve State-Changed-When: Fri Apr 2 17:50:43 PST 1999 State-Changed-Why: New port committed, thanks! >Unformatted: