diff options
author | Marius Mauch <genone@gentoo.org> | 2004-07-21 17:28:38 +0000 |
---|---|---|
committer | Marius Mauch <genone@gentoo.org> | 2004-07-21 17:28:38 +0000 |
commit | ec70ea17472aade45accd72a33f2439c747768bf (patch) | |
tree | 66338d9852f5e381fe8f05ee4142ea71e4fa1f0e /net-analyzer/darkstat | |
parent | added net-analyzer/net-snmp:lm_sensors (diff) | |
download | historical-ec70ea17472aade45accd72a33f2439c747768bf.tar.gz historical-ec70ea17472aade45accd72a33f2439c747768bf.tar.bz2 historical-ec70ea17472aade45accd72a33f2439c747768bf.zip |
new patch for dynamic IPs
Diffstat (limited to 'net-analyzer/darkstat')
-rw-r--r-- | net-analyzer/darkstat/ChangeLog | 8 | ||||
-rw-r--r-- | net-analyzer/darkstat/Manifest | 11 | ||||
-rw-r--r-- | net-analyzer/darkstat/darkstat-2.6-r1.ebuild | 43 | ||||
-rw-r--r-- | net-analyzer/darkstat/files/digest-darkstat-2.6-r1 | 1 | ||||
-rw-r--r-- | net-analyzer/darkstat/files/ipcheck.patch | 118 |
5 files changed, 176 insertions, 5 deletions
diff --git a/net-analyzer/darkstat/ChangeLog b/net-analyzer/darkstat/ChangeLog index 34a13772c800..2ababf6158e0 100644 --- a/net-analyzer/darkstat/ChangeLog +++ b/net-analyzer/darkstat/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for net-analyzer/darkstat # Copyright 2000-2004 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/darkstat/ChangeLog,v 1.6 2004/07/13 07:35:52 hansmi Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/darkstat/ChangeLog,v 1.7 2004/07/21 17:28:38 genone Exp $ + +*darkstat-2.6-r1 (21 Jul 2004) + + 21 Jul 2004; Marius Mauch <genone@gentoo.org> +files/ipcheck.patch, + +darkstat-2.6-r1.ebuild: + Addeing a patch to make it more reliable when the host has a dynamic IP. 13 Jul 2004; Michael Hanselmann <hansmi@gentoo.org> darkstat-2.6.ebuild: Added to ~ppc. diff --git a/net-analyzer/darkstat/Manifest b/net-analyzer/darkstat/Manifest index 760ee17657fe..2eeb2ccfa8d2 100644 --- a/net-analyzer/darkstat/Manifest +++ b/net-analyzer/darkstat/Manifest @@ -1,18 +1,21 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -MD5 d30cc6f7d0b91709b1d0e1a4d8914bae ChangeLog 894 MD5 6d712e4ffb73b80483aeff7101ff9950 darkstat-2.5.ebuild 971 MD5 f95c4429615a9f4be3f0fa60e05599af darkstat-2.6.ebuild 1015 MD5 7e285f080272b311b0eb8b0028928e07 metadata.xml 219 +MD5 3d523c2b2ff00c3e082c49b3772481fe ChangeLog 1099 +MD5 cb773127d924e584ae66417a9eb8d62f darkstat-2.6-r1.ebuild 1071 MD5 44483f0b13561a54b68949145198339f files/darkstat-confd 214 MD5 4c5840c8f77c7a56b0541eaaabbfd46d files/darkstat-init 461 MD5 11a0d835bd33988a1e21544896d0374e files/digest-darkstat-2.5 64 MD5 65647b954a76c7c35eef2f47dfdb5355 files/digest-darkstat-2.6 64 +MD5 178efb20612f2c23ec93b9f9a3ddb69c files/ipcheck.patch 3003 +MD5 65647b954a76c7c35eef2f47dfdb5355 files/digest-darkstat-2.6-r1 64 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) -iD8DBQFA+fRJmdTrptrqvGERAnvmAJwOeuiYksFnCwrvWL6MyoM3y2b2YgCfY7Ji -NQtEeRcUN8w0AdXrN1iurfM= -=T/ob +iD8DBQFA/qfW6J2i8a8J4okRAh6QAJ9o5lfS9zNynVgH9fm5vrCm5LYXJwCcDf49 +qTRDZj2/sgVETAVXEKk9/LY= +=swZ6 -----END PGP SIGNATURE----- diff --git a/net-analyzer/darkstat/darkstat-2.6-r1.ebuild b/net-analyzer/darkstat/darkstat-2.6-r1.ebuild new file mode 100644 index 000000000000..527c3160e8bb --- /dev/null +++ b/net-analyzer/darkstat/darkstat-2.6-r1.ebuild @@ -0,0 +1,43 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/darkstat/darkstat-2.6-r1.ebuild,v 1.1 2004/07/21 17:28:38 genone Exp $ + +inherit eutils + +DESCRIPTION="darkstat is a network traffic analyzer" +HOMEPAGE="http://dmr.ath.cx/net/darkstat/" +SRC_URI="http://dmr.ath.cx/net/darkstat/${P}.tar.gz" + +KEYWORDS="~x86 ~ppc" +IUSE="nls" +LICENSE="GPL-2" +SLOT="0" + +DEPEND=">=net-libs/libpcap-0.7.1 + nls? ( sys-devel/gettext ) " +RDEPEND="" + +src_compile() { + epatch ${FILESDIR}/ipcheck.patch + + use nls && myconf="`use_with nls`" + ./configure \ + --host=${CHOST} \ + --prefix=/usr \ + --infodir=/usr/share/info \ + --mandir=/usr/share/man \ + ${myconf} || die "./configure failed" + emake || die +} + +src_install() { + make DESTDIR=${D} install || die + + dodir /var/spool/darkstat + + dodoc ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL ISSUES NEWS README TODO + + exeinto /etc/init.d ; newexe ${FILESDIR}/darkstat-init darkstat + insinto /etc/conf.d ; newins ${FILESDIR}/darkstat-confd darkstat +} + diff --git a/net-analyzer/darkstat/files/digest-darkstat-2.6-r1 b/net-analyzer/darkstat/files/digest-darkstat-2.6-r1 new file mode 100644 index 000000000000..8793cd5ed65e --- /dev/null +++ b/net-analyzer/darkstat/files/digest-darkstat-2.6-r1 @@ -0,0 +1 @@ +MD5 0a1a407acb6f9b35a46d64885c30d08d darkstat-2.6.tar.gz 230950 diff --git a/net-analyzer/darkstat/files/ipcheck.patch b/net-analyzer/darkstat/files/ipcheck.patch new file mode 100644 index 000000000000..b51296c878f9 --- /dev/null +++ b/net-analyzer/darkstat/files/ipcheck.patch @@ -0,0 +1,118 @@ +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... */ + |