diff options
author | marino <marino> | 2012-08-11 17:22:18 +0000 |
---|---|---|
committer | marino <marino> | 2012-08-11 17:22:18 +0000 |
commit | 7bfbee8ca8f1ab7251ff6392d09ea3d29bf8619c (patch) | |
tree | 1b91039750174c27db02fa28e7f9ec24a1d8f371 /net | |
parent | 20decd902a484a37c7439eaac06f4a3861ea115b (diff) | |
download | pkgsrc-7bfbee8ca8f1ab7251ff6392d09ea3d29bf8619c.tar.gz |
net/pload: Add FreeBSD and DragonFly support
Patch differentials came from FreeBSD ports.
Diffstat (limited to 'net')
-rw-r--r-- | net/wmpload/distinfo | 5 | ||||
-rw-r--r-- | net/wmpload/patches/patch-aa | 93 | ||||
-rw-r--r-- | net/wmpload/patches/patch-configure | 14 |
3 files changed, 102 insertions, 10 deletions
diff --git a/net/wmpload/distinfo b/net/wmpload/distinfo index 5a8bab758c9..5ad242567fa 100644 --- a/net/wmpload/distinfo +++ b/net/wmpload/distinfo @@ -1,7 +1,8 @@ -$NetBSD: distinfo,v 1.6 2005/02/24 12:14:07 agc Exp $ +$NetBSD: distinfo,v 1.7 2012/08/11 17:22:18 marino Exp $ SHA1 (wmpload-0.9.5.tar.gz) = 8627bb43d789f4639ecbca67b198f371c9487e65 RMD160 (wmpload-0.9.5.tar.gz) = d0bf961b4593797caab667b160ef97f4c6d4d16c Size (wmpload-0.9.5.tar.gz) = 25373 bytes -SHA1 (patch-aa) = e9ab516214c664e930b4156531c3515dd3e6f8df +SHA1 (patch-aa) = 57521e37e6a0d1c7d26ce52f2e01b12a3ce8206f SHA1 (patch-ab) = dfc510295d8c59908fe4a619b3ec22af90021271 +SHA1 (patch-configure) = 0780b9f9b8245ec2f2d4c657b5fafa6e898112fc diff --git a/net/wmpload/patches/patch-aa b/net/wmpload/patches/patch-aa index c7d40941370..7a3f3fd95f9 100644 --- a/net/wmpload/patches/patch-aa +++ b/net/wmpload/patches/patch-aa @@ -1,23 +1,100 @@ -$NetBSD: patch-aa,v 1.4 2004/11/27 00:15:30 abs Exp $ +$NetBSD: patch-aa,v 1.5 2012/08/11 17:22:18 marino Exp $ --- ioctl_stat.c.orig 2000-02-01 07:49:01.000000000 +0000 +++ ioctl_stat.c -@@ -62,6 +62,10 @@ void ioctl_stat(if_data *ifd) +@@ -30,6 +30,15 @@ + #include <fcntl.h> /* open */ + #include <sys/ioctl.h> /* ioctl */ + #include <errno.h> ++#if defined(__FreeBSD__) || defined(__DragonFly__) ++#define __FreeFly__ 1 ++#endif ++#if __FreeFly__ ++#include <sys/sysctl.h> ++#include <sys/socket.h> ++#include <net/if.h> ++#include <net/if_mib.h> ++#endif + + #ifndef STREAMS /* Linux, FreeBSD, NetBSD, Ultrix */ + # include <sys/socket.h> /* socket */ +@@ -39,8 +48,10 @@ + # include <linux/if_ppp.h> + # else /* most everything else */ + # include <net/if.h> ++# ifndef __FreeFly__ + # include <net/ppp_defs.h> + # include <net/if_ppp.h> ++# endif /* FreeBSD | DragonFly */ + # endif /* linux && __GLIBC__ < 2 */ + #else /* STREAMS */ /* Solaris, SunOS, OSF/1, SVR4 */ + # include <net/ppp_defs.h> +@@ -61,7 +72,21 @@ void getsocket(if_data *ifd) + void ioctl_stat(if_data *ifd) { struct ifreq ifr; - struct ifpppstatsreq req; -+#ifdef SIOCGIFDATA /* Supported on at least NetBSD */ ++#if __FreeFly__ ++ static int if_ix = -1; ++ struct ifmibdata ifmd; ++ size_t ifmd_sz = sizeof(ifmd); ++ int nr_ifs; ++ size_t nr_ifs_sz = sizeof(nr_ifs); ++ int name[6]; ++ int i; ++#else ++#ifdef SIOCGIFDATA + struct ifdatareq ifdr; -+ struct if_data * const ifi = &ifdr.ifdr_data; ++ struct if_data * const ifi = &ifdr.ifdr_data; +#endif + struct ifpppstatsreq req; ++#endif /* FreeBSD | DragonFly */ if (!ifd->s) getsocket(ifd); -@@ -84,6 +88,19 @@ void ioctl_stat(if_data *ifd) +@@ -76,7 +101,9 @@ void ioctl_stat(if_data *ifd) + return; + } + ++#ifndef __FreeFly__ + memset(&req, 0, sizeof(req)); ++#endif + + #ifdef linux + req.stats_ptr = (caddr_t) &req.stats; +@@ -84,6 +111,48 @@ void ioctl_stat(if_data *ifd) #define ifr_name ifr__name #endif -+#if defined(SIOCGIFDATA) ++#if __FreeFly__ ++ name[0] = CTL_NET; ++ name[1] = PF_LINK; ++ name[2] = NETLINK_GENERIC; ++ name[3] = IFMIB_IFDATA; ++ name[5] = IFDATA_GENERAL; ++ ++ if (if_ix < 0) { ++ if (sysctlbyname("net.link.generic.system.ifcount", (void *) &nr_ifs, &nr_ifs_sz, (void *) 0, 0) < 0) { ++ return; ++ } ++ for (i = 1; i <= nr_ifs; i++) { ++ name[4] = i; /* row of the ifmib table */ ++ ++ if (sysctl(name, 6, (void *) &ifmd, &ifmd_sz, (void *) 0, 0) < 0) { ++ continue; ++ } ++ if (strncmp(ifmd.ifmd_name, ifr.ifr_name, strlen(ifr.ifr_name)) == 0) { ++ if_ix = i; ++ break; ++ } ++ } ++ } ++ ++ name[4] = if_ix; ++ if (sysctl(name, 6, (void *) &ifmd, &ifmd_sz, (void *) 0, 0) >= 0) { ++ ifd->in_bytes = ifmd.ifmd_data.ifi_ibytes; ++ ifd->out_bytes = ifmd.ifmd_data.ifi_obytes; ++ } ++#elif defined(SIOCGIFDATA) + /* prefer generic interface statistics over PPP specific ones */ + strncpy(ifdr.ifdr_name, ifd->device, sizeof(ifdr.ifdr_name)); + if (ioctl(ifd->s, SIOCGIFDATA, &ifdr) == -1) @@ -33,7 +110,7 @@ $NetBSD: patch-aa,v 1.4 2004/11/27 00:15:30 abs Exp $ strncpy(req.ifr_name, ifd->device, sizeof(req.ifr_name)); if (ioctl(ifd->s, SIOCGPPPSTATS, &req) != 0) { -@@ -95,6 +112,7 @@ void ioctl_stat(if_data *ifd) +@@ -95,6 +164,7 @@ void ioctl_stat(if_data *ifd) ifd->in_bytes = (unsigned long)req.stats.p.ppp_ibytes; ifd->out_bytes = (unsigned long)req.stats.p.ppp_obytes; diff --git a/net/wmpload/patches/patch-configure b/net/wmpload/patches/patch-configure new file mode 100644 index 00000000000..1af7e3310e3 --- /dev/null +++ b/net/wmpload/patches/patch-configure @@ -0,0 +1,14 @@ +$NetBSD: patch-configure,v 1.1 2012/08/11 17:22:18 marino Exp $ + +--- configure.orig 2000-02-01 07:49:01.000000000 +0000 ++++ configure +@@ -17,6 +17,9 @@ case $system in + echo "enabling proc stats reading"; + fi + ;; ++ DragonFly) ++ os="dragonfly"; ++ ;; + FreeBSD) + os="freebsd"; + ;; |