diff options
author | Markus Ullmann <jokey@gentoo.org> | 2007-02-01 21:35:33 +0000 |
---|---|---|
committer | Markus Ullmann <jokey@gentoo.org> | 2007-02-01 21:35:33 +0000 |
commit | f621eda434f4e6f04ad5e2bfdd7179b27cf1c373 (patch) | |
tree | b246695e6dc4f72ad4f236e14c3bdd6a2544e0c4 /net-analyzer/darkstat/files | |
parent | stable on x86 (diff) | |
download | gentoo-2-f621eda434f4e6f04ad5e2bfdd7179b27cf1c373.tar.gz gentoo-2-f621eda434f4e6f04ad5e2bfdd7179b27cf1c373.tar.bz2 gentoo-2-f621eda434f4e6f04ad5e2bfdd7179b27cf1c373.zip |
cleanup
(Portage version: 2.1.2-r1)
Diffstat (limited to 'net-analyzer/darkstat/files')
-rw-r--r-- | net-analyzer/darkstat/files/darkstat-confd | 17 | ||||
-rw-r--r-- | net-analyzer/darkstat/files/darkstat-confd2 | 8 | ||||
-rw-r--r-- | net-analyzer/darkstat/files/darkstat-confd3 | 13 | ||||
-rw-r--r-- | net-analyzer/darkstat/files/darkstat-init | 48 | ||||
-rw-r--r-- | net-analyzer/darkstat/files/darkstat-init2 | 20 | ||||
-rw-r--r-- | net-analyzer/darkstat/files/darkstat-init3 | 56 | ||||
-rw-r--r-- | net-analyzer/darkstat/files/digest-darkstat-2.6-r1 | 3 | ||||
-rw-r--r-- | net-analyzer/darkstat/files/ipcheck.patch | 118 |
8 files changed, 55 insertions, 228 deletions
diff --git a/net-analyzer/darkstat/files/darkstat-confd b/net-analyzer/darkstat/files/darkstat-confd index 2fa30dff4561..ea03a0376815 100644 --- a/net-analyzer/darkstat/files/darkstat-confd +++ b/net-analyzer/darkstat/files/darkstat-confd @@ -1,4 +1,13 @@ -# Config file for /etc/init.d/darkstat -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/darkstat/files/darkstat-confd,v 1.2 2004/07/18 03:46:13 dragonheart Exp $ -# Set preferred options here -DARKSTAT_OPTS="-i ppp0" +# The interface to listen on +# Use only with /etc/init.d/darkstat init script. If you use +# /etc/init.d/darkstat.if init script, then this option should be ignored. +#INTERFACE="eth0" + +# The port for the embedded webserver +#PORT="667" + +# The address embedded webserver should bind to +#ADDRESS="0.0.0.0" + +# Set the filter. See tcpdump documenation for details. +#FILTER="" diff --git a/net-analyzer/darkstat/files/darkstat-confd2 b/net-analyzer/darkstat/files/darkstat-confd2 deleted file mode 100644 index a54d0a245356..000000000000 --- a/net-analyzer/darkstat/files/darkstat-confd2 +++ /dev/null @@ -1,8 +0,0 @@ -# /etc/conf.d/darkstat -# Config file for /etc/init.d/darkstat -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/darkstat/files/darkstat-confd2,v 1.1 2006/07/08 02:30:32 vanquirius Exp $ - -# Set preferred options here -DARKSTAT_OPTS="-i eth0" diff --git a/net-analyzer/darkstat/files/darkstat-confd3 b/net-analyzer/darkstat/files/darkstat-confd3 deleted file mode 100644 index ea03a0376815..000000000000 --- a/net-analyzer/darkstat/files/darkstat-confd3 +++ /dev/null @@ -1,13 +0,0 @@ -# The interface to listen on -# Use only with /etc/init.d/darkstat init script. If you use -# /etc/init.d/darkstat.if init script, then this option should be ignored. -#INTERFACE="eth0" - -# The port for the embedded webserver -#PORT="667" - -# The address embedded webserver should bind to -#ADDRESS="0.0.0.0" - -# Set the filter. See tcpdump documenation for details. -#FILTER="" diff --git a/net-analyzer/darkstat/files/darkstat-init b/net-analyzer/darkstat/files/darkstat-init index d6e0c7414dba..7b8c2c298e1b 100644 --- a/net-analyzer/darkstat/files/darkstat-init +++ b/net-analyzer/darkstat/files/darkstat-init @@ -1,20 +1,56 @@ #!/sbin/runscript -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/darkstat/files/darkstat-init,v 1.3 2004/08/14 13:39:25 swegener Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/darkstat/files/darkstat-init,v 1.4 2007/02/01 21:35:33 jokey Exp $ + +IF=${SVCNAME##*.} + +if [[ -n "${IF}" && ${SVCNAME} != "darkstat" ]] ; then + PIDFILE=/var/run/darkstat.${IF}.pid +else + PIDFILE=/var/run/darkstat.pid +fi depend() { need net } +chkconfig() { + if [[ -n "${IF}" && ${SVCNAME} != "darkstat" ]] ; then + if [[ ! -f "/etc/conf.d/darkstat.${IF}" ]]; then + eerror "/etc/conf.d/darkstat.${IF} does not exist. Please, create." + return 1 + fi + INTERFACE=${IF} + else + if [[ ! -f "/etc/conf.d/darkstat" ]]; then + eerror "/etc/conf.d/darkstat does not exist. Please, create." + return 1 + fi + fi + + if [[ -z "${INTERFACE}" ]]; then + ewarn "No interface specified. Trying to use eth0." + INTERFACE="eth0" + fi + + DARKSTAT_OPTS="-i ${INTERFACE}" + [[ -n "${PORT}" ]] && DARKSTAT_OPTS="${DARKSTAT_OPTS} -p ${PORT}" + [[ -n "${ADDRESS}" ]] && DARKSTAT_OPTS="${DARKSTAT_OPTS} -b ${ADDRESS}" + [[ -n "${FILTER}" ]] && DARKSTAT_OPTS="${DARKSTAT_OPTS} -f ${FILTER}" + return 0 +} + start() { - ebegin "Starting darkstat" - start-stop-daemon --start --quiet --exec /usr/sbin/darkstat -- --detach -d /var/spool/darkstat ${DARKSTAT_OPTS} >/dev/null + chkconfig || return 1 + ebegin "Starting darkstat on ${INTERFACE}" + # Remove --background option for debugging. + start-stop-daemon --start --exec /usr/sbin/darkstat --pidfile ${PIDFILE} --make-pidfile --background -- ${DARKSTAT_OPTS} eend $? } stop() { - ebegin "Stopping darkstat" - start-stop-daemon --stop --quiet --retry 5 --exec /usr/sbin/darkstat + ebegin "Stopping darkstat on ${INTERFACE}" + start-stop-daemon --stop --quiet --retry 5 --pidfile ${PIDFILE} eend $? } diff --git a/net-analyzer/darkstat/files/darkstat-init2 b/net-analyzer/darkstat/files/darkstat-init2 deleted file mode 100644 index abcd54d62112..000000000000 --- a/net-analyzer/darkstat/files/darkstat-init2 +++ /dev/null @@ -1,20 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/darkstat/files/darkstat-init2,v 1.1 2006/07/08 02:30:32 vanquirius Exp $ - -depend() { - need net -} - -start() { - ebegin "Starting darkstat" - start-stop-daemon --start --quiet --exec /usr/sbin/darkstat -- -d /var/spool/darkstat ${DARKSTAT_OPTS} >/dev/null - eend $? -} - -stop() { - ebegin "Stopping darkstat" - start-stop-daemon --stop --quiet --retry 5 --exec /usr/sbin/darkstat - eend $? -} diff --git a/net-analyzer/darkstat/files/darkstat-init3 b/net-analyzer/darkstat/files/darkstat-init3 deleted file mode 100644 index d8fff55b982c..000000000000 --- a/net-analyzer/darkstat/files/darkstat-init3 +++ /dev/null @@ -1,56 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/darkstat/files/darkstat-init3,v 1.1 2006/10/31 13:31:00 pva Exp $ - -IF=${SVCNAME##*.} - -if [[ -n "${IF}" && ${SVCNAME} != "darkstat" ]] ; then - PIDFILE=/var/run/darkstat.${IF}.pid -else - PIDFILE=/var/run/darkstat.pid -fi - -depend() { - need net -} - -chkconfig() { - if [[ -n "${IF}" && ${SVCNAME} != "darkstat" ]] ; then - if [[ ! -f "/etc/conf.d/darkstat.${IF}" ]]; then - eerror "/etc/conf.d/darkstat.${IF} does not exist. Please, create." - return 1 - fi - INTERFACE=${IF} - else - if [[ ! -f "/etc/conf.d/darkstat" ]]; then - eerror "/etc/conf.d/darkstat does not exist. Please, create." - return 1 - fi - fi - - if [[ -z "${INTERFACE}" ]]; then - ewarn "No interface specified. Trying to use eth0." - INTERFACE="eth0" - fi - - DARKSTAT_OPTS="-i ${INTERFACE}" - [[ -n "${PORT}" ]] && DARKSTAT_OPTS="${DARKSTAT_OPTS} -p ${PORT}" - [[ -n "${ADDRESS}" ]] && DARKSTAT_OPTS="${DARKSTAT_OPTS} -b ${ADDRESS}" - [[ -n "${FILTER}" ]] && DARKSTAT_OPTS="${DARKSTAT_OPTS} -f ${FILTER}" - return 0 -} - -start() { - chkconfig || return 1 - ebegin "Starting darkstat on ${INTERFACE}" - # Remove --background option for debugging. - start-stop-daemon --start --exec /usr/sbin/darkstat --pidfile ${PIDFILE} --make-pidfile --background -- ${DARKSTAT_OPTS} - eend $? -} - -stop() { - ebegin "Stopping darkstat on ${INTERFACE}" - start-stop-daemon --stop --quiet --retry 5 --pidfile ${PIDFILE} - eend $? -} diff --git a/net-analyzer/darkstat/files/digest-darkstat-2.6-r1 b/net-analyzer/darkstat/files/digest-darkstat-2.6-r1 deleted file mode 100644 index 1e88cf55cd5f..000000000000 --- a/net-analyzer/darkstat/files/digest-darkstat-2.6-r1 +++ /dev/null @@ -1,3 +0,0 @@ -MD5 0a1a407acb6f9b35a46d64885c30d08d darkstat-2.6.tar.gz 230950 -RMD160 139d938033ad7e98505e006747f64285136a1f06 darkstat-2.6.tar.gz 230950 -SHA256 de84a7a9ef1f8abdc8eecd3faeb562fd4bf72f6fb605129fa1b1254a4f4573b0 darkstat-2.6.tar.gz 230950 diff --git a/net-analyzer/darkstat/files/ipcheck.patch b/net-analyzer/darkstat/files/ipcheck.patch deleted file mode 100644 index b51296c878f9..000000000000 --- a/net-analyzer/darkstat/files/ipcheck.patch +++ /dev/null @@ -1,118 +0,0 @@ -diff -ur darkstat-2.6/src/acct.c darkstat-2.6-patched/src/acct.c ---- darkstat-2.6/src/acct.c 2003-11-07 09:47:00.000000000 +0100 -+++ darkstat-2.6-patched/src/acct.c 2004-07-16 18:34:19.070212872 +0200 -@@ -20,11 +20,13 @@ - #if defined(sun) && (defined(__svr4__) || defined(__SVR4)) - #include <sys/sockio.h> - #endif -+#include <errno.h> - - int64 num_packets, total_data; --dword local_ip = 0, lan_ip = 0xFFFFFFFF, lan_mask = 0; -+dword local_ip = 0, lan_ip = 0xFFFFFFFF, lan_mask = 0, check_ip = 0; - int acct_linktype = 0; --time_t t_start, t_already = 0, t_lastsave = 0; -+time_t t_start, t_already = 0, t_lastsave = 0, t_lastipcheck = 0; -+int network_down = 0; - pcap_t *acct_pcap = NULL; - host_record *local_host_rec; - -@@ -367,22 +369,10 @@ - } - - -- --void acct_main(void *ignored unused) -+void init_pcap(void) - { - char err[PCAP_ERRBUF_SIZE]; - -- if (!local_ip) local_ip = get_local_ip(acctdev); -- printf("Sniffing on device %s, local IP is ", acctdev); -- print_addr(local_ip); -- putchar('\n'); -- -- init_db(); -- init_graph(); -- load_db(db_file); -- -- local_host_rec = host_from_ip(local_ip); -- - err[0] = '\0'; /* zero length string */ - acct_pcap = pcap_open_live(acctdev, 100, promisc, PCAP_TIMEOUT, err); - if (!acct_pcap) -@@ -418,7 +408,23 @@ - #endif - } - -+} -+ -+ -+void acct_main(void *ignored unused) -+{ -+ if (!local_ip) local_ip = get_local_ip(acctdev); -+ printf("Sniffing on device %s, local IP is ", acctdev); -+ print_addr(local_ip); -+ putchar('\n'); -+ -+ init_db(); -+ init_graph(); -+ load_db(db_file); -+ -+ local_host_rec = host_from_ip(local_ip); - -+ init_pcap(); - - t_lastsave = t_start = time(NULL); - acct_linktype = pcap_datalink(acct_pcap); -@@ -432,13 +438,38 @@ - { - struct pcap_stat ps; - -+ /* check if we still have the same IP from time to time */ -+ if (time(NULL) - t_lastipcheck > IPCHECK_TIME) -+ { -+ t_lastipcheck = time(NULL); -+ check_ip = get_local_ip(acctdev); -+ if (local_ip != check_ip) -+ { -+ printf("New IP "); -+ print_addr(check_ip); -+ printf(" detected, old IP was "); -+ print_addr(local_ip); -+ putchar('\n'); -+ local_ip = check_ip; -+ network_down = 0; -+ init_pcap(); -+ } -+ } -+ -+ if (network_down) -+ continue; -+ - /* capture some packets for accounting */ - if (pcap_dispatch(acct_pcap, -1, - (pcap_handler)handle_pkt, NULL) == -1) - { - printf("Error: pcap_dispatch(): %s\n", - pcap_geterr(acct_pcap)); -- FAIL(); -+ if (errno == ENETDOWN) { -+ network_down = 1; -+ } else { -+ FAIL(); -+ } - } - - /* print out cap statistics */ -diff -ur darkstat-2.6/src/darkstat.h darkstat-2.6-patched/src/darkstat.h ---- darkstat-2.6/src/darkstat.h 2003-11-07 09:51:19.000000000 +0100 -+++ darkstat-2.6-patched/src/darkstat.h 2004-07-16 18:35:50.738277208 +0200 -@@ -52,6 +52,7 @@ - #define EXIT_SUCCESS 0 - #define EXIT_FAIL 1 - #define SAVE_TIME 60*5 /* secs inbetween DB dumps */ -+#define IPCHECK_TIME 60 /* seconds between local ip checks */ - #define MSEC 1000 /* for usleep() */ - #define SOCKET int /* WinSock? err... */ - |