pkgsrc/net/darkstat/patches/patch-aa
obache 517dac9aa2 Update darkstat to 3.0.540.
Patch provided by MAINTAINER, Bartosz Kuzma via PR 34158.

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.
2006-10-07 07:49:01 +00:00

48 lines
1.6 KiB
Text

$NetBSD: patch-aa,v 1.2 2006/10/07 07:49:01 obache Exp $
--- 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_,
}
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)