summaryrefslogtreecommitdiff
path: root/net/pload
diff options
context:
space:
mode:
authormartin <martin@pkgsrc.org>2002-05-24 18:12:36 +0000
committermartin <martin@pkgsrc.org>2002-05-24 18:12:36 +0000
commitd0b72a9b6ad3dc2c9f6226d42d6dde6d055e9dd6 (patch)
treee55e2d52a2f329e67bf968c64585d5541809f46e /net/pload
parentf08e35b60f4f5e078742c19a29f85494a34e4cb1 (diff)
downloadpkgsrc-d0b72a9b6ad3dc2c9f6226d42d6dde6d055e9dd6.tar.gz
If the SIOCGIFDATA ioctl is available, use that instead of the PPP
specific one. This makes the tool useable on any network interface.
Diffstat (limited to 'net/pload')
-rw-r--r--net/pload/distinfo4
-rw-r--r--net/pload/patches/patch-aa33
2 files changed, 31 insertions, 6 deletions
diff --git a/net/pload/distinfo b/net/pload/distinfo
index d98a330312b..9ec8108e7cb 100644
--- a/net/pload/distinfo
+++ b/net/pload/distinfo
@@ -1,7 +1,7 @@
-$NetBSD: distinfo,v 1.4 2002/01/29 13:46:54 wiz Exp $
+$NetBSD: distinfo,v 1.5 2002/05/24 18:12:36 martin Exp $
SHA1 (pload-0.9.4.tar.gz) = 2e93a7796049d0132629cdd8c85e8ce54a270c60
Size (pload-0.9.4.tar.gz) = 21244 bytes
-SHA1 (patch-aa) = 5860a071b282f3cec1a8c35618ce49fcd63dbcf0
+SHA1 (patch-aa) = c5765141126846da5a71a3a35307ebca2dc3f7cc
SHA1 (patch-ab) = 53a211ff7d0990d649472e69451a144d31603a61
SHA1 (patch-ac) = 345ac88bb5d279039ae0169c2b468b22964a0c09
diff --git a/net/pload/patches/patch-aa b/net/pload/patches/patch-aa
index be744407c0e..dccb394dde9 100644
--- a/net/pload/patches/patch-aa
+++ b/net/pload/patches/patch-aa
@@ -1,18 +1,22 @@
-$NetBSD: patch-aa,v 1.2 2002/01/29 13:46:17 wiz Exp $
+$NetBSD: patch-aa,v 1.3 2002/05/24 18:12:36 martin Exp $
--- ioctl_stat.c.orig Thu Mar 4 08:33:03 1999
-+++ ioctl_stat.c
-@@ -68,6 +68,9 @@
++++ ioctl_stat.c Fri May 24 20:03:05 2002
+@@ -68,6 +68,13 @@
void ioctl_stat(if_data *ifd)
{
+#ifdef __NetBSD__
+ struct ifreq ifr;
++#ifdef SIOCGIFDATA
++ struct ifdatareq ifdr;
++ struct if_data * const ifi = &ifdr.ifdr_data;
++#endif
+#endif
struct ifpppstatsreq req;
if (s < 0) getsocket();
-@@ -78,8 +81,20 @@
+@@ -78,8 +85,33 @@
#define ifr_name ifr__name
req.stats_ptr = (caddr_t) &req.stats;
#endif
@@ -30,7 +34,28 @@ $NetBSD: patch-aa,v 1.2 2002/01/29 13:46:17 wiz Exp $
+ }
+#endif
+
++#if defined(__NetBSD__) && defined(SIOCGIFDATA)
++ /* prefere the generic interface statistics over the PPP specific ones */
++ strncpy(ifdr.ifdr_name, ifd->device, sizeof(ifdr.ifdr_name));
++ if (ioctl(s, SIOCGIFDATA, &ifdr) == -1)
++ {
++ /* non-existant device? */
++ ifd->in_bytes = 0UL;
++ ifd->out_bytes = 0UL;
++ return;
++ }
++ ifd->in_bytes = (unsigned long)ifi->ifi_ibytes;
++ ifd->out_bytes = (unsigned long)ifi->ifi_obytes;
++#else
+ sprintf(req.ifr_name, ifd->device);
if (ioctl(s, SIOCGPPPSTATS, &req) != 0)
{
/* non-existant device? */
+@@ -90,6 +122,7 @@
+
+ ifd->in_bytes = (unsigned long)req.stats.p.ppp_ibytes;
+ ifd->out_bytes = (unsigned long)req.stats.p.ppp_obytes;
++#endif
+
+ return;
+ }