Subject: pkg/34158: net/darkstat update
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <bartosz@atom.eu.org>
List: pkgsrc-bugs
Date: 08/07/2006 16:45:00
>Number:         34158
>Category:       pkg
>Synopsis:       net/darkstat update
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 07 16:45:00 +0000 2006
>Originator:     Bartosz Kuzma
>Release:        
>Organization:
>Environment:
>Description:
net/darkstat update to version 3.0.540

Changes from 3.0.524 to 3.0.540
 - Fix build against old libpcap (thanks Claudio)
 - Fix build on AIX (thanks Andreas)
 - Fix build warnings on NetBSD (thanks Bartosz)
 - Deny writes to BPF socket (thanks Can)
 - Reverse-resolve IPs less aggressively.
 - Free up the DNS queue as we process it.
 - Fix dns_reply silliness.
 - Web: tweak the look of the top bar.
 - Web: update total packets and bytes as part of graph update.
 - Decode DLT_LINUX_SLL (ippp0 on Linux),
   patch courtesy of Ingo Bressler

pkgsrc specific changes:
 - /var/empty has marked obsolete by etcupdate so I've changed
   chroot dir for darkstat to ${PREFIX}/share/darkstat/chroot.
 - patch-aa add support for DLT_PPP_SERIAL (for NetBSD only)
   and DLT_PPP devices.
>How-To-Repeat:

>Fix:
Apply following patch


diff -Nru --exclude=CVS ../../net/darkstat/Makefile ./Makefile
--- ../../net/darkstat/Makefile 2006-08-07 18:25:45.000000000 +0200
+++ ./Makefile  2006-08-07 18:25:55.000000000 +0200
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.2 2006/07/20 16:32:46 minskim Exp $
+# $NetBSD$
 #

-DISTNAME=              darkstat-3.0.524
+DISTNAME=              darkstat-3.0.540
 CATEGORIES=            net
 MASTER_SITES=          http://dmr.ath.cx/net/darkstat/
 DIST_SUBDIR=           darkstat
@@ -11,10 +11,19 @@
 HOMEPAGE=              http://dmr.ath.cx/net/darkstat/
 COMMENT=               Network statistics gatherer

+SUBST_CLASSES+=                conv_c
+SUBST_STAGE.conv_c=    post-patch
+SUBST_FILES.conv_c=    conv.c
+SUBST_SED.conv_c=      -e 's,/var/empty,${PREFIX}/share/darkstat/chroot,'
+
 BUILD_TARGET=          darkstat

 GNU_CONFIGURE=         yes

+post-install:
+       ${INSTALL_DATA_DIR} ${PREFIX}/share/darkstat
+       ${INSTALL_DATA_DIR} ${PREFIX}/share/darkstat/chroot
+
 .include "../../devel/zlib/buildlink3.mk"
 .include "../../net/libpcap/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
diff -Nru --exclude=CVS ../../net/darkstat/PLIST ./PLIST
--- ../../net/darkstat/PLIST    2006-07-19 06:41:47.000000000 +0200
+++ ./PLIST     2006-08-07 18:17:49.000000000 +0200
@@ -1,3 +1,6 @@
-@comment $NetBSD: PLIST,v 1.1.1.1 2006/07/19 04:41:47 minskim Exp $
+@comment $NetBSD$
 man/man1/darkstat.1
 sbin/darkstat
+@exec ${MKDIR} %D/share/darkstat/chroot
+@dirrm share/darkstat/chroot
+@dirrm share/darkstat
diff -Nru --exclude=CVS ../../net/darkstat/distinfo ./distinfo
--- ../../net/darkstat/distinfo 2006-07-19 06:41:47.000000000 +0200
+++ ./distinfo  2006-08-07 18:05:47.000000000 +0200
@@ -1,6 +1,6 @@
-$NetBSD: distinfo,v 1.1.1.1 2006/07/19 04:41:47 minskim Exp $
+$NetBSD$

-SHA1 (darkstat/darkstat-3.0.524.tar.bz2) = df4822961ee2320fb4d5eeaed1083f1a157478c2
-RMD160 (darkstat/darkstat-3.0.524.tar.bz2) = 42380b23902cef4cc348fd1f736542dd17296b54
-Size (darkstat/darkstat-3.0.524.tar.bz2) = 74605 bytes
-SHA1 (patch-aa) = f15405dd65381a564b920e958218a63d7bad5f2b
+SHA1 (darkstat/darkstat-3.0.540.tar.bz2) = aaca2ba07c8479b7bf2393261b0093f568746766
+RMD160 (darkstat/darkstat-3.0.540.tar.bz2) = c9ee36a5381bfc26c81759f4cde6153abac4264c
+Size (darkstat/darkstat-3.0.540.tar.bz2) = 75293 bytes
+SHA1 (patch-aa) = 8f5de074e5a5fc7798a8c196f116f12417b81d83
diff -Nru --exclude=CVS ../../net/darkstat/patches/patch-aa ./patches/patch-aa
--- ../../net/darkstat/patches/patch-aa 2006-07-19 06:41:47.000000000 +0200
+++ ./patches/patch-aa  2006-08-07 18:05:39.000000000 +0200
@@ -1,19 +1,48 @@
-$NetBSD: patch-aa,v 1.1.1.1 2006/07/19 04:41:47 minskim Exp $
+$NetBSD$

---- queue.h.orig       2006-03-14 10:10:02.000000000 +0100
-+++ queue.h
-@@ -51,12 +51,14 @@ struct {                                                  \+--- decode.c.orig      2006-08-07 02:26:32.000000000 +0200
++++ decode.c
+@@ -54,6 +54,8 @@ static void decode_ether(u_char *, const
+    const u_char *);
+ static void decode_loop(u_char *, const struct pcap_pkthdr *,
+    const u_char *);
++static void decode_ppp(u_char *, const struct pcap_pkthdr *,
++   const u_char *);
+ static void decode_pppoe(u_char *, const struct pcap_pkthdr *,
+    const u_char *);
+ static void decode_linux_sll(u_char *, const struct pcap_pkthdr *,
+@@ -67,7 +69,10 @@ static const linkhdr_t linkhdrs[] = {
+    { DLT_EN10MB,    ETHER_HDR_LEN, decode_ether  },
+    { DLT_LOOP,      NULL_HDR_LEN,  decode_loop  },
+    { DLT_NULL,      NULL_HDR_LEN,  decode_loop  },
+-   { DLT_PPP,       PPP_HDR_LEN,   NULL },
++   { DLT_PPP,       PPP_HDR_LEN,   decode_ppp },
++#if defined(__NetBSD__)
++   { DLT_PPP_SERIAL, PPP_HDR_LEN, decode_ppp },
++#endif
+    { DLT_FDDI,      FDDI_HDR_LEN,  NULL },
+    { DLT_PPP_ETHER, PPPOE_HDR_LEN, decode_pppoe },
+    { DLT_LINUX_SLL, SLL_HDR_LEN,   decode_linux_sll },
+@@ -172,6 +177,22 @@ decode_loop(u_char *user _unused_,
+ }

- #define       STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
-
-+#undef STAILQ_INSERT_TAIL
- #define       STAILQ_INSERT_TAIL(head, elm, field) do {                      \-       STAILQ_NEXT((elm), field) = NULL;                               \
-       *(head)->stqh_last = (elm);                                     \
-       (head)->stqh_last = &STAILQ_NEXT((elm), field);                 \
- } while (0)
-
-+#undef STAILQ_REMOVE_HEAD
- #define       STAILQ_REMOVE_HEAD(head, field) do {                           \-       if ((STAILQ_FIRST((head)) =                                     \
-            STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL)         \
+ static void
++decode_ppp(u_char *user _unused_,
++      const struct pcap_pkthdr *pheader,
++      const u_char *pdata)
++{
++   pktsummary sm;
++   memset(&sm, 0, sizeof(sm));
++
++   if (pdata[2] == 0x00 && pdata[3] == 0x21) {
++         decode_ip(pdata + PPP_HDR_LEN, pheader->caplen - PPP_HDR_LEN, &sm);
++         sm.time = pheader->ts.tv_sec;
++         acct_for(&sm);
++   } else
++      verbosef("non-IP PPP packet; ignoring.");
++}
++
++static void
+ decode_pppoe(u_char *user _unused_,
+       const struct pcap_pkthdr *pheader,
+       const u_char *pdata)