net-snmp port

walt wa1ter at myrealbox.com
Fri Feb 25 13:59:38 PST 2005



On Fri, 25 Feb 2005, Devon H. O'Dell wrote:

> The changes for this port are fairly trivial. I fixed it once, but I'm
> not sure if I did it the right way, and I don't have the patchset
> anymore. Simon (corecode) or Hiten might have them. I'll try to make a
> patchset again sometime if they don't.

This is corecode's original patch for version 5.2.pre-1.  It applies
cleanly to 5.2.1, but unfortunately it doesn't fix the error in
question.  Maybe it will refresh your memory, though.

(I've edited the patch so it will apply to the 5.2.1 sources.)
===================================================================

add a include/net-snmp/system/dragonfly.h with
--8<---
#include "freebsd4.h"

/*
 * dragonfly1 is a superset of freebsd4
 */
#define	freebsd4 1

#define	_KERNEL_STRUCTURES
-->8--
in it

use autoconf259 to generate a new configure

diff -ru net-snmp-5.2.1/aclocal.m4 net-snmp-5.2.1.m/aclocal.m4
--- net-snmp-5.2.1/aclocal.m4	2003-02-13 17:01:23.000000000 +0100
+++ net-snmp-5.2.1.m/aclocal.m4	2004-09-20 01:36:41.000000000 +0200
@@ -55,6 +55,45 @@
 fi
 ]) dnl

+dnl @synopsis AC_CHECK_FOR_STRUCT(INCLUDES,STRUCT,DEFINE,[no])
+dnl
+dnl Checks for STRUCT and defines DEFINE to it if found.
+dnl
+dnl @version 1.15
+dnl @author Wes Hardaker <hardaker at xxxxxxxxxxxxxxxxxxxxx>
+dnl @author Simon 'corecode' Schubert <corecode at xxxxxxxxxxxx>
+dnl
+AC_DEFUN(AC_CHECK_FOR_STRUCT,[
+
+ac_safe_struct=`echo "$2" | sed 'y%./+-%__p_%'`
+ac_safe_all="ac_cv_have_struct_${ac_safe_struct}"
+changequote(, )dnl
+  ac_uc_define=HAVE_STRUCT_`echo "${ac_safe_struct}" | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+changequote([, ])dnl
+
+AC_MSG_CHECKING([for struct $2])
+AC_CACHE_VAL($ac_safe_all,
+[
+AC_TRY_COMPILE([
+$1
+],[
+struct $2 testit;
+], eval "${ac_safe_all}=yes", eval "${ac_safe_all}=no" )
+])
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  AC_MSG_RESULT(yes)
+  AC_DEFINE_UNQUOTED($ac_uc_define)
+if test "x$3" = "x"; then :; else
+  safe_define=STRUCT_`echo "$3" | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  AC_DEFINE_UNQUOTED($safe_define, struct $2)
+fi
+else
+  AC_MSG_RESULT(no)
+fi
+
+])
+
 dnl @synopsis AC_CHECK_STRUCT_FOR(INCLUDES,STRUCT,MEMBER,DEFINE,[no])
 dnl
 dnl Checks STRUCT for MEMBER and defines DEFINE if found.
@@ -81,10 +120,15 @@
 else
   defineit="$4"
 fi
+struct_alias=STRUCT_`echo "${ac_safe_struct}" | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
 AC_TRY_COMPILE([
 $1
 ],[
-struct $2 testit;
+#if defined($struct_alias)
+$struct_alias testit;
+#else
+struct $2 testit;
+#endif
 testit.$3 $defineit;
 ], eval "${ac_safe_all}=yes", eval "${ac_safe_all}=no" )
 ])
diff -ru net-snmp-5.2.1/agent/mibgroup/mibII/ip.c net-snmp-5.2.1.m/agent/mibgroup/mibII/ip.c
--- net-snmp-5.2.1/agent/mibgroup/mibII/ip.c	2004-06-28 03:33:22.000000000 +0200
+++ net-snmp-5.2.1.m/agent/mibgroup/mibII/ip.c	2004-09-20 01:41:51.000000000 +0200
@@ -201,6 +201,11 @@
 #define	USES_TRADITIONAL_IPSTAT
 #endif

+#ifdef HAVE_STRUCT_IP_STATS
+#define	IP_STAT_STRUCTURE	struct ip_stats
+#define	USES_TRADITIONAL_IPSTAT
+#endif
+
 #if !defined(IP_STAT_STRUCTURE)
 #define IP_STAT_STRUCTURE	struct ipstat
 #define	USES_TRADITIONAL_IPSTAT
diff -ru net-snmp-5.2.1/agent/mibgroup/mibII/tcp.c net-snmp-5.2.1.m/agent/mibgroup/mibII/tcp.c
--- net-snmp-5.2.1/agent/mibgroup/mibII/tcp.c	2004-06-28 03:33:22.000000000 +0200
+++ net-snmp-5.2.1.m/agent/mibgroup/mibII/tcp.c	2004-09-20 02:19:21.000000000 +0200
@@ -165,6 +165,11 @@
 #define USES_TRADITIONAL_TCPSTAT
 #endif

+#ifdef HAVE_STRUCT_IP_STATS
+#define	TCP_STAT_STRUCTURE	struct tcp_stats
+#define	USES_TRADITIONAL_TCPSTAT
+#endif
+
 #if !defined(TCP_STAT_STRUCTURE)
 #define TCP_STAT_STRUCTURE	struct tcpstat
 #define USES_TRADITIONAL_TCPSTAT
diff -ru net-snmp-5.2.1/configure.in net-snmp-5.2.1.m/configure.in
--- net-snmp-5.2.1/configure.in	2004-09-02 07:03:54.000000000 +0200
+++ net-snmp-5.2.1.m/configure.in	2004-09-19 20:34:55.000000000 +0200
@@ -2936,6 +2936,17 @@
 #endif
 ],nlist,n_value)

+# check for struct ip_stats
+AC_CHECK_FOR_STRUCT([
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+], ip_stats, ipstat)
+
 # check struct ipstat for various things
 AC_CHECK_STRUCT_FOR([
 #include <sys/types.h>
diff -ru net-snmp-5.2.1/include/net-snmp/net-snmp-config.h.in net-snmp-5.2.1.m/include/net-snmp/net-snmp-config.h.in
--- net-snmp-5.2.1/include/net-snmp/net-snmp-config.h.in	2004-09-02 07:16:35.000000000 +0200
+++ net-snmp-5.2.1.m/include/net-snmp/net-snmp-config.h.in	2004-09-20 01:43:28.000000000 +0200
@@ -1081,6 +1081,8 @@
 #undef STRUCT_NLIST_HAS_N_VALUE

 /* ipstat structure tests */
+#undef HAVE_STRUCT_IP_STATS
+
 #undef STRUCT_IPSTAT_HAS_IPS_CANTFORWARD
 #undef STRUCT_IPSTAT_HAS_IPS_CANTFRAG
 #undef STRUCT_IPSTAT_HAS_IPS_DELIVERED





More information about the Users mailing list