diff options
author | apb <apb@pkgsrc.org> | 2009-03-10 18:30:44 +0000 |
---|---|---|
committer | apb <apb@pkgsrc.org> | 2009-03-10 18:30:44 +0000 |
commit | efb717e3a255d0609b86067570f92d0968cea6f6 (patch) | |
tree | 96f90c16756c5a613a6d020fc17d91986da102d3 /net/net-snmp/patches | |
parent | 3cf3763c9e8fd09a1e8264fbf539bd0eee2e0d6f (diff) | |
download | pkgsrc-efb717e3a255d0609b86067570f92d0968cea6f6.tar.gz |
Some systems define ifnet.if_lastchange as struct timespec (with
a tv_nsec field measured in nanoseconds), while other systems
define it as struct timeval (with a tv_usec field measured in
microseconds). Add a configure test and conditional code in
agent/mibgroup/mibII/interfaces.c.orig. This should fix PR 40990.
Bump PKGREVISION to 2.
Diffstat (limited to 'net/net-snmp/patches')
-rw-r--r-- | net/net-snmp/patches/patch-ac | 12 | ||||
-rw-r--r-- | net/net-snmp/patches/patch-af | 148 | ||||
-rw-r--r-- | net/net-snmp/patches/patch-ao | 12 | ||||
-rw-r--r-- | net/net-snmp/patches/patch-ap | 38 | ||||
-rw-r--r-- | net/net-snmp/patches/patch-dc | 14 |
5 files changed, 217 insertions, 7 deletions
diff --git a/net/net-snmp/patches/patch-ac b/net/net-snmp/patches/patch-ac index bec7e2956b6..cc65cd382ba 100644 --- a/net/net-snmp/patches/patch-ac +++ b/net/net-snmp/patches/patch-ac @@ -1,6 +1,6 @@ -$NetBSD: patch-ac,v 1.7 2008/09/08 12:58:09 adam Exp $ +$NetBSD: patch-ac,v 1.8 2009/03/10 18:30:44 apb Exp $ ---- configure.in.orig 2008-09-05 11:27:25.000000000 +0200 +--- configure.in.orig 2008-10-31 17:22:23.000000000 +0200 +++ configure.in @@ -2697,6 +2697,8 @@ AC_CHECK_LIB(kstat, kstat_lookup, AC_DEFINE(HAVE_LIBKSTAT, 1, [Define to 1 if you have the `kstat' library (-lkstat).]) @@ -134,3 +134,11 @@ $NetBSD: patch-ac,v 1.7 2008/09/08 12:58:09 adam Exp $ #include <sys/socket.h> #undef KERNEL #undef _KERNEL +@@ -4162,6 +4190,7 @@ AC_CHECK_IFNET_FOR(if_noproto) + AC_CHECK_IFNET_FOR(if_omcasts) + AC_CHECK_IFNET_FOR(if_xname,no) + AC_CHECK_IFNET_FOR(if_lastchange.tv_sec) ++AC_CHECK_IFNET_FOR(if_lastchange.tv_nsec) + AC_CHECK_IFNET_FOR(if_obytes) + AC_CHECK_IFNET_FOR(if_ibytes) + AC_CHECK_IFNET_FOR(if_addrlist) diff --git a/net/net-snmp/patches/patch-af b/net/net-snmp/patches/patch-af index 33c6fe766b2..e9259bdbb57 100644 --- a/net/net-snmp/patches/patch-af +++ b/net/net-snmp/patches/patch-af @@ -1,6 +1,6 @@ -$NetBSD: patch-af,v 1.12 2008/09/08 12:58:09 adam Exp $ +$NetBSD: patch-af,v 1.13 2009/03/10 18:30:44 apb Exp $ ---- configure.orig 2008-09-05 11:29:01.000000000 +0200 +--- configure.orig 2008-10-31 17:53:45.000000000 +0200 +++ configure @@ -27854,6 +27854,81 @@ _ACEOF fi @@ -207,3 +207,147 @@ $NetBSD: patch-af,v 1.12 2008/09/08 12:58:09 adam Exp $ #include <sys/socket.h> #undef KERNEL #undef _KERNEL +@@ -45730,6 +45831,143 @@ fi + + + ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'` ++ac_safe_member=`echo "if_lastchange.tv_nsec" | sed 'y%./+-%__p_%'` ++ac_safe_all="ac_cv_struct_${ac_safe_struct}_has_${ac_safe_member}" ++ ac_uc_define=STRUCT_`echo "${ac_safe_struct}_HAS_${ac_safe_member}" | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` ++ ++echo "$as_me:$LINENO: checking for ifnet.if_lastchange.tv_nsec" >&5 ++echo $ECHO_N "checking for ifnet.if_lastchange.tv_nsec... $ECHO_C" >&6 ++if eval "test \"\${$ac_safe_all+set}\" = set"; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ++if test "x" = "x"; then ++ defineit="= 0" ++elif test "x" = "xno"; then ++ defineit="" ++else ++ defineit="" ++fi ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ ++ ++#ifdef IFNET_NEEDS_KERNEL ++#define _KERNEL 1 ++#endif ++#include <sys/types.h> ++#include <sys/socket.h> ++#ifdef HAVE_SYS_TIME_H ++#include <sys/time.h> ++#endif ++#include <net/if.h> ++#ifdef HAVE_NET_IF_VAR_H ++#include <net/if_var.h> ++#endif ++#ifdef HAVE_SYS_QUEUE_H ++#include <sys/queue.h> ++#endif ++#ifdef linux ++struct ifnet { ++ char *if_name; /* name, e.g. "en" or "lo" */ ++ short if_unit; /* sub-unit for lower level driver */ ++ short if_mtu; /* maximum transmission unit */ ++ short if_flags; /* up/down, broadcast, etc. */ ++ int if_metric; /* routing metric (external only) */ ++ char if_hwaddr [6]; /* ethernet address */ ++ int if_type; /* interface type: 1=generic, ++ 28=slip, ether=6, loopback=24 */ ++ int if_speed; /* interface speed: in bits/sec */ ++ ++ struct sockaddr if_addr; /* interface's address */ ++ struct sockaddr ifu_broadaddr; /* broadcast address */ ++ struct sockaddr ia_subnetmask; /* interface's mask */ ++ ++ struct ifqueue { ++ int ifq_len; ++ int ifq_drops; ++ } if_snd; /* output queue */ ++ int if_ibytes; /* octets received on interface */ ++ int if_ipackets; /* packets received on interface */ ++ int if_ierrors; /* input errors on interface */ ++ int if_iqdrops; /* input queue overruns */ ++ int if_obytes; /* octets sent on interface */ ++ int if_opackets; /* packets sent on interface */ ++ int if_oerrors; /* output errors on interface */ ++ int if_collisions; /* collisions on csma interfaces */ ++/* end statistics */ ++ struct ifnet *if_next; ++}; ++#endif ++ ++ ++int ++main () ++{ ++ ++struct ifnet testit; ++testit.if_lastchange.tv_nsec $defineit; ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ eval "${ac_safe_all}=yes" ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++eval "${ac_safe_all}=no" ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ ++fi ++ ++ ++if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then ++ echo "$as_me:$LINENO: result: yes" >&5 ++echo "${ECHO_T}yes" >&6 ++ cat >>confdefs.h <<_ACEOF ++#define $ac_uc_define 1 ++_ACEOF ++ ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ ++ ++ ++ ++ ++ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'` + ac_safe_member=`echo "if_obytes" | sed 'y%./+-%__p_%'` + ac_safe_all="ac_cv_struct_${ac_safe_struct}_has_${ac_safe_member}" + ac_uc_define=STRUCT_`echo "${ac_safe_struct}_HAS_${ac_safe_member}" | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` diff --git a/net/net-snmp/patches/patch-ao b/net/net-snmp/patches/patch-ao new file mode 100644 index 00000000000..f4197033cff --- /dev/null +++ b/net/net-snmp/patches/patch-ao @@ -0,0 +1,12 @@ +$NetBSD: patch-ao,v 1.1 2009/03/10 18:30:44 apb Exp $ + +--- acconfig.h.orig 2008-06-05 23:11:53.000000000 +0200 ++++ acconfig.h +@@ -158,6 +158,7 @@ + #undef STRUCT_IFNET_HAS_IF_IMCASTS + #undef STRUCT_IFNET_HAS_IF_IQDROPS + #undef STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_SEC ++#undef STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_NSEC + #undef STRUCT_IFNET_HAS_IF_NOPROTO + #undef STRUCT_IFNET_HAS_IF_OMCASTS + #undef STRUCT_IFNET_HAS_IF_XNAME diff --git a/net/net-snmp/patches/patch-ap b/net/net-snmp/patches/patch-ap new file mode 100644 index 00000000000..bd11de73439 --- /dev/null +++ b/net/net-snmp/patches/patch-ap @@ -0,0 +1,38 @@ +$NetBSD: patch-ap,v 1.1 2009/03/10 18:30:44 apb Exp $ + +Some systems define ifnet.if_lastchange as struct timespec (with a +tv_nsec field measured in nanoseconds), while other systems define it +as struct timeval (with a tv_usec field measured in microseconds). +Both variants have a tv_sec field for integer seconds. + +--- agent/mibgroup/mibII/interfaces.c.orig 2008-06-05 23:11:53.000000000 +0200 ++++ agent/mibgroup/mibII/interfaces.c +@@ -830,15 +830,25 @@ var_ifEntry(struct variable *vp, + * * this is fixed, thus the 199607 comparison. + */ + if (ifnet.if_lastchange.tv_sec == 0 && +- ifnet.if_lastchange.tv_usec == 0) ++#if STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_NSEC ++ ifnet.if_lastchange.tv_nsec == 0 ++#else ++ ifnet.if_lastchange.tv_usec == 0 ++#endif ++ ) + long_return = 0; + else if (ifnet.if_lastchange.tv_sec < starttime.tv_sec) + long_return = 0; + else { + long_return = (u_long) + ((ifnet.if_lastchange.tv_sec - starttime.tv_sec) * 100 +- + (ifnet.if_lastchange.tv_usec - +- starttime.tv_usec) / 10000); ++ + ( ++#if STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_NSEC ++ ifnet.if_lastchange.tv_nsec / 1000 ++#else ++ ifnet.if_lastchange.tv_usec ++#endif ++ - starttime.tv_usec) / 10000); + } + #else + #if NETSNMP_NO_DUMMY_VALUES diff --git a/net/net-snmp/patches/patch-dc b/net/net-snmp/patches/patch-dc index 37bd5723e79..8c69a85e156 100644 --- a/net/net-snmp/patches/patch-dc +++ b/net/net-snmp/patches/patch-dc @@ -1,8 +1,16 @@ -$NetBSD: patch-dc,v 1.5 2008/09/08 12:58:09 adam Exp $ +$NetBSD: patch-dc,v 1.6 2009/03/10 18:30:44 apb Exp $ --- include/net-snmp/net-snmp-config.h.in.orig 2008-07-28 13:41:40.000000000 +0200 +++ include/net-snmp/net-snmp-config.h.in -@@ -1463,6 +1463,7 @@ +@@ -159,6 +159,7 @@ + #undef STRUCT_IFNET_HAS_IF_IMCASTS + #undef STRUCT_IFNET_HAS_IF_IQDROPS + #undef STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_SEC ++#undef STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_NSEC + #undef STRUCT_IFNET_HAS_IF_NOPROTO + #undef STRUCT_IFNET_HAS_IF_OMCASTS + #undef STRUCT_IFNET_HAS_IF_XNAME +@@ -1463,6 +1464,7 @@ #define NETSNMP_HPUX11ID 14 #define NETSNMP_AIXID 15 #define NETSNMP_MACOSXID 16 @@ -10,7 +18,7 @@ $NetBSD: patch-dc,v 1.5 2008/09/08 12:58:09 adam Exp $ #define NETSNMP_UNKNOWNID 255 #ifdef hpux9 -@@ -1492,6 +1493,9 @@ +@@ -1492,6 +1494,9 @@ #if defined(__FreeBSD__) #define NETSNMP_OSTYPE NETSNMP_FREEBSDID #endif |