diff -ruN darkstat-2.5/README.Debian darkstat-2.5.new/README.Debian --- darkstat-2.5/README.Debian 1969-12-31 19:00:00.000000000 -0500 +++ darkstat-2.5.new/README.Debian 2003-03-17 23:19:31.000000000 -0500 @@ -0,0 +1,23 @@ +darkstat for Debian +------------------- + +INIT SCRIPTS: + +Since version 2.3-2, the darkstat package has two init scripts: + - /etc/init.d/darkstat, to start/stop the daemon, + - /etc/darkstat/init.cfg, to configure the settings of the daemon. + +The /etc/init.d/darkstat start/stop commands will not be started until the START_DARKSTAT option is set to "no". + + +INIT SCRIPT BUGS: + +darkstat has not been programmed to act as a daemon, so the --backgound parameter of the start-stop-daemon is used as a workaround. Be sure of your configuration (init.cfg), because if something is wrong the darkstat error messages will not be displayed on your terminal, and there is no log files. + +Darkstat is 'hard' to kill. This is due to the dns thread of darkstat that can be waiting the result of the gethostbyaddr function till the resolver timeout (timeout defined in /etc/resolv.conf) is reached. So I use the --name option of start-stop-daemon to find the running darkstat process. + + +SOURCE CHANGES: + +darkstat is able to create a pidfile, but only in the same directory than the database files (-d switch). So I added in the source code the -r switch to specify which directory to use to create the pidfile. +Now, database files are stored in /var/lib/darkstat, and the pidfile is /var/run/darkstat.pid. diff -ruN darkstat-2.5/darkstat-init.sh darkstat-2.5.new/darkstat-init.sh --- darkstat-2.5/darkstat-init.sh 1969-12-31 19:00:00.000000000 -0500 +++ darkstat-2.5.new/darkstat-init.sh 2003-03-17 23:19:37.000000000 -0500 @@ -0,0 +1,27 @@ +#! /bin/sh + +source @FINKPREFIX@/bin/init.sh + +DAEMON="@FINKPREFIX@/sbin/darkstat" +NAME="darkstat" +INIT="@FINKPREFIX@/etc/darkstat.config" +PIDFILE="@FINKPREFIX@/var/run/$NAME.pid" +DIR="@FINKPREFIX@/var/lib/darkstat" + +test -f $DAEMON || exit 0 + +test -f $INIT || exit 0 + +. $INIT + +$DAEMON $INTERFACE \ + $PORT \ + -d $DIR \ + -r $PIDFILE \ + $BINDIP \ + $LOCAL \ + $FIP \ + $DNS \ + $SPY --detach + +exit 0 diff -ruN darkstat-2.5/darkstat.config darkstat-2.5.new/darkstat.config --- darkstat-2.5/darkstat.config 1969-12-31 19:00:00.000000000 -0500 +++ darkstat-2.5.new/darkstat.config 2003-03-17 23:19:37.000000000 -0500 @@ -0,0 +1,12 @@ +# Don't forget to read the man page. + +# You must set this option, else darkstat may not listen to +# the interface you want +INTERFACE="-i en0" + +#PORT="-p 666" +#BINDIP="-b localhost" +#LOCAL="-l 192.168.0.0/24" +#FIP="-f localhost" +#DNS="-n" +#SPY="-spy en0" diff -ruN darkstat-2.5/debian/config darkstat-2.5.new/debian/config --- darkstat-2.5/debian/config 1969-12-31 19:00:00.000000000 -0500 +++ darkstat-2.5.new/debian/config 2003-03-20 13:16:18.000000000 -0500 @@ -0,0 +1,18 @@ +#!/bin/sh -e + +# Source debconf library. +. @FINKPREFIX@/share/debconf/confmodule + +if [ "$1" = "configure" -a "$2" != "" ]; then + for note in init_script-2.5-1 + do + ver=${note#*-} + if dpkg --compare-versions "$2" lt "$ver"; then + db_input medium "darkstat/upgrade-note/$note" || true + fi + done +fi + +db_input medium "darkstat/configure-question/startup_script-2.5-1" || true + +db_go diff -ruN darkstat-2.5/debian/control darkstat-2.5.new/debian/control --- darkstat-2.5/debian/control 1969-12-31 19:00:00.000000000 -0500 +++ darkstat-2.5.new/debian/control 2003-03-17 23:19:37.000000000 -0500 @@ -0,0 +1,17 @@ +Source: darkstat +Section: net +Priority: optional +Maintainer: Cédric Delfosse +Build-Depends: debhelper (>> 3.0.0), libpcap-dev, autotools-dev +Standards-Version: 3.5.7 + +Package: darkstat +Architecture: any +Depends: ${shlibs:Depends}, debconf (>= 1.2.9) +Description: a network traffic analyzer + It is a packet sniffer which runs as a background process and serves its + statistics to a web browser: + - input and output IP traffic by machines, ports and protocols, + - last minute, hourly, daily and monthly global input and output graphics. + . + It is known to be smaller (in terms of memory footprint) and stabler than ntop. diff -ruN darkstat-2.5/debian/copyright darkstat-2.5.new/debian/copyright --- darkstat-2.5/debian/copyright 1969-12-31 19:00:00.000000000 -0500 +++ darkstat-2.5.new/debian/copyright 2003-03-17 23:19:37.000000000 -0500 @@ -0,0 +1,28 @@ +This package was debianized by Cédric Delfosse on +Mon, 27 May 2002 20:17:47 +0200. + +It was downloaded from http://purl.org/net/darkstat + +Upstream Author: Emil Mikulic + +Copyright: + +Copyright (c) 2001-2002, Emil Mikulic. + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 dated June, 1991. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + +On Debian GNU/Linux systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + diff -ruN darkstat-2.5/debian/templates darkstat-2.5.new/debian/templates --- darkstat-2.5/debian/templates 1969-12-31 19:00:00.000000000 -0500 +++ darkstat-2.5.new/debian/templates 2003-03-20 13:13:55.000000000 -0500 @@ -0,0 +1,14 @@ +Template: darkstat/upgrade-note/init_script-2.5-1 +Type: note +Description: New configure options + The darkstat package is now featuring a daemonic script to manage darkstat start actions. + . + Please put your settings in @FINKPREFIX@/etc/darkstat.config and read @FINKPREFIX@/share/doc/darkstat/README.Debian for more information. + +Template: darkstat/configure-question/startup_script-2.5-1 +Type: boolean +Default: false +Description: Enable at startup? + The darkstat package is now featuring a daemonic script to manage darkstat start actions. Do you want darkstat to automatically be run at system startup? + . + Remember, this takes affect at the *next* reboot. To activate daemonic now, run /Library/StartupItems/daemonic-darkstat/daemonic-darkstat as root. diff -ruN darkstat-2.5/src/darkstat.c darkstat-2.5.new/src/darkstat.c --- darkstat-2.5/src/darkstat.c 2003-01-03 22:09:57.000000000 -0500 +++ darkstat-2.5.new/src/darkstat.c 2003-03-17 23:19:37.000000000 -0500 @@ -30,6 +30,7 @@ #include #include #include +#define __USE_GNU #include #include #if defined(sun) && (defined(__svr4__) || defined(__SVR4)) @@ -279,6 +280,16 @@ fprefix = build_str("%s%s", argv[i], argv[i][strlen(argv[i])-1] == '/'?"":"/"); } + else if (strcmp(argv[i], "-r") == 0) + { + i++; + if ((argc < i+1) || (argv[i][0] == '-')) + { + printf("Pidfile not specified!\n\n"); + return EXIT_FAIL; + } + pid_file = strndup(argv[i], 255); + } else if ((strcmp(argv[i], "-V") == 0) || (strcmp(argv[i], "--version") == 0)) { @@ -414,7 +425,7 @@ return EXIT_FAIL; } - pid_file = build_str("%s" PID_FILE_NAME, fprefix); + if (pid_file) { FILE *fp = fopen(pid_file, "w"); if (!fp) perror("Warning: can't write pidfile");